/* =========================================================
   SNS Admin — template statico
   Colori, spazi e componenti in un unico file.
   Tema scuro: <html data-theme="dark"> (gestito da admin.js)
   ========================================================= */

:root {
  --brand: #0E6655;
  --brand-600: #0B5547;
  --brand-700: #0A4D40;
  --brand-tint: #E3F1EC;
  --brand-ink: #0A4D40;

  --bg: #F6F5F1;
  --surface: #FFFFFF;
  --surface-2: #FAFAF7;
  --line: #E6E3DC;
  --line-strong: #C9C6BC;
  --ink: #16191D;
  --ink-soft: #3D4652;
  --muted: #6B7280;

  --ok: #1F8A4C;   --ok-tint: #E4F4EA;   --ok-ink: #14532B;
  --warn: #C47A00; --warn-tint: #FBF0DC; --warn-ink: #5C3600;
  --bad: #C0392B;  --bad-tint: #FBE5E2;  --bad-ink: #7A1A12;
  --info: #2563A8; --info-tint: #DCE8F7; --info-ink: #173E6B;

  --wa: #1FA855; --phone: #6D4BC3; --tiktok: #111111;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(22,25,29,.05), 0 1px 3px rgba(22,25,29,.04);
  --shadow-lg: 0 12px 32px -8px rgba(22,25,29,.18), 0 2px 6px rgba(22,25,29,.06);

  --sidebar-w: 264px;
  --topbar-h: 64px;

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", sans-serif;
  color-scheme: light;
}

html[data-theme="dark"] {
  --brand: #2FA88E;
  --brand-600: #3DBB9F;
  --brand-700: #8BD9C4;
  --brand-tint: #15342D;
  --brand-ink: #8BD9C4;

  --bg: #0F1417;
  --surface: #161C20;
  --surface-2: #1B2227;
  --line: #263038;
  --line-strong: #36424B;
  --ink: #E8ECEF;
  --ink-soft: #BAC3CA;
  --muted: #8B969F;

  --ok-tint: #12301F;   --ok-ink: #7FD6A1;
  --warn-tint: #382A10; --warn-ink: #F3C46B;
  --bad-tint: #3A1714;  --bad-ink: #F2A096;
  --info-tint: #142A44; --info-ink: #9CC3F0;
  --tiktok: #E8ECEF;

  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --shadow-lg: 0 16px 40px -8px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
img { display: block; max-width: 100%; }
svg.icon { display: inline-block; vertical-align: -0.22em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.muted { color: var(--muted); }
.soft { color: var(--ink-soft); }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.app.is-collapsed { --sidebar-w: 76px; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow: hidden;
  z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; height: var(--topbar-h); padding: 0 20px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.logo { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--brand); color: #fff; font-weight: 700; font-size: 11px; letter-spacing: .04em; flex-shrink: 0; }
.brand-text strong { display: block; font-size: 15px; }
.brand-text span { display: block; font-size: 12px; color: var(--muted); }

.nav { flex: 1; overflow-y: auto; padding: 14px 12px 20px; }
.nav-group + .nav-group { margin-top: 18px; }
.nav-label { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 4px 10px 6px; border: 0; background: none; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); cursor: pointer; }
.nav-label .chev { transition: transform .2s; }
.nav-group.is-closed .chev { transform: rotate(-90deg); }
.nav-group.is-closed .nav-items { display: none; }
.nav-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink-soft); font-weight: 500; }
.nav-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-link.is-active { background: var(--brand-tint); color: var(--brand-ink); font-weight: 600; }
.nav-link .badge { margin-left: auto; }
.nav-text { white-space: nowrap; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); }
.help-card { padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 12px; color: var(--ink-soft); }
.help-card strong { display: block; color: var(--ink); font-size: 13px; margin-bottom: 2px; }

