/* DOABNO admin portal. Brand tokens come from ../assets/brand/doabno-tokens.css. */
:root {
  --navy: var(--doabno-navy);
  --navy-2: #173A5E;
  --orange: var(--doabno-orange);
  --orange-text: var(--doabno-orange-text);
  --ink: var(--doabno-ink);
  --muted: var(--doabno-muted);
  --soft: var(--doabno-soft);
  --page: #F2F5F8;
  --line: #E2E8EE;
  --line-2: #EEF2F5;
  --input: #C8D2DC;
  --side-text: #C9D5E1;
  --side-muted: #8FA3B8;
  --good: #0F7A4A; --good-bg: #E7F6EE;
  --warn: #7A4F00; --warn-bg: #FFF4D6;
  --bad: #B42318; --bad-bg: #FDECEA;
  --info-bg: #E8F0F8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(14, 42, 71, .05), 0 6px 18px rgba(14, 42, 71, .08);
  --shadow-lg: 0 18px 44px rgba(14, 42, 71, .2);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-ar: 'IBM Plex Sans Arabic', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--page); }
html[lang="ar"] body { font-family: var(--font-ar); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; color: var(--navy); line-height: 1.25; }
p { margin: 0; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--doabno-focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; unicode-bidi: isolate; }
.hint { font-size: 12px; color: var(--muted); }
.link { background: none; border: 0; padding: 0; cursor: pointer; color: var(--navy); font-weight: 600; font-size: 14px; text-decoration: underline; text-underline-offset: 2px; }
.lang-toggle:lang(ar) { font-family: var(--font-ar); }
.good-text { color: var(--good); font-weight: 600; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--navy-2); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--navy); }
.btn-ghost:hover:not(:disabled) { border-color: var(--navy); }
.btn-danger { color: var(--bad); }
.btn-danger:hover:not(:disabled) { border-color: var(--bad); }
.btn-danger-solid { background: var(--bad); color: #fff; }
.btn-danger-solid:hover { background: #912018; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--soft); color: var(--navy); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }

/* ---------- sign in ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(160deg, #0E2A47 0%, #173A5E 60%, #0E2A47 100%); }
.login-card { width: min(420px, 100%); background: #fff; border-radius: 16px; padding: 32px; box-shadow: var(--shadow-lg); }
.login-logo { height: 30px; width: auto; margin-bottom: 20px; }
.login-card h1 { font-size: 22px; }
.login-card > .muted { margin: 4px 0 20px; }
.login-card .hint { margin-top: 14px; }
.login-card .lang-toggle { margin-top: 14px; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--navy); color: var(--side-text); padding: 18px 14px; display: flex; flex-direction: column; }
.side-logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 8px; }
.side-logo img { height: 24px; width: auto; }
.side-logo span { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--doabno-orange-on-navy); border: 1px solid rgba(255, 154, 70, .5); border-radius: 4px; padding: 1px 6px; }
html[lang="ar"] .side-logo span { letter-spacing: 0; }
.nav-group { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--side-muted); margin: 18px 10px 6px; }
html[lang="ar"] .nav-group { letter-spacing: 0; font-size: 12px; }
.nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; border-inline-start: 3px solid transparent; font-size: 14px; font-weight: 500; color: var(--side-text); }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, .1); color: #fff; border-inline-start-color: var(--orange); }
.nav-count { margin-inline-start: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.side-foot { margin-top: auto; padding: 16px 10px 4px; border-top: 1px solid rgba(255, 255, 255, .12); }
.side-foot a { display: inline-flex; align-items: center; gap: 8px; color: #fff; font-weight: 600; }
.side-foot a:hover { text-decoration: underline; }
.side-foot p { font-size: 12px; color: var(--side-muted); margin-top: 8px; }
.side-backdrop { display: none; }

.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; height: 60px; display: flex; align-items: center; gap: 16px; padding: 0 28px; background: #fff; border-bottom: 1px solid var(--line); }
.menu-btn { display: none; }
.top-market { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.top-market select, .toolbar select { height: 36px; border: 1px solid var(--input); border-radius: 8px; padding: 0 10px; background: #fff; color: var(--ink); cursor: pointer; }
.top-right { margin-inline-start: auto; display: flex; align-items: center; gap: 18px; }
.user { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px; cursor: pointer; font-weight: 600; color: var(--navy); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--navy); color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.user-menu { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 50; min-width: 190px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; }
.user-menu a, .user-menu button { display: block; width: 100%; text-align: start; padding: 9px 12px; border: 0; border-radius: 6px; background: none; font-size: 14px; cursor: pointer; color: var(--ink); }
.user-menu a:hover, .user-menu button:hover { background: var(--soft); }
.main { padding: 24px 28px 56px; max-width: 1480px; width: 100%; }

/* ---------- page structure ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 24px; font-weight: 800; }
.page-head p { margin-top: 4px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 10px; }
.back:hover { text-decoration: underline; }
[dir="rtl"] .back svg, [dir="rtl"] .go svg { transform: scaleX(-1); }

.grid { display: grid; gap: 20px; margin-top: 20px; align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: grid; gap: 20px; align-content: start; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.main > .card, .main > section.card { margin-top: 20px; }
.grid > .card, .stack > .card { margin-top: 0; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card-flush > .card-head { padding: 16px 20px; margin: 0; border-bottom: 1px solid var(--line-2); }
.card-head h2 { font-size: 16px; font-weight: 700; }
.card-head p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card-head .link { font-size: 13px; white-space: nowrap; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--line-2); }
.subhead { font-size: 14px; font-weight: 700; margin: 18px 0 4px; }

/* ---------- stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 1500px) { .tiles:not(.tiles-3):not(.tiles-4) { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.tile-value { font-size: 26px; font-weight: 800; color: var(--navy); line-height: 1.2; }
.tile-value .money { font-variant-numeric: normal; }
.tile-delta { font-size: 12px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tile-sub { font-size: 12px; color: var(--muted); }
.tile .spark { margin-top: 6px; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; }
.delta.good { color: var(--good); }
.delta.bad { color: var(--bad); }
.spark { overflow: visible; }
.spark path { fill: none; stroke: #8A9AAB; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--orange); stroke: #fff; stroke-width: 2; }

/* ---------- line chart ---------- */
.lchart { margin: 0; direction: ltr; }
.lchart-body { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; }
.lchart-y { position: relative; }
.lchart-y span { position: absolute; right: 0; transform: translateY(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lchart-plot { position: relative; height: 220px; cursor: crosshair; touch-action: pan-y; border-radius: 4px; }
.lchart-plot:focus-visible { outline-offset: 4px; }
.lchart-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.lchart .gridline { stroke: #E6ECF1; stroke-width: 1; }
.lchart .area { fill: var(--navy); fill-opacity: .1; }
.lchart .line { fill: none; stroke: var(--navy); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.lchart-end, .lchart-dot { position: absolute; width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 2px #fff; transform: translate(-50%, -50%); pointer-events: none; }
.lchart-end { background: var(--orange); }
.lchart-dot { background: var(--navy); z-index: 1; }
.lchart-cross { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--muted); opacity: .45; pointer-events: none; }
.lchart-tip { position: absolute; z-index: 2; display: flex; flex-direction: column; line-height: 1.35; background: var(--navy); color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 12px; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow); }
.lchart-tip strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.lchart-tip small { color: #C9D5E1; }
.lchart-x { display: flex; justify-content: space-between; padding-left: 52px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.chart-table { margin-top: 12px; }
.chart-table summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--navy); width: fit-content; }
.chart-table .table-wrap { max-height: 260px; overflow: auto; margin-top: 8px; border: 1px solid var(--line-2); border-radius: 8px; }
[dir="rtl"] .chart-table { direction: rtl; }

/* ---------- bar list ---------- */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.bar-row { position: relative; display: grid; grid-template-columns: minmax(0, 170px) minmax(0, 1fr); gap: 12px; align-items: center; padding: 6px 8px; border-radius: 8px; }
.bar-row:hover, .bar-row:focus-visible { background: var(--soft); }
.bar-label { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-label .store-cell { max-width: 100%; }
.bar-track { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar-fill { flex: none; height: 14px; width: calc((100% - 76px) * var(--p)); min-width: 2px; background: var(--navy); border-start-end-radius: 4px; border-end-end-radius: 4px; }
.bar-value { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-tip { position: absolute; inset-inline-end: 8px; bottom: calc(100% - 2px); z-index: 3; background: var(--navy); color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 12px; white-space: nowrap; box-shadow: var(--shadow); pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; }
.bar-tip strong { font-size: 13px; }
.bar-row:hover .bar-tip, .bar-row:focus-visible .bar-tip { opacity: 1; transform: none; }

/* ---------- lists ---------- */
.attn { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.attn a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.attn a:hover { border-color: var(--navy); }
.attn a > span:not(.badge) { flex: 1; min-width: 0; }
.go { color: var(--muted); display: inline-grid; flex: none !important; }
.feed-list, .activity { list-style: none; margin: 0; padding: 0; }
.feed-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.feed-list li:last-child { border-bottom: 0; }
.activity li { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 0; font-size: 13px; border-bottom: 1px solid var(--line-2); }
.activity li:last-child { border-bottom: 0; }
.activity svg { color: var(--muted); margin-top: 2px; }
.activity time { font-size: 12px; white-space: nowrap; }

/* ---------- toolbar, chips, segmented ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); }
.field-search { position: relative; flex: 1 1 240px; max-width: 380px; display: flex; align-items: center; }
.field-search svg { position: absolute; inset-inline-start: 10px; color: var(--muted); pointer-events: none; }
.field-search input { width: 100%; height: 36px; border: 1px solid var(--input); border-radius: 8px; padding-inline: 36px 10px; background: #fff; }
.field-search input:focus, .top-market select:focus, .toolbar select:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(14, 42, 71, .12); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; background: #fff; font-size: 13px; color: var(--ink); }
a.chip:hover { border-color: var(--navy); }
.chip.on { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.chip .badge { padding: 0 6px; }
.chip-sm { padding: 1px 8px; font-size: 12px; background: var(--soft); border-color: transparent; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button, .seg a { border: 0; background: none; padding: 7px 12px; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; white-space: nowrap; }
.seg button + button, .seg a + a { border-inline-start: 1px solid var(--line); }
.seg [aria-pressed="true"] { background: var(--navy); color: #fff; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; position: relative; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-size: 12px; font-weight: 600; color: var(--muted); background: #F8FAFC; padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th a { display: inline-flex; align-items: center; gap: 4px; color: inherit; }
.table th a:hover { color: var(--navy); }
.table th[aria-sort] a { color: var(--navy); }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FAFBFD; }
.table .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: end; white-space: nowrap; }
.table .actions .btn + .btn { margin-inline-start: 6px; }
.table-compact th, .table-compact td { padding: 8px 12px; }
.table-tight .prod-cell > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-muted td { color: var(--muted); }
.row-muted .slogo { opacity: .5; }
.cats { display: flex; flex-wrap: wrap; gap: 4px; }
.flags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.feed-msg { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.table-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line-2); font-size: 13px; }
.pager { display: flex; flex-wrap: wrap; gap: 4px; }
.pager a, .pager span { min-width: 32px; height: 32px; padding: 0 10px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; font-weight: 600; color: var(--navy); background: #fff; }
.pager a:hover { border-color: var(--navy); }
.pager span[aria-current] { background: var(--navy); border-color: var(--navy); color: #fff; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 20px; text-align: center; color: var(--muted); }
.empty svg { color: var(--navy); opacity: .5; }

/* ---------- cells ---------- */
.prod-cell { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.prod-cell strong { display: block; font-weight: 600; color: var(--ink); }
.prod-cell small { display: block; font-size: 12px; }
a.prod-cell:hover strong, a.prod-cell:hover > span { text-decoration: underline; }
.pthumb { position: relative; display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 8px; overflow: hidden; background: var(--tint); color: var(--navy); }
.pthumb svg { opacity: .5; }
.pthumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.store-cell { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; min-width: 0; }
.store-cell > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.slogo { position: relative; overflow: hidden; width: 24px; height: 24px; border-radius: 6px; background: var(--c); color: #fff; font-weight: 800; font-size: 11px; display: inline-grid; place-items: center; flex-shrink: 0; border: 1px solid var(--line); }
.slogo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 3px; background: #fff; }
.bmark { display: inline-block; width: 14px; height: 14px; margin-inline-end: 5px; vertical-align: -2px; }
.bmark img { width: 100%; height: 100%; object-fit: contain; border-radius: 3px; }
.mk { display: inline-block; font-size: 10px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; margin-inline-start: 4px; vertical-align: middle; line-height: 16px; }
.user-cell { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.user-cell .avatar { width: 28px; height: 28px; font-size: 12px; background: var(--info-bg); color: var(--navy); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; font-size: 13px; background: var(--soft); border: 1px dashed var(--input); border-radius: 4px; padding: 1px 6px; }

/* ---------- badges & tags ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 18px; }
.badge-good { background: var(--good-bg); color: var(--good); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }
.badge-muted { background: var(--line-2); color: var(--muted); }
.badge-info { background: var(--info-bg); color: var(--navy); }
.tag { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.tag-sale { background: var(--orange); color: var(--navy); }
.tag-promo { background: var(--good-bg); color: var(--good); }

/* ---------- forms ---------- */
.form-stack { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.card .hint + .form-grid { margin-top: 12px; }
.field { display: grid; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > span, .field > legend { font-size: 13px; font-weight: 600; color: var(--navy); padding: 0; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--input); border-radius: 8px; padding: 9px 12px; background: #fff; color: var(--ink); }
.field input[type="color"] { width: 64px; height: 40px; padding: 2px; }
.field textarea { resize: vertical; min-height: 100px; }
.field input:focus, .field select:focus, .field textarea:focus, .input-sm:focus, .cat-edit input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(14, 42, 71, .12); }
.field select:disabled { background: var(--soft); color: var(--muted); }
.upper { text-transform: uppercase; }
.input-sm { width: 130px; border: 1px solid var(--input); border-radius: 8px; padding: 6px 10px; font-variant-numeric: tabular-nums; }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; margin: 0; accent-color: var(--navy); flex-shrink: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; font-size: 18px; font-weight: 700; color: var(--navy); }
.photos { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.photos img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--soft); }

.switch { position: relative; display: inline-flex; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-ui { width: 38px; height: 22px; border-radius: 999px; background: var(--input); transition: background .15s; position: relative; }
.switch-ui::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch input:checked + .switch-ui { background: var(--good); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); }
[dir="rtl"] .switch input:checked + .switch-ui::after { transform: translateX(-16px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid var(--doabno-focus); outline-offset: 2px; }

/* categories */
.cat-card { margin-top: 20px; }
.cat-title { display: flex; align-items: center; gap: 12px; }
.cat-ic { width: 38px; height: 38px; border-radius: 10px; background: var(--soft); color: var(--navy); display: grid; place-items: center; flex-shrink: 0; }
.cat-title h2 .muted { font-weight: 500; margin-inline-start: 6px; }
.cat-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.cat-edit input { flex: 1 1 180px; border: 1px solid var(--input); border-radius: 8px; padding: 7px 10px; }

/* ---------- drawer, dialog, toast ---------- */
.drawer-backdrop { position: fixed; inset: 0; z-index: 89; background: rgba(14, 42, 71, .45); }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; z-index: 90; width: min(460px, 100%); background: #fff; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 18px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.dialog { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 16px; background: rgba(14, 42, 71, .45); }
.dialog-card { width: min(440px, 100%); background: #fff; border-radius: 14px; padding: 24px; box-shadow: var(--shadow-lg); }
.dialog-card p { font-size: 15px; color: var(--ink); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100; max-width: calc(100% - 32px); background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .grid-2-1 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; z-index: 70; width: 264px; height: auto; transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .app.menu-open .sidebar { transform: none; visibility: visible; transition: transform .2s ease; }
  .app.menu-open .side-backdrop { display: block; position: fixed; inset: 0; z-index: 60; background: rgba(14, 42, 71, .45); }
  .menu-btn { display: grid; }
  .topbar { padding: 0 16px; gap: 10px; }
  .top-market > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .user-name { display: none; }
  .main { padding: 18px 16px 48px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .page-head h1 { font-size: 21px; }
  .tiles, .tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 12px 14px; }
  .tile-value { font-size: 21px; }
  .tile .spark { width: 100%; }
  .bar-row { grid-template-columns: minmax(0, 110px) minmax(0, 1fr); gap: 8px; }
  .toolbar { padding: 12px 14px; }
  .toolbar select { flex: 1 1 140px; }
  .field-search { max-width: none; }
  .checks { grid-template-columns: minmax(0, 1fr); }
  .feed-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .feed-list li > .muted { display: none; }
  .top-right { gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
