/* City of Bedford Project Hub. Blueprint blues for the engineering feel, safety amber for attention, green for done.
   Light and dark themes; every text color meets WCAG 2.1 AA contrast on its background. */
:root {
  --bg: #f3f6fa; --surface: #ffffff; --surface-2: #eef3f9; --line: #d5dfeb; --line-strong: #b6c5d8;
  --text: #13233a; --text-2: #3d5170; --muted: #5a6b84;
  --brand: #0f4c81; --brand-2: #1565a8; --brand-ink: #ffffff; --brand-soft: #e3eef9;
  --accent: #0d7c86; --ok: #166b2d; --ok-soft: #e3f4e8; --warn: #9a5b00; --warn-soft: #fff1d6; --bad: #b42318; --bad-soft: #fde8e6;
  --info-soft: #e4f1fb; --focus: #f2a900; --shadow: 0 1px 2px rgba(19,35,58,.06), 0 4px 16px rgba(19,35,58,.06);
  --radius: 10px; --radius-sm: 6px; --gantt-bar: #1565a8; --gantt-done: #1a7f37; --gantt-late: #b42318;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1724; --surface: #142133; --surface-2: #1a2a40; --line: #26384f; --line-strong: #36506f;
    --text: #e8eef7; --text-2: #c2cfe0; --muted: #9eb0c8; --brand: #6cb1ee; --brand-2: #8cc4f3; --brand-ink: #0b1a2b; --brand-soft: #1b3350;
    --accent: #4cc3cc; --ok: #5cc97a; --ok-soft: #173826; --warn: #f0b44c; --warn-soft: #3a2c12; --bad: #ff8a80; --bad-soft: #3e1d1b;
    --info-soft: #18304a; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); --gantt-bar: #6cb1ee; --gantt-done: #5cc97a; --gantt-late: #ff8a80; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1724; --surface: #142133; --surface-2: #1a2a40; --line: #26384f; --line-strong: #36506f;
  --text: #e8eef7; --text-2: #c2cfe0; --muted: #9eb0c8; --brand: #6cb1ee; --brand-2: #8cc4f3; --brand-ink: #0b1a2b; --brand-soft: #1b3350;
  --accent: #4cc3cc; --ok: #5cc97a; --ok-soft: #173826; --warn: #f0b44c; --warn-soft: #3a2c12; --bad: #ff8a80; --bad-soft: #3e1d1b;
  --info-soft: #18304a; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); --gantt-bar: #6cb1ee; --gantt-done: #5cc97a; --gantt-late: #ff8a80; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--brand-2); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5rem; }
h1 svg, h2 svg, h3 svg { width: 1.05em; height: 1.05em; flex: none; vertical-align: -0.15em; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--brand); color: var(--brand-ink); padding: .6rem 1rem; z-index: 100; }
.skip:focus { left: .5rem; top: .5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ---------- shell ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .75rem; padding: .55rem 1rem; background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow); }
.brand, .brand:visited { color: var(--brand-ink); }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; letter-spacing: .01em; white-space: nowrap; color: inherit; text-decoration: none; }
.brand svg { width: 28px; height: 28px; flex: none; }
.brand small { display: block; font-weight: 500; font-size: .72rem; opacity: .9; letter-spacing: .02em; }
.demo-badge { font-size: .68rem; font-weight: 700; letter-spacing: .06em; padding: .2rem .5rem; border-radius: 999px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.35); white-space: nowrap; }
:root[data-theme="dark"] .demo-badge { background: rgba(0,0,0,.12); border-color: rgba(0,0,0,.25); }
.topsearch { flex: 1; max-width: 520px; margin-left: auto; position: relative; }
.topsearch input, .topsearch input[type=search] { width: 100%; border: 0; border-radius: 999px; padding: .5rem .9rem .5rem 2.2rem; background: rgba(255,255,255,.95); color: #13233a; font: inherit; }
.topsearch svg { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: #3d5170; }
.top-actions { display: flex; align-items: center; gap: .35rem; }
.iconbtn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 999px; border: 0; background: transparent; color: inherit; cursor: pointer; }
.iconbtn:hover { background: rgba(255,255,255,.15); }
.iconbtn svg { width: 20px; height: 20px; }
.badge-dot { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #f2a900; color: #13233a; font-size: .7rem; font-weight: 800; display: grid; place-items: center; }
.userchip { display: flex; align-items: center; gap: .5rem; border: 0; background: rgba(255,255,255,.12); color: inherit; border-radius: 999px; padding: .25rem .7rem .25rem .25rem; cursor: pointer; font: inherit; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 800; background: #f2a900; color: #13233a; flex: none; }
.avatar.lg { width: 42px; height: 42px; font-size: .95rem; }
.userchip span.name { font-size: .85rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-toggle { display: none; }

.layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: calc(100vh - 54px); }
.sidenav { background: var(--surface); border-right: 1px solid var(--line); padding: .75rem .5rem; position: sticky; top: 54px; height: calc(100vh - 54px); overflow: auto; }
.sidenav a { display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; border-radius: 8px; color: var(--text-2); text-decoration: none; font-weight: 550; }
.sidenav a svg { width: 18px; height: 18px; flex: none; }
.sidenav a:hover { background: var(--surface-2); color: var(--text); }
.sidenav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.sidenav .navcount { margin-left: auto; font-size: .72rem; font-weight: 800; background: var(--warn-soft); color: var(--warn); border-radius: 999px; padding: 0 .45rem; }
.sidenav .section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .9rem .7rem .3rem; font-weight: 700; }
.persona { margin: .75rem .25rem 0; padding: .7rem; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2); font-size: .82rem; }
.persona label { font-weight: 700; display: block; margin-bottom: .3rem; }
.persona select { width: 100%; }
main:focus { outline: none; }
main { position: relative; padding: 1.25rem 1.5rem 3rem; min-width: 0; overflow-wrap: break-word; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; margin-bottom: 1rem; }
.page-head .grow { flex: 1; min-width: 220px; }
.eyebrow { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: .2rem; }
.sub { color: var(--muted); margin: .15rem 0 0; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; min-width: 0; }
.card + .card { margin-top: 1rem; }
.card h2, .card h3 { display: flex; align-items: center; gap: .5rem; }
.card-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; flex: 1; }
.grid { display: grid; gap: 1rem; }
.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)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: .8rem; font-weight: 600; }
.stat .value { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; margin-top: .1rem; }
.stat .hint { font-size: .78rem; color: var(--muted); }
.stat.warn .value { color: var(--warn); } .stat.bad .value { color: var(--bad); } .stat.ok .value { color: var(--ok); }
.top-gap { margin-top: 1rem; }
.muted { color: var(--muted); } .small { font-size: .84rem; } .nowrap { white-space: nowrap; } .right { text-align: right; } .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; } .row.end { justify-content: flex-end; } .spacer { flex: 1; }
.stack > * + * { margin-top: .75rem; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.empty { text-align: center; color: var(--muted); padding: 1.5rem 1rem; }
.notice { border-radius: var(--radius-sm); padding: .65rem .85rem; background: var(--info-soft); border: 1px solid var(--line); font-size: .9rem; }
.notice.warn { background: var(--warn-soft); } .notice.bad { background: var(--bad-soft); } .notice.ok { background: var(--ok-soft); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); border-radius: 8px; padding: .48rem .85rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.ok { color: var(--ok); border-color: var(--ok); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: .3rem .6rem; font-size: .84rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
label.field, .field { display: block; }
.field > span { display: block; font-size: .84rem; font-weight: 650; margin-bottom: .25rem; color: var(--text-2); }
.field .hint { font-weight: 400; color: var(--muted); font-size: .78rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], input[type=url], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: .48rem .6rem; }
textarea { min-height: 84px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; accent-color: var(--brand); vertical-align: middle; }
.choice { display: inline-flex; align-items: center; gap: .4rem; margin-right: 1rem; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.req { color: var(--bad); }
.err { color: var(--bad); font-size: .85rem; }
.tabs { position: relative; display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin: 0 0 1rem; overflow-x: auto; scrollbar-width: thin; }
.tabs a { padding: .55rem .8rem; color: var(--text-2); text-decoration: none; border-bottom: 3px solid transparent; font-weight: 600; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--brand); border-bottom-color: var(--brand); }
.chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); font-size: .84rem; font-weight: 600; cursor: pointer; text-decoration: none; }
.chip[aria-pressed="true"], .chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