.app.is-collapsed .brand-text, .app.is-collapsed .nav-text, .app.is-collapsed .nav-label span,
.app.is-collapsed .nav-link .badge, .app.is-collapsed .sidebar-foot, .app.is-collapsed .nav-label .chev { display: none; }
.app.is-collapsed .nav-link { justify-content: center; }
.app.is-collapsed .nav-label { justify-content: center; }
.app.is-collapsed .nav-label::after { content: ""; width: 20px; height: 1px; background: var(--line); }
.app.is-collapsed .sidebar-brand { justify-content: center; padding: 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h); padding: 0 24px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .search { flex: 1; max-width: 420px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.content { padding: 28px; max-width: 1440px; width: 100%; margin: 0 auto; }

.overlay { display: none; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.page-title { font-size: 26px; font-weight: 700; overflow-wrap: anywhere; }
.page-sub { margin-top: 4px; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); background: var(--bad); }
.btn-soft { background: var(--brand-tint); border-color: transparent; color: var(--brand-ink); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }
.icon-btn { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--ink-soft); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); border: 2px solid var(--surface); }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; }
.label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.label .req { color: var(--bad); }
.hint { font-size: 12px; color: var(--muted); }
.error { font-size: 12px; color: var(--bad); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
.input.is-invalid { border-color: var(--bad); }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon .input { padding-left: 38px; }
.input-group { display: flex; }
.input-group .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-2); color: var(--muted); }
.kbd { font-size: 11px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: var(--surface-2); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .span-2 { grid-column: span 2; }
.form-section + .form-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.form-section h3 { font-size: 16px; }
.form-section > p { margin: 4px 0 16px; color: var(--muted); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--brand); }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; cursor: pointer; }
.switch + .switch { border-top: 1px solid var(--line); }
.switch input { appearance: none; width: 40px; height: 24px; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(16px); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; padding: 6px 12px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 650; }
.card-body { padding: 20px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }

/* Stat / semaphore */
.stat { padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-foot { font-size: 13px; }
.stat-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--brand-tint); color: var(--brand-ink); }
.sema { position: relative; overflow: hidden; }
.sema::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; }
.sema-bad::before { background: var(--bad); }
.sema-warn::before { background: var(--warn); }
.sema-ok::before { background: var(--ok); }
.trend-up { color: var(--ok); } .trend-down { color: var(--bad); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--ink-soft); border: 1px solid var(--line); }
.badge::before { content: none; }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-tint); color: var(--ok-ink); border-color: transparent; }
.badge-warn { background: var(--warn-tint); color: var(--warn-ink); border-color: transparent; }
.badge-bad { background: var(--bad-tint); color: var(--bad-ink); border-color: transparent; }
.badge-info { background: var(--info-tint); color: var(--info-ink); border-color: transparent; }
.badge-brand { background: var(--brand-tint); color: var(--brand-ink); border-color: transparent; }
.badge-count { height: 20px; min-width: 20px; padding: 0 6px; justify-content: center; }

