:root {
  --bg: #f5f6fb; --card: #fff; --ink: #1a2138; --muted: #66708f; --line: #e3e6f0;
  --brand: #3a4ed6; --brand-ink: #fff; --brand-soft: #e9ecfd; --teal: #0e9f9d;
  --ok: #15803d; --ok-bg: #dcfce7; --warn: #b45309; --warn-bg: #fef3c7;
  --bad: #b91c1c; --bad-bg: #fee2e2; --info: #1d4ed8; --info-bg: #dbeafe; --mute-bg: #eceef5;
  --shadow: 0 1px 2px rgba(20, 28, 60, .06), 0 4px 14px rgba(20, 28, 60, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1424; --card: #171d33; --ink: #e8ebf7; --muted: #98a1c0; --line: #283052;
    --brand: #7b8cff; --brand-ink: #0f1424; --brand-soft: #232c55; --teal: #3dd1cf;
    --ok: #4ade80; --ok-bg: #123320; --warn: #fbbf24; --warn-bg: #3a2c0c;
    --bad: #f87171; --bad-bg: #3d1717; --info: #8fb4ff; --info-bg: #172a52; --mute-bg: #232a44;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h2 { font-size: 17px; } h3 { font-size: 15px; }
p { margin: 0 0 .6em; }
.muted { color: var(--muted); } .small { font-size: 13px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.mt { margin-top: 18px; } .mb { margin-bottom: 18px; }

/* shell */
.shell { display: flex; min-height: 100vh; }
.side { width: 232px; flex: none; background: var(--card); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.logo { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), var(--teal)); color: #fff; display: grid; place-items: center; font-weight: 800; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { padding: 9px 11px; border-radius: 8px; color: var(--ink); font-weight: 500; }
.side nav a:hover { background: var(--mute-bg); text-decoration: none; }
.side nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.persona { margin-top: auto; padding: 11px; background: var(--bg); border-radius: 10px; font-size: 13px; }
.persona b { display: block; font-size: 14px; }
.col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.demo-bar { background: var(--ink); color: var(--bg); font-size: 12.5px; padding: 6px 20px; text-align: center; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 28px 6px; flex-wrap: wrap; }
.top h1 { font-size: 24px; }
.switch { font-size: 13px; display: flex; gap: 6px; align-items: center; }
.switch a { padding: 4px 10px; border: 1px solid var(--line); border-radius: 99px; color: var(--ink); background: var(--card); }
.switch a.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.switch a:hover { text-decoration: none; }
main { padding: 12px 28px 48px; max-width: 1280px; width: 100%; }

/* components */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); }
.card > h2 + * { margin-top: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 15px 17px; box-shadow: var(--shadow); }
.kpi .l { color: var(--muted); font-size: 13px; }
.kpi .v { font-size: 25px; font-weight: 700; margin-top: 2px; }
.kpi .s { font-size: 12.5px; color: var(--muted); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; align-items: start; }
.cols.wide { grid-template-columns: 2fr 1fr; }
@media (max-width: 900px) { .cols.wide { grid-template-columns: 1fr; } }
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--bg); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.mute { background: var(--mute-bg); color: var(--muted); }
.btn { font: inherit; font-weight: 600; font-size: 14px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.btn:hover { background: var(--mute-bg); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.good { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
input[type=checkbox] { width: auto; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.form .full { grid-column: 1 / -1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { padding: 5px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-size: 13px; cursor: pointer; color: var(--ink); font-weight: 500; }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 8px; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); } .dot.info { background: var(--info); }
.bar { height: 12px; background: var(--mute-bg); border-radius: 99px; overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.buckets { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bucket { border-radius: 12px; padding: 14px; border: 1px dashed var(--line); }
.bucket .v { font-size: 22px; font-weight: 700; }
.bucket.client { background: var(--info-bg); } .bucket.rev { background: var(--ok-bg); }
.steps { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.steps span { padding: 6px 12px; border-radius: 99px; background: var(--mute-bg); color: var(--muted); font-size: 13px; font-weight: 600; }
.steps span.on { background: var(--brand); color: var(--brand-ink); }
.steps span.done { background: var(--ok-bg); color: var(--ok); }
.callout { background: var(--brand-soft); border-radius: 10px; padding: 11px 14px; font-size: 14px; }
.empty { text-align: center; color: var(--muted); padding: 22px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { font: inherit; font-size: 13px; padding: 5px 11px; border: 0; background: var(--card); color: var(--ink); cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on.ok { background: var(--ok-bg); color: var(--ok); font-weight: 700; }
.seg button.on.warn { background: var(--warn-bg); color: var(--warn); font-weight: 700; }
.seg button.on.bad { background: var(--bad-bg); color: var(--bad); font-weight: 700; }

/* modal + toast */
.overlay { position: fixed; inset: 0; background: rgba(10, 14, 30, .55); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--card); border-radius: 16px; width: min(720px, 100%); max-height: 90vh; overflow: auto; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.modal-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 14px; }
.modal-head h2 { font-size: 19px; }
.x { background: none; border: 0; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-size: 14px; z-index: 60; box-shadow: 0 8px 30px rgba(0, 0, 0, .3); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }

/* landing */
.land { max-width: 1080px; margin: 0 auto; padding: 40px 20px 60px; }
.hero { padding: 28px 0 8px; }
.hero h1 { font-size: clamp(28px, 5vw, 44px); letter-spacing: -.02em; }
.hero p { font-size: 18px; color: var(--muted); max-width: 680px; margin-top: 12px; }
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 28px 0; }
.role { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; color: var(--ink); box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.role:hover { transform: translateY(-3px); border-color: var(--brand); text-decoration: none; }
.role .tag { font-size: 12px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .06em; }
.role h3 { font-size: 20px; margin: 6px 0; }
.flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; counter-reset: s; }
.flow div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; counter-increment: s; }
.flow div::before { content: counter(s); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.feat { columns: 2 320px; column-gap: 28px; padding-left: 18px; }
.feat li { margin-bottom: 7px; break-inside: avoid; }

@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .persona { display: none; }
  .top, main { padding-left: 16px; padding-right: 16px; }
  .buckets { grid-template-columns: 1fr; }
}
@media print { .side, .demo-bar, .switch, .btn { display: none !important; } }

/* ---- complete-demo additions ---- */
.side { overflow-y: auto; }
.nav-sec { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 11px 4px; }
.side nav a { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.count { background: var(--brand); color: var(--brand-ink); border-radius: 99px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.persona { display: flex; gap: 10px; align-items: center; }
.persona b { display: block; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.demo-bar { display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; }
.demo-bar .switch a { color: var(--bg); border-color: rgba(255, 255, 255, .3); background: transparent; padding: 1px 9px; }
.demo-bar .switch a.on { background: var(--bg); color: var(--ink); }
.top { align-items: flex-start; }
.top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.crumb { font-size: 13px; color: var(--muted); min-height: 18px; }
.icon-btn { background: var(--card); border: 1px solid var(--line); border-radius: 10px; width: 38px; height: 38px; cursor: pointer; display: grid; place-items: center; position: relative; font-size: 16px; padding: 0; color: var(--ink); }
.bell-n { position: absolute; top: -5px; right: -5px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; border-radius: 99px; padding: 1px 5px; }
.pop-wrap { position: relative; }
.pop { position: absolute; right: 0; top: 46px; width: 340px; max-width: 86vw; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 40px rgba(0, 0, 0, .22); z-index: 40; overflow: hidden; }
.pop.menu { width: 220px; }
.menu-head { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.pop a { display: block; padding: 10px 14px; color: var(--ink); }
.pop a:hover { background: var(--bg); text-decoration: none; }
.pop .note { display: flex; gap: 6px; align-items: flex-start; border-bottom: 1px solid var(--line); }
.pop .note.unread { background: var(--brand-soft); }
kbd { font: 11px monospace; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; color: var(--muted); }
.grow { flex: 1; }
.modal.wide { width: min(980px, 100%); }
.kpi .v.bad { color: var(--bad); } .kpi .v.ok { color: var(--ok); } .kpi .v.warn { color: var(--warn); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type=search] { width: 240px; max-width: 100%; }
.toolbar select { width: auto; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { font: inherit; font-weight: 600; font-size: 14px; background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 16px 14px; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); border: 2px solid var(--card); }
.timeline li.ok::before { background: var(--ok); } .timeline li.warn::before { background: var(--warn); } .timeline li.bad::before { background: var(--bad); } .timeline li.info::before { background: var(--info); }
.chart { width: 100%; height: auto; }
.chart .grid { stroke: var(--line); } .chart .ax { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.legend.col { flex-direction: column; list-style: none; padding: 0; margin: 0; gap: 6px; }
.donut-wrap { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; }
.inbox { display: grid; grid-template-columns: 300px 1fr; border: 1px solid var(--line); border-radius: 14px; background: var(--card); min-height: 460px; overflow: hidden; }
.threads { border-right: 1px solid var(--line); overflow-y: auto; max-height: 560px; }
.p-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.thread { display: flex; width: 100%; justify-content: space-between; gap: 8px; text-align: left; font: inherit; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 12px 14px; cursor: pointer; color: var(--ink); }
.thread.on { background: var(--brand-soft); }
.pip { display: inline-block; width: 8px; height: 8px; background: var(--brand); border-radius: 50%; }
.convo { display: flex; flex-direction: column; }
.bubbles { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; max-height: 420px; }
.bubble { max-width: 75%; background: var(--bg); border-radius: 12px; padding: 9px 12px; align-self: flex-start; }
.bubble.me { align-self: flex-end; background: var(--brand-soft); }
.reply { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
@media (max-width: 800px) { .inbox { grid-template-columns: 1fr; } .threads { max-height: 200px; border-right: 0; border-bottom: 1px solid var(--line); } }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.cal .dow { font-size: 12px; font-weight: 700; color: var(--muted); padding: 8px; background: var(--bg); text-align: center; }
.cal .day { min-height: 98px; padding: 5px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); font-size: 12px; }
.cal .day.out { background: var(--bg); opacity: .55; } .cal .day.today { outline: 2px solid var(--brand); outline-offset: -2px; }
.cal .ev { display: block; border-radius: 5px; padding: 1px 5px; margin-top: 3px; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border: 0; font-family: inherit; width: 100%; text-align: left; }
.ev.ok { background: var(--ok-bg); color: var(--ok); } .ev.warn { background: var(--warn-bg); color: var(--warn); } .ev.bad { background: var(--bad-bg); color: var(--bad); } .ev.info { background: var(--info-bg); color: var(--info); }
@media (max-width: 800px) { .cal .day { min-height: 64px; } .cal .ev { font-size: 10px; } }
.kanban { display: grid; grid-template-columns: repeat(4, minmax(200px, 1fr)); gap: 12px; overflow-x: auto; }
.kcol { background: var(--bg); border-radius: 12px; padding: 10px; min-height: 160px; }
.kcol h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 8px; }
.kcard { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; font-size: 13.5px; cursor: pointer; width: 100%; text-align: left; font-family: inherit; color: var(--ink); }
.kcard:hover { border-color: var(--brand); }
.progress { height: 8px; background: var(--mute-bg); border-radius: 99px; overflow: hidden; } .progress i { display: block; height: 100%; background: var(--ok); }
.photo { aspect-ratio: 4 / 3; border-radius: 10px; background: linear-gradient(135deg, var(--mute-bg), var(--brand-soft)); display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.switch-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); gap: 12px; }
.toggle { appearance: none; -webkit-appearance: none; width: 40px; height: 22px; background: var(--mute-bg); border-radius: 99px; position: relative; cursor: pointer; border: 1px solid var(--line); padding: 0; transition: background .15s; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: left .15s; }
.toggle:checked { background: var(--brand); } .toggle:checked::after { left: 20px; }
.stars { color: #f59e0b; letter-spacing: 1px; }
.perm-yes { color: var(--ok); font-weight: 700; } .perm-no { color: var(--line); }
.kcard b, .role b { display: block; }
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { background: linear-gradient(150deg, #2a37a8, #0e9f9d); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art h2 { font-size: 30px; line-height: 1.2; max-width: 420px; }
.auth-art .brand { color: #fff; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; }
.auth-form .box { width: min(400px, 100%); }
.auth-form h1 { font-size: 26px; margin-bottom: 6px; }
.auth-form .form { grid-template-columns: 1fr; margin-top: 18px; }
.quick { display: grid; gap: 8px; margin-top: 18px; }
@media (max-width: 800px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.hero-prop { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: center; }
@media (max-width: 700px) { .hero-prop { grid-template-columns: 1fr; } }
.link-row { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; }

/* ======== Product polish layer ======== */
:root {
  --bg: #f6f7fa; --card: #ffffff; --ink: #111827; --muted: #6b7280; --line: #e5e7eb;
  --brand: #4338ca; --brand-ink: #fff; --brand-soft: #eef0ff; --teal: #0d9488;
  --radius: 12px; --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b1020; --card: #131a2e; --ink: #e5e9f5; --muted: #8f99b8; --line: #232c47; --brand: #8b93ff; --brand-ink: #0b1020; --brand-soft: #1c2447; --shadow: none; --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5); }
}
html { scroll-behavior: smooth; }
body { font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
h1, h2, h3 { letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* shell */
.shell { background: var(--bg); }
.side { width: 252px; padding: 16px 12px; gap: 6px; background: var(--card); border-right: 1px solid var(--line); }
.brand { padding: 4px 8px 14px; gap: 11px; }
.brand b { display: block; font-size: 16px; line-height: 1.1; }
.brand small, .persona small { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.logo { width: 34px; height: 34px; border-radius: 10px; box-shadow: 0 2px 6px rgba(67, 56, 202, .35); }
.side nav { gap: 1px; flex: 1; }
.nav-sec { padding: 16px 10px 6px; font-size: 11px; letter-spacing: .09em; }
.side nav a { gap: 11px; justify-content: flex-start; padding: 8px 10px; border-radius: 8px; color: #374151; font-weight: 500; font-size: 14px; position: relative; }
@media (prefers-color-scheme: dark) { .side nav a { color: #c3cbe3; } }
.side nav a .ico { flex: none; color: var(--muted); }
.side nav a .lbl { flex: 1; }
.side nav a:hover { background: var(--bg); }
.side nav a:hover .ico { color: var(--ink); }
.side nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.side nav a.active .ico { color: var(--brand); }
.side nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.count { margin-left: auto; background: var(--mute-bg); color: var(--ink); font-weight: 600; min-width: 22px; text-align: center; }
.side nav a.active .count { background: var(--brand); color: var(--brand-ink); }
.persona { margin: 8px 0 0; padding: 10px; background: transparent; border-top: 1px solid var(--line); border-radius: 0; gap: 10px; }
.persona .who { flex: 1; min-width: 0; } .persona .who b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col { min-width: 0; }
.demo-bar { display: none; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 28px; background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar .crumb { font-size: 13.5px; min-height: 0; }
.topbar .crumb a { color: var(--muted); } .topbar .crumb a:hover { color: var(--ink); }
.searchbox { display: flex; align-items: center; gap: 8px; width: 320px; max-width: 34vw; height: 36px; padding: 0 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; }
.searchbox span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.searchbox:hover { border-color: #c7cbd6; }
.icon-btn { width: 36px; height: 36px; border-radius: 9px; }
.icon-btn.flat { background: transparent; border-color: transparent; color: var(--muted); text-decoration: none; }
.icon-btn.flat:hover { background: var(--bg); color: var(--ink); }
.menu-btn { display: none; }
.bell-n { top: 1px; right: 1px; border: 2px solid var(--card); font-size: 9.5px; padding: 0 4px; line-height: 14px; }
.bell-n:empty { display: none; }
.pop { border-radius: 12px; box-shadow: var(--shadow-lg); top: 44px; animation: pop .12s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 24px 28px 6px; }
.page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
main { padding: 14px 28px 56px; max-width: 1320px; animation: rise .22s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* demo switcher (floating, unobtrusive) */
.demo-fab { position: fixed; right: 16px; bottom: 16px; z-index: 45; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.fab-t { font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--ink); color: var(--bg); border: 0; border-radius: 99px; padding: 7px 14px; cursor: pointer; box-shadow: var(--shadow-lg); opacity: .85; }
.fab-t:hover { opacity: 1; }
.fab-p { display: none; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-lg); width: 250px; gap: 8px; flex-direction: column; font-size: 13px; }
.demo-fab.open .fab-p { display: flex; }
.fab-p .switch { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.fab-p .switch a { color: var(--ink); background: var(--bg); border: 1px solid var(--line); }
.fab-p .switch a.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* surfaces */
.card, .kpi { border-radius: var(--radius); border-color: var(--line); box-shadow: var(--shadow); }
.card { padding: 20px; }
.card > h2 + * { margin-top: 14px; }
.card-head h2 { font-size: 16px; }
.kpis { gap: 16px; margin-bottom: 20px; }
.kpi { padding: 16px 18px; }
.kpi .l { font-size: 12.5px; font-weight: 500; }
.kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.kpi .s { margin-top: 2px; }
.callout { border-radius: 10px; border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent); }

/* tables */
.tbl-wrap { margin: 0 -4px; padding: 0 4px; }
table { font-size: 14px; }
th { background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); }
td { padding: 13px 12px; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
tr.click:hover td, tbody tr:hover td { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
tr.click { cursor: pointer; }
tr.total td { border-top: 1px solid var(--line); }
.toolbar { padding-bottom: 4px; }
.toolbar input[type=search] { background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E") no-repeat 10px center; padding-left: 32px; }
.pager { padding-top: 12px; border-top: 1px solid var(--line); margin-top: 4px; }

/* controls */
.btn { height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 14px; border-radius: 9px; font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow); text-decoration: none; transition: background .12s, box-shadow .12s, transform .05s; }
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.primary { box-shadow: 0 1px 2px rgba(67, 56, 202, .4); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn.danger { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
input, select, textarea { border-radius: 9px; padding: 8px 11px; font-size: 14px; }
input:not([type=checkbox]):not([type=file]), select { height: 38px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 3px solid color-mix(in srgb, var(--brand) 22%, transparent); outline-offset: 0; }
label { font-weight: 600; font-size: 13px; color: var(--ink); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; font-size: 12px; font-weight: 600; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.chip { font-size: 13px; padding: 5px 13px; }
.tabs { gap: 4px; margin-bottom: 18px; }
.tabs button { padding: 10px 12px; font-size: 14px; }
.avatar { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.list li { padding: 12px 0; }
.empty { padding: 32px 16px; font-size: 14px; }
.kv { grid-template-columns: 150px 1fr; gap: 9px 14px; }

/* overlays */
.overlay { background: rgba(15, 23, 42, .5); backdrop-filter: blur(3px); animation: fade .15s; }
.modal { border-radius: 16px; box-shadow: var(--shadow-lg); animation: up .18s ease-out; padding: 24px; }
@keyframes fade { from { opacity: 0; } } @keyframes up { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.toast { bottom: 24px; border-radius: 10px; padding: 11px 18px; font-weight: 500; animation: up .18s ease-out; }
.kcard, .kcol { border-radius: 12px; }
.cal { border-radius: 12px; }
.inbox, .gallery .card { border-radius: var(--radius); }
.gallery a.card { transition: transform .12s, box-shadow .12s; }
.gallery a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.photo { background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 14%, var(--card)), color-mix(in srgb, var(--teal) 14%, var(--card))); border: 1px solid var(--line); }

/* auth screens */
.auth-form .box { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 32px; box-shadow: var(--shadow-lg); }
.auth-form { background: var(--bg); }

/* mobile: off-canvas navigation */
.scrim { display: none; }
@media (max-width: 900px) {
  .menu-btn { display: grid; }
  .side { position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: 272px; height: 100vh; transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow-lg); flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
  .side nav { flex-direction: column; flex-wrap: nowrap; }
  .persona { display: flex; }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 55; }
  .shell { flex-direction: row; }
  .topbar, .page-head, main { padding-left: 16px; padding-right: 16px; }
  .searchbox span, .searchbox kbd { display: none; } .searchbox { width: 38px; padding: 0; justify-content: center; }
  .page-head h1 { font-size: 21px; }
  .kv { grid-template-columns: 110px 1fr; }
}
@media (max-width: 520px) { .card { padding: 16px; } .demo-fab { right: 10px; bottom: 10px; } }
@media print { .topbar, .demo-fab, .side { display: none !important; } }

/* grid children must be allowed to shrink, otherwise wide tables push the page sideways */
.cols > *, .cols.wide > *, .kpis > *, .gallery > *, .kanban > * { min-width: 0; }
.card, .col, main { min-width: 0; max-width: 100%; }
.tbl-wrap { max-width: 100%; }
@media (max-width: 520px) { .cols { grid-template-columns: minmax(0, 1fr); } .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kanban { grid-template-columns: repeat(4, 220px); } }
@media (max-width: 900px) { .cols.wide { grid-template-columns: minmax(0, 1fr); } }
.inbox { min-width: 0; } .threads { min-width: 0; }
.cal { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.chip:not(.on) { background: var(--card); color: var(--muted); }

/* review fixes */
td.num, th.num { white-space: nowrap; }
.list li > .muted.small, .list li > .nowrap { white-space: nowrap; }
.cols.charts { grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr)); }
.chart .ax { font-size: 14px; }
.kpis.mini { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.kpis.mini .kpi { padding: 10px 12px; box-shadow: none; }
.kpis.mini .v { font-size: 20px; }
.auth-art h2 + p { margin-top: 14px; }
.land h2 { font-size: 20px; margin: 36px 0 14px; }
.land .hero + h2 { margin-top: 28px; }
.land .mb { margin-bottom: 14px; }

/* ===== UX review fixes ===== */
.btn { white-space: nowrap; }
.cols.stack { grid-template-columns: minmax(0, 1fr); }
.cols.docs { grid-template-columns: minmax(0, 1fr) 340px; }
@media (max-width: 1180px) { .cols.docs { grid-template-columns: minmax(0, 1fr); } }
#rows td:first-child input { min-width: 240px; }
#plans select { min-width: 190px; } #plans input[type=number] { min-width: 110px; } #plans td:first-child input { min-width: 150px; }
.persona .who b { white-space: normal; overflow: visible; line-height: 1.25; }
.side-demo, .agenda { display: none; }
.side-demo { padding: 10px; margin-top: 6px; border-top: 1px solid var(--line); gap: 8px; flex-direction: column; }
.side-demo .switch { display: flex; gap: 6px; flex-wrap: wrap; }
.side-demo .switch a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; color: var(--ink); background: var(--bg); font-size: 13px; }
.side-demo .switch a.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

@media (max-width: 900px) {
  .demo-fab { display: none; }
  .side-demo { display: flex; }
}
@media (max-width: 700px) {
  /* tables keep readable columns and scroll sideways instead of crushing text */
  .tbl-wrap table:has(th:nth-child(4)) { min-width: 520px; }
  .tbl-wrap table:has(th:nth-child(5)) { min-width: 680px; }
  .tbl-wrap table:has(th:nth-child(5)) td, .tbl-wrap table:has(th:nth-child(5)) th { white-space: nowrap; }
  .tbl-wrap { box-shadow: inset -14px 0 10px -14px rgba(16, 24, 40, .25); }
  td, th { padding-left: 10px; padding-right: 10px; }
  .kpi { padding: 14px; } .kpi .v { font-size: 21px; white-space: nowrap; }
  .btn.sm { height: 36px; padding: 0 13px; }
  .chip { padding: 8px 14px; } .tabs button { padding: 12px 14px; }
  .icon-btn { width: 40px; height: 40px; }
  /* calendar becomes a month of dots plus an agenda list */
  .cal .day { min-height: 54px; padding: 3px; }
  .cal .ev { display: inline-block; width: 8px; height: 8px; padding: 0; margin: 3px 2px 0 0; border-radius: 50%; font-size: 0; line-height: 0; overflow: hidden; vertical-align: top; }
  .cal .ev.ok { background: var(--ok); } .cal .ev.warn { background: var(--warn); } .cal .ev.bad { background: var(--bad); } .cal .ev.info { background: var(--info); }
  .agenda { display: block; }
  .page-head { padding-top: 18px; }
}
@media (max-width: 700px) {
  .pop { position: fixed; left: 8px; right: 8px; top: 64px; width: auto; max-width: none; }
  .pop.menu { left: auto; width: 230px; }
  .modal { padding: 18px; border-radius: 14px; }
  .modal .list li { flex-wrap: wrap; }
  .overlay { padding: 10px; }
}
@media (max-width: 700px) { #plans select { min-width: 150px; } #plans td:first-child input { min-width: 110px; } #plans input[type=number] { min-width: 80px; } #rows td:first-child input { min-width: 200px; } }

/* ===== top message bar (all pages) ===== */
.msgbar { position: fixed; top: 0; left: 0; right: 0; height: 36px; z-index: 80; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 12px; background: #111827; color: #f3f4f6; font-size: 13px; line-height: 1.2; text-align: center; overflow: hidden; white-space: nowrap; }
.msgbar b { color: #fff; letter-spacing: .02em; }
.msgbar .sep { opacity: .5; }
.msgbar a { color: #c7d2fe; text-decoration: underline; margin-left: 6px; }
@media (prefers-color-scheme: dark) { .msgbar { background: #1f2a4a; } }
body.has-msgbar { padding-top: 36px; }
body.has-msgbar .side { top: 36px; height: calc(100vh - 36px); }
body.has-msgbar .topbar { top: 36px; }
body.has-msgbar .auth { min-height: calc(100vh - 36px); }
body.has-msgbar .demo-fab { bottom: 16px; }
@media (max-width: 900px) {
  body.has-msgbar .side { top: 0; height: 100vh; z-index: 90; }
  body.has-msgbar.nav-open .scrim { z-index: 85; }
  .msgbar .long { display: none; }
}
@media (max-width: 520px) { .msgbar { font-size: 12px; gap: 6px; } .msgbar .sep { display: none; } .msgbar span:not(.sep):not(.long) { overflow: hidden; text-overflow: ellipsis; } }
@media print { .msgbar { display: none; } body.has-msgbar { padding-top: 0; } }
.msgbar .t-short { display: none; }
@media (max-width: 520px) { .msgbar .t-full { display: none; } .msgbar .t-short { display: inline; } }

/* ===== checkboxes and on/off toggles ===== */
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; padding: 0; margin: 2px 0 0; flex: none; accent-color: var(--brand); vertical-align: middle; cursor: pointer; }
label:has(> input[type=checkbox]), label:has(> input[type=radio]) { display: flex; align-items: flex-start; gap: 9px; font-weight: 500; line-height: 1.4; cursor: pointer; margin-bottom: 8px; }
label:has(> input[type=checkbox]) input { margin-top: 1px; }
td > input[type=checkbox] { display: block; margin: 0; }
input.toggle, input[type=checkbox].toggle { -webkit-appearance: none; appearance: none; width: 42px; height: 24px; min-width: 42px; padding: 0; margin: 0; border-radius: 99px; flex: none; position: relative; background: var(--line); border: 0; transition: background .15s; cursor: pointer; }
input.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: left .15s; }
input.toggle:checked { background: var(--brand); }
input.toggle:checked::after { left: 21px; }
input.toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch-row > span { min-width: 0; }
