/* Dead Cat Shovel — brand theme · Canucks Navy #041E42, Canucks Green #006847 */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Montserrat:wght@400;500;600;700;800&display=swap');
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e5e7eb;
  --text: #041E42;
  --muted: #667085;
  --primary: #041E42;
  --primary-tint: #e6ecf5;
  --primary-hover: #0a2f5c;
  --accent: #006847;
  --green: #006847;
  --green-tint: #d9efe4;
  --amber: #b45309;
  --amber-tint: #fef3c7;
  --red: #dc2626;
  --red-dark: #991b1b;
  --red-tint: #fee2e2;
  --gray: #6b7280;
  --gray-tint: #f1f3f5;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.06);
  --radius: 14px;
  --radius-sm: 9px;
  --font: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-head: 'Bebas Neue', 'Montserrat', sans-serif;

  /* Stacking order, in one place. The header used to sit at 20 while the
     select-mode bar and the menu panels both sat at 40 — so a menu opened from
     the header was trapped under both. Anything that overlays gets a token. */
  --z-sticky-bar: 40;   /* the select-mode bar pinned to the bottom */
  --z-header: 50;       /* the site header */
  --z-menu: 60;         /* dialogs and any future overlay panel */
  --z-toast: 100;
  --z-overlay: 200;     /* welcome card, modal scrims */
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1d212a;
    --border: #2a2f3a;
    --text: #e6e8ec;
    --muted: #9aa2af;
    --primary: #6ea3e6;
    --primary-tint: #182741;
    --primary-hover: #9cc0f0;
    --accent: #4cae7a;
    --green: #4cae7a;
    --green-tint: #163726;
    --amber: #fbbf24;
    --amber-tint: #3a2c0c;
    --red: #f87171;
    --red-dark: #f87171;
    --red-tint: #3a1717;
    --gray: #9aa2af;
    --gray-tint: #23272f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Brand headline font (Bebas Neue) on the big display type; body stays Montserrat. */