.chan { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: #fff; flex-shrink: 0; }
.chan .icon { width: 15px; height: 15px; }
.chan-wa { background: var(--wa); } .chan-phone { background: var(--phone); } .chan-tiktok { background: var(--tiktok); color: var(--surface); } .chan-web { background: var(--info); }

/* ---------- Avatar ---------- */
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--brand-tint); color: var(--brand-ink); font-weight: 700; font-size: 13px; flex-shrink: 0; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.c2 { background: var(--warn-tint); color: var(--warn-ink); }
.avatar.c3 { background: var(--info-tint); color: var(--info-ink); }
.avatar.c4 { background: var(--bad-tint); color: var(--bad-ink); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who > div > strong { display: block; font-weight: 600; }
.who > div > span { display: block; font-size: 12px; color: var(--muted); }
.table .who > div > strong { white-space: nowrap; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar .search { width: 280px; }
.toolbar .spacer { flex: 1; }
.table { width: 100%; border-collapse: collapse; }
.table th { position: sticky; top: 0; padding: 10px 16px; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .check-col { width: 44px; }
.table .actions { text-align: right; white-space: nowrap; }
.table input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); }
.sort { display: inline-flex; align-items: center; gap: 4px; color: inherit; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.pages { display: flex; gap: 4px; }
.pages a, .pages span { display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px; color: var(--ink-soft); font-weight: 600; }
.pages a:hover { background: var(--surface-2); text-decoration: none; }
.pages .is-current { background: var(--brand); color: #fff; }
.bulkbar { display: none; align-items: center; gap: 10px; padding: 10px 16px; background: var(--brand-tint); color: var(--brand-ink); font-weight: 600; border-bottom: 1px solid var(--line); }
.bulkbar.is-visible { display: flex; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 10px 14px; border: 0; background: none; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--brand-ink); border-bottom-color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); font-weight: 600; font-size: 13px; cursor: pointer; }
.pill.is-active { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); display: none; z-index: 60; }
.menu.is-open { display: block; animation: pop .14s ease-out; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font-weight: 500; text-align: left; cursor: pointer; }
.menu-item:hover { background: var(--surface-2); text-decoration: none; }
.menu-item.danger { color: var(--bad); }
.menu-sep { height: 1px; margin: 6px 0; background: var(--line); }
.menu-head { padding: 10px 10px 8px; }
.menu-wide { width: 360px; padding: 0; }
.notif { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.notif:last-child { border-bottom: 0; }
.notif.unread { background: color-mix(in srgb, var(--brand-tint) 50%, transparent); }
.notif p { font-size: 13px; }
.notif time { font-size: 12px; color: var(--muted); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Modal / drawer ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: none; place-items: center; padding: 20px; background: rgba(15,20,23,.5); backdrop-filter: blur(2px); }
.modal.is-open { display: grid; }
.modal-box { width: 100%; max-width: 520px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }

/* ---------- Toast ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: grid; gap: 10px; }
.toast { display: flex; align-items: flex-start; gap: 12px; min-width: 300px; max-width: 380px; padding: 14px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); animation: pop .2s ease-out; }
.toast .icon { color: #7FD6A1; }

/* ---------- Lists & misc ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item strong { font-weight: 600; }
.date-box { display: grid; place-items: center; width: 46px; height: 50px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); flex-shrink: 0; line-height: 1.05; }
.date-box b { font-size: 17px; }
.date-box small { font-size: 10px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--line); }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.empty { display: grid; place-items: center; gap: 8px; padding: 48px 20px; text-align: center; color: var(--muted); }
.empty .icon { width: 40px; height: 40px; color: var(--line-strong); }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--info-tint); color: var(--info-ink); }
.callout-warn { background: var(--warn-tint); color: var(--warn-ink); }
.callout-ok { background: var(--ok-tint); color: var(--ok-ink); }
.callout-brand { background: var(--brand-tint); color: var(--brand-ink); }
.dl { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 26px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: -6px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 1px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.timeline time { display: block; font-size: 12px; color: var(--muted); }
.score { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; font-weight: 700; background: conic-gradient(var(--brand) calc(var(--v) * 1%), var(--surface-2) 0); position: relative; }
.score::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--surface); }
.score span { position: relative; font-size: 13px; }

/* Bar chart */
.chart { display: flex; align-items: flex-end; gap: 14px; height: 200px; padding-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar i { display: block; width: 100%; max-width: 38px; border-radius: 8px 8px 4px 4px; background: color-mix(in srgb, var(--brand) 30%, transparent); }
.bar.is-now i { background: var(--brand); }
.bar small { font-size: 12px; color: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--brand); }

/* AI draft */
.ai-box { border: 1px dashed color-mix(in srgb, var(--brand) 45%, transparent); background: color-mix(in srgb, var(--brand-tint) 55%, transparent); border-radius: 12px; padding: 14px 16px; }
.ai-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--brand-ink); text-transform: uppercase; letter-spacing: .05em; }
.approval { padding: 20px; }
.approval + .approval { border-top: 1px solid var(--line); }
.approval-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.approval-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* Inbox */
.inbox { display: grid; grid-template-columns: 320px minmax(0, 1fr) 300px; height: calc(100vh - var(--topbar-h) - 140px); min-height: 520px; overflow: hidden; }
.inbox-list { border-right: 1px solid var(--line); overflow-y: auto; }
.convo { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.convo:hover { background: var(--surface-2); }
.convo.is-active { background: var(--brand-tint); }
.convo .grow { flex: 1; min-width: 0; }
.convo p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; color: var(--muted); }
.convo time { font-size: 12px; color: var(--muted); }
.thread { display: flex; flex-direction: column; min-width: 0; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.msgs { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.msg { max-width: 72%; padding: 10px 14px; border-radius: 16px; font-size: 14px; }
.msg time { display: block; margin-top: 4px; font-size: 11px; opacity: .7; }
.msg-in { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg-out { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg-ai { align-self: flex-end; background: var(--surface); border: 1px dashed var(--brand); border-bottom-right-radius: 4px; }
.msg-sys { align-self: center; font-size: 12px; color: var(--muted); background: none; padding: 2px; }
.composer { padding: 12px 16px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.inbox-side { border-left: 1px solid var(--line); overflow-y: auto; padding: 20px; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.cal-h { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; padding-bottom: 4px; }
.day { min-height: 84px; padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.day b { font-size: 13px; }
.day small { font-size: 12px; font-weight: 600; }
.day.off { background: var(--surface-2); color: var(--muted); }
.day.sick { background: var(--info-tint); color: var(--info-ink); border-color: transparent; }
.day.leave { background: var(--warn-tint); color: var(--warn-ink); border-color: transparent; }
.day.hol { background: var(--bad-tint); color: var(--bad-ink); border-color: transparent; }
.day.out { visibility: hidden; }

/* Payslip */
.slip-lines td:last-child, .slip-lines th:last-child { text-align: right; }
.slip-total td { font-weight: 700; font-size: 15px; border-top: 2px solid var(--ink); }

/* QR */
.qr { width: 100%; max-width: 180px; aspect-ratio: 1; margin: 0 auto; padding: 10px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.qr svg { width: 100%; height: 100%; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 48px; background: var(--brand); color: #fff; }
.auth-art::before, .auth-art::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.07); }
.auth-art::before { width: 520px; height: 520px; right: -180px; top: -160px; }
.auth-art::after { width: 380px; height: 380px; left: -140px; bottom: -160px; }
.auth-art > * { position: relative; }
.auth-art .logo { background: #fff; color: var(--brand); }
.auth-art h1 { font-size: 36px; font-weight: 700; max-width: 460px; letter-spacing: -.02em; }
.auth-art ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; }
.auth-art li { display: flex; gap: 10px; align-items: center; color: rgba(255,255,255,.9); }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-box { width: 100%; max-width: 400px; }
.auth-box h2 { font-size: 26px; font-weight: 700; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inbox { grid-template-columns: 280px minmax(0, 1fr); }
  .inbox-side { display: none; }
}
@media (max-width: 1024px) {
  .app, .app.is-collapsed { grid-template-columns: 1fr; --sidebar-w: 280px; }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg); }
  .app.is-mobile-open .sidebar { transform: none; }
  .app.is-mobile-open .overlay { display: block; position: fixed; inset: 0; background: rgba(15,20,23,.45); z-index: 35; }
  .app.is-collapsed .brand-text, .app.is-collapsed .nav-text, .app.is-collapsed .nav-link .badge, .app.is-collapsed .sidebar-foot { display: revert; }
  .grid-3, .grid-main { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media (max-width: 720px) {
  .content { padding: 18px; }
  .topbar { padding: 0 14px; }
  .topbar .search, .topbar .kbd, .topbar .btn .nav-text { display: none; }
  .thread-head { flex-wrap: wrap; }
  .grid-2, .grid-4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .page-actions { width: 100%; }
  .chart { gap: 6px; }
  .day small { display: none; }
  .day.hol::after, .day.sick::after, .day.leave::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .form-grid .span-2 { grid-column: auto; }
  .toolbar .search { width: 100%; }
  .inbox { grid-template-columns: 1fr; height: auto; }
  .inbox-list { max-height: 260px; border-right: 0; border-bottom: 1px solid var(--line); }
  .cal { gap: 4px; }
  .day { min-height: 52px; padding: 5px; min-width: 0; }
  .legend { flex-wrap: wrap; gap: 8px 12px; }
  .list-item { flex-wrap: wrap; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 10px; }
  .page-title { font-size: 22px; }
  .menu-wide { width: calc(100vw - 28px); right: -60px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .sidebar, .topbar, .page-actions, .no-print { display: none !important; } .app { display: block; } .content { padding: 0; } .card { box-shadow: none; } }