/* ---------- data ---------- */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); padding: .55rem .7rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: .55rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.clickable { cursor: pointer; } table.data tr.clickable:hover td { background: var(--surface-2); }
table.data td.num, table.data th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 750; padding: .12rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; } .pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; } .pill.info { background: var(--info-soft); color: var(--brand); border-color: transparent; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--brand-2); border-radius: 999px; }
.bar.ok > i { background: var(--ok); } .bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); }
dl.kv { display: grid; grid-template-columns: fit-content(45%) minmax(0, 1fr); gap: .35rem 1rem; margin: 0; font-size: .9rem; }
dl.kv dt { color: var(--muted); font-weight: 600; overflow-wrap: anywhere; } dl.kv dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: .65rem 0; border-bottom: 1px solid var(--line); display: flex; gap: .7rem; align-items: flex-start; }
.list > li:last-child { border-bottom: 0; }
.list .meta { color: var(--muted); font-size: .8rem; }
.project-card { display: block; text-decoration: none; color: inherit; transition: border-color .15s; }
.project-card:hover { border-color: var(--brand-2); }
.project-card .code { font-size: .78rem; color: var(--muted); font-weight: 700; letter-spacing: .03em; }

/* ---------- tasks tree ---------- */
.tree td.title-cell { min-width: 280px; }
.tree .indent, .indent { display: inline-block; width: 0; }
.indent[data-indent="1"] { width: 18px; }
.indent[data-indent="2"] { width: 36px; }
.indent[data-indent="3"] { width: 54px; }
.indent[data-indent="4"] { width: 72px; }
.indent[data-indent="5"] { width: 90px; }
.indent[data-indent="6"] { width: 108px; }
.indent[data-indent="7"] { width: 126px; }
.indent[data-indent="8"] { width: 144px; }
.tree .toggle { border: 0; background: none; cursor: pointer; color: var(--muted); width: 22px; padding: 0; }
.tree .t-title { font-weight: 600; }
.tree tr.milestone .t-title::before { content: "\25C6  "; color: var(--accent); }
.tree tr.done .t-title { color: var(--muted); text-decoration: line-through; }
.tree select.inline, .tree input.inline { padding: .2rem .35rem; font-size: .84rem; width: auto; max-width: 140px; }

