:root {
  --magenta: #771160;
  --magenta-600: #8e1a74;
  --magenta-50: #f7ecf4;
  --magenta-100: #eed5e8;
  --green: #00BF63;
  --green-50: #e3f8ed;
  --orange: #FF6B00;
  --orange-50: #fff0e5;
  --red: #d42a3c;
  --red-50: #fdeaec;
  --blue: #2563c9;
  --blue-50: #e8f0fc;
  --ink: #1d1220;
  --ink-2: #4a3f4d;
  --muted: #7d7280;
  --line: #e9e3e8;
  --bg: #f8f5f7;
  --card: #ffffff;
  --side: #1f0b1c;
  --side-2: #2e1229;
  --side-text: #d9c6d4;
  --side-muted: #b79bb0;
  --surface-2: #fcfafb;
  --track: #efe9ee;
  --line-strong: #d6c8d2;
  --focus: 0 0 0 3px rgba(119, 17, 96, .28);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --radius: 10px;
  --shadow: 0 1px 2px rgba(31, 11, 28, .06), 0 4px 16px rgba(31, 11, 28, .05);
  --display: "Cormorant Garamond", Georgia, serif;
  --body: "Barlow", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--body); font-size: 15px; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--magenta); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
h1, h2 { text-wrap: balance; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.nav a:focus-visible, .me:focus-visible { box-shadow: 0 0 0 2px rgba(255, 255, 255, .55); }
.num, .k-val, .kpi .k-val { font-variant-numeric: tabular-nums; }
.link-btn { border: 0; background: none; padding: 0; color: var(--magenta); font-weight: 600; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
[data-go], [data-act]:not(button):not(input):not(select) { cursor: pointer; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); letter-spacing: .06em; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--side); color: #e9dbe6; padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 22px; }
.brand-logo { height: 24px; width: auto; display: block; }
.brand-app { font-family: var(--display); font-size: 22px; font-weight: 700; color: #fff; line-height: 1; padding-left: 12px; margin-left: 2px; border-left: 1px solid rgba(255,255,255,.22); letter-spacing: .01em; }
.auth-art .brand-logo { height: 32px; }
.auth-art .brand-app { font-size: 28px; }
.brand-name { font-family: var(--display); font-size: 22px; font-weight: 700; color: #fff; line-height: 1; }
.brand-sub { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #b79bb0; margin-top: 3px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #d9c6d4; font-weight: 500; }
.nav a:hover { background: var(--side-2); text-decoration: none; color: #fff; }
.nav a.on { background: var(--magenta); color: #fff; }
.nav a .count { margin-left: auto; background: rgba(255,255,255,.14); border-radius: 99px; font-size: 12px; padding: 1px 8px; }
.nav a.on .count { background: rgba(255,255,255,.25); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #8f7489; padding: 14px 10px 6px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--side-2); padding-top: 12px; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.me:hover { background: var(--side-2); }
.me-name { color: #fff; font-weight: 600; font-size: 14px; }
.me-role { font-size: 12px; color: #b79bb0; text-transform: capitalize; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .search { flex: 1; max-width: 420px; position: relative; }
.topbar .search input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.topbar .search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; color: var(--muted); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 360px; overflow: auto; z-index: 30; }
.search-results a { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--ink); }
.search-results a:hover { background: var(--magenta-50); text-decoration: none; }
.icon-btn.menu-btn { display: none; }
.bell { position: relative; }
.bell .dot { position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; border-radius: 99px; background: var(--orange); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.page { padding: 26px 28px 60px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--display); font-size: 34px; font-weight: 700; line-height: 1.05; color: var(--ink); }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- elements ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--card); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: transform 160ms var(--ease-out), background-color 150ms ease, border-color 150ms ease; }
.btn:hover { border-color: var(--line-strong); background: var(--surface-2); }
.btn:active, .icon-btn:active, .chip:active { transform: scale(0.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--magenta); border-color: var(--magenta); color: #fff; }
.btn.primary:hover { background: var(--magenta-600); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--magenta-50); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }
.icon-btn { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); transition: transform 160ms var(--ease-out), background-color 150ms ease, color 150ms ease; }
.icon-btn:hover { background: var(--magenta-50); color: var(--magenta); }
.icon-btn svg { width: 20px; height: 20px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 10px; }
.card-h h2 { font-size: 15px; font-weight: 700; letter-spacing: .01em; }
.card-h .hint { font-size: 13px; color: var(--muted); }
.card-b { padding: 16px 18px; }
.card-b.flush { padding: 0; }
.grid { display: grid; gap: 18px; }
.grid > * { min-width: 0; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: 2fr 1fr; }
.g-side { grid-template-columns: minmax(0, 1fr) 360px; }
.g-job { grid-template-columns: 1.3fr 1fr 1fr; align-items: start; }
.tasks-t { min-width: 1120px; }
.tasks-t td:first-child { min-width: 240px; }
.tasks-t select.cell-input { min-width: 112px; }
.tasks-t input[type=date].cell-input { min-width: 138px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; }
.k-label, .kpi .k-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.kpi .k-val { font-size: 30px; font-weight: 700; margin-top: 6px; line-height: 1; }
.kpi .k-val small { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.kpi .k-note { font-size: 13px; color: var(--muted); margin-top: 6px; }
.kpis.minor { grid-template-columns: repeat(4, 1fr); gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.kpis.minor .kpi { border: 0; box-shadow: none; border-radius: 0; padding: 12px 18px; }
.kpis.minor .kpi + .kpi { border-left: 1px solid var(--line); }
.kpis.minor .k-val { font-size: 22px; }
.kpis.minor .k-note { margin-top: 3px; font-size: 12px; }
.kpi.alert .k-val { color: var(--red); }
.kpi.good .k-val { color: #009a50; }
.kpi.warn .k-val { color: var(--orange); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--track); color: var(--ink-2); }
.pill.magenta { background: var(--magenta-50); color: var(--magenta); }
.pill.green { background: var(--green-50); color: #00804a; }
.pill.orange { background: var(--orange-50); color: #c25200; }
.pill.red { background: var(--red-50); color: var(--red); }
.pill.blue { background: var(--blue-50); color: var(--blue); }
.pill.dotted::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; flex: none; background: var(--magenta); }
.avatar.lg { width: 34px; height: 34px; font-size: 13px; }
.avatar.empty { background: #e7e0e5; color: var(--muted); }
.who { display: inline-flex; align-items: center; gap: 8px; }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
table.t td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td, table.t tr.click:focus-visible td { background: var(--magenta-50); }
table.t tr.click:focus-visible { box-shadow: inset 3px 0 0 var(--magenta); }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

.ref { font-size: 12px; font-weight: 700; color: var(--magenta); letter-spacing: .03em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.overdue { color: var(--red); font-weight: 600; }
.soon { color: #c25200; font-weight: 600; }
.empty-state { padding: 34px 18px; text-align: center; color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 10px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .n { opacity: .65; margin-left: 4px; }

.progress { height: 6px; background: var(--track); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--magenta); border-radius: 99px; }
.progress.green > span { background: var(--green); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .help { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input { min-width: 0; width: 100%; border: 1px solid #ddd3da; background: #fff; border-radius: 8px; padding: 9px 11px; }
.input:focus, .cell-input:focus { outline: none; box-shadow: var(--focus); border-color: var(--magenta); }
.input:disabled { background: var(--surface-2); color: var(--ink-2); }
textarea.input { min-height: 84px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.cell-input { border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 5px 6px; width: 100%; min-width: 0; }
.cell-input:hover { border-color: var(--line); background: #fff; }
select.cell-input { cursor: pointer; }

/* ---------- modal & toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(31, 11, 28, .45); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade 150ms ease-out; }
.modal { background: var(--card); border-radius: 14px; width: 100%; max-width: 620px; max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 24px 64px rgba(31, 11, 28, .3); animation: pop 220ms var(--ease-out); }
.modal.wide { max-width: 820px; }
.modal-h { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-h h2 { font-family: var(--display); font-size: 26px; font-weight: 700; }
.modal-b { padding: 20px 22px; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 14px 14px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } }
#toast-root { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 500; max-width: 360px;
  transition: opacity 250ms var(--ease-out), transform 250ms var(--ease-out); }
@starting-style { .toast { opacity: 0; transform: translateY(12px); } }
.toast.leaving { opacity: 0; transform: translateY(6px); transition-duration: 150ms; }
.toast.err { background: var(--red); }

/* ---------- notifications ---------- */
.notif-panel { position: absolute; right: 0; top: calc(100% + 8px); width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 48px rgba(31,11,28,.18); z-index: 40; max-height: 70vh; display: flex; flex-direction: column; }
.notif-panel .list { overflow: auto; }
.notif { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif:hover { background: var(--magenta-50); }
.notif.unread { background: #fdf8fc; }
.notif.unread .n-title::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--orange); margin-right: 7px; vertical-align: middle; }
.n-title { font-weight: 600; font-size: 14px; }
.n-body { font-size: 13px; color: var(--muted); margin-top: 2px; }
.n-time { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---------- next steps ---------- */
.steps { list-style: none; margin: 0; padding: 0; }
.step { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.step:last-child { border-bottom: 0; }
.step-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--magenta-50); color: var(--magenta); }
.step-ico svg { width: 16px; height: 16px; }
.step.p1 .step-ico { background: var(--red-50); color: var(--red); }
.step.p2 .step-ico { background: var(--orange-50); color: #c25200; }
.step-text { flex: 1; min-width: 0; }
.step-title { font-weight: 600; font-size: 14px; }
.step-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.step .btn { margin-top: 2px; }

/* ---------- board ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { background: var(--track); border-radius: 12px; padding: 10px; min-height: 160px; }
.col.drop { outline: 2px dashed var(--magenta); outline-offset: -2px; background: var(--magenta-50); }
.col-h { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.jcard { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 8px; cursor: grab; box-shadow: 0 1px 2px rgba(31,11,28,.05); }
.jcard { transition: border-color 150ms ease, box-shadow 150ms ease; }
.jcard:hover, .jcard:focus-visible { border-color: var(--line-strong); box-shadow: 0 4px 14px rgba(31,11,28,.08); }
.jcard.dragging { opacity: .5; }
.jcard .t { font-weight: 600; margin: 4px 0 8px; line-height: 1.3; }
.jcard .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.jcard.urgent { border-left: 3px solid var(--red); }
.jcard.high { border-left: 3px solid var(--orange); }

/* ---------- stage stepper ---------- */
.stepper { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.stepper button { flex: 1; min-width: 96px; border: 0; background: var(--track); color: var(--ink-2); padding: 9px 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; cursor: pointer; clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); }
.stepper button:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); border-radius: 6px 0 0 6px; }
.stepper button.past { background: var(--magenta-100); color: var(--magenta); }
.stepper button.now { background: var(--magenta); color: #fff; }
.stepper button:hover:not(.now) { background: #e2d2de; }

/* ---------- bars ---------- */
.bars .bar-row { display: grid; grid-template-columns: 140px 1fr 40px; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; }
.bars .bar { height: 10px; background: var(--track); border-radius: 99px; overflow: hidden; display: flex; }
.bars .bar span { display: block; height: 100%; }
.bars .bar .a { background: var(--magenta); }
.bars .bar .b { background: var(--red); }
.bars .bar .c { background: var(--orange); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- comments & activity ---------- */
.comment { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: 0; }
.comment .c-body { white-space: pre-wrap; margin-top: 2px; }
.feed-item { display: flex; gap: 10px; padding: 9px 18px; font-size: 14px; border-bottom: 1px solid var(--line); }
.feed-item:last-child { border-bottom: 0; }
.feed-item .when { color: var(--muted); font-size: 12px; white-space: nowrap; margin-left: auto; }

/* ---------- gantt ---------- */
.gantt-wrap { overflow-x: auto; }
.gantt .bar-wrapper .bar { fill: #d7b8cf; }
.gantt .bar-wrapper .bar-progress { fill: var(--magenta); }
.gantt .bar-wrapper.done .bar { fill: #9fe3c0; }
.gantt .bar-wrapper.done .bar-progress { fill: var(--green); }
.gantt .bar-wrapper.late .bar { fill: #f5b3ba; }
.gantt .bar-wrapper.late .bar-progress { fill: var(--red); }
.gantt .bar-wrapper.review .bar-progress { fill: var(--orange); }
.gantt .today-highlight { fill: var(--orange-50); }
.gantt .bar-label { font-family: var(--body); font-weight: 600; }
.gantt-container .popup-wrapper .title { border-bottom-color: var(--magenta); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: var(--side); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art { background:
  radial-gradient(70% 60% at 85% 100%, rgba(119, 17, 96, .55), transparent 70%),
  radial-gradient(40% 40% at 10% 0%, rgba(255, 107, 0, .10), transparent 70%),
  var(--side); }
.auth-art::after { content: ""; position: absolute; right: -140px; bottom: -140px; width: 460px; height: 460px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.12); box-shadow: 0 0 0 70px rgba(119,17,96,.35), 0 0 0 140px rgba(119,17,96,.15); }
.auth-art > * { position: relative; z-index: 1; }
.auth-art h1 { font-family: var(--display); font-size: 56px; line-height: 1; font-weight: 700; max-width: 9em; }
.auth-art p { color: #cbb3c5; max-width: 30em; font-size: 17px; line-height: 1.5; }
.auth-form { display: grid; place-items: center; padding: 32px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h2 { font-family: var(--display); font-size: 34px; margin-bottom: 6px; }
.auth-box .stack > * + * { margin-top: 14px; }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--magenta-50); color: var(--magenta); font-size: 14px; }
.notice.warn { background: var(--orange-50); color: #a24400; }

/* ---------- getting started ---------- */
.setup { border-color: var(--magenta-100); }
.setup .step-ico { background: var(--track); color: var(--muted); }
.setup .step.done .step-ico { background: var(--green-50); color: #00804a; }
.setup .step.done .step-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }

/* ---------- invites ---------- */
.invite-grid { display: grid; grid-template-columns: 1.2fr 1.4fr 1fr 1fr 1.1fr 1fr auto; gap: 8px; align-items: center; }
.invite-grid .h { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .g-side, .g3, .g-job { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform 280ms cubic-bezier(0.32, 0.72, 0, 1); }
  .topbar { flex-wrap: wrap; }
  .topbar .search { order: 5; flex: 1 1 100%; max-width: none; }
  .kpis.minor { grid-template-columns: 1fr 1fr; }
  .kpis.minor .kpi:nth-child(3) { border-left: 0; }
  .kpis.minor .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  .invite-grid { grid-template-columns: 1fr 1fr; }
  .invite-grid .h { display: none; }
  .icon-btn { width: 40px; height: 40px; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(31,11,28,.4); }
  .icon-btn.menu-btn { display: grid; }
  .topbar .btn.primary span { display: none; }
  .topbar .btn.primary { padding: 8px 10px; }
  .topbar .search input { font-size: 14px; }
  .topbar { padding: 10px 16px; }
  .page { padding: 18px 16px 48px; }
  .g2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .notif-panel { position: fixed; left: 12px; right: 12px; width: auto; top: 60px; }
  .page-head h1 { font-size: 28px; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi .k-val { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-property: opacity, background-color, border-color, color !important; }
  .btn:active, .icon-btn:active, .chip:active { transform: none; }
}

/* ---------- finance ---------- */
.fin-chart { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; align-items: end; height: 200px; }
.fin-col { display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.fin-bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.fin-bars span { width: 38%; max-width: 26px; border-radius: 4px 4px 0 0; min-height: 2px; }
.fin-bars .b1 { background: var(--magenta-100); }
.fin-bars .b2 { background: var(--magenta); }
.fin-lbl { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-top: 6px; }
.fin-val { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.totals .tot-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; font-variant-numeric: tabular-nums; }
.totals .tot-row.grand { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 10px; font-weight: 700; font-size: 17px; }
.items-t textarea.cell-input { resize: vertical; min-height: 34px; font: inherit; line-height: 1.4; }
.items-t input.num { text-align: right; }

/* ---------- client-facing document ---------- */
.pub-wrap { min-height: 100vh; background: var(--bg); padding: 24px 16px 60px; }
.pub-actions { max-width: 820px; margin: 0 auto 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pub-doc { max-width: 820px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 48px 52px; color: var(--ink); font-size: 14px; line-height: 1.5; }
.pub-head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 26px; border-bottom: 3px solid var(--magenta); }
.pub-logo { height: 40px; width: auto; display: block; margin-bottom: 14px; }
.pub-co { color: var(--ink-2); font-size: 13px; }
.pub-co strong { color: var(--ink); font-size: 14px; }
.pub-meta { text-align: right; position: relative; }
.pub-type { font-family: var(--display); font-size: 34px; font-weight: 700; color: var(--magenta); line-height: 1; }
.pub-num { font-weight: 700; letter-spacing: .03em; margin: 6px 0 10px; }
.pub-meta table { margin-left: auto; border-collapse: collapse; font-size: 13px; }
.pub-meta td { padding: 2px 0 2px 14px; }
.pub-meta td:first-child { color: var(--muted); }
.pub-stamp { display: inline-block; margin-top: 12px; border: 2px solid var(--muted); color: var(--muted); border-radius: 6px; padding: 3px 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: 12px; transform: rotate(-4deg); }
.pub-stamp.paid { border-color: #00804a; color: #00804a; }
.pub-bill { padding: 22px 0; }
.pub-title { margin-top: 12px; font-weight: 600; font-size: 15px; }
.pub-items-wrap { overflow-x: auto; }
.pub-items { width: 100%; border-collapse: collapse; }
.pub-items th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--ink); }
.pub-items td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.pub-items .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pub-totals { margin: 16px 0 0 auto; width: min(340px, 100%); font-variant-numeric: tabular-nums; }
.pub-totals > div { display: flex; justify-content: space-between; padding: 6px 8px; }
.pub-totals .grand { border-top: 1px solid var(--ink); font-weight: 700; font-size: 16px; margin-top: 4px; padding-top: 10px; }
.pub-bank, .pub-notes { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); }
.pub-bank > div + div { margin-top: 4px; }
.pub-foot { margin-top: 40px; text-align: center; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 640px) {
  .pub-doc { padding: 22px 14px; font-size: 13px; }
  .pub-items th, .pub-items td { padding: 8px 4px; }
  .pub-type { font-size: 28px; }
  .pub-actions { justify-content: stretch; }
  .pub-actions .btn { flex: 1; justify-content: center; }
  .pub-head { flex-direction: column; }
  .pub-meta { text-align: left; }
  .pub-meta table { margin-left: 0; }
  .pub-meta td { padding: 2px 14px 2px 0; }
  .fin-chart { gap: 6px; }
}
@media print {
  @page { size: A4; margin: 14mm; }
  body, .pub-wrap { background: #fff !important; padding: 0 !important; }
  .no-print, #toast-root { display: none !important; }
  .pub-doc { border: 0; box-shadow: none; padding: 0; max-width: none; border-radius: 0; }
  .pub-items tr { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
