/* ==========================================================================
   Azkoo admin panel
   ========================================================================== */
@font-face { font-family: "Vazirmatn FD"; src: url("../fonts/Vazirmatn-FD-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn FD"; src: url("../fonts/Vazirmatn-FD-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Vazirmatn FD"; src: url("../fonts/Vazirmatn-FD-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Vazirmatn FD"; src: url("../fonts/Vazirmatn-FD-Black.woff2") format("woff2"); font-weight: 900; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #F3F2EE;
  --surface: #FFFFFF;
  --surface-2: #F7F6F2;
  --line: #E3E0D8;
  --line-2: #EEECE6;
  --ink: #1B1E2E;
  --ink-2: #4A4D5C;
  --muted: #7A7C88;
  --indigo: #1E2852;
  --indigo-2: #2A3A72;
  --accent: #2A3A72;
  --accent-ink: #FFFFFF;
  --accent-soft: #E7EAF6;
  --madder: #B22A2E;
  --weld: #E0A526;
  --ok: #2F6B3A; --ok-bg: #E4F0DF;
  --warn: #7A5300; --warn-bg: #FBEFD5;
  --err: #A3262A; --err-bg: #F8E5E4;
  --series-1: #3355B5;
  --series-2: #D9653B;
  --grid: #ECEAE4;
  --heat-0: #F0F2FA; --heat-1: #CBD3EF; --heat-2: #96A6DE; --heat-3: #5D74C6; --heat-4: #2F4597; --heat-5: #1E2852;
  --shadow: 0 1px 2px rgb(20 24 50 / .05), 0 6px 20px -12px rgb(20 24 50 / .18);
  --r: 12px;
  --font: "Vazirmatn FD", Tahoma, system-ui, sans-serif;
  --side-w: 256px;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #11131E; --surface: #181C2C; --surface-2: #1E2336; --line: #2B3149; --line-2: #232840;
    --ink: #ECEDF3; --ink-2: #C3C6D4; --muted: #8E92A6; --accent: #6E8BE0; --accent-ink: #0E1122; --accent-soft: #232C4E;
    --ok: #8CCB8F; --ok-bg: #1D3322; --warn: #F1C56A; --warn-bg: #3A2F16; --err: #F08A86; --err-bg: #3D1E21;
    --series-1: #6E8BE0; --series-2: #D96A3D; --grid: #262B42;
    --heat-0: #1F2438; --heat-1: #2A3561; --heat-2: #3A4D8F; --heat-3: #5570C2; --heat-4: #7F98E3; --heat-5: #B5C4F3;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -14px rgb(0 0 0 / .6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11131E; --surface: #181C2C; --surface-2: #1E2336; --line: #2B3149; --line-2: #232840;
  --ink: #ECEDF3; --ink-2: #C3C6D4; --muted: #8E92A6; --accent: #6E8BE0; --accent-ink: #0E1122; --accent-soft: #232C4E;
  --ok: #8CCB8F; --ok-bg: #1D3322; --warn: #F1C56A; --warn-bg: #3A2F16; --err: #F08A86; --err-bg: #3D1E21;
  --series-1: #6E8BE0; --series-2: #D96A3D; --grid: #262B42;
  --heat-0: #1F2438; --heat-1: #2A3561; --heat-2: #3A4D8F; --heat-3: #5570C2; --heat-4: #7F98E3; --heat-5: #B5C4F3;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px -14px rgb(0 0 0 / .6);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.8; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; }
img { display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.4; }
p { margin: 0 0 .8em; }
ul, ol { margin: 0; padding: 0; }
dl, dd { margin: 0; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; direction: ltr; unicode-bidi: embed; }
pre.code { background: var(--surface-2); padding: 12px 14px; border-radius: 10px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; border: 1px solid var(--line); }
:focus-visible { outline: 3px solid var(--weld); outline-offset: 2px; border-radius: 4px; }
.ic { width: 1.2em; height: 1.2em; flex: none; vertical-align: -0.22em; }
.ic--flip { transform: rotate(180deg); }
.skip { position: absolute; inset-inline-start: 10px; top: -50px; background: var(--weld); color: #111; padding: 6px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 10px; }
.muted { color: var(--muted); }
.ltr { direction: ltr; unicode-bidi: embed; }
[hidden] { display: none !important; }
.hide-sm { }
@media (max-width: 640px) { .hide-sm { display: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 7px 16px;
  border-radius: 9px; border: 1px solid transparent; background: var(--surface-2); color: var(--ink);
  font-weight: 700; font-size: 14px; line-height: 1.3; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { filter: brightness(1.1); }
.btn--ghost { background: transparent; border-color: var(--line); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--danger { background: var(--err-bg); color: var(--err); }
.btn--danger:hover { background: var(--err); color: #fff; }
.btn--ok { background: var(--ok-bg); color: var(--ok); }
.btn--sm { min-height: 32px; padding: 4px 12px; font-size: 13px; border-radius: 8px; }
.btn--lg { min-height: 46px; padding: 10px 22px; font-size: 15px; }
.btn--block { width: 100%; }
.btn.is-busy { opacity: .6; pointer-events: none; }
.iconbtn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; border: 0; background: transparent; cursor: pointer; color: inherit; }
.iconbtn:hover { background: var(--surface-2); }
.row-gap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- shell ---------- */
.side {
  position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--side-w); z-index: 30;
  display: flex; flex-direction: column; background: var(--indigo); color: #fff;
}
.side__brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid rgb(255 255 255 / .08); }
.side__brand img { width: 36px; height: 36px; border-radius: 10px; }
.side__brand div { display: grid; line-height: 1.35; }
.side__brand b { font-size: 16px; }
.side__brand small { color: rgb(255 255 255 / .6); font-size: 12px; }
.side__nav { flex: 1; overflow-y: auto; padding: 10px 10px 20px; scrollbar-width: thin; scrollbar-color: rgb(255 255 255 / .2) transparent; }
.side__group { margin: 14px 10px 4px; font-size: 12px; color: rgb(255 255 255 / .45); }
.side__nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; text-decoration: none;
  color: rgb(255 255 255 / .78); font-size: 14px; font-weight: 500;
}
.side__nav a:hover { background: rgb(255 255 255 / .07); color: #fff; }
.side__nav a[aria-current="page"] { background: rgb(255 255 255 / .12); color: #fff; box-shadow: inset -3px 0 0 var(--weld); }
.side__nav a span { flex: 1; }
.side__badge { font-style: normal; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--weld); color: #1B1E2E; font-size: 12px; font-weight: 900; display: grid; place-items: center; }
.side__foot { padding: 10px 18px 14px; font-size: 12px; color: rgb(255 255 255 / .45); border-top: 1px solid rgb(255 255 255 / .08); }
.side-scrim { position: fixed; inset: 0; background: rgb(10 12 26 / .45); z-index: 25; }
.main { margin-inline-start: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.top__title { font-size: 18px; font-weight: 900; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top__actions { display: flex; align-items: center; gap: 4px; }
.top__actions form { margin: 0; }
.top__menu { display: none; }
.ic--light { display: none; }
:root[data-theme="dark"] .ic--dark { display: none; }
:root[data-theme="dark"] .ic--light { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ic--dark { display: none; }
  :root:not([data-theme="light"]) .ic--light { display: inline; }
}
.content { padding: 22px 24px 60px; width: 100%; max-width: 1400px; }
@media (max-width: 1000px) {
  .side { transform: translateX(100%); transition: transform .25s; }
  .side.is-open { transform: none; box-shadow: 0 0 40px rgb(0 0 0 / .4); }
  .main { margin-inline-start: 0; }
  .top__menu { display: inline-grid; }
  .top { padding-inline: 14px; }
  .content { padding: 16px 14px 60px; }
}

/* ---------- flash & toasts ---------- */
.flash { display: flex; align-items: flex-start; gap: 8px; padding: 10px 14px; border-radius: 10px; margin: 0 0 16px; font-weight: 500; }
.flash .ic { margin-top: 3px; }
.flash ul { margin: 0; padding-inline-start: 18px; }
.flash--ok { background: var(--ok-bg); color: var(--ok); }
.flash--err { background: var(--err-bg); color: var(--err); }
.flash--warn { background: var(--warn-bg); color: var(--warn); }
.flash--info { background: var(--accent-soft); color: var(--ink); }
.toasts { position: fixed; bottom: 18px; inset-inline: 0; display: grid; justify-items: center; gap: 8px; z-index: 90; pointer-events: none; }
.toast { pointer-events: auto; background: #1B1E2E; color: #fff; padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 500; }
.toast--err { background: var(--err); }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 18px; min-width: 0; }
.panel__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.panel__title { font-size: 15.5px; font-weight: 900; flex: 1; display: flex; align-items: center; gap: 8px; }
.panel__title small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.panel__body { padding: 16px 18px; }
.panel__body--flush { padding: 0; }
.panel__foot { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cols { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.cols--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols--main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .cols--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .cols, .cols--3, .cols--main { grid-template-columns: 1fr; } }
.pagebar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.pagebar__title { flex: 1; font-size: 13.5px; color: var(--muted); }
.empty { padding: 34px 20px; text-align: center; color: var(--muted); }
.empty .ic { width: 42px; height: 42px; color: var(--line); margin-bottom: 6px; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); display: grid; gap: 2px; min-width: 0; }
.kpi__label { font-size: 13px; color: var(--muted); }
.kpi__value { font-size: 26px; font-weight: 900; line-height: 1.35; overflow-wrap: anywhere; }
.kpi__sub { font-size: 12.5px; color: var(--ink-2); }
.kpi__unit { font-size: 14px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.kpi--accent .kpi__unit { color: rgb(255 255 255 / .75); }
.kpi__delta { font-size: 12.5px; font-weight: 700; }
.kpi__delta.up { color: var(--ok); }
.kpi__delta.down { color: var(--err); }
.kpi--hero .kpi__value { font-size: 34px; }
.kpi--accent { background: var(--indigo); color: #fff; border-color: transparent; }
.kpi--accent .kpi__label, .kpi--accent .kpi__sub { color: rgb(255 255 255 / .75); }
.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #3DBE6A; margin-inline-end: 6px; box-shadow: 0 0 0 0 rgb(61 190 106 / .6); animation: live 1.8s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 8px rgb(61 190 106 / 0); } 100% { box-shadow: 0 0 0 0 rgb(61 190 106 / 0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .nowrap { white-space: nowrap; }
.table a.rowlink { font-weight: 700; text-decoration: none; }
.table a.rowlink:hover { color: var(--accent); }
.table .thumb { width: 52px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.table .avatar { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; object-position: top; }
.table small { color: var(--muted); display: block; line-height: 1.5; }
.table .actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: nowrap; }
.table .actions form { margin: 0; }
.pill { display: inline-block; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.9; white-space: nowrap; }
.pill--amber { background: var(--warn-bg); color: var(--warn); }
.pill--blue { background: var(--accent-soft); color: var(--accent); }
.pill--violet { background: #EFE6FA; color: #5B2F8E; }
.pill--teal { background: #DDF1EE; color: #1D5E58; }
.pill--green { background: var(--ok-bg); color: var(--ok); }
.pill--red { background: var(--err-bg); color: var(--err); }
.pill--gray { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
:root[data-theme="dark"] .pill--violet { background: #33274A; color: #CDB4F2; }
:root[data-theme="dark"] .pill--teal { background: #17332F; color: #8FD6CB; }
.pager { display: flex; gap: 4px; justify-content: center; padding: 14px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; text-decoration: none; font-weight: 700; font-size: 13px; padding: 0 8px; }
.pager a:hover { background: var(--surface-2); }
.pager [aria-current] { background: var(--accent); color: var(--accent-ink); }

/* ---------- toolbar / filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.toolbar input, .toolbar select { min-height: 36px; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.toolbar input[type="search"] { min-width: 220px; flex: 1; max-width: 360px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border-radius: 8px; text-decoration: none; font-size: 13.5px; font-weight: 700; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover { background: var(--surface-2); }
.tabs a[aria-current] { background: var(--accent); color: var(--accent-ink); }
.tabs a em { font-style: normal; font-size: 11.5px; opacity: .75; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a { padding: 4px 12px; border-radius: 7px; text-decoration: none; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.seg a[aria-current] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- forms ---------- */
.form { display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
@media (max-width: 760px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.field { display: grid; gap: 5px; min-width: 0; margin: 0; padding: 0; border: 0; align-content: start; }
.field--wide { grid-column: 1 / -1; }
.field__label, .field > legend { font-size: 13.5px; font-weight: 700; color: var(--ink); padding: 0; }
.field__label em { font-style: normal; font-weight: 400; color: var(--muted); font-size: 12px; }
.field__help { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.field input, .field select, .field textarea, .pairs input, .input {
  width: 100%; min-height: 40px; padding: 7px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; line-height: 1.8; }
.field input:focus, .field select:focus, .field textarea:focus, .pairs input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input[readonly] { background: var(--surface-2); }
.input-affix { display: flex; align-items: stretch; }
.input-affix input { border-start-end-radius: 0; border-end-end-radius: 0; }
.input-affix span { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line); border-inline-start: 0; border-radius: 0 9px 9px 0; background: var(--surface-2); color: var(--muted); font-size: 13px; }
[dir="rtl"] .input-affix input { border-radius: 0 9px 9px 0; }
[dir="rtl"] .input-affix span { border-radius: 9px 0 0 9px; border-inline-start: 0; border-inline-end: 1px solid var(--line); }
.input-affix input { border-radius: 9px 0 0 9px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding-top: 4px; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: 12px 18px; margin: 0 -18px -16px; border-radius: 0 0 var(--r) var(--r); }

.toggle { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 6px 0; }
.toggle input[type="checkbox"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle__track { position: relative; flex: none; width: 42px; height: 24px; border-radius: 999px; background: var(--line); transition: background .2s; margin-top: 2px; }
.toggle__track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .2s; }
.toggle input:checked + .toggle__track { background: var(--accent); }
.toggle input:checked + .toggle__track::after { transform: translateX(-18px); }
.toggle input:focus-visible + .toggle__track { outline: 3px solid var(--weld); outline-offset: 2px; }
.toggle__text { display: grid; line-height: 1.6; }
.toggle__text b { font-weight: 700; font-size: 14px; }
.checkgrid { display: flex; flex-wrap: wrap; gap: 6px; }
.checkchip { position: relative; display: inline-flex; }
.checkchip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.checkchip span { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; cursor: pointer; }
.checkchip input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.checkchip input:focus-visible + span { outline: 3px solid var(--weld); outline-offset: 1px; }
.radio, .check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.radio input, .check input { width: 17px; height: 17px; accent-color: var(--accent); }

.imgfield__box { display: flex; gap: 14px; align-items: center; }
.imgfield__prev { flex: none; width: 108px; height: 108px; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px dashed var(--line); display: grid; place-items: center; }
.imgfield__prev img { width: 100%; height: 100%; object-fit: cover; }
.imgfield__ph .ic { width: 30px; height: 30px; color: var(--muted); }
.imgfield__ctrl { display: grid; gap: 8px; justify-items: start; }
.imgfield__rm { font-size: 13px; color: var(--err); display: flex; gap: 6px; align-items: center; cursor: pointer; }
.gallery-edit { display: flex; flex-wrap: wrap; gap: 10px; }
.gthumb, .gadd { position: relative; width: 104px; height: 104px; border-radius: 12px; overflow: hidden; cursor: pointer; }
.gthumb img { width: 100%; height: 100%; object-fit: cover; }
.gthumb input { position: absolute; top: 6px; inset-inline-start: 6px; width: 18px; height: 18px; accent-color: var(--err); }
.gthumb span { position: absolute; inset: auto 0 0 0; background: rgb(0 0 0 / .55); color: #fff; font-size: 12px; text-align: center; padding: 2px; }
.gthumb:has(input:checked) img { opacity: .35; }
.gthumb:has(input:checked) span { background: var(--err); }
.gadd { display: grid; place-items: center; align-content: center; gap: 4px; border: 1.5px dashed var(--line); color: var(--muted); font-size: 12.5px; background: var(--surface-2); }
.gadd:hover { border-color: var(--accent); color: var(--accent); }
.gadd .ic { width: 26px; height: 26px; }
.gnew { width: 104px; height: 104px; border-radius: 12px; object-fit: cover; outline: 2px solid var(--accent); }

.pairs { display: grid; gap: 8px; margin-bottom: 8px; }
.pairs__row { display: grid; grid-template-columns: 18px minmax(0, 1fr) minmax(0, 1.5fr) 36px 36px; gap: 6px; align-items: center; }
.pairs__drag { color: var(--muted); font-size: 12px; letter-spacing: -2px; text-align: center; }
@media (max-width: 600px) { .pairs__row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px 32px; } .pairs__drag { display: none; } }

.repeater { display: grid; gap: 8px; margin-bottom: 8px; }
.repeater__row { display: grid; grid-template-columns: minmax(0, 1fr) auto 36px; gap: 6px; align-items: center; }

/* ---------- charts ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .s1 { stroke: var(--series-1); }
.chart .s2 { stroke: var(--series-2); }
.chart .f1 { fill: var(--series-1); }
.chart .f2 { fill: var(--series-2); }
.chart .area1 { fill: var(--series-1); opacity: .1; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--muted); stroke-width: 1; opacity: .6; }
.chart .endlabel { fill: var(--ink-2); font-size: 11.5px; font-weight: 700; font-family: var(--font); }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 140px; padding: 8px 12px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 12.5px; line-height: 1.7; transform: translate(-50%, -100%);
}
.chart-tip b { display: block; font-size: 12.5px; margin-bottom: 2px; }
.chart-tip i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-inline-end: 6px; vertical-align: middle; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.legend .k1 { background: var(--series-1); }
.legend .k2 { background: var(--series-2); }

.barlist { display: grid; gap: 8px; list-style: none; }
.barlist li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; font-size: 13.5px; align-items: center; }
.barlist__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.barlist__label a { text-decoration: none; }
.barlist__label a:hover { color: var(--accent); }
.barlist__val { display: inline-flex; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.barlist__val b { font-weight: 700; unicode-bidi: isolate; }
.barlist__val small { color: var(--muted); font-weight: 400; unicode-bidi: isolate; min-width: 3.2em; text-align: end; }
.barlist__label[dir="ltr"] { text-align: right; }
.barlist__bar { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.barlist__bar i { display: block; height: 100%; border-radius: 4px; background: var(--series-1); min-width: 3px; }


.funnel { display: grid; gap: 10px; list-style: none; }
.funnel li { display: grid; grid-template-columns: 170px minmax(0, 1fr) 120px; gap: 12px; align-items: center; font-size: 13.5px; }
.funnel__bar { height: 22px; border-radius: 0 4px 4px 0; background: var(--surface-2); position: relative; }
.funnel__bar i { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 4px; background: var(--series-1); max-width: 100%; min-width: 3px; }
.funnel__n { text-align: end; font-weight: 700; font-variant-numeric: tabular-nums; }
.funnel__n small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; line-height: 1.3; }
@media (max-width: 640px) { .funnel li { grid-template-columns: 110px minmax(0, 1fr) 84px; gap: 8px; font-size: 12.5px; } }

.heat { display: grid; grid-template-columns: 64px repeat(24, minmax(0, 1fr)); gap: 2px; font-size: 11px; }
.heat__h { text-align: center; color: var(--muted); font-size: 10.5px; }
.heat__d { color: var(--ink-2); white-space: nowrap; display: flex; align-items: center; }
.heat__c { aspect-ratio: 1; border-radius: 3px; background: var(--heat-0); min-height: 12px; }
.heat__c[data-l="1"] { background: var(--heat-1); }
.heat__c[data-l="2"] { background: var(--heat-2); }
.heat__c[data-l="3"] { background: var(--heat-3); }
.heat__c[data-l="4"] { background: var(--heat-4); }
.heat__c[data-l="5"] { background: var(--heat-5); }
.heat-scale { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); margin-top: 10px; }
.heat-scale i { width: 14px; height: 14px; border-radius: 3px; }

.feed { list-style: none; display: grid; }
.feed li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 18px; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.feed li:last-child { border-bottom: 0; }
.feed__ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--surface-2); color: var(--accent); }
.feed__t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed__t small { display: block; color: var(--muted); font-size: 12px; }
.feed time { color: var(--muted); font-size: 12px; white-space: nowrap; }

.journey { list-style: none; display: grid; gap: 0; position: relative; }
.journey li { display: grid; grid-template-columns: 70px 20px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 6px 0; font-size: 13.5px; }
.journey time { color: var(--muted); font-size: 12px; text-align: end; padding-top: 2px; }
.journey .jdot { width: 12px; height: 12px; border-radius: 50%; background: var(--series-1); margin-top: 7px; box-shadow: 0 0 0 3px var(--surface); position: relative; z-index: 1; }
.journey .jdot--ev { background: var(--series-2); border-radius: 3px; }
.journey li + li .jdot::before { content: ""; position: absolute; bottom: 12px; left: 5px; width: 2px; height: 40px; background: var(--line); z-index: -1; }
.journey small { color: var(--muted); display: block; }
.journey .jdur { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ---------- order view ---------- */
.kv { display: grid; }
.kv > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line-2); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-size: 13.5px; }
.kv dd { font-weight: 500; overflow-wrap: anywhere; }
.timeline { list-style: none; display: grid; gap: 10px; border-inline-start: 2px solid var(--line); padding-inline-start: 14px; margin: 4px 6px 0 0; }
.timeline li { position: relative; font-size: 13.5px; display: grid; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -20px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.timeline li.is-private::before { background: var(--muted); }
.timeline time, .timeline small { color: var(--muted); font-size: 12px; }
.statusbar { display: flex; flex-wrap: wrap; gap: 6px; }
.statusbar button { border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 700; }
.statusbar button:hover { border-color: var(--accent); }
.statusbar button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- QR admin ---------- */
.qrgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.qrcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.qrcard__top { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 14px; align-items: center; }
.qrcard__code { width: 96px; height: 96px; border-radius: 10px; background: #fff; padding: 4px; border: 1px solid var(--line); }
.qrcard__code img { width: 100%; height: 100%; }
.qrcard h3 { font-size: 15px; font-weight: 900; line-height: 1.5; }
.qrcard__meta { font-size: 12.5px; color: var(--muted); }
.qrcard__foot { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line-2); }
.qrshow { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
.qrbig { background: #fff; border-radius: 16px; padding: 18px; border: 1px solid var(--line); }
.qrbig img { width: 100%; height: auto; }
.phone { width: 300px; max-width: 100%; height: 600px; border-radius: 34px; border: 10px solid #1B1E2E; overflow: hidden; background: #fff; box-shadow: var(--shadow); margin-inline: auto; }
.phone iframe { width: 100%; height: 100%; border: 0; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { position: relative; }
.swatch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatch span { display: block; width: 34px; height: 34px; border-radius: 10px; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--accent); }
.swatch input:focus-visible + span { outline: 3px solid var(--weld); }
@media (max-width: 900px) { .qrshow { grid-template-columns: 1fr; } }

/* ---------- checklist / install / login ---------- */
.checklist { list-style: none; display: grid; gap: 6px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 6px 10px; border-radius: 8px; }
.checklist b { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 13px; margin-top: 2px; }
.checklist span { display: grid; line-height: 1.6; }
.checklist small { color: var(--muted); }
.checklist__ok b { background: var(--ok-bg); color: var(--ok); }
.checklist__warn { background: var(--warn-bg); }
.checklist__warn b { background: var(--weld); color: #1B1E2E; }
.checklist__bad { background: var(--err-bg); }
.checklist__bad b { background: var(--err); color: #fff; }
.auth-body { background: var(--indigo) url("../img/hero-landscape.svg") center bottom / 100% auto no-repeat; min-height: 100vh; }
.install { max-width: 760px; margin: 0 auto; padding: 30px 16px 80px; }
.install__head { display: flex; gap: 14px; align-items: center; color: #fff; margin-bottom: 18px; }
.install__head h1 { font-size: 24px; }
.install__head p { margin: 0; color: rgb(255 255 255 / .65); }
.install .card { background: var(--surface); border-radius: 16px; padding: 22px; margin-bottom: 16px; box-shadow: 0 20px 50px -20px rgb(0 0 0 / .5); }
.install .card__title { font-size: 17px; font-weight: 900; margin-bottom: 12px; }
.install h3 { font-size: 15px; margin: 18px 0 6px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login__card { width: min(420px, 100%); background: var(--surface); border-radius: 18px; padding: 0 26px 22px; box-shadow: 0 30px 60px -20px rgb(0 0 0 / .6); overflow: hidden; }
.kilim-bar { height: 12px; margin: 0 -26px 22px; background: url("../img/kilim.svg") repeat-x center / auto 100%; }
.login__head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login__head img { width: 52px; height: 52px; border-radius: 14px; }
.login__head h1 { font-size: 18px; font-weight: 900; }
.login__head p { margin: 0; color: var(--muted); font-size: 13.5px; }
.login__back { display: inline-flex; gap: 6px; align-items: center; margin-top: 14px; font-size: 13px; color: var(--muted); text-decoration: none; }

/* ---------- misc ---------- */
.stack { display: grid; gap: 12px; }
.inline-form { display: inline; margin: 0; }
.mini { font-size: 12.5px; color: var(--muted); }
.hr { height: 1px; background: var(--line-2); margin: 14px 0; border: 0; }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); font-size: 13.5px; margin-bottom: 14px; }
.notice .ic { color: var(--accent); margin-top: 3px; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.statgrid div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; display: grid; }
.statgrid small { color: var(--muted); font-size: 12px; }
.statgrid b { font-size: 18px; font-weight: 900; }
.copyrow { display: flex; gap: 6px; align-items: stretch; }
.copyrow input { flex: 1; min-width: 0; min-height: 38px; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); direction: ltr; font-family: ui-monospace, monospace; font-size: 12.5px; }
dialog.modal { border: 0; border-radius: 16px; padding: 0; width: min(520px, 94vw); background: var(--surface); color: var(--ink); box-shadow: 0 30px 70px -20px rgb(0 0 0 / .5); }
dialog.modal::backdrop { background: rgb(10 12 26 / .5); }
.modal__body { padding: 20px; display: grid; gap: 12px; }
.modal__foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--line-2); }

/* ---------- phone fixes ---------- */
code { overflow-wrap: anywhere; word-break: break-all; }
@media (max-width: 760px) {
  .repeater__row { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; padding: 10px; border: 1px solid var(--line-2); border-radius: 10px; }
  .repeater__row > :first-child:not([type="hidden"]), .repeater__row > input[type="hidden"] + input { grid-column: 1 / -1; }
  .repeater__row .iconbtn { justify-self: start; }
  .table .actions { flex-wrap: wrap; }
  .kpi__value { font-size: 22px; }
  .kpi--hero .kpi__value { font-size: 26px; }
  .pagebar__title { flex-basis: 100%; order: 3; }
}

/* tables become cards on phones */
@media (max-width: 640px) {
  .table--cards thead { display: none; }
  .table--cards, .table--cards tbody { display: block; width: 100%; }
  .table--cards tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
  .table--cards tr:last-child { border-bottom: 0; }
  .table--cards td { display: block; padding: 0; border: 0; min-width: 0; }
  .table--cards tbody tr:hover td { background: none; }
  .table--cards td:first-child { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .table--cards td:first-child small { display: inline; }
  .table--cards td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--muted); line-height: 1.6; }
  .table--cards .num { text-align: start; }
  .table--cards td:last-child:not([data-label]) { grid-column: 1 / -1; }
  .table--cards .actions { justify-content: flex-start; }
}
