/* The admin screen's look. Mobile first: a bottom tab bar on phones, an icon rail on tablets, a
   sidebar on computers. Light and dark follow the device. No external fonts or images.
   Logical properties (inline-start/end) so Arabic (right-to-left) mirrors by itself. */
:root {
  --bg: #f3f5fa; --surface: #fff; --surface-2: #f7f8fc; --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --line: #e4e8f0; --line-2: #eef1f6;
  --brand: #3b5bdb; --brand-2: #3049b8; --brand-ink: #fff; --brand-soft: #edf1ff;
  --ok: #15803d; --ok-soft: #e3f6ea; --warn: #b45309; --warn-soft: #fdf1dc; --bad: #c02626; --bad-soft: #fde7e7; --info: #0b6aa2; --info-soft: #e2f2fb; --violet: #6d3fd1; --violet-soft: #efe8fd; --teal: #0f766e; --teal-soft: #dff5f2; --pink: #be185d; --pink-soft: #fce7f3;
  --r: 14px; --r-sm: 10px; --sh: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06); --sh-lg: 0 12px 32px rgba(16, 24, 40, .16);
  --side: 248px; --top: 60px; --tab: 64px; --safe-b: env(safe-area-inset-bottom, 0px);
  /* layout editor */
  --zone: #d92d20; --mask: #f79009; --box: #2457d6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020; --surface: #121a2c; --surface-2: #172137; --ink: #e7ebf3; --ink-2: #c3cbda; --muted: #8f9bb2; --line: #243049; --line-2: #1c2740;
    --brand: #7d93ff; --brand-2: #9aabff; --brand-ink: #0b1020; --brand-soft: #1d2850;
    --ok: #4ade80; --ok-soft: #12301f; --warn: #fbbf24; --warn-soft: #33270c; --bad: #f87171; --bad-soft: #3a1717; --info: #38bdf8; --info-soft: #0c2a3b; --violet: #b197fc; --violet-soft: #271c45; --teal: #2dd4bf; --teal-soft: #0d2f2c; --pink: #f472b6; --pink-soft: #3b1229;
    --sh: 0 1px 2px rgba(0, 0, 0, .4); --sh-lg: 0 16px 40px rgba(0, 0, 0, .55);
  }
}
:root[data-theme="dark"] {
  --bg: #0b1020; --surface: #121a2c; --surface-2: #172137; --ink: #e7ebf3; --ink-2: #c3cbda; --muted: #8f9bb2; --line: #243049; --line-2: #1c2740;
  --brand: #7d93ff; --brand-2: #9aabff; --brand-ink: #0b1020; --brand-soft: #1d2850;
  --ok: #4ade80; --ok-soft: #12301f; --warn: #fbbf24; --warn-soft: #33270c; --bad: #f87171; --bad-soft: #3a1717; --info: #38bdf8; --info-soft: #0c2a3b; --violet: #b197fc; --violet-soft: #271c45; --teal: #2dd4bf; --teal-soft: #0d2f2c; --pink: #f472b6; --pink-soft: #3b1229;
  --sh: 0 1px 2px rgba(0, 0, 0, .4); --sh-lg: 0 16px 40px rgba(0, 0, 0, .55);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
html, body { overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif; }
a { color: var(--brand); text-decoration: none; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; } svg.i.lg { width: 24px; height: 24px; }
[dir="rtl"] svg.i.flip { transform: scaleX(-1); }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: var(--ink); }
.hidden { display: none !important; }
.muted, .sub { color: var(--muted); }
.small { font-size: 13px; } .tiny { font-size: 12px; }
.grow { flex: 1; min-width: 0; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; } .row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.stack > *, .two > *, .kpis > *, .tiles > *, .cols > *, .grid > *, .menu-grid > *, .page > * { min-width: 0; }
.err { color: var(--bad); min-height: 1.2em; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }

/* ---- frame */
.app { min-height: 100vh; min-height: 100dvh; }
.side { display: none; }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--top); display: flex; align-items: center; gap: 10px; padding: 0 16px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid transparent; }
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .title { font-size: 18px; font-weight: 700; letter-spacing: -.01em; flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.topbar .title .back { margin-inline-start: -8px; }
.search-btn { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; text-align: start; font: inherit; font-size: 15px; }
.search-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .search-btn, .topbar .add-btn { display: none; }
.page { padding: 8px 16px calc(var(--tab) + var(--safe-b) + 24px); max-width: 1240px; margin: 0 auto; min-width: 0; }
.tabbar { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--tab) + var(--safe-b)); padding-bottom: var(--safe-b); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; position: relative; }
.tabbar a.on { color: var(--brand); }
.tabbar a.on::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
.dot { position: absolute; top: 8px; inset-inline-start: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; line-height: 1; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; font-weight: 800; font-size: 16px; letter-spacing: -.01em; color: var(--ink); }
.logo { width: 36px; height: 36px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); display: flex; align-items: center; justify-content: center; flex: none; }
.side .grp-l { display: none; }
@media (min-width: 640px) {
  .app { display: grid; grid-template-columns: 76px minmax(0, 1fr); }
  .side { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; height: 100dvh; padding: 14px 10px; background: var(--surface); border-inline-end: 1px solid var(--line); gap: 4px; overflow-y: auto; }
  .side .brand span { display: none; }
  .side a.nav { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 11px; border-radius: 12px; color: var(--ink-2); font-weight: 600; font-size: 14px; position: relative; }
  .side a.nav span:not(.dot) { display: none; }
  .side a.nav:hover { background: var(--surface-2); }
  .side a.nav.on { background: var(--brand-soft); color: var(--brand); }
  .side a.nav .dot { top: 4px; inset-inline-start: auto; inset-inline-end: 4px; }
  .side .sep { height: 1px; background: var(--line); margin: 8px 6px; }
  .side .foot { margin-top: auto; display: grid; gap: 4px; border-top: 1px solid var(--line); padding-top: 10px; }
  .side .who { display: none; }
  .tabbar { display: none; }
  .page { padding: 12px 24px 40px; }
  .topbar { padding: 0 24px; }
  .topbar .search-btn { display: flex; flex: 0 1 460px; min-width: 120px; }
  .topbar .add-btn { display: inline-flex; margin-inline-start: auto; }
  .search-btn:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
  .search-btn .kbd { margin-inline-start: auto; }
  .only-mobile { display: none !important; }
}
@media (max-width: 639px) { .only-desktop { display: none !important; } }
@media (min-width: 1100px) {
  .app { grid-template-columns: var(--side) minmax(0, 1fr); }
  .side { padding: 16px 14px; }
  .side .brand span, .side a.nav span:not(.dot) { display: inline; }
  .side a.nav { justify-content: flex-start; padding: 10px 12px; }
  .side a.nav .dot { position: static; margin-inline-start: auto; }
  .side .grp-l { display: block; padding: 12px 12px 4px; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
  .side .sep { display: none; }
  .side .who { display: flex; align-items: center; gap: 10px; padding: 8px 6px; }
}
.kbd { font: 600 11px/1 ui-monospace, Consolas, monospace; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); background: var(--surface-2); }

