/* Sahra web UI — shared by the customer portal, admin panel and reseller panel.
   Same palette as the TV app: warm ivory by day, deep charcoal by night, champagne accent. */
:root {
  --bg: #f6f3ed; --bg-2: #efeae1; --surface: #ffffff; --surface-2: #f4f0e8; --line: rgba(30, 24, 12, 0.10); --line-2: rgba(30, 24, 12, 0.16);
  --text: #1a1710; --text-2: #4a4437; --muted: #7d776b;
  --accent: #9c6f22; --accent-2: #b8862f; --accent-ink: #ffffff; --accent-soft: rgba(156, 111, 34, 0.10);
  --ok: #1f8a52; --ok-soft: rgba(31, 138, 82, 0.11); --warn: #a8670f; --warn-soft: rgba(184, 120, 20, 0.12);
  --bad: #c2413a; --bad-soft: rgba(194, 65, 58, 0.10); --info: #2d6cb5; --info-soft: rgba(45, 108, 181, 0.10);
  --shadow: 0 1px 2px rgba(40, 30, 10, 0.05), 0 8px 24px rgba(40, 30, 10, 0.06);
  --shadow-lg: 0 24px 60px rgba(30, 20, 5, 0.18);
  --r: 14px; --r-s: 10px; --ease: cubic-bezier(.2,.7,.2,1);
  --font: "IBM Plex Sans Arabic", "Segoe UI", system-ui, -apple-system, Roboto, Tahoma, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0e11; --bg-2: #121318; --surface: #17191f; --surface-2: #1e2028; --line: rgba(255,255,255,0.08); --line-2: rgba(255,255,255,0.14);
    --text: #f3efe7; --text-2: #cdc7bb; --muted: #8f8d94;
    --accent: #d8b46e; --accent-2: #e6c483; --accent-ink: #1b1508; --accent-soft: rgba(216, 180, 110, 0.13);
    --ok: #6fcf97; --ok-soft: rgba(111, 207, 151, 0.12); --warn: #f2c94c; --warn-soft: rgba(242, 201, 76, 0.12);
    --bad: #ef7d76; --bad-soft: rgba(239, 125, 118, 0.12); --info: #7fb2f0; --info-soft: rgba(127, 178, 240, 0.12);
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.25); --shadow-lg: 0 24px 60px rgba(0,0,0,0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0e11; --bg-2: #121318; --surface: #17191f; --surface-2: #1e2028; --line: rgba(255,255,255,0.08); --line-2: rgba(255,255,255,0.14);
  --text: #f3efe7; --text-2: #cdc7bb; --muted: #8f8d94;
  --accent: #d8b46e; --accent-2: #e6c483; --accent-ink: #1b1508; --accent-soft: rgba(216, 180, 110, 0.13);
  --ok: #6fcf97; --ok-soft: rgba(111, 207, 151, 0.12); --warn: #f2c94c; --warn-soft: rgba(242, 201, 76, 0.12);
  --bad: #ef7d76; --bad-soft: rgba(239, 125, 118, 0.12); --info: #7fb2f0; --info-soft: rgba(127, 178, 240, 0.12);
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.25); --shadow-lg: 0 24px 60px rgba(0,0,0,0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); font-size: 15px; line-height: 1.55; background: var(--bg); color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.02em; direction: ltr; unicode-bidi: embed; }
.ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }
.nowrap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.between { justify-content: space-between; }

