/* ===== Rise Care design system — every colour, size and space lives here ===== */
@font-face {
  font-family: "Onest";
  src: url("fonts/onest.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #EEF0F4;
  --surface: #FFFFFF;
  --surface-2: #F6F7FA;
  --surface-3: #E2E5EC;
  --line: #EEF0F4;
  --border: #DADDE6;
  --ink: #15172B;
  --ink-2: #222542;
  --ink-3: #2A2D4A;
  --ink-track: #2F3352;
  --ink-sub: #C7CAD9;
  --text: #15172B;
  --text-2: #3B3F55;
  --muted: #5E6378;

  --amber: #F2A93B;
  --amber-soft: #FFF0D4;  --amber-text: #8A5300;
  --rose: #C8264A;        --rose-dark: #9E1C3A;
  --red-soft: #FCE4E8;    --red-text: #A3203A;
  --blue-soft: #E3EAFB;   --blue-text: #2B4FA8;
  --green-soft: #DFF3E8;  --green-text: #1F7A4D;
  --pink-soft: #F9D8DF;
  --grey-soft: #EEF0F4;   --grey-text: #3B3F55;

  --r-xs: 10px; --r-sm: 12px; --r-md: 16px; --r-lg: 20px; --r-xl: 24px; --r-2xl: 28px; --r-pill: 999px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 28px;
  --font: "Onest", "Segoe UI", -apple-system, sans-serif;
  --fs-xs: 12px; --fs-sm: 13px; --fs: 14px; --fs-md: 15px; --fs-lg: 16px; --fs-h2: 20px; --fs-h1: 30px; --fs-stat: 32px; --fs-hero: 72px;
  --nav-w: 260px;
  --ctl-h: 44px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: var(--fs-md); color: var(--text); background: var(--bg); line-height: 1.5; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
a { color: var(--rose); }
a:hover { color: var(--rose-dark); }
h1, h2, h3 { margin: 0; }
h1 { font-size: var(--fs-h1); font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
h2 { font-size: var(--fs-h2); font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; }
h3 { font-size: var(--fs-lg); font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.hidden { display: none !important; }
.late { color: var(--red-text); font-weight: 600; }
svg { flex: none; }

.boot { display: grid; place-items: center; min-height: 100vh; }
.boot-msg { color: var(--muted); }

/* ===== Shell ===== */
.shell { display: flex; gap: var(--s5); padding: var(--s5); min-height: 100vh; align-items: flex-start; }
.nav { width: var(--nav-w); flex: none; background: var(--surface); border-radius: var(--r-xl); padding: var(--s5) var(--s4); display: flex; flex-direction: column; gap: var(--s5); align-self: stretch; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: -0.02em; line-height: 1.15; }
.brand-sub { font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }
.org-chip { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 14px; padding: 10px 12px; }
.org-chip .t { line-height: 1.25; min-width: 0; }
.org-chip .t div:first-child { font-weight: 600; font-size: var(--fs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-chip .t div:last-child { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 32px; height: 32px; border-radius: var(--r-xs); background: var(--blue-soft); color: var(--blue-text); font-weight: 700; font-size: var(--fs-sm); display: flex; align-items: center; justify-content: center; flex: none; }
.avatar.round { border-radius: var(--r-pill); }
.avatar.lg { width: var(--ctl-h); height: var(--ctl-h); font-size: var(--fs-md); }
.avatar.pink { background: var(--pink-soft); color: var(--rose-dark); }
.avatar.amber { background: var(--amber-soft); color: var(--amber-text); }
.avatar.green { background: var(--green-soft); color: var(--green-text); }

.nav-links { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs); }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: var(--s3) 12px var(--s1); font-weight: 600; }
.nav-links a { text-decoration: none; color: var(--text-2); border-radius: var(--r-sm); padding: 10px 12px; display: flex; align-items: center; gap: 10px; font-weight: 500; }
.nav-links a:hover { background: var(--bg); color: var(--ink); }
.nav-links a[aria-current="page"] { background: var(--ink); color: #FFFFFF; font-weight: 600; }

.next-card { background: var(--amber-soft); border-radius: 18px; padding: var(--s4); display: flex; flex-direction: column; gap: var(--s2); }
.next-card .lbl { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--amber-text); }
.next-card .ttl { font-weight: 700; font-size: var(--fs-md); line-height: 1.3; }
.next-card .sub { font-size: var(--fs-sm); color: #5E4A1E; }

.user-card { margin-top: auto; background: var(--bg); border-radius: var(--r-md); padding: var(--s3); display: flex; align-items: center; gap: 10px; }
.user-card .t { line-height: 1.25; min-width: 0; flex: 1; }
.user-card .t div:first-child { font-weight: 600; font-size: var(--fs); }
.user-card .t div:last-child { font-size: var(--fs-xs); color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--s5); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.topbar p { margin: var(--s1) 0 0; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.searchpill { display: flex; align-items: center; gap: var(--s2); background: var(--surface); border-radius: var(--r-pill); padding: 0 var(--s4); height: var(--ctl-h); min-width: 240px; margin: 0; font-weight: 400; }
.searchpill input { border: 0; background: transparent; font: inherit; font-size: var(--fs); width: 100%; padding: 0; height: 100%; }
.searchpill input:focus-visible { outline: none; }
.searchpill:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
.round-btn { width: var(--ctl-h); height: var(--ctl-h); border-radius: var(--r-pill); border: 0; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
.menu-btn { display: none; }

/* ===== Cards ===== */
.card { background: var(--surface); border-radius: var(--r-xl); padding: var(--s6); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); flex-wrap: wrap; }
.card-head a, .card-head .note { font-size: var(--fs-sm); }
.card-head .note { color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: var(--s5); align-items: flex-start; }
.row > .grow-2 { flex: 2 1 480px; min-width: 0; }
.row > .grow-1 { flex: 1 1 300px; min-width: 0; }

/* Hero */
.hero { flex: 2 1 480px; min-width: 0; background: var(--ink); color: #FFFFFF; border-radius: var(--r-2xl); padding: var(--s7); display: flex; flex-wrap: wrap; gap: var(--s6); align-items: center; justify-content: space-between; }
.hero-left { flex: 1 1 240px; display: flex; flex-direction: column; gap: var(--s3); }
.hero h2 { font-size: var(--fs-lg); font-weight: 600; color: var(--ink-sub); letter-spacing: 0; }
.hero .big { font-size: var(--fs-hero); font-weight: 800; letter-spacing: -0.04em; line-height: .95; }
.hero .big span { font-size: 36px; color: var(--amber); }
.hero p { margin: 0; color: var(--ink-sub); max-width: 38ch; }
.hero-right { flex: 0 1 300px; display: flex; flex-direction: column; gap: 14px; }
.hero-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); font-size: var(--fs-sm); }
.hero-tiles div { background: var(--ink-2); border-radius: var(--r-sm); padding: 10px 12px; color: var(--ink-sub); }
.hero-tiles strong { display: block; font-size: 18px; font-weight: 700; color: #FFFFFF; }
.btn-row { display: flex; gap: var(--s2); flex-wrap: wrap; }

/* Stat tiles */
.stat-grid { flex: 1 1 260px; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.stat { background: var(--surface); border-radius: var(--r-lg); padding: 18px; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; }
.stat .num { font-size: var(--fs-stat); font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.stat .lbl { font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }
.icon-tile { width: 36px; height: 36px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; flex: none; }
.icon-tile.lg { width: 44px; height: 44px; border-radius: 14px; }
.t-red { background: var(--red-soft); color: var(--red-text); }
.t-amber { background: var(--amber-soft); color: var(--amber-text); }
.t-blue { background: var(--blue-soft); color: var(--blue-text); }
.t-green { background: var(--green-soft); color: var(--green-text); }
.t-grey { background: var(--grey-soft); color: var(--grey-text); }

/* Action items */
.item { background: var(--surface-2); border-radius: var(--r-md); padding: var(--s4); display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.item .t { flex: 1 1 240px; min-width: 0; }
.item .t .ttl { font-weight: 600; }
.item .t .sub { font-size: var(--fs-sm); color: var(--muted); }

/* Date blocks */
.dated { display: flex; gap: 14px; align-items: center; }
.datebox { width: 48px; height: 52px; border-radius: 14px; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05; flex: none; }
.datebox b { font-size: 18px; font-weight: 800; }
.datebox span { font-size: 11px; font-weight: 600; color: var(--muted); }
.datebox.warn { background: var(--amber-soft); color: var(--amber-text); }
.datebox.warn span { color: var(--amber-text); }
.datebox.bad { background: var(--red-soft); color: var(--red-text); }
.datebox.bad span { color: var(--red-text); }
.dated .ttl { font-weight: 600; font-size: var(--fs); }
.dated .sub { font-size: var(--fs-sm); color: var(--muted); }

/* Progress */
.bar { height: 10px; background: var(--bg); border-radius: var(--r-pill); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ink); border-radius: var(--r-pill); width: 0; }
.bar.done > i { background: var(--green-text); }
.bar.mid > i { background: var(--amber); }
.phase-row { display: grid; grid-template-columns: minmax(200px, 1.3fr) 2fr 56px; gap: var(--s4); align-items: center; padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.phase-row:last-child { border-bottom: 0; }
.phase-row a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: var(--fs); }
.phase-row a:hover { color: var(--rose); }
.phase-row .pct { text-align: right; font-weight: 700; font-size: var(--fs); }
.phase-row .meta { font-size: var(--fs-xs); color: var(--muted); }

/* Chips */
.chip { display: inline-block; padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; background: var(--grey-soft); color: var(--grey-text); }
.chip.green { background: var(--green-soft); color: var(--green-text); }
.chip.amber { background: var(--amber-soft); color: var(--amber-text); }
.chip.red { background: var(--red-soft); color: var(--red-text); }
.chip.blue { background: var(--blue-soft); color: var(--blue-text); }
.chip.purple { background: var(--pink-soft); color: var(--rose-dark); }
.chip.ink { background: var(--ink); color: #FFFFFF; }
.chip.flag::before { content: "◆ "; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--line); align-items: baseline; font-size: var(--fs); }
.list li:last-child { border-bottom: 0; }
.list .t { min-width: 0; font-weight: 500; }
.list .d { white-space: nowrap; font-size: var(--fs-sm); color: var(--muted); }
.list .d.late { color: var(--red-text); font-weight: 600; }
.empty { color: var(--muted); padding: var(--s2) 0; font-size: var(--fs); }

.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.doc-tile { border: 0; border-radius: 14px; padding: var(--s3) 14px; display: flex; justify-content: space-between; gap: var(--s2); align-items: center; font-size: var(--fs-sm); font-weight: 600; background: var(--surface-2); cursor: pointer; text-align: left; font-family: inherit; color: inherit; }
.doc-tile:hover { background: var(--bg); }

.clock { display: flex; justify-content: space-between; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--line); font-size: var(--fs); align-items: center; }
.clock:last-child { border-bottom: 0; }

/* ===== Toolbar & tables ===== */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .grow { flex: 1; }
.toolbar select { height: var(--ctl-h); border: 0; border-radius: var(--r-pill); padding: 0 36px 0 var(--s4); width: auto; min-width: 150px; font-size: var(--fs); font-weight: 500; appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235E6378' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center; }
.count { color: var(--muted); font-size: var(--fs-sm); }
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--r-xl); padding: var(--s2); }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs); }
table.data th { text-align: left; font-weight: 600; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: var(--s3) 14px; white-space: nowrap; }
table.data th button { all: unset; cursor: pointer; }
table.data th button:focus-visible { outline: 2px solid var(--ink); border-radius: 4px; }
table.data td { padding: 14px; border-top: 1px solid var(--line); vertical-align: top; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data tbody tr:hover td:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
table.data tbody tr:hover td:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
table.data tbody tr:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
td.wrap { min-width: 260px; font-weight: 600; }
td .late { color: var(--red-text); font-weight: 600; }

/* ===== Buttons & forms ===== */
button, .btn { font-family: inherit; font-size: var(--fs); border-radius: var(--r-sm); padding: 10px var(--s4); border: 1px solid var(--border); background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); line-height: 1.3; }
button:hover, .btn:hover { background: var(--surface-2); color: var(--ink); }
button.primary, .btn.primary { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }
button.primary:hover, .btn.primary:hover { background: var(--ink-3); color: #FFFFFF; }
button.accent, .btn.accent { background: var(--amber); border-color: var(--amber); color: var(--ink); font-weight: 700; }
button.accent:hover, .btn.accent:hover { filter: brightness(1.04); background: var(--amber); }
.btn.dark { background: var(--ink-3); border-color: var(--ink-3); color: #FFFFFF; }
.btn.dark:hover { background: var(--ink-track); color: #FFFFFF; }
button.rose { background: var(--rose); border-color: var(--rose); color: #FFFFFF; font-weight: 700; }
button.danger { color: var(--red-text); border-color: var(--red-soft); background: var(--surface); }
button.danger:hover { background: var(--red-soft); color: var(--red-text); }
button.link-btn { border: 0; background: transparent; padding: var(--s1) 0; color: var(--muted); font-size: var(--fs-xs); justify-content: flex-start; }
button.link-btn:hover { background: transparent; color: var(--rose); }
button:disabled { opacity: .55; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, .btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

input, select, textarea { font-family: inherit; font-size: var(--fs); padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--text); width: 100%; }
textarea { min-height: 96px; resize: vertical; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--ink); padding: 0; flex: none; }
label { display: block; font-weight: 600; font-size: var(--fs-sm); margin-bottom: 6px; color: var(--text-2); }
.field { margin-bottom: var(--s4); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); margin-top: 6px; font-weight: 400; }
.field.check label { display: flex; gap: 10px; align-items: center; font-size: var(--fs); color: var(--ink); margin-top: 30px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s5); }
.form-grid .full { grid-column: 1 / -1; }
.ro-value { padding: 10px 14px; white-space: pre-wrap; background: var(--surface-2); border-radius: var(--r-sm); min-height: 42px; font-size: var(--fs); }
.multi { background: var(--surface-2); border-radius: var(--r-sm); max-height: 180px; overflow-y: auto; padding: var(--s2) var(--s3); }
.multi label { font-weight: 500; display: flex; gap: 10px; align-items: center; margin: 0; padding: 5px 0; color: var(--ink); font-size: var(--fs); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: var(--fs-sm); margin-bottom: 6px; padding: 0; color: var(--text-2); }
.fs-group { margin-bottom: var(--s6); }
.fs-group > legend { font-size: var(--fs-lg); font-weight: 700; color: var(--ink); margin-bottom: var(--s4); letter-spacing: -0.01em; }
.form-error { background: var(--red-soft); color: var(--red-text); padding: 10px 14px; border-radius: var(--r-sm); margin-bottom: var(--s4); font-size: var(--fs); font-weight: 500; }
.notice { background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 14px; font-size: var(--fs-sm); color: var(--muted); margin-bottom: var(--s4); }

/* ===== Modal ===== */
.modal { border: 0; border-radius: var(--r-xl); padding: 0; width: min(780px, 94vw); max-height: 90vh; background: var(--surface); color: var(--text); box-shadow: 0 30px 70px -20px rgba(21, 23, 43, .45); }
.modal::backdrop { background: rgba(21, 23, 43, .5); }
.modal form { display: flex; flex-direction: column; max-height: 90vh; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s4); padding: var(--s6) var(--s6) var(--s4); }
.modal-head .kicker { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: var(--s1); }
.modal-body { padding: 0 var(--s6) var(--s4); overflow-y: auto; }
.modal-foot { display: flex; justify-content: space-between; gap: var(--s2); padding: var(--s4) var(--s6) var(--s6); border-top: 1px solid var(--line); }
.modal-foot .right { display: flex; gap: var(--s2); margin-left: auto; }
.icon-btn { width: 40px; height: 40px; border-radius: var(--r-pill); border: 0; background: var(--bg); padding: 0; color: var(--ink); flex: none; }
.icon-btn:hover { background: var(--surface-3); }

/* ===== Auth ===== */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--s5); }
.auth-card { width: min(440px, 100%); background: var(--surface); border-radius: var(--r-2xl); padding: 36px; }
.auth-card .brand { padding: 0; margin-bottom: var(--s6); }
.auth-card h1 { font-size: 26px; margin-bottom: var(--s1); }
.auth-card p { margin: 0 0 var(--s6); color: var(--muted); }
.auth-card button[type="submit"] { width: 100%; margin-top: var(--s2); padding: 13px; }
.auth-card code { background: var(--bg); padding: 1px 6px; border-radius: 6px; font-size: var(--fs-sm); }

/* ===== Toast ===== */
.toast { position: fixed; bottom: var(--s6); right: var(--s6); background: var(--ink); color: #FFFFFF; padding: var(--s3) 18px; border-radius: 14px; font-size: var(--fs); font-weight: 600; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none; z-index: 1000; }
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--rose); }

/* ===== Gantt ===== */
.gantt { background: var(--surface); border-radius: var(--r-xl); overflow-x: auto; padding: var(--s2); }
.g-inner { position: relative; min-width: 900px; }
.g-row { display: grid; grid-template-columns: 300px 1fr; min-height: 38px; border-top: 1px solid var(--line); }
.g-row.g-head { border-top: 0; }
.g-label { padding: 9px 14px; font-size: var(--fs-sm); position: sticky; left: 0; background: var(--surface); z-index: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-row.phase .g-label { font-weight: 700; font-size: var(--fs); }
.g-label button { all: unset; cursor: pointer; }
.g-label button:focus-visible { outline: 2px solid var(--ink); border-radius: 4px; }
.g-track { position: relative; }
.g-head .g-track { display: flex; }
.g-month { flex: 0 0 auto; font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: var(--s3) var(--s1); white-space: nowrap; overflow: hidden; border-left: 1px solid var(--line); }
.g-bar { position: absolute; top: 10px; height: 18px; border-radius: var(--r-pill); background: var(--blue-text); min-width: 6px; cursor: pointer; border: 0; padding: 0; }
.g-bar:hover { filter: brightness(1.1); background: var(--blue-text); }
.g-row.phase .g-bar { background: var(--ink); }
.g-bar.complete, .g-bar.complete:hover { background: var(--green-text); }
.g-bar.blocked, .g-bar.blocked:hover { background: var(--rose); }
.g-bar.late, .g-bar.late:hover { background: var(--amber); }
.g-ms { position: absolute; top: 12px; width: 14px; height: 14px; transform: rotate(45deg); background: var(--rose); cursor: pointer; border: 0; padding: 0; border-radius: 3px; }
.g-ms.complete, .g-ms.complete:hover { background: var(--green-text); }
.g-ms:hover { background: var(--rose-dark); }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--amber); z-index: 1; pointer-events: none; }
.legend { display: flex; gap: var(--s4); flex-wrap: wrap; font-size: var(--fs-sm); color: var(--muted); align-items: center; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: var(--r-pill); margin-right: 6px; vertical-align: -1px; }
.legend .l-task { background: var(--blue-text); } .legend .l-done { background: var(--green-text); } .legend .l-late { background: var(--amber); } .legend .l-block { background: var(--rose); } .legend .l-ms { background: var(--rose); border-radius: 3px; transform: rotate(45deg); } .legend .l-phase { background: var(--ink); } .legend .l-today { background: var(--amber); width: 3px; border-radius: 0; }