/* ---------- gantt ---------- */
.gantt-frame { display: grid; grid-template-columns: 300px minmax(0, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.gantt-frame .gantt-wrap { border: 0; border-radius: 0; border-left: 1px solid var(--line); }
.gantt-labels { display: block; overflow: hidden; }
@media (max-width: 860px) { .gantt-frame { grid-template-columns: 150px minmax(0, 1fr); } .gantt-labels { width: 150px; } }
.gantt-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.gantt { display: block; font: 12px system-ui, sans-serif; }
.gantt .grid-line { stroke: var(--line); } .gantt .month { fill: var(--muted); font-weight: 650; }
.gantt .label { fill: var(--text); } .gantt .label.parent { font-weight: 700; }
.gantt .bar-bg { fill: var(--brand-soft); } .gantt .bar-fill { fill: var(--gantt-bar); } .gantt .bar-done { fill: var(--gantt-done); } .gantt .bar-late { fill: var(--gantt-late); }
.gantt .ms { fill: var(--accent); } .gantt .today { stroke: var(--bad); stroke-width: 2; stroke-dasharray: 4 3; } .gantt .dep { stroke: var(--muted); fill: none; stroke-width: 1.2; }
.gantt .rowband { fill: var(--surface-2); }

/* ---------- calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal .dow { background: var(--surface-2); font-size: .74rem; font-weight: 750; text-transform: uppercase; color: var(--muted); padding: .4rem .5rem; border-bottom: 1px solid var(--line); }
.cal .day { min-height: 104px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .3rem .35rem; font-size: .78rem; min-width: 0; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day.other { background: var(--bg); color: var(--muted); }
.cal .day.today { box-shadow: inset 0 0 0 2px var(--brand-2); }
.cal .num { font-weight: 750; font-size: .8rem; }
.cal .item { display: block; margin-top: 2px; padding: 1px 5px; border-radius: 4px; background: var(--info-soft); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.cal .item.milestone { background: #d9f2f3; } :root[data-theme="dark"] .cal .item.milestone { background: #123a3d; }
.cal .item.event { background: var(--warn-soft); } .cal .item.late { background: var(--bad-soft); }
.cal-list { display: none; }

/* ---------- misc ---------- */
.chart { width: 100%; height: auto; }
.chart .b { fill: var(--brand-2); } .chart .t { fill: var(--text-2); font: 11px system-ui, sans-serif; } .chart .v { fill: var(--text); font: 600 11px system-ui, sans-serif; } .chart .g { stroke: var(--line); }
.msg { display: flex; gap: .65rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.msg:last-child { border-bottom: 0; }
.msg > div { min-width: 0; flex: 1; }
.msg .who { font-weight: 700; } .msg .when { color: var(--muted); font-size: .78rem; }
.msg .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.mention { color: var(--brand); font-weight: 700; }
mark { background: #ffe58f; color: #13233a; padding: 0 1px; border-radius: 2px; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 1rem; text-align: center; color: var(--muted); }
.folder-head { font-size: .78rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: .6rem .2rem .25rem; }
.filerow { display: flex; align-items: center; gap: .6rem; padding: .5rem .2rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.filerow .ficon { width: 32px; height: 32px; border-radius: 6px; display: grid; place-items: center; background: var(--surface-2); font-size: .66rem; font-weight: 800; color: var(--text-2); flex: none; }
.filerow .ficon.bb { background: #e7f0ff; color: #0f4c81; } :root[data-theme="dark"] .filerow .ficon.bb { background: #1b3350; color: #8cc4f3; }
.filerow .fname { font-weight: 650; overflow-wrap: anywhere; }
.steps { display: flex; gap: .35rem; flex-wrap: wrap; margin: .3rem 0; }
.step { font-size: .78rem; padding: .2rem .55rem; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text-2); }
.step.done { background: var(--ok-soft); color: var(--ok); border-color: transparent; } .step.current { background: var(--warn-soft); color: var(--warn); border-color: transparent; font-weight: 750; } .step.denied { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .3rem 1rem; }
.perm-grid label { display: flex; gap: .45rem; align-items: flex-start; font-size: .86rem; padding: .25rem 0; }
.builder-field { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .7rem; margin-bottom: .6rem; background: var(--surface-2); }
.manual { max-width: 880px; } .manual h2 { margin-top: 1.4rem; } .manual h3 { margin-top: 1rem; } .manual li { margin: .2rem 0; } .manual code { background: var(--surface-2); padding: 0 .3rem; border-radius: 4px; }
.manual table { border-collapse: collapse; } .manual td, .manual th { border: 1px solid var(--line); padding: .3rem .5rem; }

/* dialog, toasts, drawer */
dialog.modal { border: 0; border-radius: 14px; padding: 0; width: min(680px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog.modal::backdrop { background: rgba(10,20,35,.55); }
dialog.modal .m-head { display: flex; align-items: center; padding: 1rem 1.1rem .5rem; gap: .5rem; } dialog.modal .m-head h2 { margin: 0; flex: 1; }
dialog.modal .m-body { padding: .25rem 1.1rem 1rem; overflow: auto; max-height: calc(100vh - 10rem); }
dialog.modal .m-foot { padding: .75rem 1.1rem 1rem; display: flex; gap: .5rem; justify-content: flex-end; border-top: 1px solid var(--line); }
dialog.modal.wide { width: min(1000px, calc(100vw - 2rem)); }
.toasts { position: fixed; bottom: 1rem; right: 1rem; left: 1rem; z-index: 200; display: grid; gap: .5rem; justify-items: end; pointer-events: none; }
.toast { pointer-events: auto; max-width: min(380px, 100%) !important; background: var(--text); color: var(--bg); padding: .7rem 1rem; border-radius: 10px; box-shadow: var(--shadow); max-width: 380px; font-weight: 550; }
.toast.bad { background: var(--bad); color: #fff; }
.panel { position: fixed; top: 54px; right: 0; width: min(420px, 100vw); height: calc(100vh - 54px); background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow); z-index: 40; display: flex; flex-direction: column; }
.panel .p-head { display: flex; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--line); gap: .5rem; } .panel .p-head h2 { margin: 0; flex: 1; }
.panel .p-body { overflow: auto; padding: .5rem 1rem 1rem; flex: 1; }
.notif.unread { background: var(--info-soft); border-radius: 8px; padding-left: .5rem !important; }

/* sign-in */
.signin-wrap { min-height: calc(100vh - 54px); display: grid; place-items: center; padding: 2rem 1rem; background: radial-gradient(1200px 500px at 10% -10%, var(--brand-soft), transparent), var(--bg); }
.signin { width: min(440px, 100%); }
.signin .card { padding: 1.6rem; }
.or { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .8rem; margin: 1rem 0; } .or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.help-fab { position: fixed; right: 1rem; bottom: 1rem; z-index: 35; border-radius: 999px; box-shadow: var(--shadow); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidenav { position: fixed; left: 0; top: 54px; z-index: 45; width: 270px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidenav.open { transform: none; }
  .menu-toggle { display: inline-grid; }
  .topsearch { display: none; } .userchip span.name { display: none; } .brand small { display: none; }
  main { padding: 1rem 1rem 4rem; }
  .g2, .g3, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .topbar { gap: .35rem; padding: .5rem .6rem; }
  .brand { min-width: 0; flex: 1; font-size: .95rem; }
  .brand > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .userchip { padding: .2rem; }
  .iconbtn { width: 34px; height: 34px; }
  .card-head h2 { min-width: 0; }
  .cal { display: none; } .cal-list { display: block; }
  .demo-badge { display: none; }
}
@media (max-width: 520px) { .g4 { grid-template-columns: 1fr 1fr; } h1 { font-size: 1.25rem; } .stat .value { font-size: 1.2rem; } }
@media print { .topbar, .sidenav, .help-fab, .toasts { display: none !important; } .layout { display: block; } main { padding: 0; } .card { box-shadow: none; } }
