/* =====================================================================
   PSD Teams — one stylesheet, no build step.
   The group frame (ink rail, cool paper) stays quiet so each business's
   own colour can carry identity: rail threads, board bands, group edges.
   ===================================================================== */

@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  font-stretch: 75% 100%;
  src: url(../fonts/instrument-sans-latin-wdth-normal.woff2) format('woff2-variations'), url(../fonts/instrument-sans-latin-wdth-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  font-stretch: 75% 100%;
  src: url(../fonts/instrument-sans-latin-ext-wdth-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1E00-1E9F,U+1EF2-1EFF,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

:root {
  --ink: #172033;
  --ink-2: #4A5468;
  --ink-3: #737D90;
  --paper: #F2F4F7;
  --surface: #FFFFFF;
  --sunk: #F7F8FA;
  --line: #E2E6EC;
  --line-2: #CDD3DC;
  /* Sidebar shades. The layout overrides these per person (see RailTheme.php). */
  --rail: #172033;
  --rail-text: #B9C1CF;
  --rail-hover: #212C42;
  --rail-active: #2A3448;
  --rail-strong: #FFFFFF;
  --rail-sub: #9DA7B8;
  --rail-muted: #7F8AA0;
  --rail-line: #263149;
  --rail-accent: #E39B1B;
  --rail-edge: #172033;
  --saffron: #E39B1B;
  --saffron-ink: #7C5100;
  --saffron-tint: #FDF3E1;
  --danger: #C73A31;
  --danger-tint: #FCECEB;
  --ok: #1F8A5B;
  --ok-tint: #E7F5EE;
  --info: #2F64B3;
  --info-tint: #EAF1FB;
  --biz: #3A7BD5;

  --font: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r-sm: 6px;
  --r-md: 10px;
  --shadow-pop: 0 14px 36px rgba(23, 32, 51, .16), 0 2px 6px rgba(23, 32, 51, .08);
  --focus: 0 0 0 3px rgba(227, 155, 27, .5);
  --rail-w: 252px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
[x-cloak] { display: none !important; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-stretch: 88%; font-weight: 700; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 .75em; }
img { max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------ Shell */

.shell { display: flex; min-height: 100vh; }

.rail {
  width: var(--rail-w);
  flex: 0 0 var(--rail-w);
  background: var(--rail);
  color: var(--rail-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rail-line) transparent;
  border-right: 1px solid var(--rail-edge);
  transition: background-color .2s, border-color .2s;
}
.wordmark {
  display: block;
  padding: 22px 22px 18px;
  color: var(--rail-strong);
  text-decoration: none !important;
  line-height: 1;
}
.wordmark b {
  display: block;
  font-size: 30px;
  font-weight: 700;
  font-stretch: 75%;
  letter-spacing: .01em;
}
.wordmark span { display: block; margin-top: 4px; font-size: 13px; color: var(--rail-text); font-weight: 500; }
.wordmark span::before { content: ''; display: inline-block; width: 14px; height: 2px; background: var(--rail-accent); vertical-align: middle; margin-right: 7px; }

.rail nav { padding: 4px 12px; }
.rail a.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  color: var(--rail-text);
  text-decoration: none;
  font-weight: 500;
  position: relative;
}
.rail a.nav:hover { background: var(--rail-hover); color: var(--rail-strong); }
.rail a.nav.active { background: var(--rail-active); color: var(--rail-strong); }
.rail a.nav.active::before {
  content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--rail-accent);
}
.rail svg { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.rail .count {
  margin-left: auto;
  min-width: 20px; padding: 0 6px; height: 19px; line-height: 19px;
  border-radius: 10px; font-size: 11.5px; font-weight: 650; text-align: center;
  background: var(--saffron); color: #2B1B00;
}
.rail-heading { padding: 18px 22px 6px; font-size: 12px; color: var(--rail-muted); font-weight: 600; }

.biz-list { padding: 0 12px 8px; }
.biz-link {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: var(--r-sm);
  color: var(--rail-text); text-decoration: none !important; font-weight: 500;
}
.biz-link .thread { width: 4px; height: 18px; border-radius: 2px; background: var(--biz); flex: none; transition: height .15s; }
.biz-link:hover { background: var(--rail-hover); color: var(--rail-strong); }
.biz-link.active { color: var(--rail-strong); }
.biz-link.active .thread { height: 22px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--biz) 30%, transparent); }
.biz-link .code { margin-left: auto; font-size: 11px; color: var(--rail-muted); font-weight: 600; font-stretch: 85%; }
.biz-boards { margin: 2px 0 8px 22px; padding-left: 10px; border-left: 1px solid var(--rail-line); }
.biz-boards a {
  display: block; padding: 4px 8px; border-radius: var(--r-sm);
  color: var(--rail-sub); font-size: 13px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.biz-boards a:hover { color: var(--rail-strong); background: var(--rail-hover); }
.biz-boards a.active { color: var(--rail-strong); background: var(--rail-active); font-weight: 600; }
.rail-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--rail-line); }
.rail-note { padding: 4px 10px; color: var(--rail-muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; display: flex; align-items: center; gap: 12px;
  padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--ink-3); }