/* ---------- brand / header ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: 0.01em; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: url("/portal/img/mark.svg") center / cover no-repeat; color: transparent; font-size: 0; flex: none; }
.brand small { display: block; font-size: 11px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1120px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 12px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; transition: background-color .15s, border-color .15s, transform .1s, box-shadow .15s; white-space: nowrap; }
.btn:hover { border-color: var(--text-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); }
.btn.dark { background: var(--text); color: var(--bg); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: transparent; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn.block { width: 100%; }
.btn.icon { width: 38px; padding: 0; }
.btn.icon.sm { width: 32px; }
.btn:focus-visible, .input:focus-visible, .tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { font-size: 16px; font-weight: 700; }
.card-body { padding: 20px 22px; }
h1.page { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.sub { color: var(--muted); font-size: 14px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.section-title { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin: 6px 0 2px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat { padding: 18px; }
.stat .k { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.stat .v { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .k svg { color: var(--accent); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.gold { background: var(--accent-soft); color: var(--accent); }
.badge.plain { background: var(--surface-2); color: var(--text-2); }
.badge.plain::before { display: none; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.input, select.input, textarea.input { width: 100%; height: 44px; padding: 0 14px; border-radius: var(--r-s); border: 1px solid var(--line-2); background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 90px; padding: 10px 14px; resize: vertical; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.mono { font-size: 15px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { width: 42px; height: 24px; border-radius: 999px; background: var(--line-2); position: relative; transition: background-color .2s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: inset-inline-start .2s var(--ease); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { inset-inline-start: 21px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 0; border-top: 1px solid var(--line); }
.setting:first-child { border-top: 0; padding-top: 0; }
.setting .t { font-weight: 600; }
.setting .d { font-size: 13px; color: var(--muted); }

/* ---------- segmented / tabs ---------- */
.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface-2); border-radius: 999px; border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; height: 32px; padding: 0 14px; border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
:root[data-theme="dark"] .seg button.on { background: var(--bg-2); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: start; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
table.t td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: var(--surface-2); }
table.t .actions { text-align: end; white-space: nowrap; }
@media (max-width: 760px) {
  table.t.stackable thead { display: none; }
  table.t.stackable tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.t.stackable td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 0; }
  table.t.stackable td::before { content: attr(data-l); color: var(--muted); font-size: 12px; font-weight: 600; }
  table.t.stackable td.actions { justify-content: flex-end; padding-top: 8px; }
  table.t.stackable td.actions::before { display: none; }
}

/* ---------- empty / loading ---------- */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; color: var(--accent); opacity: .8; margin-bottom: 10px; }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; justify-content: center; padding: 40px; }

