/* C Square ERP - colours and type follow csquare.co: C Square red, navy, charcoal; Poppins with DM Serif Display titles */
:root {
  /* brand (csquare.co) */
  --brand: #f93822;      /* C Square red: marks, bars, highlights */
  --navy: #081835;       /* C Square navy: side panel, headers */
  --navy-2: #172a4d;     /* navy hover / lines on navy */
  --cream: #f2f1e5;
  /* "teal" is the action colour (kept as the variable name used across the screens): the red, one step darker for readable white text */
  --teal: #d92f19;
  --teal-600: #b8260f;
  --teal-50: #fff0ec;
  --link: #0b4a9e;       /* links: blue, so red stays for actions and alerts */
  --orange: #d9822b;
  --orange-50: #fdf2e4;
  --red: #b3261e;        /* danger: deeper than the brand red */
  --red-50: #fbe9e8;
  --green: #2f8a4c;
  --green-50: #e8f4ec;
  --ink: #2c2927;
  --ink-2: #5d6572;
  --ink-3: #8a929c;
  --line: #e3e6eb;
  --bg: #f2f5f7;
  --card: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(8, 24, 53, 0.06), 0 1px 1px rgba(8, 24, 53, 0.04);
  font-family: Poppins, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-family: 'DM Serif Display', Georgia, serif; font-size: 26px; margin: 0; font-weight: 400; letter-spacing: 0.1px; color: var(--navy); }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 600; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.right { text-align: right; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
@media (max-width: 1000px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } .span2 { grid-column: auto; } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #c9d2e3; display: flex; flex-direction: column; padding: 18px 12px; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 16px; padding: 4px 8px 18px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; font-size: 13px; letter-spacing: -0.5px; }
.nav-sec { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #8592ab; padding: 14px 10px 6px; }
.side a { color: #c9d2e3; padding: 8px 10px; border-radius: 8px; display: flex; align-items: center; gap: 8px; }
.side a:hover { background: var(--navy-2); text-decoration: none; }
.side a.active { background: var(--teal); color: #fff; }
.side .badge { margin-left: auto; }
.side-foot { margin-top: auto; padding: 10px; font-size: 12px; color: #a3aec4; border-top: 1px solid var(--navy-2); }
.main { padding: 24px 28px 48px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-2); font-size: 13px; margin-top: 2px; }

/* ---------- cards & tables ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--ink-2); background: #fafbfb; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr.click:hover { background: #f7fafa; cursor: pointer; }
.empty { padding: 28px; text-align: center; color: var(--ink-3); }
dl.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; margin: 0; }
dl.kv dt { color: var(--ink-2); }
dl.kv dd { margin: 0; }

/* ---------- KPI ---------- */
.kpi .label { color: var(--ink-2); font-size: 12px; }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.kpi .hint { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 110px; gap: 10px; align-items: center; margin: 8px 0; }
.bar-track { background: #eef2f3; border-radius: 6px; height: 22px; overflow: hidden; }
.bar-fill { background: var(--brand); height: 100%; border-radius: 6px; min-width: 2px; }
.bar-fill.won { background: var(--green); }

/* ---------- controls ---------- */
button, .btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 12px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
button:hover { border-color: #c4ced3; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
button.primary:hover { background: var(--teal-600); }
button.danger { color: var(--red); border-color: #efc9c6; }
button.ghost { border-color: transparent; background: transparent; }
button.sm { padding: 4px 9px; font-size: 12px; }
input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal-50); border-color: var(--teal); }
textarea { min-height: 70px; resize: vertical; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); font-weight: 500; }
label.field .req { color: var(--red); }
label.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
label.check input { width: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.search { max-width: 280px; }

/* ---------- pills ---------- */
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #eef2f3; color: var(--ink-2); white-space: nowrap; }
.pill.teal { background: var(--teal-50); color: var(--teal); }
.pill.orange { background: var(--orange-50); color: #a5650b; }
.pill.red { background: var(--red-50); color: var(--red); }
.pill.green { background: var(--green-50); color: var(--green); }
.pill.navy { background: #e6eaf2; color: var(--navy); }
/* priority: the same colours on every screen - critical solid red, high solid orange, medium blue, low grey */
.prio { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; letter-spacing: 0.02em; }
.prio::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.prio.CRITICAL { background: var(--red); color: #fff; }
.prio.HIGH { background: var(--orange); color: #fff; }
.prio.MEDIUM { background: #e7eefa; color: #1d4f9a; }
.prio.LOW { background: #eef1f4; color: var(--ink-2); }
tr.prio-CRITICAL > td:first-child { box-shadow: inset 4px 0 0 var(--red); }
tr.prio-HIGH > td:first-child { box-shadow: inset 4px 0 0 var(--orange); }
tr.prio-CRITICAL > td { background: #fdf4f3; }
.witem.prio-CRITICAL { border-left: 4px solid var(--red); }
.witem.prio-HIGH { border-left: 4px solid var(--orange); }
.badge { background: var(--orange); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 700; }

/* ---------- alerts / modal ---------- */
.alert { border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.alert.error { background: var(--red-50); color: var(--red); }
.alert.warn { background: var(--orange-50); color: #8a5408; }
.alert.ok { background: var(--green-50); color: var(--green); }
.backdrop { position: fixed; inset: 0; background: rgba(16, 32, 40, 0.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 12px; width: min(680px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25); }
.modal.wide { width: min(1040px, 100%); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- kanban ---------- */
.board { display: grid; grid-template-columns: repeat(6, minmax(168px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #eaeff1; border-radius: var(--radius); padding: 10px; min-height: 420px; display: flex; flex-direction: column; gap: 8px; transition: background 0.15s; }
.col.over { background: var(--teal-50); outline: 2px dashed var(--teal); }
.col-head { display: flex; align-items: baseline; gap: 6px; padding: 2px 4px 6px; }
.col-head .name { font-weight: 600; font-size: 13px; }
.col-head .sum { margin-left: auto; font-size: 12px; color: var(--ink-2); }
.deal { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; cursor: grab; box-shadow: var(--shadow); }
.deal:active { cursor: grabbing; }
.deal .t { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.deal .a { font-size: 12px; color: var(--ink-2); }
.deal .m { display: flex; gap: 6px; align-items: baseline; justify-content: space-between; margin-top: 8px; font-size: 13px; white-space: nowrap; }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 70px 1fr; gap: 10px; }
.timeline li:last-child { border-bottom: none; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, var(--navy) 0%, #13306b 100%); padding: 20px; }
.login { width: min(400px, 100%); background: #fff; border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
.login .brand { color: var(--navy); padding: 0 0 6px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { border: none; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 12px; color: var(--ink-2); }
.tabs button.on { color: var(--navy); border-bottom-color: var(--brand); }

/* ---------- notifications ---------- */
.notif-pop { position: absolute; left: 100%; bottom: 0; margin-left: 12px; width: 360px; max-height: 70vh; overflow: auto; background: #fff; color: var(--ink); border-radius: 10px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25); z-index: 40; }
.notif { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif:hover { background: #f6f9f9; }
.notif.unread { border-left: 3px solid var(--brand); }
.side-foot a.active, .side-foot a:hover { background: none; text-decoration: underline; }

/* ---------- projects ---------- */
.stepper { display: flex; gap: 0; margin: 4px 0 16px; overflow-x: auto; }
.stepper .st { flex: 1; min-width: 110px; padding: 8px 10px; background: #eef2f3; color: var(--ink-2); font-size: 12px; font-weight: 600; position: relative; text-align: center; }
.stepper .st:first-child { border-radius: 8px 0 0 8px; }
.stepper .st:last-child { border-radius: 0 8px 8px 0; }
.stepper .st.done { background: var(--teal-50); color: var(--teal); }
.stepper .st.now { background: var(--teal); color: #fff; }
.stepper .st.hold { background: var(--orange); color: #fff; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; }
.checks .ok { color: var(--green); font-weight: 700; }
.checks .no { color: var(--red); font-weight: 700; }
.checks .soft { color: #a5650b; font-weight: 700; }
.plan { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; }
.plan-table { overflow-x: auto; border-right: 1px solid var(--line); }
.plan-table table td, .plan-table table th { padding: 0 8px; height: 32px; vertical-align: middle; white-space: nowrap; font-size: 12.5px; }
.plan-table tr.sum td { font-weight: 700; background: #fafbfb; }
.plan-table tr.sel td { background: var(--teal-50); }
.plan-table td.nm { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.gantt { overflow-x: auto; position: relative; }
.gantt-head { height: 33px; border-bottom: 1px solid var(--line); position: relative; background: #fafbfb; font-size: 11px; color: var(--ink-2); }
.gantt-head span { position: absolute; top: 9px; white-space: nowrap; border-left: 1px solid var(--line); padding-left: 4px; height: 24px; }
.gantt-row { height: 32px; border-bottom: 1px solid var(--line); position: relative; }
.gantt-row .bar { position: absolute; top: 9px; height: 14px; border-radius: 4px; background: #fcb9b0; overflow: hidden; }
.gantt-row .bar .fill { background: var(--brand); height: 100%; }
.gantt-row .bar.sum { background: var(--navy); height: 8px; top: 12px; border-radius: 2px; }
.gantt-row .bar.late { background: #e7a6a1; }
.gantt-row .bar.late .fill { background: var(--red); }
.gantt-row .base { position: absolute; top: 24px; height: 4px; background: #c4ced3; border-radius: 2px; }
.gantt-row .ms { position: absolute; top: 9px; width: 13px; height: 13px; background: var(--navy); transform: rotate(45deg); margin-left: -6px; }
.gantt-row .ms.done { background: var(--green); }
.gantt .today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--orange); opacity: 0.7; z-index: 2; }
.heat td.h { text-align: center; font-size: 12px; font-weight: 600; }
.cr-board { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 12px; overflow-x: auto; }
@media print {
  .side, .no-print, .tabs { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  body, :root { background: #fff; }
}
.cert { max-width: 820px; margin: 0 auto; background: #fff; border: 2px solid var(--navy); padding: 40px 48px; }
.cert h1 { text-align: center; font-size: 26px; color: var(--navy); margin-bottom: 4px; }
.cert .sig { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 40px; }
.cert .sig div { border-top: 1px solid var(--ink); padding-top: 6px; font-size: 13px; }

/* ---------- client portal ---------- */
.portal { min-height: 100vh; }
.portal-head { display: flex; align-items: center; gap: 14px; background: var(--navy); color: #c9d2e3; padding: 10px 24px; flex-wrap: wrap; position: sticky; top: 0; z-index: 20; }
.portal-head .brand { color: #fff; font-size: 15px; }
.portal-org { color: #fff; font-weight: 600; padding-left: 12px; border-left: 1px solid var(--navy-2); }
.portal-head nav { display: flex; gap: 2px; flex-wrap: wrap; }
.portal-head a { color: #c9d2e3; padding: 6px 10px; border-radius: 8px; }
.portal-head a:hover { background: var(--navy-2); text-decoration: none; }
.portal-head a.active { background: var(--teal); color: #fff; }
.portal-bell .notif-pop { left: auto; right: 0; bottom: auto; top: 100%; margin: 8px 0 0; }
mark { background: #fff1c2; padding: 0 1px; }

.print-only { display: none; }
@media print { .print-only { display: block; } }

/* ---------- AI layer ---------- */
.ai-fab { position: fixed; right: 20px; bottom: 20px; z-index: 40; background: var(--navy); color: #fff; border-color: var(--navy); border-radius: 999px; padding: 10px 16px; box-shadow: 0 6px 18px rgba(8, 24, 53, 0.25); }
.ai-fab:hover { background: var(--navy-2); }
.ai-panel { position: fixed; right: 0; top: 0; bottom: 0; width: min(440px, 100vw); z-index: 45; background: #fff; border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(8, 24, 53, 0.12); display: flex; flex-direction: column; }
.ai-msgs { flex: 1; overflow: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-msg { border-radius: 10px; padding: 8px 11px; font-size: 13px; line-height: 1.45; max-width: 95%; }
.ai-msg.user { align-self: flex-end; background: var(--teal-50); white-space: pre-wrap; }
.ai-msg.assistant { align-self: flex-start; background: #f6f8f9; border: 1px solid var(--line); }
.ai-md p { margin: 0 0 6px; } .ai-md h4 { margin: 8px 0 4px; font-size: 13px; } .ai-md ul, .ai-md ol { margin: 0 0 6px; padding-left: 18px; }
.ai-md code { background: #eef2f3; border-radius: 4px; padding: 0 3px; font-size: 12px; }
.ai-pre { background: #f3f5f6; border: 1px solid var(--line); border-radius: 6px; padding: 8px; font-size: 11px; overflow: auto; white-space: pre; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; }
.ai-tip { position: absolute; top: 24px; transform: translateX(-10%); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 8px; padding: 8px 10px; font-size: 12px; pointer-events: none; min-width: 150px; }
@media print { .ai-fab, .ai-panel { display: none; } }
.miss { color: #a5650b; font-weight: 700; }

/* ---------- build 17: DR runbook / remediation documents ---------- */
.doc { max-width: 980px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 32px 40px; }
.doc h1 { font-size: 24px; color: var(--navy); margin: 0 0 4px; }
.doc h2 { font-size: 16px; color: var(--navy); margin: 26px 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--brand); display: flex; align-items: center; gap: 8px; }
.doc h3 { font-size: 13px; margin: 14px 0 6px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.doc table { font-size: 12px; margin-bottom: 8px; }
.doc table th, .doc table td { border: 1px solid var(--line); padding: 5px 7px; vertical-align: top; }
.doc table th { background: #f3f6f7; text-align: left; }
.doc ol.steps { padding-left: 20px; margin: 0; }
.doc ol.steps li { margin-bottom: 8px; }
.doc .meta { display: grid; grid-template-columns: 160px 1fr 160px 1fr; gap: 4px 12px; font-size: 12px; margin-top: 14px; }
.doc .meta dt { color: var(--ink-2); }
.doc .meta dd { margin: 0; }
.doc .edit { font-size: 11px; font-weight: 500; }
.doc .std { font-size: 10px; }
.doc pre.steps { white-space: pre-wrap; font-family: inherit; font-size: 12px; margin: 0; background: #f7f9fa; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.sev { display: inline-block; min-width: 64px; text-align: center; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 700; border: 1px solid transparent; }
.sev.CRITICAL { background: #f6d3d3; color: #7a1414; border-color: #e8a9a9; } .sev.HIGH { background: #fbe1dc; color: #9c2a1b; } .sev.MEDIUM { background: #fcebd2; color: #7d4c07; } .sev.LOW { background: #e1ecf7; color: #285a87; } .sev.INFO { background: #eef2f3; color: #55636b; }
@media print {
  .doc { border: none; padding: 0; max-width: none; }
  .doc .edit, .doc .std { display: none !important; }
  .doc h2 { break-after: avoid; }
  .doc table { break-inside: auto; } .doc tr { break-inside: avoid; }
  .sev { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- build 18/19: work boards and timesheets ---------- */
.witem { cursor: pointer; }
.witem:hover { border-color: #c3cad6; }
.avatar { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 10px; font-weight: 700; }
.pick { padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.pick:hover { background: var(--teal-50); }
table.sheet th, table.sheet td { padding: 6px 8px; }
table.sheet th.wkend, table.sheet td.wkend { background: #f6f8f9; }
table.sheet th.today { color: var(--teal); }
table.sheet tfoot td { border-top: 2px solid var(--line); background: #fafbfb; }
input.cell { width: 58px; text-align: right; padding: 4px 6px; border-color: transparent; background: transparent; }
input.cell:hover { border-color: var(--line); }
input.cell:focus { background: #fff; }
.cell-ro { display: inline-block; min-width: 40px; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: none; border-radius: 0; padding: 6px 12px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--teal); color: #fff; }

/* ---------- side panel: collapsible, foldable sections, search ---------- */
.shell { transition: grid-template-columns 0.15s; }
.shell.narrow { grid-template-columns: 64px 1fr; }
.side { position: sticky; top: 0; height: 100vh; z-index: 30; }
.side .brand { position: relative; padding-right: 30px; }
.nav-toggle { position: absolute; right: 0; top: 2px; background: transparent; border: 1px solid var(--navy-2); color: #c9d2e3; padding: 2px 7px; border-radius: 6px; font-size: 13px; }
.nav-toggle:hover { background: var(--navy-2); border-color: var(--navy-2); }
.side.collapsed { padding: 18px 8px; }
.side.collapsed .brand { flex-direction: column; padding: 4px 0 14px; gap: 8px; }
.side.collapsed .nav-toggle { position: static; }
.nav-search { position: relative; margin: 0 2px 6px; }
.nav-search input { background: var(--navy-2); border-color: transparent; color: #fff; padding: 6px 28px 6px 10px; font-size: 13px; }
.nav-search input::placeholder { color: #8592ab; }
.nav-search button { position: absolute; right: 2px; top: 1px; color: #a3aec4; padding: 4px 8px; }
.nav-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; scrollbar-color: var(--navy-2) transparent; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
button.nav-sec { all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #8592ab; padding: 14px 10px 6px; }
button.nav-sec:hover { color: #c9d2e3; }
button.nav-sec .chev { margin-left: auto; font-size: 10px; }
button.nav-sec .badge { margin-left: 0; text-transform: none; letter-spacing: 0; }
.nav-sep { height: 1px; background: var(--navy-2); margin: 8px 6px; }
.nav-ico { width: 18px; text-align: center; flex: none; }
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side.collapsed a { justify-content: center; padding: 8px 0; position: relative; }
.side.collapsed .badge.dot { position: absolute; top: 4px; right: 6px; width: 8px; height: 8px; padding: 0; min-width: 0; }
.side.collapsed .side-foot { padding: 10px 0; text-align: center; }
.side.collapsed .nav-label { display: none; }
.side.collapsed .side-foot button { padding: 4px 8px; }

/* build 21: chat */
.main:has(.chat) { padding: 0; }
.chat { display: grid; grid-template-columns: 300px 1fr; height: 100vh; background: var(--card); }
.chat-list { border-right: 1px solid var(--line); overflow-y: auto; background: #fafbfc; }
.chat-sec { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3); padding: 12px 14px 4px; font-weight: 600; }
.chat-room { all: unset; box-sizing: border-box; width: 100%; display: flex; gap: 10px; align-items: center; padding: 7px 12px; cursor: pointer; }
.chat-room:hover { background: #f0f2f6; }
.chat-room.on { background: var(--teal-50); box-shadow: inset 3px 0 0 var(--brand); }
.chat-room.unread .chat-room-name { font-weight: 700; color: var(--navy); }
.chat-room .badge { background: var(--brand); }
.chat-room-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.chat-room-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-room-last { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-ava { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: #e6eaf2; color: var(--navy); }
.chat-ava.k-DEPARTMENT { background: var(--navy); color: #fff; }
.chat-ava.k-EXTERNAL, .chat-ava.a-VISITOR { background: var(--orange-50); color: #a5650b; }
.chat-ava.a-BOT { background: #eef1f4; }
.chat-main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.chat-head { display: flex; gap: 8px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.chat-head h2 { font-family: 'DM Serif Display', Georgia, serif; font-weight: 400; font-size: 20px; color: var(--navy); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px 18px; }
.chat-msg { display: flex; gap: 10px; align-items: flex-start; padding: 2px 0; position: relative; }
.chat-msg:not(.grouped) { margin-top: 10px; }
.chat-msg.grouped { padding-left: 40px; }
.chat-msg.mention .chat-bubble { background: #fff7e6; border-radius: 6px; }
.chat-msg .chat-del { visibility: hidden; position: absolute; right: 0; top: 0; }
.chat-msg:hover .chat-del { visibility: visible; }
.chat-msg:hover { background: #fafbfc; }
.chat-bubble { min-width: 0; padding: 1px 4px; }
.chat-meta { font-size: 12px; }
.chat-meta b { color: var(--navy); margin-right: 6px; }
.chat-text { white-space: pre-wrap; word-wrap: break-word; line-height: 1.45; }
.chat-sys { text-align: center; font-size: 12px; color: var(--ink-3); margin: 10px 0; }
.chat-compose { border-top: 1px solid var(--line); padding: 10px 18px 12px; position: relative; }
.chat-compose textarea { flex: 1; resize: none; }
.chat-mentions { position: absolute; bottom: 100%; left: 18px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 4px; display: flex; flex-direction: column; z-index: 5; }
.chat-closed { padding: 14px 18px; border-top: 1px solid var(--line); }
@media (max-width: 860px) { .chat { grid-template-columns: 1fr; } .chat-list { max-height: 40vh; } }

/* .NET shell (phase 0): the same stylesheet as the React app (copied from apps/web/src/styles.css) plus these */
.net-banner { background: var(--cream); border: 1px solid #e6e2c8; color: var(--ink-2); font-size: 12px; padding: 6px 12px; border-radius: 8px; margin-bottom: 14px; }
.pill.net { margin-left: auto; background: var(--brand); color: #fff; font-size: 9px; padding: 1px 6px; }
.alert.err { background: var(--red-50); color: var(--red); padding: 8px 10px; border-radius: 8px; margin: 8px 0; font-size: 13px; }
.login .field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }

/* .NET: tabs and actions as links / forms (static pages) */
.tabs a { padding: 8px 12px; color: var(--ink-2); border-bottom: 2px solid transparent; text-decoration: none; }
.tabs a.on { color: var(--navy); border-bottom-color: var(--brand); }
.tabs a .badge { margin-left: 4px; }
form.inline { display: inline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 16px; background: var(--cream, #f2f1e5); padding: 8px 12px; border-radius: 8px; user-select: all; }
.checks label { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; }
.form-grid label.field > span { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 4px; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; }
a.btn { text-decoration: none; }
a.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
a.btn.primary:hover { background: var(--teal-600); }
.pager { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
details.diff summary { cursor: pointer; color: var(--link, #0b4a9e); font-size: 12px; }
details.diff pre { white-space: pre-wrap; font-size: 11px; background: #f6f8f9; padding: 6px; border-radius: 6px; max-width: 520px; }

/* .NET charts (server-rendered SVG) */
figure.chart { margin: 0; }
figure.chart figcaption { font-weight: 600; color: var(--navy); font-size: 13px; margin-bottom: 6px; }
figure.chart svg { width: 100%; height: auto; display: block; }
figure.chart .grid { stroke: #e6eaee; stroke-width: 1; }
figure.chart .ax { fill: #6b7785; font-size: 11px; font-family: inherit; }
figure.chart .val { fill: var(--ink, #2c2927); font-size: 10.5px; font-weight: 600; }
figure.chart .legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 4px; }
figure.chart .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
figure.bars .bar-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr 64px; gap: 8px; align-items: center; margin: 5px 0; font-size: 12.5px; }
figure.bars .bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
figure.bars .bar-track { background: #eef2f4; border-radius: 4px; height: 12px; overflow: hidden; display: block; }
figure.bars .bar-fill { display: block; height: 100%; border-radius: 4px; }
figure.bars .bar-val { text-align: right; font-variant-numeric: tabular-nums; }
.delta { font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.delta.good { color: var(--green, #1e7b4a); }
.delta.bad { color: var(--red, #b3261e); }
.delta.flat { color: var(--ink-2); }
.cmp td.num, .cmp th.num { text-align: right; font-variant-numeric: tabular-nums; }
.level-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; color: #fff; font-weight: 600; font-size: 12px; }
.progress { background: #eef2f4; border-radius: 999px; height: 10px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand, #f93822); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge-chip { display: inline-flex; gap: 6px; align-items: center; background: #fff4e5; border: 1px solid #f3d19c; color: #7a4a00; border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.badge-chip.off { background: #f4f6f8; border-color: #e1e6ea; color: #9aa5b1; }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.podium .card { text-align: center; }
.podium .rank { font-size: 26px; }
.rank-cell { font-weight: 700; color: var(--navy); width: 40px; }
@media (max-width: 760px) { .podium { grid-template-columns: 1fr; } }

/* ---------- dialer additions (buttons modifiers + layout) ---------- */
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-600); }
.btn.primary:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: transparent; color: #c9d2e3; }
.btn.ghost:hover { background: var(--navy-2); }
.content { padding: 22px 26px; }
@media (max-width: 1000px) { .shell { grid-template-columns: 1fr; } .side { flex-direction: row; flex-wrap: wrap; } }