/* ===== Timeline ===== */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.timeline li { display: flex; gap: 14px; align-items: flex-start; background: var(--surface-2); border-radius: var(--r-md); padding: 14px var(--s4); }
.timeline .tl-body { min-width: 0; flex: 1; }
.timeline .what { font-weight: 600; }
.timeline .what a { color: var(--ink); text-decoration: none; }
.timeline .what a:hover { color: var(--rose); }
.timeline .meta { font-size: var(--fs-sm); color: var(--muted); }
.timeline .detail { font-size: var(--fs-sm); white-space: pre-wrap; color: var(--text-2); margin-top: 6px; }
.tl-month { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: var(--s2) var(--s1) 0; }

.seg { display: inline-flex; background: var(--surface); border-radius: var(--r-pill); padding: 4px; gap: 2px; }
.seg button { border: 0; border-radius: var(--r-pill); padding: 8px var(--s4); background: transparent; color: var(--text-2); font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #FFFFFF; }
.toggle { display: inline-flex; align-items: center; gap: var(--s2); background: var(--surface); border-radius: var(--r-pill); height: var(--ctl-h); padding: 0 var(--s4); margin: 0; font-size: var(--fs); font-weight: 500; color: var(--ink); cursor: pointer; }

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .shell { padding: var(--s3); gap: var(--s3); }
  .nav { position: fixed; z-index: 60; top: var(--s3); left: var(--s3); max-height: calc(100vh - 2 * var(--s3)); overflow-y: auto; transform: translateX(calc(-100% - 20px)); transition: transform .2s; box-shadow: 0 30px 60px -20px rgba(21, 23, 43, .4); }
  .nav.open { transform: none; }
  .menu-btn { display: inline-flex; }
  h1 { font-size: 24px; }
  .hero .big { font-size: 56px; }
  .searchpill { min-width: 0; flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .field.check label { margin-top: 0; }
  .phase-row { grid-template-columns: 1fr 48px; }
  .phase-row .bar { grid-column: 1 / -1; grid-row: 2; }
}

@media print {
  .nav, .toolbar, .menu-btn, .topbar-right { display: none !important; }
  body { background: #FFFFFF; }
}

a.stat { text-decoration: none; color: inherit; }
a.stat:hover { background: var(--surface-2); color: inherit; }
a.plain { color: var(--ink); text-decoration: none; }
a.plain:hover { color: var(--rose); }
.toolbar .searchpill { min-width: 260px; }

/* ===== Files, related records, boards ===== */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.small-btn { padding: 6px 12px; font-size: var(--fs-sm); border-radius: var(--r-xs); }
label.btn.small-btn { margin: 0; color: var(--ink); font-weight: 600; cursor: pointer; }
label.btn.small-btn:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
.files-block, .rel { background: var(--surface-2); border-radius: var(--r-md); padding: 14px var(--s4); margin-bottom: var(--s3); }
.files-head, .rel-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); }
.files-head .flabel { font-weight: 700; font-size: var(--fs); }
.rel-head h3 { font-size: var(--fs); }
.file-list { display: flex; flex-direction: column; gap: var(--s2); margin-top: 10px; }
.file-item { display: flex; align-items: center; gap: var(--s3); background: var(--surface); border-radius: var(--r-sm); padding: var(--s2) 10px; }
.file-item .t { flex: 1; min-width: 0; font-size: var(--fs); }
.file-item .t a { font-weight: 600; word-break: break-all; }
.file-item .sub { font-size: var(--fs-xs); color: var(--muted); }
.file-thumb { width: 48px; height: 48px; object-fit: cover; border-radius: var(--r-xs); flex: none; background: var(--bg); }
.icon-btn.confirm { background: var(--red-soft); color: var(--red-text); }
.rel-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.rel-item { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); width: 100%; text-align: left; background: var(--surface); border: 0; border-radius: var(--r-sm); padding: 10px var(--s3); font-weight: 500; }
.rel-item:hover { background: var(--bg); }
.rel-item .t { min-width: 0; display: flex; flex-direction: column; }
.rel-item .t .sub { font-size: var(--fs-xs); color: var(--muted); font-weight: 400; }
.rel-item .meta { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; justify-content: flex-end; font-size: var(--fs-sm); color: var(--muted); }
#related { margin-top: var(--s2); }