/* ---------- modal / toast ---------- */
.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(10, 8, 4, 0.45); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); animation: pop .2s var(--ease); }
.modal.wide { max-width: 880px; }
.modal-head { padding: 20px 22px 6px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-head h3 { font-size: 18px; font-weight: 700; }
.modal-body { padding: 10px 22px 6px; }
.modal-foot { padding: 16px 22px 20px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
#toasts { position: fixed; bottom: 20px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
:root[dir="rtl"] #toasts { transform: translateX(50%); }
.toast { background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); animation: pop .2s var(--ease); max-width: 90vw; display: flex; gap: 8px; align-items: center; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok svg { color: var(--ok); }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { position: relative; overflow: hidden; background: #0f0f12; color: #f3efe7; padding: 44px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art::before { content: ""; position: absolute; inset: -20%; background: radial-gradient(40% 40% at 30% 30%, rgba(216,180,110,.35), transparent 70%), radial-gradient(35% 35% at 75% 70%, rgba(120,90,200,.22), transparent 70%); filter: blur(10px); }
.auth-art > * { position: relative; }
.auth-art h2 { font-size: 38px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; max-width: 460px; }
.auth-art p { color: rgba(243,239,231,.72); max-width: 420px; margin-top: 12px; }
.auth-art .brand small { color: rgba(243,239,231,.55); }
.auth-form { display: grid; place-items: center; padding: 32px 20px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h1 { font-size: 26px; font-weight: 700; margin: 18px 0 6px; }
.auth-box .sub { margin-bottom: 22px; }
.alert { padding: 12px 14px; border-radius: var(--r-s); font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.info { background: var(--info-soft); color: var(--info); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; }
  /* phones: the form starts at the top instead of floating in the middle of a tall screen */
  .auth-form { place-items: start center; padding: max(28px, env(safe-area-inset-top)) 18px 28px; } }

/* ---------- admin shell ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-inline-end: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { padding: 4px 8px 18px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: 14px; cursor: pointer; border: 0; background: transparent; width: 100%; text-align: start; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.on { background: var(--accent-soft); color: var(--accent); }
.nav-link .count { margin-inline-start: auto; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.main { min-width: 0; }
.main-head { display: flex; align-items: center; gap: 12px; padding: 18px 28px; border-bottom: 1px solid var(--line); background: var(--bg); background: color-mix(in srgb, var(--bg) 90%, transparent); position: sticky; top: 0; z-index: 10; background: var(--bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.main-head h1 { font-size: 20px; font-weight: 700; }
.main-body { padding: 24px 28px 60px; max-width: 1240px; display: flex; flex-direction: column; gap: 18px; }
.menu-btn { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 270px; z-index: 50; transform: translateX(-105%); transition: transform .25s var(--ease); box-shadow: var(--shadow-lg); }
  :root[dir="rtl"] .side { transform: translateX(105%); }
  .side.open { transform: none !important; }
  .menu-btn { display: inline-flex; }
  .main-head, .main-body { padding-inline: 16px; }
}
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .input { height: 40px; max-width: 320px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { font-weight: 600; }
.codes-box { white-space: pre; font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: var(--r-s); padding: 12px 14px; line-height: 1.9; direction: ltr; text-align: left; max-height: 260px; overflow: auto; user-select: all; }

/* ---------- customer portal ---------- */
.page { max-width: 1040px; margin: 0 auto; padding: 26px 20px 60px; }
.hero-device { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
@media (max-width: 820px) { .hero-device { grid-template-columns: 1fr; } }
.pl-list { display: flex; flex-direction: column; }
.pl { display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-top: 1px solid var(--line); }
.pl:first-child { border-top: 0; }
.pl-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.pl .name { font-weight: 700; }
.pl .meta { font-size: 13px; color: var(--muted); }
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.plan { border: 1.5px solid var(--line-2); border-radius: var(--r); padding: 16px; cursor: pointer; transition: border-color .15s, background-color .15s; position: relative; }
.plan:hover { border-color: var(--text-2); }
.plan.on { border-color: var(--accent); background: var(--accent-soft); }
.plan .p-name { font-weight: 700; }
.plan .p-price { font-size: 24px; font-weight: 800; margin-top: 4px; letter-spacing: -.01em; }
.plan .tag { position: absolute; top: -10px; inset-inline-end: 12px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.pay-box { background: var(--surface-2); border-radius: var(--r); padding: 16px; }
.copy-line { display: flex; align-items: center; gap: 8px; justify-content: space-between; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); padding: 8px 8px 8px 14px; }
:root[dir="rtl"] .copy-line { padding: 8px 14px 8px 8px; }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 0 10px; }

/* offers */
.alert.offer { background: var(--accent-soft, rgba(217,178,106,.16)); color: var(--text); font-weight: 600; align-items: center; }
.alert.offer svg { color: var(--accent); }
.plan .p-old { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.footer .legal-links { margin-top: 6px; } .footer a { color: var(--muted); text-decoration: underline; }

/* admin: support inbox */
.card.msg { margin-bottom: 14px; }
.card.msg > p { padding: 16px 22px 0; margin: 0 0 14px !important; line-height: 1.7; }
.card.msg > .row { padding: 0 22px 18px; }
.card.msg.new { border-color: var(--accent); }
.help-card { padding: 18px 22px; }
.plan-matrix input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent, #d9a441); cursor: pointer; }
.plan-matrix td, .plan-matrix th { vertical-align: middle; }

/* admin numbers: money per month */
.bars { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; align-items: end; }
.bar-col { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.bar-stack { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 150px; width: 100%; border-bottom: 1px solid var(--line-2); }
.bar { width: 34%; max-width: 28px; min-height: 2px; border-radius: 6px 6px 0 0; }
.bar.egp, .legend.egp::before { background: var(--accent); }
.bar.usd, .legend.usd::before { background: var(--info); }
.bar-v { font-size: 12.5px; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.bar-v.sub { font-weight: 400; margin-top: 2px; min-height: 16px; }
.bar-m { font-size: 12px; color: var(--muted); margin-top: 4px; }
.legend { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.legend::before { content: ""; width: 10px; height: 10px; border-radius: 3px; }
@media (max-width: 640px) { .bars { gap: 6px; } .bar-v { font-size: 11px; } }

/* ---- panels v2: sidebar groups, top search, action center, filters, bulk, pager, device page ---- */
.nav-group { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .08em; padding: 14px 12px 4px; }
.search-wrap { position: relative; display: flex; align-items: center; gap: 6px; }
.search-wrap > svg { position: absolute; inset-inline-start: 10px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search-wrap .input { padding-inline-start: 34px; height: 38px; min-width: 260px; }
.search-pop { position: absolute; top: 44px; inset-inline-end: 0; width: min(420px, 90vw); max-height: 70vh; overflow: auto; background: var(--surface);
  border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 40; }
.search-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; padding: 9px 10px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; color: var(--text); }
.search-item:hover { background: var(--surface-2); }
.search-item svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.todo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.todo { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: start; color: var(--text); }
.todo:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.todo-ic { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); flex: none; }
.todo-ic svg { width: 20px; height: 20px; }
.todo-n { font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.todo.warn .todo-ic { background: var(--warn-soft); color: var(--warn); } .todo.warn { border-color: var(--warn-soft); }
.todo.bad .todo-ic { background: var(--bad-soft); color: var(--bad); }
.todo.info .todo-ic { background: var(--info-soft); color: var(--info); }
.todo.ok .todo-ic { background: var(--ok-soft); color: var(--ok); } .todo.ok .todo-n { color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters select.input { height: 38px; min-width: 140px; width: auto; }
.search-in { position: relative; max-width: 420px; }
.filters .search-in { flex: 1 1 260px; }
.search-in svg { position: absolute; inset-inline-start: 10px; top: 50%; margin-top: -8px; width: 16px; height: 16px; color: var(--muted); }
.search-in .input { padding-inline-start: 34px; height: 38px; width: 100%; }
.bulk-bar { position: sticky; top: 74px; z-index: 9; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px;
  background: var(--accent-soft); border: 1px solid var(--accent); }
.bulk-bar .input { height: 32px; }
.pager { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 12px 16px; border-top: 1px solid var(--line); }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--surface-2); }
table.t th.cb, table.t td.cb { width: 34px; }
table.t input[type=checkbox], .bulk-bar input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); flex: none; display: inline-block; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.big { width: 12px; height: 12px; }
.dev-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs-scroll { overflow-x: auto; padding-bottom: 2px; }
.tabs-scroll .seg { display: inline-flex; flex-wrap: nowrap; white-space: nowrap; }
.dirty-bar { position: sticky; bottom: 16px; z-index: 12; display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 12px 16px; border-radius: 14px;
  background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); }
.dirty-bar .btn.ghost { color: var(--bg); }
.dirty-bar svg { width: 18px; height: 18px; }
@media (max-width: 900px) { .search-wrap .input { min-width: 0; width: 150px; } .bulk-bar { top: 64px; } }
@media (max-width: 640px) { .search-wrap { display: none; } }

/* ---- reseller + customer tabs ---- */
.ptabs { display: flex; gap: 4px; overflow-x: auto; padding: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); position: sticky; top: 64px; z-index: 8; }
.ptab { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px; border: 0; background: transparent; color: var(--text-2); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.ptab svg { width: 17px; height: 17px; }
.ptab.on { background: var(--accent-soft); color: var(--accent); }
.ptab .count { background: var(--bad); color: #fff; font-size: 11px; padding: 0 6px; border-radius: 999px; }
.meter { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.meter.warn > i { background: var(--warn); } .meter.bad > i { background: var(--bad); }
.summary { border: 1px solid var(--line-2); border-radius: 14px; padding: 14px 16px; background: var(--surface-2); }
.summary .line { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; }
.summary .line.total { border-top: 1px dashed var(--line-2); margin-top: 6px; padding-top: 10px; font-weight: 700; font-size: 17px; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.step-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.step-dot b { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-2); font-size: 12px; }
.step-dot.on b { background: var(--accent); color: var(--accent-ink); }

/* admin: store pictures + uploads */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.img-slot { display: flex; flex-direction: column; gap: 10px; }
.img-slot .pic { position: relative; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.img-slot .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.upbar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.upbar i { display: block; height: 100%; width: 0; background: var(--accent, #d9a441); transition: width .2s; }
.img-slot .pic .upbar { position: absolute; inset-inline: 10px; bottom: 10px; }

/* phones: nothing may be wider than the screen (one wide thing zooms the whole panel out) */
.main { min-width: 0; }
.badge { max-width: 100%; }
@media (max-width: 760px) {
  .badge { white-space: normal; height: auto; min-height: 24px; padding: 3px 10px; line-height: 1.35; }
  .toolbar > .seg, .filters > .seg, .card-head .seg { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .toolbar > .seg::-webkit-scrollbar, .filters > .seg::-webkit-scrollbar { display: none; }
  .seg button { flex: none; white-space: nowrap; }
  .main-body, .card, .card-body { min-width: 0; max-width: 100%; }
  .mono { overflow-wrap: anywhere; }
}
