:root {
  --navy: #071A3D; --navy-2: #0E2A5C; --green: #00A878; --green-text: #007A57; --gold: #FFB323;
  --bg: #F5F7FA; --surface: #FFFFFF; --ink: #071A3D; --muted: #4A5A78; --faint: #7B88A1;
  --line: #DDE3EE; --line-2: #E9EDF4; --red: #C8341F; --red-bg: #FDECEA; --amber-bg: #FFF4DC; --amber: #8A5A00;
  --green-bg: #E3F6EF; --blue: #2C74C9; --blue-bg: #E6EFFA;
  --radius: 12px; --shadow: 0 1px 2px rgba(7,26,61,.06), 0 4px 16px rgba(7,26,61,.06);
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #06132B; --surface: #0C1F42; --ink: #E8EDF7; --muted: #A9B6CE; --faint: #7F8DA8;
    --line: #1E3360; --line-2: #172A51; --green-text: #34C99A; --red: #FF7A66; --red-bg: #3A1A1F;
    --amber-bg: #3A2E10; --amber: #FFC95A; --green-bg: #0E3A33; --blue: #7FB0F0; --blue-bg: #13305E;
    --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #06132B; --surface: #0C1F42; --ink: #E8EDF7; --muted: #A9B6CE; --faint: #7F8DA8;
  --line: #1E3360; --line-2: #172A51; --green-text: #34C99A; --red: #FF7A66; --red-bg: #3A1A1F;
  --amber-bg: #3A2E10; --amber: #FFC95A; --green-bg: #0E3A33; --blue: #7FB0F0; --blue-bg: #13305E;
  --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- layout */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--navy); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; text-decoration: none; }
