/* Business360 AI — neutral, charcoal, single quiet accent */
:root {
  --bg: #f5f4f1; --surface: #ffffff; --surface-2: #faf9f7; --line: #e6e3dd; --line-2: #d8d4cc;
  --ink: #1d1f23; --ink-2: #4a4e57; --muted: #7a7e87;
  --side: #1b1d21; --side-ink: #c9ccd2; --side-mute: #7f848d; --side-hover: #26292e;
  --accent: #1f6f6b; --accent-ink: #ffffff; --accent-soft: #e4f0ee;
  --ok: #2e7d4f; --ok-soft: #e5f2ea; --warn: #a2650d; --warn-soft: #fbf0dc; --bad: #b4372f; --bad-soft: #f9e5e3;
  --chart-a: #1f6f6b; --chart-b: #b9b3a6;
  --radius: 10px; --shadow: 0 1px 2px rgba(20,22,26,.05), 0 1px 1px rgba(20,22,26,.03);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 22px; letter-spacing: -.01em; margin: 2px 0 2px; font-weight: 650; }
h2, h3 { font-weight: 600; } h3 { font-size: 14px; margin: 18px 0 8px; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .danger { color: var(--bad); } .center { text-align: center; } .right { text-align: right; white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Shell ---------- */
.navtoggle { display: none; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 650; font-size: 15px; text-decoration: none !important; }
.brand em { font-style: normal; color: #8fc7c1; font-weight: 600; }
.brand.dark { color: var(--ink); padding: 0 0 8px; } .brand.dark em { color: var(--accent); }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: -.02em; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 10px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--side-ink); font-size: 13.5px; text-decoration: none; margin-bottom: 1px; }
.sidebar nav a svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.sidebar nav a:hover { background: var(--side-hover); color: #fff; }
.sidebar nav a.active { background: #2c3036; color: #fff; box-shadow: inset 2px 0 0 #8fc7c1; }
.sidebar nav a.planned { color: var(--side-mute); }
.sidebar nav a .phase { margin-left: auto; font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 99px; border: 1px solid #3a3e45; color: var(--side-mute); }
.sidebar-foot { padding: 12px 18px; font-size: 11px; color: var(--side-mute); border-top: 1px solid #2a2d32; }
.main { margin-left: 248px; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 28px; background: rgba(245,244,241,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.switcher select { font-weight: 600; min-width: 240px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.who { font-weight: 500; } .role { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 4px; }
.hamburger { display: none; cursor: pointer; } .hamburger svg { width: 22px; height: 22px; stroke: var(--ink); stroke-width: 2; fill: none; }
.scrim { display: none; }
.content { padding: 24px 28px 48px; max-width: 1320px; }

/* ---------- Common blocks ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 0; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; } .card-head.pad { padding: 14px 20px 0; }
.card-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); margin: 0 0 12px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.card.notice { background: var(--surface-2); border-style: dashed; box-shadow: none; }
.card.notice p { margin: 4px 0 0; }
.grid { display: grid; gap: 16px; } .grid > .card { margin-bottom: 0; } .grid { margin-bottom: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.two-1 { grid-template-columns: 1.4fr 1fr; } .grid.score-row { grid-template-columns: minmax(280px, .9fr) 1.6fr; }
.section-title { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 22px 0 8px; text-transform: uppercase; letter-spacing: .04em; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.flash.success { background: var(--ok-soft); border-color: #c7e2d1; color: #1f5a38; }
.flash.error { background: var(--bad-soft); border-color: #efc6c2; color: #8a2a24; }
.chip { display: inline-block; font-size: 11.5px; font-weight: 500; padding: 1px 8px; border-radius: 99px; background: #eeece7; color: var(--ink-2); white-space: nowrap; vertical-align: middle; }
.chip.ok { background: var(--ok-soft); color: var(--ok); } .chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); } .chip.muted { color: var(--muted); }
.chip.phase { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.chip.conf-none, .chip.conf-low { background: var(--warn-soft); color: var(--warn); } .chip.conf-medium { background: #eef0e3; color: #5d6420; } .chip.conf-high { background: var(--ok-soft); color: var(--ok); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }
.empty { color: var(--ink-2); } .empty p { margin: 0 0 6px; }
.empty-big { text-align: center; padding: 48px 20px; } .empty-big h2 { margin-top: 0; }
.note { color: var(--warn); }
.pre { white-space: pre-wrap; }
pre.code { background: var(--side); color: #e6e8eb; padding: 12px 14px; border-radius: 8px; overflow-x: auto; }
.pager { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 500 13.5px var(--font); padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); border-color: #c8c3b9; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); } .btn.primary:hover { background: #1a5f5b; }
.btn.ghost { background: transparent; } .btn.sm { padding: 4px 10px; font-size: 12.5px; } .btn.block { width: 100%; margin-top: 8px; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; } .linkbtn.danger { color: var(--bad); font-size: 12.5px; }
form.inline { display: inline; }
input, select, textarea { font: 14px var(--font); color: var(--ink); background: #fff; border: 1px solid var(--line-2); border-radius: 7px; padding: 7px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
input[type=month], .period select { width: auto; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; } fieldset[disabled] input, fieldset[disabled] select, fieldset[disabled] textarea { background: var(--surface-2); color: var(--ink-2); }
.form label { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 12px; }
.form label input, .form label select, .form label textarea { margin-top: 4px; }
.form label.check, label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--ink); font-size: 13.5px; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.fgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.fgrid .span2 { grid-column: span 2; } .fgrid .span3 { grid-column: 1 / -1; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 12px; } .checks legend { margin-bottom: 6px; color: var(--ink-2); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.inline-form { display: flex; gap: 8px; margin-top: 12px; } .inline-form.wrap { flex-wrap: wrap; } .inline-form input, .inline-form select { flex: 1 1 160px; width: auto; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 8px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg a { padding: 5px 12px; color: var(--ink-2); text-decoration: none; } .seg a.active { background: var(--ink); color: #fff; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
.data th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.data td { padding: 10px 14px; border-bottom: 1px solid #efede8; vertical-align: top; }
.data tbody tr:last-child td { border-bottom: 0; }
.data tr.archived td { color: var(--muted); } .data tr.sel td { background: #f3f8f7; }
.data.conn td:nth-child(2) { max-width: 260px; } .data.conn td:nth-child(3) { max-width: 340px; } .data.conn .chip { margin: 0 4px 4px 0; }
.card:not(.flush) .data { margin: 0 -4px; }
.kv td { padding: 5px 0; border-bottom: 1px solid #f0eee9; } .kv td:first-child { color: var(--ink-2); width: 45%; }
ul.rows { list-style: none; padding: 0; margin: 0; } ul.rows li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f0eee9; }

/* ---------- Dashboard ---------- */
.score-top { display: flex; justify-content: space-between; align-items: flex-start; }
.score-top p { margin: -8px 0 0; }
.score-num { font-size: 56px; font-weight: 650; letter-spacing: -.03em; line-height: 1.1; margin: 10px 0 12px; font-variant-numeric: tabular-nums; }
.score-num.na { font-size: 26px; letter-spacing: -.01em; margin: 22px 0 18px; }
.score-num small { font-size: 16px; color: var(--muted); font-weight: 500; margin-left: 4px; } .score-num.na { color: #b9b5ad; }
.coverage { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bar { flex: 1; height: 6px; background: #ece9e3; border-radius: 99px; overflow: hidden; } .bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.cats td { padding: 7px 0; border-bottom: 1px solid #f0eee9; } .cats tr:last-child td { border-bottom: 0; }
.na-pill { font-size: 11.5px; color: var(--muted); background: #f1efea; padding: 2px 8px; border-radius: 99px; }
details.drill > summary { list-style: none; cursor: pointer; } details.drill > summary::-webkit-details-marker { display: none; }
details.drill.inline > summary { display: inline; border-bottom: 1px dashed var(--line-2); }
.drill-body { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--ink-2); display: grid; gap: 3px; }
details.inline .drill-body { text-align: left; white-space: normal; max-width: 360px; margin-left: auto; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 16px; align-items: start; }
.kpis > .card { margin: 0; }
.kpi summary, .kpi.pending { display: flex; flex-direction: column; gap: 2px; }
.kpi:hover { border-color: var(--line-2); } .kpi[open] { border-color: var(--accent); }
.kpi-label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.kpi-val { font-size: 26px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-val.na { color: #b9b5ad; font-size: 20px; padding: 3px 0; }
.kpi.pending { background: var(--surface-2); box-shadow: none; border-style: dashed; }
.delta { font-size: 12px; font-weight: 500; color: var(--ink-2); } .delta.up { color: var(--ok); } .delta.down { color: var(--bad); }
.legend { font-size: 12px; color: var(--ink-2); } .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 5px 0 12px; vertical-align: -1px; }
.sw.rev, .chart .rev { background: var(--chart-a); fill: var(--chart-a); } .sw.spend, .chart .spend { background: var(--chart-b); fill: var(--chart-b); }
.chart { width: 100%; height: auto; max-height: 240px; } .chart .axis { stroke: var(--line-2); } .chart text { font-size: 11px; fill: var(--muted); }
ul.issues, ul.tasklist { list-style: none; margin: 0; padding: 0; }
ul.issues li, ul.tasklist li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid #f0eee9; }
ul.issues li > div, ul.tasklist li > div { flex: 1; } ul.issues p { margin: 2px 0 0; }
.sev { flex: none; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 5px; margin-top: 2px; background: #eeece7; color: var(--ink-2); }
.sev.critical { background: var(--bad); color: #fff; } .sev.high { background: var(--bad-soft); color: var(--bad); } .sev.medium { background: var(--warn-soft); color: var(--warn); } .sev.low { background: #eeece7; color: var(--ink-2); }
.foot { margin: 10px 0 0; }
.highlight { display: flex; flex-direction: column; gap: 4px; } .hl-name { font-size: 17px; }
.formulas dt { font-weight: 600; margin-top: 10px; display: flex; justify-content: space-between; gap: 8px; } .formulas dd { margin: 2px 0 0; color: var(--ink-2); font-size: 12.5px; }
.kpi-inline { font-variant-numeric: tabular-nums; color: var(--ink); }

/* ---------- Tasks ---------- */
.tasks { display: grid; gap: 8px; margin-bottom: 8px; }
.task { padding: 12px 16px; margin: 0; } .task summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; flex-wrap: wrap; }
.task summary::-webkit-details-marker { display: none; }
.task-title { font-weight: 500; flex: 1 1 240px; } .task .chip.st { text-transform: capitalize; }
.task.st-completed .task-title, .task.st-dismissed .task-title { color: var(--muted); text-decoration: line-through; }
.task-body { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); display: grid; gap: 4px; font-size: 13px; }
.add-task summary { cursor: pointer; } .add-task form { margin-top: 14px; }
.planned-card { max-width: 760px; } .planned-card .lede { font-size: 15px; color: var(--ink); margin-top: 0; } .planned-card ul { padding-left: 20px; }

/* ---------- Auth ---------- */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: 0 10px 30px rgba(20,22,26,.06); }
.auth-card.wide { max-width: 640px; } .auth-card h1 { margin: 10px 0 16px; }
.auth-card label { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 12px; } .auth-card label input { margin-top: 4px; }
.auth-card .kv { margin-bottom: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .grid.three { grid-template-columns: 1fr 1fr; } .grid.score-row, .grid.two-1 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .navtoggle:checked ~ .sidebar { transform: none; }
  .navtoggle:checked ~ .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
  .main { margin-left: 0; } .hamburger { display: inline-flex; }
  .topbar { padding: 0 16px; } .content { padding: 18px 16px 40px; }
  .switcher select { min-width: 0; max-width: 46vw; } .who .role, .who { display: none; }
  .grid.two, .grid.three { grid-template-columns: 1fr; } .fgrid { grid-template-columns: 1fr; } .fgrid .span2 { grid-column: auto; }
  /* tables → stacked cards */
  .data thead { display: none; } .data, .data tbody, .data tr, .data td { display: block; width: 100%; }
  .data tr { padding: 10px 14px; border-bottom: 1px solid var(--line); } .data td { border: 0; padding: 3px 0; text-align: left; white-space: normal; }
  .data td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 42%; color: var(--muted); font-size: 12px; }
  .data td.right { text-align: left; padding-top: 8px; } .data.conn td { max-width: none !important; }
  .score-num { font-size: 46px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; } .kpi-val { font-size: 21px; } .kpis .card { padding: 14px; }
}