.page-title, .digest-title-lead, .section-lead, .brand, .login-card h1, .category-head h2 {
  font-family: var(--font-head);
  font-weight: 400;
  letter-spacing: 0.03em;
}
.page-title { font-size: 30px; }
.brand { letter-spacing: 0.04em; font-size: 20px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: var(--z-header);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(6px);
}
.header-inner {
  max-width: 1080px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .logo { width: 30px; height: 30px; border-radius: 6px; object-fit: cover; }
.nav { display: flex; gap: 4px; margin-left: 8px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { white-space: nowrap; }
.nav a {
  color: var(--muted); padding: 7px 12px; border-radius: 8px; font-size: 14px; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--primary-tint); color: var(--primary); }
.nav-badge { display: inline-block; min-width: 18px; text-align: center; margin-left: 6px; padding: 0 6px; font-size: 11px; font-weight: 700; line-height: 18px; border-radius: 999px; background: var(--red); color: #fff; }

/* ---------- Project links ---------- */
.link-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.link-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 999px; background: var(--primary-tint); color: var(--primary); border: 1px solid transparent; cursor: pointer; max-width: 100%; }
.link-chip:hover { text-decoration: none; border-color: var(--primary); }
.link-chip .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.ask-box { background: var(--amber-tint); border: 1px solid var(--amber); border-radius: 10px; padding: 9px 12px; font-size: 14px; margin-bottom: 12px; }
.ask-box b { color: var(--amber); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.role-pill {
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: var(--primary-tint); color: var(--primary);
}
.role-pill.viewer { background: var(--gray-tint); color: var(--muted); }

/* ---------- Layout ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 24px 20px 80px; }
.page-title { font-size: 24px; font-weight: 700; margin: 4px 0 2px; }
.page-sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  padding: 9px 15px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--red); border-color: var(--border); }
.btn.danger:hover { background: var(--red-tint); }
.btn.small { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card.pad { padding: 18px; }

/* ---------- Portfolio stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)); gap: 10px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.stat .num { font-size: 22px; font-weight: 700; line-height: 1.1; }
.stat .label { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat.alert .num { color: var(--red); }
.stat.warn .num { color: var(--amber); }

/* ---------- Boss digest ---------- */
.digest-title-lead { font-size: 18px; margin: 6px 0 12px; }
.digest-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
/* Wraps rather than overflowing once the control carries four modes. */
.seg { display: inline-flex; flex-wrap: wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 2px; }
.seg-btn { font: inherit; font-size: 13px; font-weight: 600; padding: 6px 14px; border: none; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; }
@media (max-width: 480px) { .seg-btn { padding: 6px 10px; } }
.seg-btn.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.digest-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.digest-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.digest-section.alert { border-color: var(--amber); }
.digest-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 8px; }
.digest-count { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.digest-item { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 9px 6px; border-top: 1px solid var(--border); color: var(--text); }
.digest-item:first-of-type { border-top: none; }
.digest-item:hover { text-decoration: none; background: var(--surface-2); border-radius: 8px; }
.digest-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.digest-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.digest-approval { padding: 10px 6px; border-top: 1px solid var(--border); }
.digest-approval:first-of-type { border-top: none; }
.digest-ask { font-size: 13px; color: var(--text); margin-top: 2px; }

/* ---------- Comments / discussion ---------- */
.comment { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface-2); }
.comment.boss { border-left: 3px solid var(--primary); }
.comment.team { border-left: 3px solid var(--accent); }
.comment-meta { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 3px; }

/* ---------- Board / Kanban ---------- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x proximity; }
.board-col { flex: 0 0 250px; min-width: 250px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px; scroll-snap-align: start; }
.board-col-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 13px; margin: 2px 4px 10px; }
.board-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 11px; margin-bottom: 9px; box-shadow: var(--shadow); }
.board-card:hover { text-decoration: none; border-color: var(--primary); }
.board-card-title { font-weight: 600; font-size: 14px; color: var(--text); margin-bottom: 6px; }
.board-card-meta { display: flex; flex-wrap: wrap; gap: 5px; }
.board-card-cat { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- Category groups ---------- */
.category { margin-bottom: 28px; }
.category-head {
  display: flex; align-items: center; gap: 10px;
  margin: 30px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.category-head:first-of-type { margin-top: 4px; }
.category-head h2 {
  font-size: 16px; margin: 0; font-weight: 700; line-height: 1.2;
  letter-spacing: .02em; text-transform: uppercase; color: var(--text);
}
.category-count { font-size: 12px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 2px 9px; border-radius: 999px; }
.category-desc { margin: -6px 0 12px; color: var(--muted); font-size: 13.5px; max-width: 70ch; }
.category-desc.muted-hint { cursor: pointer; opacity: .7; font-style: italic; }
.category-desc.muted-hint:hover { color: var(--primary); opacity: 1; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }

/* ---------- Project card ---------- */
.project-card { display: flex; flex-direction: column; gap: 9px; padding: 15px; cursor: pointer; transition: transform .1s, box-shadow .12s; }
.pc-foot { font-size: 12.5px; color: var(--muted); }
.pc-foot.over { color: var(--red); font-weight: 600; }
.pc-approve-link { align-self: flex-start; background: none; border: none; padding: 0; margin-top: 1px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--primary); cursor: pointer; }
.pc-approve-link:hover { text-decoration: underline; }
.project-card:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(16,24,40,.10); text-decoration: none; }
.project-card .pc-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.project-card h3 { margin: 0; font-size: 15.5px; color: var(--text); }
.project-card .pc-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); }

