/* Sales Desk — one stylesheet. Logical properties throughout, so Kurdish and
   Arabic (rtl) lay out without a second file. Colors are tokens only. */
:root {
  --bg: #f3f5f4; --surface: #fff; --sunk: #e9edeb; --hover: #f0f4f2;
  --ink: #15201c; --ink2: #3c4a45; --muted: #66746f; --line: #dbe2df; --line2: #c9d3cf;
  --accent: #0b6b5d; --accent-ink: #fff; --accent-soft: #ddefe9; --accent-line: #9fd0c3;
  --warn: #8f5b0f; --warn-soft: #fbf0da; --bad: #ad3229; --bad-soft: #f9e3e0;
  --info: #2b5ca3; --info-soft: #e2ebf8; --ok: #1d7a4a; --ok-soft: #dcf1e5;
  --shadow: 0 1px 2px rgba(16,32,28,.06), 0 8px 24px -12px rgba(16,32,28,.22);
  --radius: 10px; --radius-sm: 7px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans Arabic", "Noto Sans", Tahoma, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --side: 232px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1312; --surface: #161d1b; --sunk: #1d2624; --hover: #1b2422;
    --ink: #e6ece9; --ink2: #c2ccc8; --muted: #95a39e; --line: #2a3532; --line2: #36433f;
    --accent: #4cc0a9; --accent-ink: #062019; --accent-soft: #163029; --accent-line: #2d6a5c;
    --warn: #e4ab52; --warn-soft: #33281a; --bad: #ee7d72; --bad-soft: #3a201d;
    --info: #85acec; --info-soft: #1b2638; --ok: #6bd39b; --ok-soft: #15301f;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 28px -12px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
input, select, textarea, button { min-width: 0; max-width: 100%; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14.5px/1.5 var(--font); -webkit-text-size-adjust: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 21px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.i { width: 18px; height: 18px; flex: none; vertical-align: -4px; }
.i-sm { width: 15px; height: 15px; flex: none; vertical-align: -3px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 14px 10px; background: var(--surface); border-inline-end: 1px solid var(--line); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.brand b { display: block; font-size: 14px; }
.brand span { font-size: 12px; color: var(--muted); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink2); font-weight: 500; }
.nav a:hover { background: var(--hover); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.nav a .count { margin-inline-start: auto; font-size: 11.5px; font-weight: 650; min-width: 20px; text-align: center; padding: 1px 6px; border-radius: 999px; background: var(--bad); color: #fff; }
.nav a .count.soft { background: var(--sunk); color: var(--ink2); }
.nav .sep { height: 1px; background: var(--line); margin: 8px 6px; }
.side-foot { margin-top: auto; display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 8px; color: var(--ink); }
.me:hover { background: var(--hover); text-decoration: none; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--sunk); color: var(--ink2); display: grid; place-items: center; font-size: 12px; font-weight: 650; flex: none; }
.me b { font-size: 13px; display: block; }
.me span { font-size: 11.5px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .search { position: relative; width: 260px; }
.top .search input { padding-inline-start: 32px; }
.top .search .i { position: absolute; inset-inline-start: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.iconbtn { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink2); cursor: pointer; }
.iconbtn:hover { background: var(--hover); }
.iconbtn .dot { position: absolute; top: 5px; inset-inline-end: 5px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; }
.content { padding: 20px 24px 60px; max-width: 1280px; width: 100%; }
.tabbar { display: none; }
.mtop { display: none; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line2); background: var(--surface); color: var(--ink); font: 550 13.5px/1 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: var(--hover); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.pri:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; }
.btn.block { width: 100%; height: 44px; font-size: 14.5px; }
.btn[disabled], .btn.busy { opacity: .6; pointer-events: none; }
.btn.confirming { background: var(--bad); border-color: var(--bad); color: #fff; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=search], input[type=date], input[type=datetime-local], input[type=time], select, textarea {
  width: 100%; height: 38px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--line2); background: var(--surface); color: var(--ink); font: 14px var(--font);
}
textarea { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input.err, select.err, textarea.err { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
input[type=tel], .ltr-input { direction: ltr; text-align: start; }
[dir=rtl] input[type=tel], [dir=rtl] .ltr-input { text-align: right; }
label.f { display: grid; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink2); min-width: 0; }
label.f .hint, .hint { font-weight: 400; font-size: 12px; color: var(--muted); }
.fgrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.fgrid.two { grid-template-columns: 1fr 1fr; }
.fstack { display: grid; gap: 12px; }
.ferr { color: var(--bad); font-size: 12.5px; }
input.inline-save, select.inline-save, textarea.inline-save { border-color: transparent; background: transparent; }
input.inline-save:hover, select.inline-save:hover, textarea.inline-save:hover { border-color: var(--line2); background: var(--surface); }
input.inline-save:focus, select.inline-save:focus, textarea.inline-save:focus { background: var(--surface); border-color: var(--accent); }
td .inline-save { height: 32px; padding: 0 7px; }

/* chips: radio / checkbox look-alikes */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line2); background: var(--surface); color: var(--ink2); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; user-select: none; text-decoration: none !important; }
.chip:hover { background: var(--hover); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:checked), .chip.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip .n { font-variant-numeric: tabular-nums; font-weight: 650; opacity: .8; }
.chip.warn .n { color: var(--warn); opacity: 1; }
.chip.bad .n { color: var(--bad); opacity: 1; }
.chip.on .n { color: inherit; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.choice { position: relative; display: grid; place-items: center; text-align: center; min-height: 46px; padding: 8px; border-radius: 10px; border: 1px solid var(--line2); background: var(--surface); font-size: 13.5px; font-weight: 550; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice.bad:has(input:checked) { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }

/* pills = state */
.pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--sunk); color: var(--ink2); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.acc { background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.st-new { background: var(--info-soft); color: var(--info); }
.st-contacted, .st-interested { background: var(--sunk); color: var(--ink2); }
.st-viewing, .st-visited { background: var(--accent-soft); color: var(--accent); }
.st-negotiating, .st-reserved { background: var(--warn-soft); color: var(--warn); }
.st-sold { background: var(--ok-soft); color: var(--ok); }
.st-lost { background: var(--bad-soft); color: var(--bad); }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card > .hd { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card > .hd h2 { flex: 1; }
.card > .bd { padding: 14px 16px; }
.section { margin-bottom: 18px; }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.cols { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 9px; font-size: 13.5px; background: var(--info-soft); color: var(--ink); }
.notice.warn { background: var(--warn-soft); }
.notice.bad { background: var(--bad-soft); }
.notice.ok { background: var(--ok-soft); }
.notice .i { margin-top: 1px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.empty p { max-width: 440px; margin: 0 auto 14px; }

/* tables */
.tablewrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: start; font-size: 11.5px; font-weight: 650; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; white-space: nowrap; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover { background: var(--hover); }
table.t tr.click { cursor: pointer; }
table.t td.r, table.t th.r { text-align: end; }
table.t tr.archived td { opacity: .55; }

/* ---------- leads ---------- */
.lead-row .who b { display: block; font-weight: 600; }
.lead-row .who span { font-size: 12.5px; color: var(--muted); }
.next { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.next.late { color: var(--bad); font-weight: 600; }
.next.soon { color: var(--warn); }
.lead-list { display: grid; gap: 0; }
.lcard { display: grid; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.lcard:first-child { border-start-start-radius: var(--radius); border-start-end-radius: var(--radius); }
.lcard .r1 { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.lcard .nm { font-weight: 650; font-size: 14.5px; color: var(--ink); }
.lcard .want { font-size: 12.5px; color: var(--muted); }
.lcard .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.lcard.late { box-shadow: inset 3px 0 0 var(--bad); }
.lcard.replied { box-shadow: inset 3px 0 0 var(--info); }
.lcard.fresh { box-shadow: inset 3px 0 0 var(--accent); }
[dir=rtl] .lcard.late { box-shadow: inset -3px 0 0 var(--bad); }
[dir=rtl] .lcard.replied { box-shadow: inset -3px 0 0 var(--info); }
[dir=rtl] .lcard.fresh { box-shadow: inset -3px 0 0 var(--accent); }
.group-h { display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; font-size: 13px; font-weight: 650; color: var(--ink2); text-transform: uppercase; letter-spacing: .04em; }
.group-h .n { font-variant-numeric: tabular-nums; color: var(--muted); }
.group-h.bad { color: var(--bad); }
.group-h.info { color: var(--info); }
.group-h.acc { color: var(--accent); }
.group { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

/* client card */
.cc { display: grid; gap: 14px; }
.cc-head { display: flex; gap: 12px; align-items: flex-start; }
.cc-head .avatar { width: 42px; height: 42px; font-size: 15px; }
.cc-head h2 { font-size: 18px; }
.cc-head .sub { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); margin-top: 3px; }
.cc-next { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--sunk); }
.cc-next.late { background: var(--bad-soft); }
.cc-next .what { flex: 1; min-width: 0; font-size: 13.5px; }
.cc-next .what b { display: block; }
.kv { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 2px 10px; align-items: center; font-size: 13.5px; }
.kv > dt { color: var(--muted); font-size: 12.5px; padding: 6px 0; }
.kv > dd { margin: 0; min-width: 0; }
.kv .words { display: block; font-size: 12px; color: var(--muted); font-style: italic; padding: 0 8px 4px; }
.fit { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.fit .code { font-family: var(--mono); font-size: 12px; }
.fit .figs { font-size: 12px; color: var(--muted); }
.tl { display: grid; gap: 0; }
.tl-item { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 7px 0; font-size: 13px; border-bottom: 1px dashed var(--line); }
.tl-item:last-child { border-bottom: 0; }
.tl-item .ic { color: var(--muted); padding-top: 1px; }
.tl-item .when { font-size: 11.5px; color: var(--muted); }
.tl-item .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.subtabs a, .subtabs button { padding: 8px 12px; border: 0; background: none; font: 550 13px var(--font); color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; text-decoration: none; }
.subtabs a.on, .subtabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
details.fold { border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
details.fold > summary { list-style: none; cursor: pointer; padding: 10px 12px; font-weight: 600; font-size: 13.5px; display: flex; gap: 8px; align-items: center; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: "+"; margin-inline-start: auto; color: var(--muted); font-weight: 400; font-size: 18px; line-height: 1; }
details.fold[open] > summary::after { content: "–"; }
details.fold > .in { padding: 0 12px 12px; display: grid; gap: 10px; }

/* drawer / sheet */
.scrim { position: fixed; inset: 0; background: rgba(10,20,18,.38); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .18s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(520px, 100vw); background: var(--bg); z-index: 61; box-shadow: var(--shadow); transform: translateX(105%); transition: transform .2s ease; display: flex; flex-direction: column; }
[dir=rtl] .drawer { transform: translateX(-105%); }
.drawer.on { transform: none !important; }
.drawer .dh { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.drawer .dh .t { flex: 1; font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer .db { flex: 1; overflow-y: auto; padding: 16px; }
@media (prefers-reduced-motion: reduce) { .drawer, .scrim { transition: none; } }

/* toasts */
.toasts { position: fixed; bottom: 20px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); }
[dir=rtl] .toasts { transform: translateX(50%); }
.toast { display: flex; gap: 10px; align-items: center; padding: 10px 12px 10px 14px; border-radius: 10px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow); font-size: 13.5px; animation: tin .18s ease; }
.toast.bad { background: var(--bad); color: #fff; }
.toast .msg { flex: 1; }
.toast button { background: none; border: 0; color: inherit; font: 650 13px var(--font); cursor: pointer; text-decoration: underline; padding: 4px; }
@keyframes tin { from { opacity: 0; transform: translateY(6px); } }

/* stat tiles (team) */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.tile .v { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile .l { font-size: 12.5px; color: var(--muted); }
.tile.bad .v { color: var(--bad); }
.tile.warn .v { color: var(--warn); }
a.tile:hover { text-decoration: none; border-color: var(--accent-line); }
.bar { height: 6px; border-radius: 999px; background: var(--sunk); overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--accent); }

/* projects */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.pcard { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); }
.pcard:hover { text-decoration: none; border-color: var(--accent-line); box-shadow: var(--shadow); }
.pcard .ph { aspect-ratio: 16 / 9; background: var(--sunk) center / cover no-repeat; display: grid; place-items: center; color: var(--muted); max-width: 100%; }
.pcard .pb { padding: 12px 14px; display: grid; gap: 6px; }
.pcard .pb b { font-size: 15px; }
.pcard .meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.pside { display: grid; gap: 2px; align-content: start; position: sticky; top: 72px; }
.pside a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--ink2); font-weight: 500; font-size: 13.5px; }
.pside a:hover { background: var(--hover); text-decoration: none; }
.pside a.on { background: var(--accent-soft); color: var(--accent); }
.pside a .pill { margin-inline-start: auto; }
.playout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 18px; align-items: start; }
.ut { scroll-margin-top: 80px; }
.ut-head { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; align-items: end; }
.ut-head .code { font-family: var(--mono); font-weight: 650; }
.plan { border: 1px solid var(--line); border-radius: 9px; background: var(--bg); scroll-margin-top: 80px; }
.plan .ph2 { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.plan .lines { padding: 8px 10px; display: grid; gap: 6px; }
.pline { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.1fr) minmax(0, .6fr) minmax(0, .6fr) minmax(0, 1.2fr) 30px; gap: 6px; align-items: center; }
.pline input, .pline select { height: 34px; font-size: 13px; }
.pline .x { width: 30px; height: 30px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 6px; }
.pline .x:hover { background: var(--bad-soft); color: var(--bad); }
.pline-h { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.pcheck { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.pcheck.ok { background: var(--ok-soft); color: var(--ok); }
.pcheck.under, .pcheck.over { background: var(--bad-soft); color: var(--bad); }
.pcheck.no_price, .pcheck.unknown, .pcheck.empty { background: var(--warn-soft); color: var(--warn); }
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.mitem { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface); display: grid; }
.mitem .thumb { aspect-ratio: 4 / 3; background: var(--sunk) center / cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 12px; max-width: 100%; }
.mitem .mb { padding: 8px; display: grid; gap: 6px; font-size: 12px; }
.mitem select { height: 30px; font-size: 12px; }
.drop { border: 2px dashed var(--line2); border-radius: 10px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; display: grid; gap: 6px; place-items: center; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.health { display: grid; gap: 6px; }
.hitem { display: flex; gap: 10px; align-items: center; padding: 9px 11px; border-radius: 8px; font-size: 13.5px; background: var(--warn-soft); }
.hitem.bad { background: var(--bad-soft); }
.hitem .t { flex: 1; }

/* auth pages */
.bare { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.bare .box { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 26px; box-shadow: var(--shadow); display: grid; gap: 16px; }
.bare .brand { padding: 0; }

/* ---------- phone ---------- */
@media (max-width: 860px) {
  body { font-size: 15px; }
  .shell { grid-template-columns: 1fr; }
  .side, .top { display: none; }
  .mtop { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .mtop h1 { flex: 1; font-size: 18px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .content { padding: 14px 16px calc(84px + env(safe-area-inset-bottom, 0px)); }
  .tabbar { position: fixed; bottom: 0; inset-inline: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .tabbar a, .tabbar button { display: grid; justify-items: center; gap: 2px; padding: 8px 0 7px; font: 550 11px var(--font); color: var(--muted); background: none; border: 0; position: relative; }
  .tabbar a.on { color: var(--accent); }
  .tabbar a:hover { text-decoration: none; }
  .tabbar .count { position: absolute; top: 3px; inset-inline-start: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; }
  .cols { grid-template-columns: 1fr; }
  .playout { grid-template-columns: 1fr; }
  .pside { position: static; display: flex; overflow-x: auto; gap: 4px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
  .pside a { white-space: nowrap; }
  .drawer { top: auto; width: 100vw; height: 92vh; border-radius: 16px 16px 0 0; transform: translateY(105%) !important; }
  [dir=rtl] .drawer { transform: translateY(105%) !important; }
  .drawer.on { transform: none !important; }
  .ut-head { grid-template-columns: 1fr 1fr; }
  .pline { grid-template-columns: 1fr 1fr 64px 30px; }
  .pline .pct, .pline .lbl { display: none; }
  .pline-h .pct, .pline-h .lbl { display: none; }
  .hide-m { display: none !important; }
  .fgrid.two { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 104px minmax(0, 1fr); }
  table.t.stack-m thead { display: none; }
  table.t.stack-m tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  table.t.stack-m td { padding: 0; border: 0; }
}
@media (min-width: 861px) { .show-m { display: none !important; } }
@media print { .side, .top, .tabbar, .mtop { display: none; } }
.pcard .ph.noimg { aspect-ratio: auto; height: 56px; }
@media (max-width: 1100px) and (min-width: 861px) {
  .playout { grid-template-columns: 1fr; }
  .pside { position: static; display: flex; overflow-x: auto; gap: 4px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
  .pside a { white-space: nowrap; }
}

/* ---------- inbox ---------- */
.ibox { display: grid; grid-template-columns: 320px minmax(0, 1fr) 380px; height: calc(100vh - 62px - 40px); min-height: 520px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ibox > section, .ibox > aside { min-width: 0; min-height: 0; }
.ilist { display: flex; flex-direction: column; border-inline-end: 1px solid var(--line); }
.ilist-h { padding: 10px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.ilist-h .chip { height: 28px; padding: 0 10px; font-size: 12.5px; }
.ilist-b { flex: 1; overflow-y: auto; }
.conv { display: grid; gap: 2px; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--ink); }
.conv:hover { background: var(--hover); text-decoration: none; }
.conv.sel { background: var(--accent-soft); }
.conv .r1, .conv .r2, .conv .r3 { display: flex; gap: 6px; align-items: center; min-width: 0; }
.conv .who { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv.unread .who { font-weight: 750; }
.conv .snip { flex: 1; min-width: 0; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv.unread .snip { color: var(--ink); }
.conv .when { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.conv .badge { margin-inline-start: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.ch { display: inline-block; font: 650 10px/1 var(--font); letter-spacing: .03em; padding: 3px 5px; border-radius: 4px; background: var(--sunk); color: var(--ink2); }
.ch-whatsapp { background: #d9f7e5; color: #0f6b39; }
.ch-instagram { background: #fbe1ef; color: #9b1c5c; }
.ch-messenger { background: #dde9fd; color: #1d4fa8; }
@media (prefers-color-scheme: dark) { .ch-whatsapp { background: #12341f; color: #6bd39b; } .ch-instagram { background: #3a1a2b; color: #f08cc0; } .ch-messenger { background: #18294a; color: #8fb4f5; } }
.ithread { display: flex; flex-direction: column; background: var(--bg); }
.ithread > .empty { margin: auto; display: grid; place-items: center; gap: 6px; }
.thread { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.thead { display: flex; gap: 8px; align-items: center; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.thead .tname { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.m { max-width: 76%; align-self: flex-start; padding: 8px 11px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; overflow-wrap: anywhere; }
.m.out { align-self: flex-end; background: var(--accent-soft); border-color: transparent; }
.m.out.bot { background: var(--info-soft); }
.m .mb { white-space: normal; unicode-bidi: plaintext; }
.m .mt { display: flex; gap: 4px; justify-content: flex-end; font-size: 11px; color: var(--muted); margin-top: 3px; }
.m .tick.st-read { color: var(--info); font-weight: 700; }
.m .tick.st-failed { color: var(--bad); font-weight: 700; }
.m .merr { font-size: 12px; color: var(--bad); margin-top: 4px; }
.m .mimg { display: block; max-width: 260px; max-height: 260px; border-radius: 8px; }
.m .mfile { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.composer { display: grid; gap: 8px; padding: 10px 12px; background: var(--surface); border-top: 1px solid var(--line); }
.composer .tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.composer textarea { min-height: 42px; max-height: 180px; resize: none; }
.icard { border-inline-start: 1px solid var(--line); overflow-y: auto; padding: 14px; }
.icard .cc { gap: 10px; }
@media (max-width: 1250px) and (min-width: 861px) { .ibox { grid-template-columns: 300px minmax(0, 1fr); } .icard { display: none; } }
@media (max-width: 860px) {
  .ibox { grid-template-columns: 1fr; height: calc(100vh - 60px - 64px - env(safe-area-inset-bottom, 0px)); border-radius: 0; border-inline: 0; margin: -14px -16px 0; }
  .ibox.has-open .ilist { display: none; }
  .ibox:not(.has-open) .ithread { display: none; }
  .icard { display: none; }
  .m { max-width: 88%; }
}
@media (min-width: 1251px) { .show-narrow { display: none !important; } }
.mfix { margin-top: 4px; } .mfix summary { cursor: pointer; list-style: none; } .mfix summary::-webkit-details-marker { display: none; }