.brand img { width: 36px; height: 36px; background: #fff; border-radius: 9px; padding: 4px; }
.brand b { display: block; font-size: 14px; font-weight: 800; line-height: 1.15; }
.brand span { font-size: 11px; color: #B4C0D8; }
.nav { padding: 6px 10px; display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; text-decoration: none; color: #D6DEED; font-weight: 600; font-size: 13.5px; }
.nav a svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: rgba(0,168,120,.18); color: #fff; box-shadow: inset 3px 0 0 var(--green); }
.nav .sep { height: 1px; background: rgba(255,255,255,.1); margin: 8px 6px; }
.side-foot { margin-top: auto; padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; color: #B4C0D8; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-foot button { background: none; border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 7px; padding: 4px 10px; cursor: pointer; font-size: 12px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }

.search { position: relative; flex: 1; max-width: 420px; }
.search input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; stroke: var(--faint); fill: none; stroke-width: 2; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; z-index: 30; }
.search-results a { display: flex; gap: 10px; padding: 9px 12px; text-decoration: none; }
.search-results a:hover, .search-results a.sel { background: var(--bg); }
.search-results .kind { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); width: 62px; flex: none; padding-top: 2px; }
.spacer { flex: 1; }
.timer { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-radius: 999px; background: var(--green-bg); color: var(--green-text); font-weight: 700; font-size: 13px; max-width: 340px; }
.timer .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse 1.6s infinite; flex: none; }
.timer .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--ink); }
@keyframes pulse { 50% { opacity: .35; } }
.content { padding: 24px 28px 48px; max-width: 1360px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--green-text); margin-bottom: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
:root[data-theme="dark"] .btn.primary { background: var(--green); border-color: var(--green); color: #04122B; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { background: var(--green); border-color: var(--green); color: #04122B; } }
.btn.primary:hover { filter: brightness(1.15); }
.btn.accent { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn { background: none; border: none; cursor: pointer; padding: 4px; border-radius: 6px; color: var(--muted); display: inline-flex; }
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); min-width: 0; }
textarea { resize: vertical; min-height: 72px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(0,168,120,.18); }
label.field { display: grid; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters select, .filters input { width: auto; min-width: 150px; padding: 7px 10px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: none; padding: 10px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--green); }
.seg { display: inline-flex; background: var(--line-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: none; background: none; padding: 6px 12px; border-radius: 7px; font-weight: 600; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(7,26,61,.1); }

/* ---------- cards & tables */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head a { font-size: 12px; font-weight: 600; color: var(--green-text); text-decoration: none; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; display: block; }
.kpi .k { font-size: 12px; font-weight: 600; color: var(--muted); }
.kpi .v { font-size: 26px; font-weight: 800; margin-top: 2px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi .s.bad { color: var(--red); font-weight: 600; }
.kpi.hero { background: var(--navy); border-color: var(--navy); color: #fff; position: relative; overflow: hidden; }
.kpi.hero .k, .kpi.hero .s { color: #B4C0D8; }
.kpi.hero::after { content: ""; position: absolute; right: -20px; top: 0; bottom: 0; width: 90px; background: linear-gradient(115deg, transparent 0 30%, var(--gold) 30% 42%, var(--green) 42% 100%); opacity: .85; clip-path: polygon(40% 0, 100% 0, 100% 100%, 0 100%); }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr.link { cursor: pointer; }
.tbl tbody tr.link:hover td { background: var(--bg); }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table-wrap .tbl th:first-child, .table-wrap .tbl td:first-child { padding-left: 16px; }
.table-wrap .tbl th:last-child, .table-wrap .tbl td:last-child { padding-right: 16px; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-2); text-decoration: none; min-width: 0; }
.list-item:last-child { border-bottom: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; background: var(--line-2); color: var(--muted); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.nodot::before { display: none; }
.b-green { background: var(--green-bg); color: var(--green-text); }
.b-blue { background: var(--blue-bg); color: var(--blue); }
.b-amber { background: var(--amber-bg); color: var(--amber); }
.b-red { background: var(--red-bg); color: var(--red); }
.b-navy { background: var(--navy); color: #fff; }
.pri { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.pri-urgent { color: var(--red); } .pri-high { color: var(--amber); } .pri-medium { color: var(--muted); } .pri-low { color: var(--faint); }
.due-over { color: var(--red); font-weight: 700; }
.due-soon { color: var(--amber); font-weight: 600; }
.line-chip { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.progress { height: 6px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; flex: none; }
:root[data-theme="dark"] .avatar { background: var(--green); color: #04122B; }

/* ---------- kanban */
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--line-2); border-radius: var(--radius); padding: 10px; min-height: 200px; display: flex; flex-direction: column; gap: 8px; }
.col.drag-over { outline: 2px dashed var(--green); outline-offset: -2px; }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 4px; font-weight: 700; font-size: 13px; }
.col-head .count { color: var(--faint); font-weight: 600; }
.tcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: grab; box-shadow: 0 1px 1px rgba(7,26,61,.04); }
.tcard:hover { border-color: var(--faint); }
.tcard.dragging { opacity: .45; }
.tcard .tt { font-weight: 600; margin-bottom: 6px; line-height: 1.35; }
.tcard .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.tcard .proj { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-card { border: 1px dashed var(--line); background: transparent; border-radius: 10px; padding: 8px; color: var(--muted); font-weight: 600; cursor: pointer; }
.add-card:hover { background: var(--surface); color: var(--ink); }

/* ---------- project cards */
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; display: flex; flex-direction: column; gap: 10px; }
.pcard:hover { border-color: var(--faint); box-shadow: var(--shadow); }
.pcard .top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.pcard .name { font-weight: 700; font-size: 15px; line-height: 1.3; }
.pcard .client { font-size: 12.5px; color: var(--muted); }
.pcard .stats { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* ---------- chart */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding-top: 18px; position: relative; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; position: relative; cursor: default; }
.bars .b i { display: block; width: 100%; max-width: 34px; background: var(--green); border-radius: 4px 4px 0 0; min-height: 2px; transition: filter .15s; }
.bars .b:hover i { filter: brightness(1.15); }
.bars .b span { font-size: 11px; color: var(--faint); white-space: nowrap; }
.bars .b em { position: absolute; bottom: calc(100% - 14px); font-style: normal; font-size: 11px; font-weight: 700; color: var(--ink); opacity: 0; transition: opacity .15s; white-space: nowrap; background: var(--surface); border: 1px solid var(--line); padding: 2px 6px; border-radius: 6px; pointer-events: none; }
.bars .b:hover em { opacity: 1; }
.bars.navy .b i { background: var(--navy-2); }
:root[data-theme="dark"] .bars.navy .b i { background: var(--blue); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bars.navy .b i { background: var(--blue); } }
.hbar { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; }
.hbar .track { height: 10px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--green); border-radius: 0 4px 4px 0; }
.hbar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lines-tbl td { padding: 8px 6px; }

/* ---------- modal */
.modal-bg { position: fixed; inset: 0; background: rgba(7,26,61,.45); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .12s; }
.modal { background: var(--surface); border-radius: 14px; width: min(620px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(7,26,61,.3); }
.modal.wide { width: min(920px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.modal-foot .left { margin-right: auto; }
.err { color: var(--red); font-size: 13px; font-weight: 600; margin-top: 10px; }
@keyframes fade { from { opacity: 0; } }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 10px; font-weight: 600; opacity: 0; transition: .2s; z-index: 200; pointer-events: none; }
#toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------- auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-art { background: var(--navy); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ""; position: absolute; right: -10%; top: 0; bottom: 0; width: 55%; background: linear-gradient(115deg, transparent 0 38%, var(--gold) 38% 46%, var(--green) 46% 62%, rgba(0,168,120,.16) 62% 100%); clip-path: polygon(34% 0, 100% 0, 100% 100%, 0 100%); opacity: .85; }
.auth-art > * { position: relative; z-index: 1; }
.auth-art .plate { background: #fff; border-radius: 14px; padding: 14px 18px; display: inline-block; }
.auth-art .plate img { height: 58px; display: block; }
.auth-art h1 { font-size: clamp(28px, 4vw, 42px); max-width: 14ch; margin-top: 32px; }
.auth-art h1 span { color: var(--gold); }
.auth-art p { color: #B4C0D8; max-width: 44ch; }
.auth-form { display: grid; place-items: center; padding: 32px 16px; }
.auth-form form { width: min(380px, 100%); display: grid; gap: 14px; }

/* ---------- document view */
.doc-paper { background: #fff; color: #071A3D; border: 1px solid var(--line); border-radius: var(--radius); padding: 40px 44px; max-width: 860px; }
.doc-paper .dh { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; padding-bottom: 20px; border-bottom: 3px solid #071A3D; position: relative; }
.doc-paper .dh::after { content: ""; position: absolute; left: 0; bottom: -3px; width: 120px; height: 3px; background: linear-gradient(90deg, #FFB323 0 30%, #00A878 30% 100%); }
.doc-paper .dh img { height: 64px; }
.doc-paper .co { text-align: right; font-size: 12px; color: #4A5A78; line-height: 1.6; }
.doc-paper .dtitle { font-size: 30px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; margin: 24px 0 4px; }
.doc-paper .meta-grid { display: grid; grid-template-columns: 1fr auto; gap: 24px; margin: 18px 0 24px; font-size: 13px; }
.doc-paper .meta-grid .lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #007A57; margin-bottom: 4px; }
.doc-paper .kv { display: grid; grid-template-columns: auto auto; gap: 4px 18px; }
.doc-paper .kv span:nth-child(odd) { color: #4A5A78; }
.doc-paper table { width: 100%; border-collapse: collapse; font-size: 13px; }
.doc-paper th { background: #071A3D; color: #fff; text-align: left; padding: 9px 10px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.doc-paper td { padding: 10px; border-bottom: 1px solid #DDE3EE; }
.doc-paper .r { text-align: right; font-variant-numeric: tabular-nums; }
.doc-paper .totals { margin-left: auto; width: min(320px, 100%); margin-top: 14px; font-size: 13px; }
.doc-paper .totals div { display: flex; justify-content: space-between; padding: 5px 10px; }
.doc-paper .totals .grand { background: #F5F7FA; font-weight: 800; font-size: 16px; border-top: 2px solid #071A3D; margin-top: 4px; padding: 10px; }
.doc-paper .notes { margin-top: 28px; font-size: 12.5px; color: #4A5A78; white-space: pre-wrap; }
.doc-paper .foot { margin-top: 36px; padding-top: 14px; border-top: 1px solid #DDE3EE; font-size: 12px; color: #4A5A78; display: flex; justify-content: space-between; gap: 12px; }
.doc-paper .foot b { color: #071A3D; }
.stamp { display: inline-block; border: 3px solid #00A878; color: #00A878; font-weight: 800; letter-spacing: .1em; padding: 4px 12px; border-radius: 8px; transform: rotate(-6deg); text-transform: uppercase; }
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.items-tbl input, .items-tbl select { padding: 7px 8px; }
.items-tbl td { padding: 4px; vertical-align: top; }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 20px; }
.detail-grid .k { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.detail-grid .v { font-weight: 600; margin-top: 2px; }

/* ---------- fixes */
.icon-btn.menu-btn { display: none; }
.search input[type=search] { padding-left: 36px; background: var(--bg); }
.kpi .v { font-size: 23px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .tbl-scroll { overflow-x: auto; margin: 0 -4px; }
.seg { max-width: 100%; overflow-x: auto; }
.seg button { flex: none; }

/* ---------- responsive */
@media (max-width: 1100px) {
  .g-main, .g3 { grid-template-columns: minmax(0, 1fr); }
  .doc-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(7,26,61,.4); }
  .icon-btn.menu-btn { display: inline-flex; }
  .list-item .badge, .list-item .pri { display: none; }
  .hide-sm { display: none; }
  .week-strip { grid-template-columns: repeat(7, 84px) !important; overflow-x: auto; }
  .topbar { padding: 10px 16px; }
  .content { padding: 18px 16px 40px; }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { padding: 28px 20px; min-height: 0; }
  .auth-art h1 { margin-top: 18px; }
  .doc-paper { padding: 22px 18px; }
  .doc-paper .dh { flex-direction: column; }
  .doc-paper .co { text-align: left; }
  .timer .lbl { display: none; }
  .hbar { grid-template-columns: minmax(0, 100px) minmax(0, 1fr) auto; }
}

/* ---------- print (quotes & invoices) */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; }
  .side, .topbar, .no-print, #toast { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  .doc-layout { display: block; }
  .doc-paper { border: none; padding: 0; max-width: none; }
  .doc-paper th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-paper .dh::after, .doc-paper .totals .grand { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