/* ---------- Badges ---------- */
.badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge.stage { background: var(--primary-tint); color: var(--primary); }
.badge.s-on-track { background: var(--green-tint); color: var(--green); }
.badge.s-at-risk { background: var(--amber-tint); color: var(--amber); }
.badge.s-blocked { background: var(--red-tint); color: var(--red); }
.badge.s-on-hold { background: var(--gray-tint); color: var(--gray); }
.badge.done { background: var(--green-tint); color: var(--green); }
.badge.overdue { background: var(--red-tint); color: var(--red); }
.badge.private { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* ---------- Progress + stage stepper ---------- */
.progress { height: 7px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.progress.over > span { background: var(--red); }

.stepper { display: flex; gap: 4px; margin: 4px 0; }
.stepper .step { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.stepper .step.done { background: var(--primary); border-color: var(--primary); }
/* One column per stage, so each label sits under its own segment. A flex row
   with space-between drifts out of alignment and wraps raggedly once a pipeline
   runs past six or seven stages — retail runs to nine. */
.stepper-labels {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: 4px; margin-top: 6px;
  font-size: 10px; line-height: 1.3; color: var(--muted);
}
.stepper-labels span { text-align: center; overflow-wrap: anywhere; }

.budget-line { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.budget-line .over { color: var(--red); font-weight: 600; }
/* "Budget" label: dark bold red until the project is approved, then green. */
.budget-word { font-weight: 800; letter-spacing: .02em; color: var(--red-dark); }
.budget-word.approved { color: var(--green); }

/* ---------- Project detail ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 860px) { .detail-grid { grid-template-columns: 1.6fr 1fr; align-items: start; } }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14px; }
.kv .k { color: var(--muted); }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 10px; font-weight: 700; }
.outline-text, .report-text { white-space: pre-wrap; font-size: 14.5px; }

/* ---------- Timeline (updates feed) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 22px; border-left: 2px solid var(--border); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px; border-radius: 999px; background: var(--primary); border: 2px solid var(--surface); }
.timeline .t-date { font-size: 12px; color: var(--muted); }
.timeline .t-body { white-space: pre-wrap; font-size: 14px; margin: 3px 0 0; }
.timeline .t-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.chip.move { background: var(--primary-tint); color: var(--primary); border-color: transparent; }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--text); }
label.field span { display: block; margin-bottom: 5px; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 14px; padding: 9px 11px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
.checkbox-row { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 500; margin-bottom: 12px; cursor: pointer; }
.checkbox-row input { width: 18px; height: 18px; flex: 0 0 auto; }
.checkbox-row span { display: inline; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Dialog ---------- */
dialog {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0; max-width: 560px; width: 92vw;
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.28);
}
dialog::backdrop { background: rgba(15, 20, 30, .5); }
.dialog-head { padding: 16px 18px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 16px; }
.dialog-body { padding: 18px; max-height: 70vh; overflow: auto; }
.dialog-foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; text-align: center; padding: 34px 30px; }
.login-card .logo { width: 56px; height: 56px; margin: 0 auto 14px; display: block; }
.login-card .brand-logo { display: block; width: 220px; max-width: 78%; margin: 0 auto 12px; background: #fff; border-radius: 16px; padding: 12px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 22px; margin: 0 0 4px; }
.login-card p.sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.role-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.role-toggle button { flex: 1; padding: 9px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.role-toggle button.active { background: var(--primary-tint); border-color: var(--primary); color: var(--primary); }
.form-error { color: var(--red); font-size: 13px; min-height: 18px; margin: 4px 0 0; }

/* ---------- Misc ---------- */
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.muted { color: var(--muted); }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px;
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow); opacity: 0; transition: opacity .2s, transform .2s; z-index: var(--z-toast); pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.hidden { display: none !important; }

/* ---------- Welcome splash (boss) ---------- */
.welcome-overlay { position: fixed; inset: 0; background: rgba(10, 16, 28, .55); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: var(--z-overlay); padding: 24px; opacity: 1; transition: opacity .35s; }
.welcome-overlay.fade { opacity: 0; }
.welcome-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.35); padding: 28px 26px; max-width: 470px; width: 100%; text-align: center; }
.welcome-hi { font-size: 24px; font-weight: 800; }
.welcome-sub { color: var(--muted); margin: 6px 0 16px; font-size: 15px; }
.welcome-list { list-style: none; margin: 0; padding: 0; text-align: left; }
.welcome-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.welcome-item-title { font-weight: 600; font-size: 14.5px; }
.welcome-timer { height: 4px; background: var(--primary); border-radius: 999px; margin-top: 18px; animation: welcomeShrink 5s linear forwards; }
@keyframes welcomeShrink { from { width: 100%; } to { width: 0%; } }

/* ---------- ShovelReport: selection mode ---------- */
body.selecting { padding-bottom: 92px; }

.project-card.selectable {
  position: relative;
  cursor: pointer;
  border: 1px solid var(--border);
  user-select: none;
}
.project-card.selectable:hover { transform: none; box-shadow: var(--shadow); border-color: var(--primary); }
.project-card.selectable.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-tint), var(--shadow);
  background: var(--primary-tint);
}
.pc-check {
  position: absolute;
  top: 12px; right: 12px;
  width: 22px; height: 22px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; line-height: 1;
  color: #fff;
}
.project-card.selectable.selected .pc-check { background: var(--primary); border-color: var(--primary); }