/* ---- buttons and fields (old pages use .small / .danger: same look) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-2); }
.btn.soft { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.lg { height: 52px; font-size: 16px; border-radius: 14px; padding: 0 20px; }
.btn.sm, .btn.small { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.icon { width: 42px; padding: 0; } .btn.icon.sm { width: 34px; }
.btn.block { width: 100%; }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not([type="range"]), select, textarea, .input { height: 42px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); outline: none; min-width: 0; transition: border-color .15s, box-shadow .15s; }
textarea { height: auto !important; min-height: 90px; padding: 10px 12px !important; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
input[type="number"] { width: 84px; }
input.wide, select.wide, textarea.wide { width: 100%; }
input[type="file"] { font-size: 14px; max-width: 100%; }
label.f { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
label.f > span:first-child { font-weight: 600; color: var(--ink-2); }
label.inline { display: inline-flex; gap: 6px; align-items: center; }
.searchbox { position: relative; flex: 1; min-width: 0; }
.searchbox svg.i { position: absolute; inset-inline-start: 12px; top: 11px; color: var(--muted); pointer-events: none; }
.searchbox input { width: 100%; padding-inline-start: 40px !important; }

/* ---- surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); padding: 16px; min-width: 0; }
.card.flat { padding: 0; overflow: hidden; }
.card h3:first-child { margin-top: 0; }
.sec { margin-top: 22px; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; }
.sec-h h2 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 24px 0 10px; letter-spacing: -.01em; }
h3 { font-size: 14.5px; margin: 14px 0 6px; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 6px 0 16px; }
.page-h h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; line-height: 1.2; }
.page-h .sub { font-size: 14px; margin-top: 2px; }
.page-h .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; margin-bottom: 4px; }
.crumbs a { color: var(--muted); } .crumbs a:hover { color: var(--brand); }
.crumbs .sep { color: var(--muted); }
@media (max-width: 639px) { .page-h h1.hide-m { display: none; } .page-h { margin-top: 0; } }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); gap: 12px; align-items: start; }
.panel { margin-top: 12px; }

/* ---- home */
.hello { margin: 4px 0 14px; }
.hello h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 900px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--sh); color: var(--ink); cursor: pointer; text-align: start; min-height: 104px; transition: border-color .15s, transform .05s; font: inherit; }
.tile:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.tile:active { transform: scale(.985); }
.tile .ic { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.tile b { font-size: 15px; }
.tile .sub { font-size: 12.5px; margin-top: -6px; }
.tile .count { position: absolute; top: 12px; inset-inline-end: 12px; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { padding: 14px 16px; color: inherit; display: block; }
.kpi .l { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi .v { font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi .v, .kpi .s, .kpi .l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 639px) { .kpi .v { font-size: 22px; } .kpi { padding: 12px 14px; } }
.kpi.click { cursor: pointer; } .kpi.click:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.two { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 1000px) { .two { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.c-blue { background: var(--brand-soft); color: var(--brand); } .c-green { background: var(--ok-soft); color: var(--ok); } .c-amber { background: var(--warn-soft); color: var(--warn); } .c-red { background: var(--bad-soft); color: var(--bad); } .c-violet { background: var(--violet-soft); color: var(--violet); } .c-teal { background: var(--teal-soft); color: var(--teal); } .c-sky { background: var(--info-soft); color: var(--info); } .c-pink { background: var(--pink-soft); color: var(--pink); } .c-gray { background: var(--surface-2); color: var(--ink-2); }

/* ---- lists */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line-2); color: var(--ink); cursor: pointer; min-height: 64px; text-align: start; }
.item:first-child { border-top: 0; }
.item:hover { background: var(--surface-2); }
.item.sel { background: var(--brand-soft); }
.item.static { cursor: default; } .item.static:hover { background: none; }
.item .im { flex: 1; min-width: 0; }
.item .t { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .m { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .m.wrap { white-space: normal; }
.item .end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; max-width: 45%; }
.item .acts { display: flex; gap: 6px; flex: none; align-items: center; }
.item .xdel { flex: none; color: var(--muted); } .item .xdel:hover { color: var(--bad); }
.list-sub { padding: 9px 14px 7px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); border-top: 1px solid var(--line-2); }
.list-sub:first-child { border-top: 0; }
.list-n { width: 22px; text-align: end; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; font-size: 13px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: none; letter-spacing: .02em; }
.avatar.sq { border-radius: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }
.avatar.xs { width: 30px; height: 30px; font-size: 12px; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.badge.dotted::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.count-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 12px; font-weight: 700; }
.more-row { display: flex; justify-content: center; padding: 12px; }
@media (max-width: 639px) {
  .item.doc { flex-wrap: wrap; }
  .item.doc .acts { width: 100%; padding-inline-start: 52px; }
  .item.doc .acts .btn.primary { flex: 1; }
}

/* ---- toolbar, chips, tabs */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; -ms-overflow-style: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 13.5px; white-space: nowrap; cursor: pointer; flex: none; }
.chip .n { font-size: 12px; color: var(--muted); font-weight: 600; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip.on .n { color: inherit; opacity: .75; }
.chip.x { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 16px 0 14px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { border: 0; background: none; padding: 10px 14px; color: var(--muted); font-weight: 650; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; cursor: pointer; }
.tabs .on { color: var(--brand); border-bottom-color: var(--brand); }

/* ---- agency / group page */
.hero { display: flex; gap: 14px; align-items: center; padding: 16px; }
.hero h2 { margin: 0; font-size: 20px; letter-spacing: -.01em; line-height: 1.25; }
.hero .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px 16px; }
.nums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line-2); }
.nums > div { padding: 12px 8px; text-align: center; border-inline-start: 1px solid var(--line-2); min-width: 0; }
.nums > div:first-child { border-inline-start: 0; }
.nums .v { font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; }
.nums .k { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.banner { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px; margin: 0 0 12px; background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: 14px; flex-wrap: wrap; }
.banner > span { flex: 1; min-width: 180px; }
.cards3 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 700px) { .cards3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .cards3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.agency { display: flex; flex-direction: column; gap: 10px; color: var(--ink); cursor: pointer; transition: border-color .15s; }
.agency:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.agency.off { opacity: .6; }
.agency .nums { margin: 0 -16px; }
.agency .foot { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

/* ---- settings */
.settings { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 900px) { .settings { grid-template-columns: 220px minmax(0, 1fr); } }
.set-nav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
@media (min-width: 900px) { .set-nav { display: grid; gap: 2px; position: sticky; top: calc(var(--top) + 8px); } }
.set-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: 14px; white-space: nowrap; }
.set-item:hover { background: var(--surface-2); }
.set-item.on { background: var(--brand-soft); color: var(--brand); }
@media (max-width: 899px) { .set-item { border: 1px solid var(--line); background: var(--surface); } }
.set-body { min-width: 0; }
.set-body > h2:first-child { margin-top: 0; }

/* ---- layers: sheets, search, viewer, camera (the phone's Back button closes them) */
.layer { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; background: rgba(9, 13, 24, 0); transition: background .2s; }
.layer.in { background: rgba(9, 13, 24, .45); }
.bsheet { width: 100%; max-height: 90vh; max-height: 90dvh; display: flex; flex-direction: column; background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: var(--sh-lg); transform: translateY(100%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); padding-bottom: var(--safe-b); }
.layer.in .bsheet { transform: none; }
.bsheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; flex: none; }
.bsheet .sh { display: flex; align-items: center; gap: 8px; padding: 10px 12px; padding-inline-start: 18px; flex: none; }
.bsheet .sh h3 { margin: 0; font-size: 17px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bsheet .sb { padding: 4px 18px 18px; overflow-y: auto; flex: 1; }
.bsheet .sf { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); flex: none; }
.bsheet .sf > .btn { flex: 1; }
@media (min-width: 640px) {
  .layer { align-items: center; padding: 24px; }
  .bsheet { max-width: 560px; border-radius: 18px; transform: translateY(12px) scale(.98); opacity: 0; transition: transform .2s, opacity .2s; }
  .layer.in .bsheet { transform: none; opacity: 1; }
  .bsheet .grab { display: none; }
  .bsheet.wide { max-width: 860px; }
}
.menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.menu-grid a, .menu-grid button { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 650; cursor: pointer; text-align: start; font-size: 14px; }
.palette { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; background: var(--bg); }
.palette .ph { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.palette .ph input { flex: 1; height: 46px; border: 0 !important; box-shadow: none !important; background: transparent; font-size: 17px; min-width: 0; padding: 0 !important; }
.palette .pb { flex: 1; overflow-y: auto; padding: 8px 0 24px; }
.palette .grp { padding: 12px 16px 6px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.palette .item { border-top: 0; min-height: 56px; }
.palette .hint { padding: 24px 16px; color: var(--muted); text-align: center; }
@media (min-width: 640px) {
  .palette { background: rgba(9, 13, 24, .45); align-items: center; padding-top: 10vh; }
  .palette .box { width: min(680px, 92vw); max-height: 72vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 18px; box-shadow: var(--sh-lg); overflow: hidden; }
}
@media (max-width: 639px) { .palette .box { display: flex; flex-direction: column; height: 100%; } }
.viewer { position: fixed; inset: 0; z-index: 80; background: rgba(6, 8, 14, .94); display: flex; flex-direction: column; }
.viewer .vb { display: flex; gap: 8px; padding: 10px 12px; align-items: center; color: #fff; flex-wrap: wrap; }
.viewer .vb .t { flex: 1; min-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.viewer .vb .btn { background: rgba(255, 255, 255, .1); border-color: transparent; color: #fff; }
.viewer .vb .btn.primary { background: var(--brand); color: var(--brand-ink); }
.viewer .vbody { flex: 1; overflow: auto; padding: 0 8px 16px; -webkit-overflow-scrolling: touch; }
.viewer .pdfpages { background: none; padding: 0; }
.livecam .vbody { position: relative; padding: 0; overflow: hidden; display: flex; }
.livecam video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.livecam .flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.livecam .flash.go { animation: fl .25s ease-out; }
@keyframes fl { 0% { opacity: .85; } 100% { opacity: 0; } }
.shutterbar { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 0 calc(18px + var(--safe-b)); }
.livestatus { color: #fff; font-size: 14px; min-height: 20px; text-align: center; padding: 0 12px; }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 5px solid rgba(255, 255, 255, .85); background: #fff; box-shadow: 0 0 0 3px rgba(0, 0, 0, .35) inset; cursor: pointer; }
.shutter:active { transform: scale(.93); }
.toast { position: fixed; left: 50%; bottom: calc(var(--tab) + var(--safe-b) + 14px); transform: translateX(-50%); z-index: 90; background: var(--ink); color: var(--surface); padding: 11px 16px; border-radius: 12px; box-shadow: var(--sh-lg); max-width: 92vw; font-weight: 600; font-size: 14px; }
.toast.bad { background: var(--bad); color: #fff; }
@media (min-width: 640px) { .toast { bottom: 24px; } }
.printframe { position: fixed; left: -10000px; top: 0; width: 10px; height: 10px; border: 0; }
.uplist { display: grid; gap: 6px; margin-top: 12px; }
.upline { display: flex; gap: 10px; align-items: center; font-size: 13.5px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.upline .ell { flex: 1; min-width: 0; }
.big-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.big-actions .btn { height: 64px; flex-direction: column; gap: 4px; font-size: 13.5px; }

/* ---- states */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 36px 16px; color: var(--muted); text-align: center; }
.empty .ic { width: 52px; height: 52px; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--muted); }
.skel { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--line-2), var(--surface-2), var(--line-2)); background-size: 200% 100%; animation: sk 1.2s ease-in-out infinite; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: sp .8s linear infinite; vertical-align: -3px; }
@keyframes sp { to { transform: rotate(360deg); } }
.msg { padding: 10px 14px; border-radius: 12px; margin: 8px 0; font-size: 14px; font-weight: 550; background: var(--surface-2); }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.bad { background: var(--bad-soft); color: var(--bad); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

/* ---- tables (admin pages) */
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: start; padding: 10px 14px; border-top: 1px solid var(--line-2); vertical-align: top; }
th { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; border-top: 0; background: var(--surface-2); white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click:hover, tr.sel { background: var(--brand-soft); }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }
.daygrp { padding: 10px 14px 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); background: var(--surface-2); border-top: 1px solid var(--line-2); }
.daygrp:first-child { border-top: 0; }

/* ---- sign-in */
.login { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login .card { width: min(400px, 100%); padding: 28px; }
.login .logo { width: 48px; height: 48px; border-radius: 14px; margin-bottom: 14px; }
.login h1 { margin: 0 0 4px; font-size: 22px; }
.login form { display: grid; gap: 12px; margin-top: 18px; }
.login form input { width: 100%; height: 46px; }
.login .tip { display: flex; gap: 10px; margin-top: 18px; padding: 12px; border-radius: 12px; background: var(--brand-soft); color: var(--ink-2); font-size: 13.5px; align-items: flex-start; }

/* ---- misc kept from before */
.token { font-family: ui-monospace, Consolas, monospace; background: var(--brand-soft); padding: 10px; border-radius: 10px; word-break: break-all; user-select: all; }
.qimg { max-width: 100%; max-height: 420px; border: 1px solid var(--line); border-radius: 10px; }
iframe.pdf { width: 100%; height: 75vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.pdfpages { display: grid; gap: 10px; justify-items: center; background: #8a8f98; padding: 10px; border-radius: 10px; overflow-x: auto; }
canvas.pdfpage { background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); max-width: 100%; height: auto; }

/* Layout editor */
.editor { display: grid; grid-template-columns: minmax(300px, 460px) 1fr; gap: 14px; align-items: start; }
@media (max-width: 900px) { .editor { grid-template-columns: 1fr; } }
.sheet-wrap { position: sticky; top: 72px; }
svg.sheet { width: 100%; height: auto; background: #fff; border: 1px solid var(--line); border-radius: 4px; touch-action: none; user-select: none; }
svg.sheet .margin { fill: none; stroke: #98a2b3; stroke-dasharray: 2 1.5; stroke-width: .3; }
svg.sheet .zone { fill: rgba(217, 45, 32, .14); stroke: var(--zone); stroke-width: .4; }
svg.sheet .mask { fill: rgba(247, 144, 9, .10); stroke: var(--mask); stroke-dasharray: 1.5 1; stroke-width: .4; }
svg.sheet .box { fill: rgba(36, 87, 214, .08); stroke: var(--box); stroke-width: .4; cursor: move; }
svg.sheet .box.block { stroke-dasharray: 2 1; }
svg.sheet .sel { stroke-width: .9; fill: rgba(36, 87, 214, .18); }
svg.sheet .zone.sel { fill: rgba(217, 45, 32, .25); }
svg.sheet .handle { fill: var(--box); cursor: nwse-resize; }
svg.sheet text { font: 3px sans-serif; fill: #344054; pointer-events: none; }
svg.sheet .grid5 { stroke: #e4ecf7; stroke-width: .15; }
svg.sheet .grid10 { stroke: #c9d7ee; stroke-width: .25; }
.elist { display: grid; gap: 6px; }
.el { border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: grid; gap: 6px; background: var(--surface); }
.el.sel { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 25%, transparent); }
.el .head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.el .kind { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 6px; }
.kind.field, .kind.block { color: var(--box); border: 1px solid var(--box); }
.kind.zone { color: var(--zone); border: 1px solid var(--zone); }
.kind.mask { color: var(--mask); border: 1px solid var(--mask); }
.mm { display: flex; gap: 6px; flex-wrap: wrap; }
.mm label { display: inline-flex; gap: 3px; align-items: center; font-size: 12px; color: var(--muted); }
.mm input { width: 70px !important; height: 34px !important; }
[dir="rtl"] .mm input, [dir="rtl"] input[type="number"] { direction: ltr; }
button.item { width: 100%; border: 0; border-top: 1px solid var(--line-2); background: none; font: inherit; }
button.item:first-child { border-top: 0; }
.side a.who { color: inherit; border-radius: 12px; }
.side a.who:hover { background: var(--surface-2); }
/* With the sidebar's labels showing, the settings page needs no second list of its sections. */
@media (min-width: 1100px) { .settings { grid-template-columns: minmax(0, 1fr); } .set-nav { display: none !important; } }
.item .avatar.sq { font-size: 19px; }

/* Sorular: the passport picture big on the left, the reading to fix or approve on the right. */
.qcard { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.qcard > .qhead, .qcard > .row, .qcard > div:not(.qleft):not(.qright) { grid-column: 1 / -1; }
.qleft { min-width: 0; }
.qpic { position: relative; background: var(--surface-2, #0f1626); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; min-height: 240px; display: flex; align-items: center; justify-content: center; }
.qimgbig { display: block; width: 100%; max-height: 82vh; object-fit: contain; }
.qtools { position: absolute; top: 8px; inset-inline-end: 8px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.qtools .btn { background: rgba(0, 0, 0, .6); color: #fff; border-color: transparent; height: 36px; }
.qtools .btn.on { background: var(--brand); }
.qpic.lens { cursor: none; touch-action: none; }
.loupe { position: absolute; width: 190px; height: 190px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 6px 24px rgba(0, 0, 0, .45); background-repeat: no-repeat; background-color: #fff; pointer-events: none; z-index: 3; }
.qtop { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.qtop .qtitle { font-weight: 700; font-size: 16px; }
.qwhere { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 3px; font-size: 13.5px; }
.qwhere .qchat { font-weight: 600; color: var(--ink-2); }
.qhead { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; margin-bottom: 8px; }
.qwhy { font-size: 13px; color: var(--amber, #d29a2a); margin-bottom: 10px; }
.qfield { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.qfield .ql { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.qfield input, .qfield select { width: 100%; font-size: 16px; font-weight: 600; letter-spacing: .02em; }
.qfield.doubt input, .qfield.doubt select { border-color: var(--amber, #d29a2a); box-shadow: 0 0 0 1px var(--amber, #d29a2a); }
.qfield .chips { padding: 0; }
.qfield .chip { height: 30px; font-size: 13px; }
.mt4 { margin-top: 4px; }
@media (max-width: 860px) { .qcard { grid-template-columns: 1fr; } }

/* Acentalar: one switch per chat (agency or not). */
.switch { position: relative; display: inline-flex; width: 46px; height: 26px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: var(--sh); transition: transform .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(20px); }
[dir="rtl"] .switch input:checked + span::after { transform: translateX(-20px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch input:disabled + span { opacity: .5; }
.agrow.on .t { font-weight: 700; }

/* ---- top bar: language and light / dark, on every page */
.top-prefs { display: flex; align-items: center; gap: 4px; flex: none; }
.top-lang { height: 36px; padding: 0 6px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; }
.seg { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.seg-b { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.seg-b:hover { color: var(--ink); }
.seg-b.on { background: var(--surface); color: var(--ink); box-shadow: var(--sh); }
@media (max-width: 639px) { .theme-seg .seg-b:not(.on) .lbl { display: none; } .seg-b { padding: 0 8px; } }

/* ---- WhatsApp QR */
.qrbox { display: flex; justify-content: center; padding: 12px; background: #fff; border-radius: var(--r); min-height: 260px; align-items: center; }
.qrimg { width: 280px; max-width: 100%; height: auto; image-rendering: pixelated; }
.card.dim { opacity: .62; }
a.im { color: inherit; }
@media (max-width: 599px) { .agrow .docs-btn { display: none; } }

/* ---- where am I: a big path on every inner page */
.crumbbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 2px 0 14px; font-size: 15px; }
.crumbbar .crumb { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbbar a.crumb:hover { border-color: var(--brand); color: var(--brand); }
.crumbbar .crumb.cur { border-color: transparent; background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.crumbbar .sep { color: var(--muted); font-size: 18px; line-height: 1; }
[dir="rtl"] .crumbbar .sep { transform: scaleX(-1); }
@media (max-width: 639px) { .crumbbar .crumb.home span { display: none; } .crumbbar .crumb { padding: 0 11px; } }

/* ---- Acentalar: three clear tabs, a section per number / bot */
.tabs3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 4px; margin-bottom: 10px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.tab3 { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 6px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; min-width: 0; }
.tab3 .ti { font-size: 18px; line-height: 1.2; } .tab3 .tl { font-weight: 700; font-size: 14px; } .tab3 .tn { font-size: 12px; }
.tab3.on { background: var(--surface); color: var(--ink); box-shadow: var(--sh); }
.tab3.on .tn { color: var(--brand); font-weight: 700; }
.acc-h { padding-top: 6px; border-top: 1px solid var(--line); }
.acc-h h2 { font-size: 15px; }
.more-btn { width: 100%; margin-top: 6px; border-style: dashed; color: var(--brand); }
.agname { color: var(--brand); font-weight: 600; }
.avatar.ph { object-fit: cover; background: var(--surface-2); }
.avatar.xxs { width: 22px; height: 22px; font-size: 11px; border-radius: 50%; }
.origin { display: grid; gap: 3px; margin-top: 6px; }
.origin .orow { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; }
.origin .oname { font-weight: 600; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.origin .oacc { color: var(--muted); white-space: nowrap; flex: none; }
.origin.sm .orow { font-size: 12.5px; }
.hero-origin { padding: 0 16px 12px; }
.hero-origin .k { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.item.dim { opacity: .6; }
@media (min-width: 640px) and (max-width: 1099px) { .topbar .add-btn span { display: none; } .topbar .add-btn { width: 42px; padding: 0; } .topbar .search-btn .kbd { display: none; } }

/* ---- live: what is being read right now */
.livebar { position: sticky; top: var(--top); z-index: 15; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 16px; padding: 8px 14px; border-radius: 12px; background: var(--info-soft); color: var(--info); font-size: 13.5px; font-weight: 600; box-shadow: var(--sh); }
.livebar .lw { color: var(--ink-2); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1 1 200px; }
.livebar .lnew { margin-inline-start: auto; }
@media (min-width: 640px) { .livebar { margin: 0 24px; } }

/* ---- PDF viewer: a bar on every page (print this page, take the person out) */
.pdfpw { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0 auto 18px; }
.pagebar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; max-width: 900px; padding: 8px 10px; border-radius: 12px; background: var(--surface); box-shadow: var(--sh); }
.pagebar .pw { flex: 1 1 200px; min-width: 0; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