.crumbs a { color: var(--ink-2); }
.crumbs .sep { color: var(--line-2); }
.crumbs .here { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .menu-btn { display: none; }

.page { padding: 28px 32px 64px; max-width: 1240px; width: 100%; }
.page.wide { max-width: none; padding: 0; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .lede { margin: 6px 0 0; color: var(--ink-2); max-width: 64ch; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ----------------------------------------------------------- Buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 13.5px; cursor: pointer; text-decoration: none !important; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #26324A; border-color: #26324A; }
.btn-accent { background: var(--saffron); border-color: var(--saffron); color: #261800; }
.btn-accent:hover { background: #D18C10; border-color: #D18C10; }
.btn-danger { color: var(--danger); border-color: #EBC3C0; }
.btn-danger:hover { background: var(--danger-tint); border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--sunk); border-color: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 30px; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--info); cursor: pointer; font-weight: 600; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }

/* ------------------------------------------------------------- Forms */

.field { display: block; margin-bottom: 16px; }
.field > span, .label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.field .hint { display: block; font-weight: 400; color: var(--ink-3); font-size: 12.5px; margin-top: 5px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 38px; padding: 8px 11px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font: inherit;
}
textarea.input { min-height: 110px; resize: vertical; line-height: 1.55; }
.input:focus { border-color: var(--saffron); box-shadow: var(--focus); outline: none; }
.input-color { width: 46px; height: 38px; padding: 3px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--ink); }
.check small { display: block; color: var(--ink-3); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-weight: 650; font-size: 15px; margin-bottom: 10px; }

.segmented { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: block; padding: 7px 14px; font-weight: 600; font-size: 13px; color: var(--ink-2); border-right: 1px solid var(--line); }
.segmented label:last-child span { border-right: 0; }
.segmented input:checked + span { background: var(--ink); color: #fff; }
.segmented input:focus-visible + span { box-shadow: inset var(--focus); }

/* ------------------------------------------------------------ Panels */

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.panel-pad { padding: 20px 22px; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 15px; }
.panel-head .more { margin-left: auto; font-size: 13px; font-weight: 600; }

/* ------------------------------------------------------- Flash & alerts */

.flashes { padding: 16px 32px 0; max-width: 1240px; }
.flash {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; border-radius: var(--r-sm); margin-bottom: 8px;
  background: var(--ok-tint); color: #12553A; border: 1px solid #BFE3D0; font-weight: 500;
}
.flash.error { background: var(--danger-tint); color: #8A231C; border-color: #F1C6C2; }
.flash.secret { background: var(--saffron-tint); color: #5C3C00; border-color: #F2D49A; }
.flash.secret code { font-size: 15px; font-weight: 700; background: #fff; padding: 1px 6px; border-radius: 4px; }
.flash button { margin-left: auto; background: none; border: 0; cursor: pointer; color: inherit; opacity: .6; font-size: 18px; line-height: 1; }

/* Broadcast banners (urgent / must-acknowledge) */
.banner {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 32px; border-bottom: 1px solid;
  font-size: 13.5px;
}
.banner.urgent { background: #FBE9E7; border-color: #F0C3BE; color: #7F1F18; }
.banner.important, .banner.info { background: var(--saffron-tint); border-color: #F2D49A; color: #5C3C00; }
.banner .tag { font-weight: 700; }
.banner a.title { color: inherit; font-weight: 600; }
.banner form { margin-left: auto; }
.banner .btn { height: 30px; }

/* ----------------------------------------------------------- Avatars */

.avatar {
  --av: #4E5D78;
  display: inline-grid; place-items: center; flex: none;
  border-radius: 50%; background: var(--av); color: #fff;
  font-weight: 650; font-stretch: 85%; letter-spacing: .02em;
}
.avatar-sm { width: 24px; height: 24px; font-size: 10.5px; }
.avatar-md { width: 30px; height: 30px; font-size: 12px; }
.avatar-lg { width: 44px; height: 44px; font-size: 16px; }
.avatars { display: inline-flex; }
.avatars .avatar { flex: none; box-shadow: 0 0 0 2px var(--surface); }
.avatars .avatar + .avatar { margin-left: -4px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px; border-radius: 11px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--sunk); color: var(--ink-2); border: 1px solid var(--line);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--biz); }
.pill.biz { border-color: transparent; background: color-mix(in srgb, var(--biz) 12%, white); color: color-mix(in srgb, var(--biz) 70%, black); }
.pill.warn { background: var(--saffron-tint); border-color: #F2D49A; color: var(--saffron-ink); }
.pill.bad { background: var(--danger-tint); border-color: #F1C6C2; color: #8A231C; }
.pill.good { background: var(--ok-tint); border-color: #BFE3D0; color: #12553A; }
.status-chip { display: inline-block; padding: 2px 9px; border-radius: 4px; color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; }

/* ------------------------------------------------------------ Tables */

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--ink-3); padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--sunk); }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.off td { color: var(--ink-3); }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person b { font-weight: 600; display: block; }
.person small { color: var(--ink-3); display: block; }

/* ---------------------------------------------------------- Home page */

.greet h1 { font-size: 30px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.work-strip { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; margin-bottom: 24px; }
.work-strip a { padding: 16px 18px; color: var(--ink); text-decoration: none !important; border-right: 1px solid var(--line); }
.work-strip a:last-child { border-right: 0; }
.work-strip a:hover { background: var(--sunk); }
.work-strip strong { display: block; font-size: 30px; font-weight: 700; font-stretch: 80%; line-height: 1.1; }
.work-strip span { color: var(--ink-2); font-size: 13px; }
.work-strip a.alert strong { color: var(--danger); }

.biz-table td:first-child { width: 42%; }
.biz-name { display: flex; align-items: center; gap: 12px; color: var(--ink); font-weight: 650; }
.biz-name:hover { text-decoration: none; }
.biz-name .thread { width: 5px; height: 30px; border-radius: 3px; background: var(--biz); }
.biz-name small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12.5px; }
.num { font-weight: 650; font-size: 15px; }
.num.alert { color: var(--danger); }
.bar { height: 6px; border-radius: 3px; background: var(--sunk); overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--biz); }

.notice {
  display: block; padding: 14px 20px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none !important;
}
.notice:last-child { border-bottom: 0; }
.notice:hover { background: var(--sunk); }
.notice .t { font-weight: 650; display: flex; gap: 8px; align-items: center; }
.notice .t .new { width: 8px; height: 8px; border-radius: 50%; background: var(--saffron); flex: none; }
.notice p { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notice .meta { margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.prio { font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 4px; }
.prio.urgent { background: var(--danger); color: #fff; }
.prio.important { background: var(--saffron); color: #261800; }
.prio.info { background: var(--info-tint); color: var(--info); }

.feed { list-style: none; margin: 0; padding: 6px 0; }
.feed li { display: flex; gap: 10px; padding: 9px 20px; font-size: 13px; }
.feed li .what { color: var(--ink-2); }
.feed li .what b { color: var(--ink); font-weight: 600; }
.feed li .when { display: block; color: var(--ink-3); font-size: 12px; margin-top: 1px; }

.empty {
  padding: 36px 24px; text-align: center; color: var(--ink-2);
}
.empty h3 { font-size: 16px; margin-bottom: 6px; color: var(--ink); }
.empty p { max-width: 46ch; margin: 0 auto 14px; }

/* ----------------------------------------------------------- My work */

.bucket { margin-bottom: 26px; }
.bucket-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.bucket-head h2 { font-size: 16px; }
.bucket-head .n { color: var(--ink-3); font-weight: 600; }
.bucket.overdue h2 { color: var(--danger); }
.work-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.work-row {
  display: grid; grid-template-columns: 4px minmax(0, 1fr) 170px 110px; gap: 14px; align-items: center;
  padding: 0 16px 0 0; min-height: 50px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none !important;
}
.work-row:last-child { border-bottom: 0; }
.work-row:hover { background: var(--sunk); }
.work-row .edge { align-self: stretch; background: var(--biz); }
.work-row .name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-row .where { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-row .due { font-weight: 600; font-size: 13px; text-align: right; }
.work-row .due.late { color: var(--danger); }

/* --------------------------------------------------------- Business page */

.biz-head { border-top: 4px solid var(--biz); background: var(--surface); border-bottom: 1px solid var(--line); padding: 22px 32px 18px; }
.under-head { padding: 24px 32px 64px; max-width: 1240px; }
.biz-head h1 { display: flex; align-items: center; gap: 12px; }
.biz-head .code { font-size: 13px; font-weight: 700; color: var(--biz); border: 1.5px solid var(--biz); border-radius: 4px; padding: 1px 6px; font-stretch: 85%; }
.board-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.board-tile {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
  color: var(--ink); text-decoration: none !important; min-height: 132px;
}
.board-tile:hover { border-color: var(--line-2); box-shadow: 0 1px 0 var(--line-2); }
.board-tile h3 { font-size: 15.5px; display: flex; gap: 8px; align-items: center; }
.board-tile p { color: var(--ink-2); font-size: 13px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.board-tile .foot { margin-top: auto; display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-3); }
.board-tile .foot b { color: var(--ink); }
.board-tile .foot .late b { color: var(--danger); }
.lock { width: 14px; height: 14px; stroke: var(--ink-3); fill: none; stroke-width: 2; }

.template-pick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.template-pick label { position: relative; display: block; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--r-sm); cursor: pointer; }
.template-pick input { position: absolute; opacity: 0; }
.template-pick b { display: block; font-size: 13.5px; }
.template-pick small { color: var(--ink-3); }
.template-pick input:checked + span { display: block; }
.template-pick label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--sunk); }
.template-pick label:has(input:focus-visible) { box-shadow: var(--focus); }

/* --------------------------------------------------------------- Dialog */

dialog.modal {
  border: 0; padding: 0; border-radius: var(--r-md); width: min(560px, calc(100vw - 32px));
  box-shadow: var(--shadow-pop); color: var(--ink);
}
dialog.modal::backdrop { background: rgba(23, 32, 51, .45); }
.modal-head { display: flex; align-items: center; padding: 18px 22px 0; }
.modal-head h2 { font-size: 18px; }
.modal-head .btn { margin-left: auto; }
.modal-body { padding: 16px 22px 22px; }

/* --------------------------------------------------------------- Popover */

.pop {
  position: absolute; z-index: 60; min-width: 200px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-pop); padding: 6px;
}
.pop .opt {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 10px; border: 0; background: none; border-radius: var(--r-sm);
  text-align: left; cursor: pointer; font-size: 13.5px; color: var(--ink); text-decoration: none !important;
}
.pop .opt:hover, .pop .opt.on { background: var(--sunk); }
.pop .opt.danger { color: var(--danger); }
.pop hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }
.pop .search { margin: 2px 2px 6px; width: calc(100% - 4px); }
.pop-label { padding: 6px 10px 4px; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.status-opt { display: block; width: 100%; border: 0; color: #fff; font-weight: 600; padding: 8px 10px; border-radius: var(--r-sm); margin-bottom: 4px; cursor: pointer; text-align: center; font-size: 13px; }
.status-opt:hover { filter: brightness(1.06); }
.status-opt.clear { background: var(--sunk); color: var(--ink-2); border: 1px dashed var(--line-2); }

/* ------------------------------------------------------- Notification bell */

.bell { position: relative; }
.bell .dot { position: absolute; top: 1px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.bell-pop { right: 0; top: 44px; width: 380px; max-height: 70vh; overflow-y: auto; padding: 0; }
.bell-pop .head { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.bell-pop .head b { font-size: 14px; }
.bell-pop .head button { margin-left: auto; }
.note { display: flex; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none !important; font-size: 13px; }
.note:hover { background: var(--sunk); }
.note.unread { background: #FFFBF2; }
.note .t { font-weight: 600; }
.note .b { color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note .w { color: var(--ink-3); font-size: 12px; }
.note .ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--sunk); flex: none; }
.note .ic svg { width: 15px; height: 15px; stroke: var(--ink-2); fill: none; stroke-width: 1.8; }

.user-pop { right: 0; top: 46px; }

/* =========================================================== Board */

.is-board .page { padding: 0; max-width: none; }
.board-head {
  background: var(--surface); border-top: 4px solid var(--biz); border-bottom: 1px solid var(--line);
  padding: 18px 28px 0;
}
.board-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.board-title h1 { font-size: 24px; }
.board-title h1[contenteditable="true"] { border-radius: var(--r-sm); padding: 0 4px; margin-left: -4px; }
.board-title h1[contenteditable="true"]:hover { background: var(--sunk); }
.board-desc { color: var(--ink-2); margin: 4px 0 0; max-width: 80ch; font-size: 13.5px; }
.board-bar { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tab { white-space: nowrap; }
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 12px; border: 0; background: none; cursor: pointer;
  font-weight: 600; color: var(--ink-3); border-bottom: 2.5px solid transparent; font-size: 13.5px;
}
.tab svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--saffron); }
.board-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; padding-bottom: 8px; }
.board-tools .input { min-height: 32px; height: 32px; width: 200px; padding: 4px 10px; }
.toggle-me.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.board-body { padding: 20px 28px 80px; }
.sync-note { font-size: 12px; color: var(--ink-3); }

/* ---- Table view */
.group { margin-bottom: 28px; }
.group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; position: relative; }
.group-head .caret { width: 26px; height: 26px; border: 0; background: none; cursor: pointer; border-radius: var(--r-sm); color: var(--g); display: grid; place-items: center; }
.group-head .caret:hover { background: var(--sunk); }
.group-head .caret svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.2; transition: transform .15s; }
.group.collapsed .caret svg { transform: rotate(-90deg); }
.group-name { font-size: 16px; font-weight: 700; color: var(--g); border-radius: var(--r-sm); padding: 1px 4px; outline: none; }
.group-name[contenteditable="true"]:hover { background: var(--sunk); }
.group-name:focus { box-shadow: var(--focus); }
.group-count { color: var(--ink-3); font-size: 12.5px; }
.group-menu-btn { opacity: 0; }
.group-head:hover .group-menu-btn, .group-menu-btn:focus { opacity: 1; }

.grid-wrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); }
.grid { border-collapse: separate; border-spacing: 0; min-width: 100%; table-layout: fixed; }
.grid th, .grid td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); height: 38px; padding: 0; font-size: 13.5px; }
.grid th:last-child, .grid td:last-child { border-right: 0; }
.grid thead th { background: var(--surface); font-weight: 600; font-size: 12.5px; color: var(--ink-3); text-align: center; position: relative; }
.grid thead th.name-col { text-align: left; padding-left: 14px; }
.grid .edge { width: 6px; min-width: 6px; background: var(--g); border-right: 0; position: sticky; left: 0; z-index: 3; }
/* Keep the item name in view while scrolling wide boards sideways */
.grid .name-col, .grid .name-td { position: sticky; left: 6px; z-index: 2; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
.grid tbody tr:hover td:not(.edge) { background: #FAFBFC; }
.summary-row td.name-td { background: var(--sunk); }
.grid tbody tr.dragging td { opacity: .4; }
.grid tbody tr.drop-before td { box-shadow: inset 0 2px 0 var(--saffron); }
.grid tfoot td { border-bottom: 0; }
.col-head { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 0 8px; height: 38px; }
.col-head .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-head .role { width: 6px; height: 6px; border-radius: 50%; background: var(--saffron); flex: none; }
.col-head .btn { opacity: 0; }
.grid thead th:hover .col-head .btn, .col-head .btn:focus { opacity: 1; }
.add-col { width: 44px; }

.cell-name { display: flex; align-items: center; gap: 6px; padding: 0 8px 0 10px; height: 38px; }
.cell-name .grip { cursor: grab; color: var(--line-2); width: 14px; flex: none; display: grid; place-items: center; }
.cell-name .grip svg { width: 12px; height: 12px; fill: currentColor; }
tr:hover .cell-name .grip { color: var(--ink-3); }
.cell-name input { flex: 1; min-width: 0; border: 1px solid transparent; background: transparent; padding: 4px 6px; border-radius: 4px; font: inherit; color: var(--ink); text-overflow: ellipsis; }
.cell-name input:hover { border-color: var(--line-2); }
.cell-name input:focus { border-color: var(--saffron); background: #fff; outline: none; }
.open-item { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; cursor: pointer; color: var(--ink-3); border-radius: 4px; padding: 3px 6px; font-size: 12px; font-weight: 600; flex: none; }
.open-item:hover { background: var(--sunk); color: var(--ink); }
.open-item svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.open-item .n { min-width: 16px; height: 16px; border-radius: 8px; background: var(--info); color: #fff; font-size: 10.5px; line-height: 16px; text-align: center; }

.cell { width: 100%; height: 38px; display: flex; align-items: center; justify-content: center; border: 0; background: none; cursor: pointer; padding: 0 8px; font: inherit; color: var(--ink); position: relative; }
.cell:disabled { cursor: default; }
.cell.status { color: #fff; font-weight: 600; font-size: 13px; }
.cell.status.empty { color: transparent; }
.cell.status:not(:disabled):hover::after { content: ''; position: absolute; right: 0; top: 0; border: 7px solid transparent; border-top-color: rgba(255,255,255,.7); border-right-color: rgba(255,255,255,.7); }
.cell .ph { color: var(--line-2); }
.cell:not(:disabled):hover .ph { color: var(--ink-3); }
.cell.date.late { color: var(--danger); font-weight: 600; }
.cell.date.soon { color: var(--saffron-ink); font-weight: 600; }
.cell input[type="date"], .cell input[type="number"], .cell input[type="text"], .cell input[type="url"] {
  width: 100%; height: 30px; border: 1px solid var(--saffron); border-radius: 4px; padding: 0 6px; font: inherit; box-shadow: var(--focus); text-align: center;
}
.cell .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.cell.text-left { justify-content: flex-start; }
.cell .cb { width: 18px; height: 18px; border: 1.5px solid var(--line-2); border-radius: 4px; display: grid; place-items: center; background: #fff; }
.cell .cb.on { background: var(--ok); border-color: var(--ok); }
.cell .cb svg { width: 12px; height: 12px; stroke: #fff; fill: none; stroke-width: 3; }
.cell a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.add-row td { height: 36px; }
.add-row input { width: 100%; height: 36px; border: 0; padding: 0 12px 0 34px; font: inherit; background: transparent; color: var(--ink); }
.add-row input::placeholder { color: var(--ink-3); }
.add-row input:focus { outline: none; background: #FFFCF5; }
.summary-row td { height: 34px; background: var(--sunk); }
.status-bar { display: flex; height: 22px; margin: 0 8px; border-radius: 3px; overflow: hidden; }
.status-bar i { display: block; height: 100%; }
.summary-text { font-size: 12px; color: var(--ink-3); text-align: center; }

.add-group { margin-top: 4px; }

/* ---- Kanban */
.kanban-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.lane { flex: 0 0 280px; background: #E9ECF1; border-radius: var(--r-md); display: flex; flex-direction: column; max-height: calc(100vh - 250px); }
.lane.over { box-shadow: inset 0 0 0 2px var(--saffron); }
.lane-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; font-weight: 700; }
.lane-head .sw { width: 12px; height: 12px; border-radius: 3px; }
.lane-head .n { color: var(--ink-3); font-weight: 600; font-size: 12.5px; }
.lane-cards { padding: 4px 10px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.card {
  background: var(--surface); border-radius: var(--r-sm); padding: 10px 12px 10px 14px; position: relative; cursor: grab;
  box-shadow: 0 1px 0 rgba(23,32,51,.08), 0 0 0 1px rgba(23,32,51,.05);
}
.card::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--g); }
.card:hover { box-shadow: 0 2px 8px rgba(23,32,51,.12), 0 0 0 1px rgba(23,32,51,.06); }
.card.dragging { opacity: .4; }
.card .t { font-weight: 600; line-height: 1.35; }
.card .g { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.card .meta { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.card .meta .late { color: var(--danger); font-weight: 600; }
.card .meta .avatars { margin-left: auto; }
.lane-add { margin: 0 10px 10px; }
.lane-add input { width: 100%; border: 1px dashed var(--line-2); border-radius: var(--r-sm); padding: 8px 10px; background: transparent; font: inherit; }
.lane-add input:focus { background: #fff; border-style: solid; border-color: var(--saffron); outline: none; }

/* ---- Calendar */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cal-head h2 { font-size: 20px; min-width: 190px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--line); gap: 1px; }
.cal .dow { background: var(--sunk); padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.cal .day { background: var(--surface); min-height: 118px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cal .day.out { background: #FAFBFC; }
.cal .day.out .d { color: var(--line-2); }
.cal .day.drop { box-shadow: inset 0 0 0 2px var(--saffron); }
.cal .d { font-size: 12.5px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; justify-content: space-between; }
.cal .day.today .d b { background: var(--saffron); color: #261800; border-radius: 10px; padding: 0 7px; }
.cal .add-day { opacity: 0; border: 0; background: none; cursor: pointer; color: var(--ink-3); font-size: 16px; line-height: 1; padding: 0 4px; }
.cal .day:hover .add-day { opacity: 1; }
.cal-item { display: block; width: 100%; text-align: left; border: 0; cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; padding: 3px 7px; border-radius: 4px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item.nostatus { background: var(--sunk); color: var(--ink); border-left: 3px solid var(--g); }
.cal-more { font-size: 12px; color: var(--ink-3); padding: 0 4px; }
.undated { margin-top: 18px; }

/* ---- Mind map */
.mm-wrap {
  position: relative; height: calc(100vh - 196px); min-height: 460px;
  border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden;
  background-color: #FBFCFD;
  background-image: radial-gradient(circle, #D9DEE6 1px, transparent 1.2px);
  background-size: 22px 22px;
}
.mm-wrap.fs { position: fixed; inset: 0; height: auto; z-index: 80; border-radius: 0; }
.mm-svg { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; user-select: none; }
.mm-svg.panning { cursor: grabbing; }
.mm-toolbar {
  position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; pointer-events: none;
}
.mm-toolbar > * { pointer-events: auto; }
.mm-toolbar .group-box { display: flex; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: 0 1px 2px rgba(23,32,51,.06); }
.mm-toolbar .btn { height: 30px; border: 0; }
.mm-toolbar .btn:hover { background: var(--sunk); }
.mm-toolbar .sel { padding: 0 10px; font-size: 12.5px; color: var(--ink-2); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-help {
  position: absolute; left: 12px; bottom: 12px; font-size: 12px; color: var(--ink-3);
  background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 10px; display: flex; gap: 12px; flex-wrap: wrap;
}
kbd { font-family: inherit; font-size: 11px; font-weight: 700; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line-2); border-bottom-width: 2px; background: #fff; color: var(--ink-2); }
.mm-legend { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 12px; font-size: 12px; color: var(--ink-3); background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 10px; }
.mm-legend i { display: inline-block; width: 18px; height: 10px; border-radius: 3px; vertical-align: middle; margin-right: 5px; border: 1.5px solid var(--ink-3); background: #fff; }
.mm-legend i.idea { border-style: dashed; background: #FFFDF7; border-color: #C79A3A; }
.mm-edit {
  position: absolute; z-index: 5; font: inherit; font-size: 14px; font-weight: 600;
  padding: 6px 10px; border: 2px solid var(--saffron); border-radius: 8px; background: #fff; box-shadow: var(--shadow-pop); min-width: 180px;
}
.mm-node { cursor: pointer; }
.mm-node text { font-family: var(--font); pointer-events: none; }
.mm-node .knob { cursor: pointer; }

/* ---- Item drawer */
.drawer-shade { position: fixed; inset: 0; background: rgba(23, 32, 51, .28); z-index: 70; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--surface); z-index: 71;
  display: flex; flex-direction: column; box-shadow: -18px 0 48px rgba(23, 32, 51, .18);
}
.drawer-head { padding: 18px 22px 12px; border-bottom: 1px solid var(--line); border-top: 4px solid var(--g, var(--biz)); }
.drawer-head .top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; }
.drawer-head .top .btn { margin-left: auto; }
.drawer-head textarea {
  width: 100%; border: 1px solid transparent; border-radius: var(--r-sm); padding: 4px 6px; margin-left: -6px;
  font: inherit; font-size: 21px; font-weight: 700; font-stretch: 90%; resize: none; color: var(--ink); line-height: 1.25; background: transparent;
}
.drawer-head textarea:hover { border-color: var(--line); }
.drawer-head textarea:focus { border-color: var(--saffron); outline: none; box-shadow: var(--focus); }
.drawer-body { flex: 1; overflow-y: auto; }
.fields { display: grid; grid-template-columns: 130px minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.fields .k { padding: 0 22px; display: flex; align-items: center; font-size: 13px; color: var(--ink-3); font-weight: 600; min-height: 40px; border-bottom: 1px solid var(--line); }
.fields .v { min-height: 40px; border-bottom: 1px solid var(--line); display: flex; align-items: stretch; position: relative; }
.fields .v .cell { justify-content: flex-start; height: auto; min-height: 40px; padding: 4px 12px; }
.fields .v .cell.status { justify-content: center; margin: 5px 10px 5px 0; border-radius: 4px; min-height: 30px; max-width: 220px; }
.fields .v textarea.input { border: 0; border-radius: 0; min-height: 70px; }
.drawer-tabs { display: flex; gap: 2px; padding: 0 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.composer { padding: 16px 22px; border-bottom: 1px solid var(--line); position: relative; }
.composer textarea { min-height: 84px; }
.composer .row { margin-top: 8px; }
.mention-pop { left: 22px; bottom: 100%; margin-bottom: -60px; max-height: 220px; overflow-y: auto; width: 260px; }
.update { padding: 16px 22px; border-bottom: 1px solid var(--line); }
.update .who { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.update .who b { font-weight: 600; }
.update .who .when { color: var(--ink-3); font-size: 12px; }
.update .who .link-btn { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--ink-3); }
.update .body { line-height: 1.6; overflow-wrap: anywhere; }
.mention { background: var(--info-tint); color: var(--info); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.files { padding: 16px 22px; }
.drop {
  border: 1.5px dashed var(--line-2); border-radius: var(--r-md); padding: 22px; text-align: center; color: var(--ink-2); cursor: pointer; display: block;
}
.drop.over { border-color: var(--saffron); background: var(--saffron-tint); }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.file-row .thumb { width: 44px; height: 44px; border-radius: var(--r-sm); background: var(--sunk); display: grid; place-items: center; overflow: hidden; flex: none; font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; }
.file-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-row .info { min-width: 0; flex: 1; }
.file-row .info a { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .info small { color: var(--ink-3); }
.log { list-style: none; margin: 0; padding: 8px 0; }
.log li { display: flex; gap: 10px; padding: 9px 22px; font-size: 13px; color: var(--ink-2); }
.log li b { color: var(--ink); font-weight: 600; }
.log li small { display: block; color: var(--ink-3); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-sm); box-shadow: var(--shadow-pop); font-weight: 500; max-width: calc(100vw - 32px);
}
.toast.error { background: var(--danger); }

/* ----------------------------------------------------------- Broadcasts */

.notice-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.notice-tabs a { padding: 9px 12px; font-weight: 600; color: var(--ink-3); border-bottom: 2.5px solid transparent; text-decoration: none; }
.notice-tabs a.on { color: var(--ink); border-bottom-color: var(--saffron); }
.bc-list { display: flex; flex-direction: column; gap: 12px; }
.bc {
  display: grid; grid-template-columns: 6px minmax(0, 1fr) auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  color: var(--ink); text-decoration: none !important; overflow: hidden;
}
.bc:hover { border-color: var(--line-2); }
.bc .edge { background: var(--info-tint); }
.bc.urgent .edge { background: var(--danger); }
.bc.important .edge { background: var(--saffron); }
.bc.info .edge { background: #9FB8DD; }
.bc .main-col { padding: 16px 20px; min-width: 0; }
.bc .t { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bc .t h3 { font-size: 16px; }
.bc .unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--saffron); }
.bc p { margin: 6px 0 0; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bc .meta { margin-top: 10px; font-size: 12.5px; color: var(--ink-3); display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.bc .side { padding: 16px 20px; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); border-left: 1px solid var(--line); min-width: 150px; }
.bc .side b { font-size: 18px; color: var(--ink); }

.bc-read { max-width: 760px; }
.bc-read .sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.bc-read .sheet-head { padding: 24px 28px 18px; border-bottom: 1px solid var(--line); border-top: 5px solid #9FB8DD; }
.bc-read.urgent .sheet-head { border-top-color: var(--danger); }
.bc-read.important .sheet-head { border-top-color: var(--saffron); }
.bc-read h1 { font-size: 28px; margin: 10px 0 12px; }
.bc-read .from { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--ink-2); }
.bc-read .from b { color: var(--ink); }
.bc-read .text { padding: 24px 28px; font-size: 15.5px; line-height: 1.65; max-width: 68ch; overflow-wrap: anywhere; }
.ack-bar { display: flex; align-items: center; gap: 14px; padding: 16px 28px; background: var(--saffron-tint); border-top: 1px solid #F2D49A; }
.ack-bar.done { background: var(--ok-tint); border-top-color: #BFE3D0; color: #12553A; }
.reach { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.reach div { padding: 16px 20px; border-right: 1px solid var(--line); }
.reach div:last-child { border-right: 0; }
.reach strong { display: block; font-size: 26px; font-weight: 700; font-stretch: 80%; }
.reach span { color: var(--ink-2); font-size: 13px; }
.audience-pick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.audience-pick label { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); cursor: pointer; }
.audience-pick label:has(input:checked) { border-color: var(--biz); box-shadow: inset 4px 0 0 var(--biz); background: color-mix(in srgb, var(--biz) 6%, white); }
.prio-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.prio-pick label { position: relative; display: block; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); cursor: pointer; }
.prio-pick label b { display: block; }
.prio-pick label small { color: var(--ink-3); }
.prio-pick input { position: absolute; opacity: 0; }
.prio-pick label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.prio-pick label.urgent:has(input:checked) { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); background: var(--danger-tint); }
.prio-pick label.important:has(input:checked) { border-color: var(--saffron); box-shadow: inset 0 0 0 1px var(--saffron); background: var(--saffron-tint); }
.preview-card { position: sticky; top: 76px; }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }

/* ----------------------------------------------------------- Admin */

.admin-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.admin-tabs a { padding: 9px 12px; font-weight: 600; color: var(--ink-3); border-bottom: 2.5px solid transparent; text-decoration: none; }
.admin-tabs a.on { color: var(--ink); border-bottom-color: var(--saffron); }
.role-grid { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 8px 16px; align-items: center; }
.role-grid .bn { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.role-grid .bn i { width: 5px; height: 22px; border-radius: 3px; background: var(--biz); }
code.block { display: block; padding: 10px 12px; background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 12.5px; overflow-x: auto; white-space: nowrap; }

/* ----------------------------------------------------------- Auth / install */

.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth-side {
  background: var(--rail); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.auth-side .wordmark { padding: 0; }
.auth-side .wordmark b { font-size: 44px; }
.auth-side .threads { display: flex; flex-direction: column; gap: 10px; }
.auth-side .threads i { display: block; height: 6px; border-radius: 3px; }
.auth-side p { color: var(--rail-text); max-width: 34ch; font-size: 15px; line-height: 1.6; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card .lede { color: var(--ink-2); margin-bottom: 24px; }
.auth-card .btn-primary { width: 100%; height: 42px; }

.install { max-width: 820px; margin: 0 auto; padding: 40px 24px 80px; }
.install .wordmark { color: var(--ink); padding: 0 0 28px; }
.install .wordmark span { color: var(--ink-3); }
.checks { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.checks li { display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
.checks .ok { color: var(--ok); font-weight: 700; }
.checks .no { color: var(--danger); font-weight: 700; }
.install section { margin-bottom: 18px; }
.install h2 { font-size: 17px; margin-bottom: 4px; }
.install .section-lede { color: var(--ink-2); margin-bottom: 16px; font-size: 13.5px; }

.error-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.error-page .code { font-size: 80px; font-weight: 700; font-stretch: 75%; color: var(--line-2); line-height: 1; }
.error-page h1 { margin: 10px 0; }
.error-page p { color: var(--ink-2); max-width: 46ch; margin: 0 auto 20px; }

/* --------------------------------------------------------- Responsive */

@media (max-width: 1100px) {
  .home-grid, .two-col { grid-template-columns: 1fr; }
  .preview-card { position: static; }
}
@media (max-width: 860px) {
  .rail { position: fixed; z-index: 90; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: none; }
  .rail.open { transform: none; box-shadow: 0 0 0 100vmax rgba(23, 32, 51, .45); }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { padding: 0 14px; }
  .page { padding: 20px 16px 56px; }
  .flashes { padding: 12px 16px 0; }
  .banner { padding: 10px 16px; flex-wrap: wrap; }
  .board-head { padding: 14px 16px 0; }
  .board-body { padding: 16px 16px 64px; }
  .board-tools { margin-left: 0; width: 100%; flex-wrap: wrap; }
  .crumbs a, .crumbs .sep { display: none; }
  .mm-help, .mm-legend { display: none; }
  .board-tools .input { flex: 1; width: auto; }
  .biz-head { padding: 18px 16px; }
  .under-head { padding: 16px 16px 48px; }
  .work-strip { grid-template-columns: 1fr 1fr; }
  .work-strip a:nth-child(2) { border-right: 0; }
  .work-strip a:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .work-row { grid-template-columns: 4px minmax(0, 1fr) 84px; }
  .work-row .where, .work-row .status-col { display: none; }
  .grid-2, .grid-3, .template-pick, .audience-pick, .prio-pick { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .checks { grid-template-columns: 1fr; }
  .bc { grid-template-columns: 6px minmax(0, 1fr); }
  .bc .side { display: none; }
  .fields { grid-template-columns: 110px minmax(0, 1fr); }
  .fields .k { padding: 0 14px; }
  .mm-wrap { height: calc(100vh - 230px); }
  .bell-pop { position: fixed; left: 12px; right: 12px; width: auto; top: 60px; }
  .reach { grid-template-columns: 1fr; }
  .reach div { border-right: 0; border-bottom: 1px solid var(--line); }
}

/* ------------------------------------------------------------- Share dialog */

dialog.share-modal { width: min(600px, calc(100vw - 32px)); overflow: visible; }
.share-add { display: flex; gap: 8px; align-items: flex-start; }
.share-pick { position: relative; flex: 1; min-width: 0; }
.share-chip { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 4px 8px; border: 1px solid #F2D49A; border-radius: var(--r-sm); background: var(--saffron-tint); font-weight: 600; }
.share-chip button { margin-left: auto; border: 0; background: none; cursor: pointer; font-size: 18px; line-height: 1; color: var(--ink-3); }
.share-list { left: 0; right: 0; top: 42px; max-height: 300px; overflow-y: auto; }
.share-list .opt { align-items: flex-start; }
.share-add .share-role { width: 112px; flex: none; }
.share-h { font-size: 13px; color: var(--ink-3); font-weight: 600; margin: 20px 0 6px; }
.share-people { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); max-height: 270px; overflow-y: auto; }
.share-people li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.share-people li:last-child { border-bottom: 0; }
.share-people .who { flex: 1; min-width: 0; }
.share-people .who b { display: block; font-weight: 600; }
.share-people .who small { display: block; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-people li.off { opacity: .55; }
.share-people .empty-li { color: var(--ink-3); font-size: 13px; padding: 12px; }
.share-people .share-role { width: 104px; min-height: 32px; padding: 4px 8px; }
.share-note { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 0; font-size: 13px; color: var(--ink-2); }
.share-note svg { width: 16px; height: 16px; flex: none; margin-top: 2px; stroke: var(--ink-3); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 560px) {
  .share-add { flex-wrap: wrap; }
  .share-pick { flex-basis: 100%; }
}

/* Projects in the rail: a diamond thread marks a cross-business team */
.project-link .thread { border-radius: 2px; width: 8px; height: 8px; transform: rotate(45deg); margin: 0 1px; }
.project-link.active .thread { height: 9px; width: 9px; }
.project-link .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- Projects */

.late { color: var(--danger) !important; }
dialog.modal-wide { width: min(720px, calc(100vw - 32px)); }
.diamond { display: inline-block; width: 10px; height: 10px; background: var(--biz); transform: rotate(45deg); border-radius: 2px; flex: none; }
.diamond.lg { width: 14px; height: 14px; border-radius: 3px; }
.project-head h1 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.project-meta { gap: 8px; margin-top: 12px; }
.project-meta .ic { width: 14px; height: 14px; vertical-align: -2px; stroke: currentColor; fill: none; stroke-width: 1.8; }

.project-list { display: flex; flex-direction: column; gap: 10px; }
.project-row {
  display: grid; grid-template-columns: 6px minmax(0, 1fr) 150px 190px 120px; align-items: center; gap: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--ink);
  text-decoration: none !important; overflow: hidden; padding-right: 18px; min-height: 92px;
}
.project-row:hover { border-color: var(--line-2); }
.project-row .edge { align-self: stretch; background: var(--biz); }
.project-row .main-col { padding: 14px 0; min-width: 0; }
.project-row .t { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.project-row .t b { font-size: 16px; font-weight: 650; }
.project-row .d { display: block; color: var(--ink-2); font-size: 13px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-row .team-col, .project-row .prog-col { display: flex; flex-direction: column; gap: 6px; }
.project-row .prog-col .bar { width: 100%; }
.project-row .due-col { text-align: right; }

.role-key { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); margin-bottom: 20px; }
.role-key div { padding: 12px 16px; border-right: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.role-key div:last-child { border-right: 0; }
.role-key b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 2px; }

.pick-list { max-height: 360px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }
.pick { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pick:last-child { border-bottom: 0; }
.pick:hover { background: var(--sunk); }
.pick:has(input:checked) { background: var(--saffron-tint); }
.pick input { width: 16px; height: 16px; accent-color: var(--ink); flex: none; }
.pick b { display: block; font-weight: 600; }
.pick small { display: block; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; background: var(--sw); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; padding: 0; flex: none; }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }
.swatch-dot { width: 14px; height: 14px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.color-pop { top: 36px; left: 0; min-width: 0; width: 230px; padding: 10px; }
.color-pop .opt { margin-top: 8px; font-size: 13px; }

/* -------------------------------------------------------------- Mind maps */

.map-tile { position: relative; }
.map-tile .map-glyph { width: 64px; height: 28px; margin-bottom: -2px; }
.map-glyph path { fill: none; stroke: var(--g); stroke-width: 2; opacity: .55; stroke-linecap: round; }
.map-glyph circle { fill: #fff; stroke: var(--g); stroke-width: 2; }
.map-glyph circle.core { fill: var(--g); }
.role-tag { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.role-tag.viewer { color: var(--saffron-ink); }
.map-page .mm-wrap { height: calc(100vh - 176px); }
.mm-empty {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, 64px); text-align: center; color: var(--ink-2);
  background: rgba(255,255,255,.92); border: 1px dashed var(--line-2); border-radius: var(--r-md); padding: 12px 18px; pointer-events: none;
}
.mm-empty b { display: block; color: var(--ink); }
.reach strong.late { color: var(--danger); }

@media (max-width: 1100px) {
  .project-row { grid-template-columns: 6px minmax(0, 1fr) 170px; }
  .project-row .team-col, .project-row .due-col { display: none; }
}
@media (max-width: 860px) {
  .project-row { grid-template-columns: 6px minmax(0, 1fr); }
  .project-row .prog-col { display: none; }
  .role-key { grid-template-columns: 1fr; }
  .role-key div { border-right: 0; border-bottom: 1px solid var(--line); }
  .role-key div:last-child { border-bottom: 0; }
  .map-page .mm-wrap { height: calc(100vh - 210px); }
}
.biz-name .diamond { margin: 0 4px; }
.shared-feed li { align-items: flex-start; }
.shared-feed a.what { color: var(--ink-2); text-decoration: none; min-width: 0; }
.shared-feed a.what:hover b { text-decoration: underline; }
.kind-ic { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--g) 14%, white); }
.kind-ic svg { width: 15px; height: 15px; stroke: var(--g); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ----------------------------------------------------------- Project files */

.file-path { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; font-size: 13.5px; }
.file-path a { color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.file-path a svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.file-path .here { color: var(--ink); font-weight: 650; }
.file-path .sep { color: var(--line-2); }
.btn svg.up { transform: rotate(180deg); }
.file-panel { position: relative; min-height: 160px; }
.file-panel.dragging { box-shadow: 0 0 0 2px var(--saffron); }
.drop-overlay { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; background: rgba(253, 243, 225, .92); border-radius: var(--r-md); pointer-events: none; }
.drop-overlay div { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--saffron-ink); font-size: 15px; }
.drop-overlay svg { width: 30px; height: 30px; stroke: currentColor; fill: none; stroke-width: 1.8; transform: rotate(180deg); }
.file-table td { padding-top: 8px; padding-bottom: 8px; }
.file-name { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none !important; min-width: 0; }
.file-name b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.file-name:hover b { text-decoration: underline; }
.file-name small { display: block; color: var(--ink-3); font-size: 12.5px; }
.folder-ic { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--biz) 12%, white); }
.folder-ic svg { width: 22px; height: 22px; fill: color-mix(in srgb, var(--biz) 75%, white); stroke: var(--biz); stroke-width: 1.2; }
.file-badge { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; flex: none; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; color: var(--fc); background: color-mix(in srgb, var(--fc) 12%, white); border: 1px solid color-mix(in srgb, var(--fc) 22%, white); }
.file-thumb { width: 38px; height: 38px; border-radius: 8px; overflow: hidden; flex: none; background: var(--sunk); border: 1px solid var(--line); }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row-menu { position: relative; display: inline-block; }
.row-menu .pop { right: 0; top: 34px; min-width: 170px; text-align: left; }
.row-menu form { margin: 0; }
.show-sm { display: none !important; }
.upload-list { padding: 10px 14px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
.upload-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px 150px; gap: 12px; align-items: center; font-size: 13px; }
.upload-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.upload-row .bar { height: 6px; }
.upload-row .bar i { background: var(--saffron); transition: width .15s; }
.upload-row.done .bar i { background: var(--ok); }
.upload-row.error .st { color: var(--danger); }
.upload-row.error .bar i { background: var(--danger); width: 100% !important; }
.file-mini { list-style: none; margin: 0; padding: 4px 0; }
.file-mini li a { display: flex; align-items: center; gap: 10px; padding: 7px 18px; color: var(--ink); text-decoration: none; font-size: 13px; min-width: 0; }
.file-mini li a:hover { background: var(--sunk); }
.file-mini .folder-ic, .file-mini .file-badge, .file-mini .file-thumb { width: 28px; height: 28px; border-radius: 6px; font-size: 9px; }
.file-mini .folder-ic svg { width: 16px; height: 16px; }
.file-mini b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-mini small { color: var(--ink-3); margin-left: auto; white-space: nowrap; }
@media (max-width: 860px) {
  .hide-sm { display: none; }
  .show-sm { display: block !important; }
  .upload-row { grid-template-columns: minmax(0, 1fr) 80px; }
  .upload-row .st { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------- Sidebar colour picker */

.rp-head { margin: 18px 0 8px; font-size: 13px; font-weight: 650; color: var(--ink-2); }
.rp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
.rp-card {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  padding: 6px 6px 8px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer; transition: border-color .12s, box-shadow .12s;
}
.rp-card:hover { border-color: var(--line-2); }
.rp-card.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.rp-card:has(input:focus-visible) { box-shadow: var(--focus); }
.rp-prev { display: flex; height: 64px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.rp-rail {
  width: 44%; flex: none; display: flex; flex-direction: column; gap: 4px; padding: 7px 6px;
  background: var(--rail); border-right: 1px solid var(--rail-edge);
}
.rp-rail i { display: block; height: 4px; width: 78%; border-radius: 2px; background: var(--rail-text); opacity: .55; }
.rp-rail i.w { height: 6px; width: 58%; background: var(--rail-strong); opacity: 1; margin-bottom: 3px; }
.rp-rail i.a { height: 9px; width: 100%; background: var(--rail-active); opacity: 1; box-shadow: inset 2px 0 0 var(--rail-accent); }
.rp-rail i.s { width: 52%; }
.rp-page { flex: 1; display: flex; flex-direction: column; gap: 5px; padding: 8px 7px; background: var(--paper); }
.rp-page i { display: block; height: 15px; border-radius: 3px; background: var(--surface); border: 1px solid var(--line); }
.rp-page i.s { width: 70%; }
.rp-name { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 2px; font-size: 13px; font-weight: 600; color: var(--ink); }
.rp-sub { padding: 0 2px; font-size: 12px; line-height: 1.35; color: var(--ink-3); margin-top: -3px; }
.rp-tick { width: 16px; height: 16px; flex: none; stroke: var(--ink); fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.rp-card.on .rp-tick { visibility: visible; }
.rp-color { display: flex; align-items: center; gap: 6px; padding: 0 2px; margin-top: -2px; }
.rp-color input[type=color] { width: 30px; height: 24px; padding: 0; border: 1px solid var(--line-2); border-radius: 5px; background: none; cursor: pointer; }
.rp-color input[type=color]::-webkit-color-swatch-wrapper { padding: 2px; }
.rp-color input[type=color]::-webkit-color-swatch { border: 0; border-radius: 3px; }
.rp-color code { font-size: 12px; color: var(--ink-3); text-transform: uppercase; }
.rp-note { margin-top: 10px; }
.rail-picker > .rp-head:first-child { margin-top: 12px; }