.cat-check {
  flex: none;
  width: 22px; height: 22px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: #fff;
  font: inherit; font-size: 14px; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.cat-check.on, .cat-check.part { background: var(--primary); border-color: var(--primary); }
.cat-check:hover { border-color: var(--primary); }

/* Sticky action bar while selecting */
.report-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--z-sticky-bar);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(16, 24, 40, .10);
}
.rb-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rb-note { font-size: 12px; color: var(--muted); }
.rb-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }

/* Report preview dialog */
dialog.report-dialog { max-width: 760px; width: calc(100vw - 32px); }
.report-opts { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 10px; }
.report-meta {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 10px; margin-bottom: 8px;
}
.report-preview {
  max-height: 46vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 10px;
}
/* The preview is a real email body: keep it light even in dark mode. */
.report-preview, .report-preview * { color-scheme: light; }

@media (max-width: 560px) {
  .rb-actions { margin-left: 0; width: 100%; }
  .rb-actions .btn { flex: 1; }
}

/* Quick-select by priority, inside the selection bar */
.report-bar { flex-direction: column; align-items: stretch; gap: 10px; }
.rb-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.rb-quick { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.rb-quick-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.rb-chip {
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.rb-chip:hover:not(:disabled) { border-color: var(--primary); }
.rb-chip:disabled { opacity: .45; cursor: default; }
.rb-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- To-dos on a project card ---------- */
.todo-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 4px; border-top: 1px solid var(--border); }
.todo-row:first-child { border-top: none; }
.todo-row.done .todo-title { text-decoration: line-through; color: var(--muted); }
.todo-title { font-size: 14px; font-weight: 600; line-height: 1.4; }
.todo-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.todo-meta.overdue-text { color: var(--red); font-weight: 700; }
/* Square rather than round, so it doesn't read as a radio button. */
.todo-check {
  flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 6px; cursor: pointer;
  border: 2px solid var(--border); background: var(--surface); color: #fff;
  font: inherit; font-size: 12px; font-weight: 700; line-height: 1; padding: 0;
}
.todo-check:hover:not(:disabled) { border-color: var(--primary); }
.todo-check.on { background: var(--primary); border-color: var(--primary); }
.todo-check:disabled { cursor: default; opacity: .8; }
.todo-del {
  flex: none; border: none; background: transparent; color: var(--muted);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; border-radius: 6px;
}
.todo-del:hover { color: var(--red); background: var(--red-tint); }
/* The next-action block sits apart from the update fields above it. */
.update-todo { border-top: 1px dashed var(--border); margin-top: 6px; padding-top: 14px; }
/* Open-to-do count on a dashboard project card. */
.todo-pill { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }

/* ---------- Backup & restore ---------- */
.backup-row {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); margin-bottom: 7px;
}
.backup-row:hover { border-color: var(--primary); }
.backup-when { font-size: 14px; font-weight: 600; }
.backup-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.danger-note {
  background: var(--amber-tint); border: 1px solid var(--amber); color: var(--text);
  border-radius: 10px; padding: 11px 13px; font-size: 13.5px; line-height: 1.55; margin: 12px 0 2px;
}
.danger-note strong { color: var(--amber); }

