/* Al Qamar Threads — admin dashboard (mock-up) */
:root {
  --bg: #F8F6F2;
  --surface: #FFFFFF;
  --sidebar: #2F2B27;
  --sidebar-text: #E9E3DA;
  --text: #3F3A35;
  --muted: #6E665E;
  --line: #E7E1D8;
  --sand: #E6D3B3;
  --sand-hover: #DCC49C;
  --bronze: #8A6A45;
  --bar: #A98559;
  --good: #2F7D4F;
  --warn: #9A6A12;
  --bad: #A23B32;
  --info: #3D6A8C;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Jost", "Helvetica Neue", Arial, sans-serif;
  --radius: 3px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-weight: 300; font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; line-height: 1.15; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--bronze); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--sand); border: 1px solid var(--sand); border-radius: var(--radius); padding: 10px 18px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-weight: 400; cursor: pointer; text-decoration: none; color: var(--text); }
.btn:hover { background: var(--sand-hover); border-color: var(--sand-hover); }
.btn--ghost { background: transparent; border-color: var(--line); }
.btn--ghost:hover { background: var(--bg); border-color: var(--text); }
.btn--danger { background: transparent; border-color: #E2C2BE; color: var(--bad); }
.btn--danger:hover { background: #FBF1F0; border-color: var(--bad); }
.btn--sm { padding: 6px 12px; font-size: 11px; }
.btn[disabled] { opacity: .5; cursor: default; }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-photo { background: #DCD3C6 center / cover no-repeat; position: relative; }
.login-photo::after { content: ""; position: absolute; inset: 0; background: rgba(47,43,39,.18); }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-box { width: 100%; max-width: 380px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand svg { width: 24px; height: 24px; }
.brand span { font-family: var(--serif); font-size: 20px; letter-spacing: .06em; }
.login-box h1 { font-size: 40px; margin: 48px 0 8px; }
.login-box .sub { color: var(--muted); margin: 0 0 32px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 400; margin-bottom: 7px; }
.field input, .field select { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 16px; }
.field input:focus, .field select:focus { outline: none; border-color: var(--text); }
.login-box .btn { width: 100%; padding: 14px; margin-top: 6px; }
.error { color: var(--bad); font-size: 14px; min-height: 1.5em; margin: 12px 0 0; }
.demo-note { margin-top: 32px; padding: 14px 16px; background: #F1ECE4; font-size: 13px; color: var(--muted); border-radius: var(--radius); }
.back-link { display: inline-block; margin-top: 18px; font-size: 13px; color: var(--muted); }
@media (max-width: 800px) { .login { grid-template-columns: 1fr; } .login-photo { display: none; } }

/* Shell */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); padding: 28px 18px; display: flex; flex-direction: column; gap: 36px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { color: #F8F6F2; padding: 0 10px; }
.sidebar .brand span { font-size: 17px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav button { background: none; border: 0; text-align: left; padding: 11px 12px; border-radius: var(--radius); color: var(--sidebar-text); cursor: pointer; font-size: 14px; letter-spacing: .04em; display: flex; justify-content: space-between; align-items: center; }
.side-nav button:hover { background: rgba(255,255,255,.06); }
.side-nav button[aria-current="page"] { background: rgba(230,211,179,.16); color: #fff; }
.side-nav .count { font-size: 12px; opacity: .7; }
.side-foot { margin-top: auto; font-size: 12px; opacity: .6; padding: 0 10px; }

.main { min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px 36px; border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 30px; }
.topbar .actions { display: flex; gap: 10px; align-items: center; }
.who { font-size: 13px; color: var(--muted); margin-right: 6px; }
.content { padding: 32px 36px 64px; max-width: 1280px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 12px; padding: 12px 16px; overflow-x: auto; }
  .sidebar .brand span, .side-foot { display: none; }
  .side-nav { flex-direction: row; }
  .side-nav button { white-space: nowrap; padding: 8px 12px; }
  .side-nav .count { display: none; }
  .topbar { padding: 16px; position: static; flex-wrap: wrap; }
  .topbar h1 { font-size: 26px; }
  .who { display: none; }
  .content { padding: 20px 16px 48px; }
}

/* Cards & KPIs */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; }
.card h2 { font-size: 22px; margin-bottom: 4px; }
.card .hint { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi .label { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
.kpi .value { font-family: var(--serif); font-size: 40px; line-height: 1.1; margin: 8px 0 4px; }
.kpi .note { font-size: 13px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1.7fr 1fr; gap: 16px; margin-bottom: 24px; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .kpi .value { font-size: 32px; } .card { padding: 18px; } }

/* Chart */
.chart-wrap { position: relative; }
.chart { width: 100%; height: 240px; display: block; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.chart .bar { fill: var(--bar); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart g.col:hover .bar { fill: var(--bronze); }
.tooltip { position: absolute; pointer-events: none; background: var(--sidebar); color: #fff; font-size: 12px; padding: 7px 10px; border-radius: var(--radius); white-space: nowrap; transform: translate(-50%, -100%); margin-top: -8px; opacity: 0; transition: opacity .12s; }
.tooltip b { font-weight: 500; display: block; font-size: 13px; }
.tooltip.show { opacity: 1; }

/* Lists */
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rank li:last-child { border-bottom: 0; }
.rank img { width: 44px; height: 44px; object-fit: cover; border-radius: 2px; }
.rank .meta { font-size: 13px; color: var(--muted); }

/* Tables */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input, .toolbar select { padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 14px; }
.toolbar input { min-width: 220px; flex: 1; max-width: 340px; }
.toolbar .spacer { flex: 1; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-weight: 400; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FCFBF9; }
table.data td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover { background: #FBF9F6; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data select { padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 13px; }
.empty-row { text-align: center; color: var(--muted); padding: 40px 16px !important; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 9px; border-radius: 20px; background: #F1ECE4; white-space: nowrap; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.Awaiting { color: var(--warn); background: #FBF4E6; }
.tag.Processing { color: var(--bronze); background: #F6EFE6; }
.tag.Shipped { color: var(--info); background: #EDF3F8; }
.tag.Completed { color: var(--good); background: #ECF6F0; }
.tag.Refunded, .tag.Cancelled { color: var(--bad); background: #FBF0EF; }
.demo-badge { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); padding: 1px 6px; border-radius: 2px; margin-left: 6px; }

/* Products editor */
.products { display: grid; gap: 16px; }
.prod { display: grid; grid-template-columns: 110px 1fr; gap: 22px; }
.prod img { width: 110px; height: 136px; object-fit: cover; border-radius: 2px; }
.prod-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; margin-bottom: 14px; }
.prod-head .slug { font-size: 13px; color: var(--muted); }
.price-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.price-grid .field { margin: 0; }
.price-grid label { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--muted); }
.money-input { position: relative; }
.money-input span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.money-input input { padding-left: 26px; }
.prod-foot { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.switch input { appearance: none; -webkit-appearance: none; width: 36px; height: 20px; border-radius: 20px; background: #D9D2C7; position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked { background: var(--bronze); }
.switch input:checked::after { transform: translateX(16px); }
.prod-foot .btns { margin-left: auto; display: flex; gap: 8px; }
.saved { font-size: 13px; color: var(--good); }
@media (max-width: 560px) { .prod { grid-template-columns: 1fr; } .prod img { width: 100%; height: 180px; } .prod-foot .btns { margin-left: 0; } }

/* Drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(47,43,39,.35); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); background: var(--surface); z-index: 21; padding: 28px; overflow-y: auto; box-shadow: -10px 0 40px rgba(0,0,0,.08); }
.drawer-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 24px; }
.drawer-head h2 { font-size: 30px; }
.drawer .close { background: none; border: 0; font-size: 28px; line-height: 1; cursor: pointer; padding: 0 4px; }
.dl { display: grid; grid-template-columns: 110px 1fr; gap: 8px 16px; font-size: 14px; margin: 0 0 24px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.line-items { border-top: 1px solid var(--line); margin-bottom: 24px; }
.line-items div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.line-items .total { font-weight: 400; font-size: 16px; border-bottom: 0; }

/* Settings */
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .settings { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--sidebar); color: #fff; padding: 10px 18px; border-radius: var(--radius); font-size: 14px; z-index: 30; }
