/* ממשק ניהול – עטרת שלמה */
:root {
  --bg: #f5f3ee; --surface: #ffffff; --surface-2: #faf8f4; --surface-3: #f1ede4;
  --border: #e6e0d4; --border-strong: #d6cebf;
  --text: #1b2232; --text-2: #3d4558; --muted: #707789;
  --primary: #1f3a5f; --primary-hover: #17304f; --primary-soft: #e6edf6; --on-primary: #fff;
  --accent: #b5862f; --accent-soft: #f6ecd8;
  --success: #17803d; --success-soft: #e3f4e8;
  --warning: #b05f05; --warning-soft: #fdf0dc;
  --danger: #b42318; --danger-soft: #fde8e6;
  --info: #2459c7; --info-soft: #e5edfc;
  --violet: #6b46c1; --violet-soft: #efe9fb;
  --shadow-sm: 0 1px 2px rgba(20, 25, 40, .06);
  --shadow: 0 4px 16px rgba(20, 25, 40, .07), 0 1px 3px rgba(20, 25, 40, .05);
  --shadow-lg: 0 24px 60px rgba(15, 20, 35, .22);
  --radius: 14px; --radius-sm: 9px;
  --sidebar-w: 248px;
  --font: "Heebo", "Segoe UI", "Arial Hebrew", Arial, sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0e131d; --surface: #151b28; --surface-2: #1a2131; --surface-3: #212a3d;
  --border: #263046; --border-strong: #334061;
  --text: #e7eaf1; --text-2: #c3c9d6; --muted: #8e98ad;
  --primary: #86aee0; --primary-hover: #a3c3ea; --primary-soft: #1c2b44; --on-primary: #0e1626;
  --accent: #d8b169; --accent-soft: #33291a;
  --success: #55c27c; --success-soft: #16301f;
  --warning: #f0a54a; --warning-soft: #36260f;
  --danger: #f2776b; --danger-soft: #3a1a18;
  --info: #7fa6ff; --info-soft: #18264a;
  --violet: #b39cf2; --violet-soft: #2a2145;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 4px 18px rgba(0,0,0,.35); --shadow-lg: 0 24px 60px rgba(0,0,0,.6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); flex: none; background: var(--surface); border-inline-end: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 40; transition: transform .25s ease; }
.brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px 16px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, #1f3a5f, #2f5487);
  display: grid; place-items: center; color: #f3e2b8; font-weight: 800; font-size: 17px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-weight: 800; font-size: 15px; line-height: 1.2; }
.brand-sub { font-size: 11.5px; color: var(--muted); }
.nav { padding: 6px 10px; overflow-y: auto; flex: 1; }
.nav-group { font-size: 11px; font-weight: 700; color: var(--muted); padding: 14px 10px 6px; letter-spacing: .3px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px; color: var(--text-2);
  font-weight: 500; margin-bottom: 2px; text-decoration: none; position: relative; transition: background .15s, color .15s; }
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.nav a.active::before { content: ""; position: absolute; inset-inline-start: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent); }
.nav .badge { margin-inline-start: auto; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; flex: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px 26px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 520px; }
.search input { width: 100%; padding: 9px 40px 9px 14px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); outline: none; transition: border .15s, box-shadow .15s; }
.search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search > svg { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search kbd { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; background: var(--surface-2); }
.search-results { position: absolute; top: calc(100% + 6px); inset-inline: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; max-height: 420px; overflow-y: auto; }
.search-results a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: var(--text); border-bottom: 1px solid var(--border); text-decoration: none; }
.search-results a:hover, .search-results a.sel { background: var(--surface-3); }
.search-results .type { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); color: var(--muted); }
.icon-btn { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; color: var(--text-2); transition: background .15s; }
.icon-btn:hover { background: var(--surface-3); }
.icon-btn .dot { position: absolute; top: -4px; left: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.content { padding: 24px 26px 60px; max-width: 1480px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.2px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-enter { animation: pageIn .28s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Cards & stats ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 15.5px; font-weight: 700; }
.card-body { padding: 18px; }
.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stat { padding: 16px 18px; position: relative; overflow: hidden; transition: transform .2s, box-shadow .2s; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.stat .value { font-size: 26px; font-weight: 800; margin-top: 6px; letter-spacing: -.5px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat .ico { position: absolute; left: 14px; top: 14px; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
.tone-primary .ico { background: var(--primary-soft); color: var(--primary); }
.tone-accent .ico { background: var(--accent-soft); color: var(--accent); }
.tone-success .ico { background: var(--success-soft); color: var(--success); }
.tone-warning .ico { background: var(--warning-soft); color: var(--warning); }
.tone-danger .ico { background: var(--danger-soft); color: var(--danger); }
.tone-info .ico { background: var(--info-soft); color: var(--info); }
.tone-violet .ico { background: var(--violet-soft); color: var(--violet); }
.status-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.status-tile { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-align: start; transition: border .15s, transform .15s; }
.status-tile:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.status-tile .n { font-size: 22px; font-weight: 800; }
.status-tile .t { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; text-decoration: none; font-size: 14px; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 30%, transparent); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { padding: 7px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  outline: none; transition: border .15s, box-shadow .15s; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.err { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
textarea.input { resize: vertical; min-height: 80px; }
.input.sm { padding: 6px 9px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 20px; transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 3px; right: 3px; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::after { right: 21px; }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-soft); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.toolbar .input { width: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 6px 12px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2); display: inline-flex; gap: 6px; align-items: center; transition: .15s; }
.chip:hover { border-color: var(--border-strong); }
.chip.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.chip .c { font-size: 11.5px; opacity: .75; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.b-new { background: var(--info-soft); color: var(--info); }
.b-pending { background: var(--warning-soft); color: var(--warning); }
.b-processing { background: var(--violet-soft); color: var(--violet); }
.b-ready { background: var(--accent-soft); color: var(--accent); }
.b-delivered, .b-success, .b-sent, .b-resolved { background: var(--success-soft); color: var(--success); }
.b-cancelled, .b-danger, .b-failed, .b-urgent { background: var(--danger-soft); color: var(--danger); }
.b-warning, .b-high, .b-waiting, .b-skipped { background: var(--warning-soft); color: var(--warning); }
.b-open, .b-info { background: var(--info-soft); color: var(--info); }
.b-in_progress { background: var(--violet-soft); color: var(--violet); }
.b-closed, .b-low, .b-muted { background: var(--surface-3); color: var(--muted); }
.b-normal { background: var(--primary-soft); color: var(--primary); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: start; font-size: 12px; font-weight: 700; color: var(--muted); padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; }
.t td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.t tbody tr { transition: background .12s; }
.t tbody tr:hover { background: var(--surface-2); }
.t tbody tr.click { cursor: pointer; }
.t tbody tr.sel { background: var(--primary-soft); }
.t tbody tr:last-child td { border-bottom: none; }
.t .w-check { width: 36px; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 42px; height: 42px; opacity: .45; margin-bottom: 8px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.thumb { width: 42px; height: 42px; border-radius: 9px; object-fit: cover; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); flex: none; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.bulkbar { display: flex; align-items: center; gap: 10px; padding: 10px 18px; background: var(--primary-soft); border-bottom: 1px solid var(--border); flex-wrap: wrap; animation: pageIn .2s ease; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: none; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 22px 16px 0; }
.timeline li::before { content: ""; position: absolute; right: 5px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.timeline li::after { content: ""; position: absolute; right: 9px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline .tl-meta { font-size: 12px; color: var(--muted); }
.timeline .tl-msg { white-space: pre-wrap; word-break: break-word; }
.timeline li.k-note::before { background: var(--info); box-shadow: 0 0 0 3px var(--info-soft); }
.timeline li.k-status::before { background: var(--violet); box-shadow: 0 0 0 3px var(--violet-soft); }
.timeline li.k-email::before { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }

/* ---------- Drawer, modal, toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(12, 16, 28, .45); backdrop-filter: blur(2px); z-index: 80; animation: fade .2s ease both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(720px, 100%); background: var(--bg); z-index: 90; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slideIn .28s cubic-bezier(.2,.8,.2,1) both; }
@keyframes slideIn { from { transform: translateX(-100%); } to { transform: none; } }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.drawer-head h2 { margin: 0; font-size: 18px; flex: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 40px; display: flex; flex-direction: column; gap: 16px; }
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: pop .22s cubic-bezier(.2,.8,.2,1) both; position: relative; z-index: 101; }
.modal.lg { width: min(860px, 100%); }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 17px; flex: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-start; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 16px 16px; flex-direction: row-reverse; }
.toasts { position: fixed; bottom: 20px; left: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: flex-start; animation: pop .22s ease both; font-weight: 500; }
.toast.ok svg { color: #4ade80; } .toast.err svg { color: #f87171; }
.toast.leave { opacity: 0; transform: translateY(6px); transition: .25s; }
.popover { position: absolute; top: calc(100% + 8px); left: 0; width: 380px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); z-index: 60; overflow: hidden; animation: pop .18s ease both; }
.popover .list { max-height: 420px; overflow-y: auto; }
.notif { cursor: pointer; align-items: flex-start !important; }
.notif.unread { background: var(--primary-soft); }
.notif .ni { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); flex: none; }

/* ---------- Charts ---------- */
.chart { width: 100%; height: 260px; position: relative; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 4; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .area { fill: url(#gradArea); }
.chart .line { fill: none; stroke: var(--primary); stroke-width: 2.4; }
.chart .bar { fill: var(--accent); opacity: .85; transition: opacity .15s; }
.chart .bar:hover { opacity: 1; }
.chart .pt { fill: var(--surface); stroke: var(--primary); stroke-width: 2; opacity: 0; transition: opacity .15s; }
.chart .hit:hover + .pt, .chart .pt.on { opacity: 1; }
.chart-tip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); padding: 7px 10px; border-radius: 9px; font-size: 12.5px; white-space: nowrap; transform: translate(50%, -110%); box-shadow: var(--shadow); z-index: 5; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 5px; vertical-align: -1px; }
.hbar { display: flex; flex-direction: column; gap: 10px; }
.hbar .r { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: 13px; }
.hbar .track { grid-column: 1 / -1; height: 7px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--accent), var(--primary)); transform-origin: right; animation: grow .7s cubic-bezier(.2,.8,.2,1) both; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.donut { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }

/* ---------- Misc ---------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }
.alert { padding: 12px 14px; border-radius: 12px; display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.alert.info { background: var(--info-soft); color: var(--info); }
.alert.warn { background: var(--warning-soft); color: var(--warning); }
.alert.danger { background: var(--danger-soft); color: var(--danger); }
.alert.success { background: var(--success-soft); color: var(--success); }
.alert b { color: inherit; }
.alert .alert-text { color: var(--text); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 6px; overflow-x: auto; }
.tabs button { background: none; border: none; padding: 11px 14px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--primary); border-color: var(--accent); }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; height: 14px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.loading-page { display: grid; gap: 16px; }
.email-preview { border: 1px solid var(--border); border-radius: 12px; width: 100%; height: 420px; background: #f4f1ea; }
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: start; }
.line-items .li { display: grid; grid-template-columns: minmax(0, 1fr) 90px 90px 34px; gap: 8px; align-items: center; margin-bottom: 8px; }
.code { font-family: Consolas, "Courier New", monospace; font-size: 12.5px; background: var(--surface-3); padding: 2px 6px; border-radius: 6px; direction: ltr; unicode-bidi: isolate; }
.divider { height: 1px; background: var(--border); margin: 4px 0; }
.big-total { font-size: 20px; font-weight: 800; }
.scrim { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .g-main, .g-3, .g-2 { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; right: 0; transform: translateX(105%); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .menu-btn { display: grid; }
  .content { padding: 18px 14px 60px; }
  .topbar { padding: 10px 14px; }
  .search kbd { display: none; }
}
@media (max-width: 640px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat .value { font-size: 21px; }
  .status-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head h1 { font-size: 20px; }
  .t .hide-sm { display: none; }
  .t td, .t th { padding: 9px 10px; }
  .drawer-body { padding: 14px; }
  .line-items .li { grid-template-columns: minmax(0, 1fr) 70px 70px 30px; }
  .hide-mobile { display: none !important; }
  .toolbar .input { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* fixes */
.search > span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; pointer-events: none; }
.search .input { padding-right: 38px; }
input[type=date].input, select.input.sm, .toolbar select.input, .card-head select.input { width: auto; }
.card-head .row .input { width: auto; }
.toolbar .search { flex: 1 1 240px; }
.t .num { white-space: nowrap; }
@media (max-width: 640px) { .toolbar .search { flex-basis: 100%; max-width: none !important; } .topbar .search { min-width: 0; } }
@media (max-width: 980px) { .topbar > .grow { display: none; } .topbar .search { flex: 1; } }