.board { display: flex; gap: var(--s3); overflow-x: auto; align-items: flex-start; padding-bottom: var(--s2); }
.lane { flex: 0 0 260px; background: var(--surface-3); border-radius: var(--r-xl); padding: var(--s3); display: flex; flex-direction: column; gap: 10px; }
.lane-head { display: flex; justify-content: space-between; align-items: center; padding: var(--s1) 6px; }
.lane-head h2 { font-size: var(--fs-md); }
.lane-card { display: flex; flex-direction: column; align-items: stretch; gap: 6px; text-align: left; background: var(--surface); border: 0; border-radius: 18px; padding: 14px; font-weight: 400; }
.lane-card:hover { background: var(--surface-2); }
.lane-card .ttl { font-weight: 700; }
.lane-card .sub { font-size: var(--fs-xs); color: var(--muted); }

.stat-grid.wide { flex: 1 1 100%; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat-grid.wide .num { font-size: 26px; }
.table-wrap.flat { padding: 0; background: transparent; }
.bar.over > i { background: var(--rose); }
.mini-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mini { background: var(--surface-2); border-radius: var(--r-md); padding: 14px; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 6px; }
.mini:hover { background: var(--bg); color: inherit; }
.mini .lbl { font-size: var(--fs-sm); color: var(--muted); }
.mini .v { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
table.data td .bar { min-width: 110px; margin-top: 6px; }

/* ===== Collapsible sidebar categories ===== */
.nav-sec { display: flex; flex-direction: column; }
.nav-group-btn { display: flex; align-items: center; gap: var(--s2); width: 100%; border: 0; background: transparent; border-radius: var(--r-sm); padding: 10px 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); justify-content: flex-start; }
.nav-group-btn:hover { background: var(--bg); color: var(--ink); }
.nav-group-btn span:first-child { flex: 1; text-align: left; }
.nav-group-btn .nav-count { font-size: 11px; font-weight: 600; letter-spacing: 0; background: var(--bg); color: var(--muted); border-radius: var(--r-pill); padding: 1px 8px; }
.nav-group-btn .chev { transition: transform .15s; transform: rotate(-90deg); }
.nav-group-btn[aria-expanded="true"] .chev { transform: none; }
.nav-sec.has-active > .nav-group-btn { color: var(--ink); }
.nav-items { display: flex; flex-direction: column; gap: 2px; padding-bottom: var(--s1); }
.nav-items[hidden] { display: none; }