/* ---------- Dashboard toolbar: search + view ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 4px 0 18px; }
.search-wrap { position: relative; flex: 1 1 280px; min-width: 220px; display: flex; align-items: center; }
.search-icon { position: absolute; left: 12px; font-size: 17px; color: var(--muted); pointer-events: none; line-height: 1; }
#search {
  font: inherit; font-size: 15px; width: 100%; padding: 10px 34px 10px 34px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
}
#search::-webkit-search-cancel-button { display: none; }
#search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.search-clear {
  position: absolute; right: 8px; border: none; background: transparent; color: var(--muted);
  font-size: 20px; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.search-clear:hover { color: var(--text); background: var(--surface-2); }
.toolbar-view { display: flex; align-items: center; gap: 8px; }
.toolbar-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.search-note {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 14px; color: var(--muted); margin: -8px 0 16px;
}

/* ---------- Timeline view ---------- */
.tl-group { margin-bottom: 22px; }
.tl-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tl-month { font-size: 16px; font-weight: 700; }
.tl-items { display: flex; flex-direction: column; }
.tl-item {
  display: flex; align-items: center; gap: 14px; padding: 11px 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--border);
  border-radius: 10px; margin-bottom: 6px;
}
.tl-item:hover { text-decoration: none; border-color: var(--primary); border-left-color: var(--primary); }
.tl-item.overdue { border-left-color: var(--red); }
.tl-date {
  font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap;
  width: 88px; flex: none; font-variant-numeric: tabular-nums;
}
.tl-title { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-meta { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-right { display: flex; align-items: center; gap: 8px; flex: none; }
.tl-days { font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-days.overdue-text { color: var(--red); }
@media (max-width: 560px) { .tl-date { width: 66px; font-size: 11px; } }

/* The to-do badge is a count, not an alarm — approvals keep the red. */
.nav-badge.todo { background: var(--gray); }

/* While fresh data is on its way, the cached paint sits slightly back so it
   doesn't read as final. No spinner — the content is real, just a moment old. */
body.refreshing #stats, body.refreshing #digest, body.refreshing #groups,
body.refreshing #board, body.refreshing #timeline { opacity: .55; }
@media (prefers-reduced-motion: no-preference) {
  #stats, #digest, #groups, #board, #timeline { transition: opacity .2s ease; }
}
/* The overflow trigger is a quiet control, not a call to action. */
.toolbar .inline-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
@media (max-width: 620px) {
  .toolbar { gap: 8px; }
  .search-wrap { flex: 1 1 100%; }
  .toolbar .inline-actions { margin-left: 0; }
}
.backup-body { display: flex; flex-direction: column; gap: 22px; }
.backup-body section { display: flex; flex-direction: column; }
.backup-body .section-title { margin-bottom: 4px; }
.backup-row .backup-meta { font-size: 12px; color: var(--muted); }

/* ---------- Printing ---------- */
/* #printArea holds a built memo and is invisible on screen. When printing, the
   app chrome drops out and the memo becomes the page — so a printed approvals
   sheet is the same document Mr. Doyle gets by email, not a screenshot of a
   dashboard with nav and buttons in it. */
#printArea { display: none; }
@media print {
  .site-header, #app, .report-bar, .toast { display: none !important; }
  #printArea { display: block; }
  /* The memo carries its own light colours inline; force a light canvas so a
     dark-mode screen doesn't print white text onto white paper. */
  html, body, #printArea { background: #fff !important; color-scheme: light; }
  #printArea, #printArea * { color-scheme: light; }
  @page { margin: 14mm; }
  /* Keep a project's detail from splitting across two sheets. */
  #printArea table, #printArea div[style*="border:1px solid"] { break-inside: avoid; }
}

/* ---------- Approvals: whose turn it is ---------- */
.approval-section-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin: 22px 0 10px; padding-bottom: 7px; border-bottom: 1px solid var(--border);
}
.approval-section-head:first-child { margin-top: 0; }
/* An amber rule, not a red card: this is "your move", not "something broke". */
.approval-section-head.alert { border-bottom-color: var(--amber); }
.approval-section-head.alert .section-title { color: var(--amber); }
.approval-hint { font-size: 12.5px; color: var(--muted); }
.approval-section-head.alert .approval-hint { color: var(--amber); font-weight: 600; }

/* ---------- Shovel manager (shared shovels only) ---------- */
.mgr-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 2px 9px 2px 3px; border-radius: 999px; white-space: nowrap;
}
.mgr-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 9px; font-weight: 700; letter-spacing: .02em;
}
.category-head .mgr-badge { font-weight: 700; }

/* Whose shovel this is — on the sign-in card and in the header. Several
   deployments are open at once and they are otherwise identical. */
.login-owner {
  margin: 0 0 18px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--primary);
}
.brand-owner {
  font-weight: 600;
  color: var(--muted);
}
.brand-owner:not(:empty)::before {
  content: "·";
  margin: 0 7px;
  color: var(--muted);
  opacity: .55;
  font-weight: 400;
}
@media (max-width: 600px) {
  .brand-name { display: none; }
  .brand-owner:not(:empty)::before { content: none; margin: 0; }
  .brand-owner { color: var(--text); font-weight: 700; }
}
