/* ==========================================================================
   Rite — design system

   Dark by default. Two reasons, one practical and one not: this is a low-light
   app, and a private one. High-contrast white on a bright screen is legible
   from across a room.

   No external assets are loaded. Every colour, font stack and icon here is
   local, because a font or icon request tells a third party when the app was
   opened and roughly how long it stayed open.
   ========================================================================== */

:root {
  /* Surfaces, darkest to lightest */
  --bg:            #0a0a0d;
  --bg-raised:     #121218;
  --bg-input:      #1a1a22;
  --bg-hover:      #20202a;
  --border:        #2a2a36;
  --border-strong: #3a3a48;

  /* Text */
  --fg:            #e8e6f0;
  --fg-muted:      #9a97a8;
  --fg-faint:      #6a6778;

  /* Accents */
  --accent:        #a78bfa;
  --accent-dim:    #7c5cf0;
  --accent-glow:   rgba(167, 139, 250, 0.16);

  --ok:            #4ade80;
  --warn:          #fbbf24;
  --danger:        #f87171;
  --info:          #60a5fa;

  --radius:        10px;
  --radius-sm:     6px;
  --radius-lg:     16px;

  --shadow:        0 4px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg:     0 12px 48px rgba(0, 0, 0, 0.6);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo,
          Consolas, monospace;

  --nav-w: 232px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:            #14121c;
    --bg-raised:     #1c1a26;
    --bg-input:      #24222f;
    --bg-hover:      #2a2836;
    --border:        #34323f;
    --border-strong: #45434f;
  }
}

/* --------------------------------------------------------------- reset -- */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: 0.95rem; }
p  { margin: 0 0 0.8em; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Scrollbars — the default light ones are jarring on this palette. */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 5px;
  border: 2px solid var(--bg);
}

/* ------------------------------------------------------------ utilities -- */

.hidden { display: none !important; }
.muted { color: var(--fg-muted); }
.faint { color: var(--fg-faint); }
.mono { font-family: var(--mono); font-size: 0.86em; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; gap: 0.6rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.col { display: flex; flex-direction: column; gap: 0.6rem; }
.grow { flex: 1 1 auto; min-width: 0; }
.wrap { flex-wrap: wrap; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Screen-reader-only: for labels that are visually implied by layout. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------ app shell -- */

#app { min-height: 100vh; }

.boot {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; min-height: 100vh; color: var(--fg-muted);
}

.spinner {
  width: 28px; height: 28px;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
  * { transition: none !important; }
}

.layout {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  min-height: 100vh;
}

/* -------------------------------------------------------------- sidebar -- */

.nav {
  background: var(--bg-raised);
  border-right: 1px solid var(--border);
  padding: 1.1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.nav-brand {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.35rem 0.6rem 1.1rem;
}
.nav-mark {
  width: 26px; height: 26px; flex: 0 0 auto;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  box-shadow: 0 0 16px var(--accent-glow);
}
.nav-brand-text { font-weight: 650; letter-spacing: 0.02em; }
.nav-brand-sub { font-size: 0.75rem; color: var(--fg-faint); }

.nav-section {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--fg-faint);
  padding: 1rem 0.6rem 0.35rem;
}

.nav-link {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
  font-size: 0.92rem;
  transition: background 0.12s, color 0.12s;
}
.nav-link:hover { background: var(--bg-hover); color: var(--fg); text-decoration: none; }
.nav-link.active { background: var(--accent-glow); color: var(--accent); font-weight: 550; }
.nav-link[disabled] { opacity: 0.4; cursor: not-allowed; }
.nav-icon { width: 18px; text-align: center; flex: 0 0 auto; font-size: 0.95rem; }
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #0a0a0d;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.05rem 0.4rem;
  border-radius: 9px;
  min-width: 19px;
  text-align: center;
}

.nav-foot { margin-top: auto; padding-top: 1rem; }

.nav-user {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

/* ---------------------------------------------------------------- main -- */

.main {
  padding: 1.75rem 2rem 4rem;
  max-width: 1180px;
  width: 100%;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}
.page-head h1 { margin-bottom: 0.15rem; }
.page-sub { color: var(--fg-muted); font-size: 0.9rem; }
.page-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* --------------------------------------------------------------- cards -- */

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
}
.card-tight { padding: 0.8rem; }
.card-flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.6rem; margin-bottom: 0.85rem;
}
.card-title { font-size: 0.98rem; font-weight: 600; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* --------------------------------------------------------------- stats -- */

.stat { display: flex; flex-direction: column; gap: 0.15rem; }
.stat-value { font-size: 1.7rem; font-weight: 650; line-height: 1.1; letter-spacing: -0.02em; }
.stat-label {
  font-size: 0.74rem; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--fg-faint);
}
.stat-hint { font-size: 0.78rem; color: var(--fg-muted); }
.stat-value.ok { color: var(--ok); }
.stat-value.warn { color: var(--warn); }
.stat-value.danger { color: var(--danger); }

/* -------------------------------------------------------------- buttons -- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--fg);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--accent-dim); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }

.btn-danger { color: var(--danger); border-color: rgba(248, 113, 113, 0.35); }
.btn-danger:hover:not(:disabled) { background: rgba(248, 113, 113, 0.12); border-color: var(--danger); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--fg-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--fg); }

.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.82rem; }
.btn-block { width: 100%; }

/* --------------------------------------------------------------- forms -- */

.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.9rem; }
.label { font-size: 0.85rem; font-weight: 550; color: var(--fg-muted); }
.hint { font-size: 0.78rem; color: var(--fg-faint); }
.error-text { font-size: 0.82rem; color: var(--danger); }

.input, .textarea, .select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.12s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent-dim); outline: none; }
.input::placeholder, .textarea::placeholder { color: var(--fg-faint); }
.textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.select { cursor: pointer; }

.input-invalid { border-color: var(--danger); }

.checkbox { display: flex; align-items: flex-start; gap: 0.5rem; cursor: pointer; font-size: 0.9rem; }
.checkbox input { margin-top: 0.25rem; accent-color: var(--accent); flex: 0 0 auto; }

/* --------------------------------------------------------------- table -- */

.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th {
  text-align: left; padding: 0.55rem 0.75rem;
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--fg-faint); font-weight: 600;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg-raised);
}
.table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-hover); }

/* -------------------------------------------------------------- badges -- */

.badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-neutral { background: var(--bg-input); color: var(--fg-muted); border-color: var(--border); }
.badge-ok      { background: rgba(74, 222, 128, 0.14); color: var(--ok); border-color: rgba(74, 222, 128, 0.3); }
.badge-warn    { background: rgba(251, 191, 36, 0.14); color: var(--warn); border-color: rgba(251, 191, 36, 0.3); }
.badge-danger  { background: rgba(248, 113, 113, 0.14); color: var(--danger); border-color: rgba(248, 113, 113, 0.3); }
.badge-info    { background: rgba(96, 165, 250, 0.14); color: var(--info); border-color: rgba(96, 165, 250, 0.3); }
.badge-accent  { background: var(--accent-glow); color: var(--accent); border-color: rgba(167, 139, 250, 0.35); }

/* Chips are badges you can press: the tag filters on the Library view and the
   per-row tags that add themselves to that filter. Reset the button defaults,
   because a bare <button> carries the platform font, border and padding. */
.chip {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.16rem 0.6rem;
  border-radius: 999px;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  background: var(--bg-input);
  color: var(--fg-muted);
  border: 1px solid var(--border);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chip:hover { background: var(--bg-hover); color: var(--fg); }
.chip.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: rgba(167, 139, 250, 0.35);
}
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ------------------------------------------------------------ avatars -- */

.avatar {
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-input);
  border: 1px solid var(--border);
  flex: 0 0 auto;
}
.avatar-sm { width: 28px; height: 28px; }
.avatar-md { width: 40px; height: 40px; }
.avatar-lg { width: 88px; height: 88px; }
.avatar-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 650; color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid rgba(167, 139, 250, 0.3);
}

/* ------------------------------------------------------------ calendar -- */

.cal-head {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  margin-bottom: 4px;
}
.cal-dow {
  text-align: center; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--fg-faint); padding: 0.3rem 0;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }

.cal-day {
  min-height: 92px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.35rem;
  display: flex; flex-direction: column; gap: 0.2rem;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
  position: relative;
  overflow: hidden;
}
.cal-day:hover { border-color: var(--accent-dim); background: var(--bg-hover); }
.cal-day.out { opacity: 0.35; }
.cal-day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-glow); }
.cal-day.selected { border-color: var(--accent); background: var(--accent-glow); }
.cal-day-num { font-size: 0.8rem; color: var(--fg-muted); font-weight: 550; }
.cal-day.today .cal-day-num { color: var(--accent); }

.cal-chip {
  font-size: 0.7rem;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  background: var(--bg-input);
  border-left: 2.5px solid var(--border-strong);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  line-height: 1.4;
}
.cal-chip.completed { border-left-color: var(--ok); }
.cal-chip.failed    { border-left-color: var(--danger); }
.cal-chip.assigned  { border-left-color: var(--info); }
.cal-chip.submitted { border-left-color: var(--warn); }
.cal-chip.planned   { border-left-color: var(--fg-faint); border-style: dashed; }
.cal-more { font-size: 0.68rem; color: var(--fg-faint); padding-left: 0.3rem; }

.cal-load {
  position: absolute; inset: auto 0 0 0; height: 3px;
  background: var(--ok);
}

/* -------------------------------------------------------------- charts -- */

/* Bar charts are plain elements, not canvas or SVG libraries. A dependency
   here would be one more thing to audit, and these are all simple enough. */
.chart { display: flex; flex-direction: column; gap: 0.45rem; }
.chart-row { display: grid; grid-template-columns: 96px 1fr 52px; gap: 0.6rem; align-items: center; }
.chart-label { font-size: 0.82rem; color: var(--fg-muted); }
.chart-track { background: var(--bg-input); border-radius: 999px; height: 9px; overflow: hidden; }
.chart-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.3s; }
.chart-fill.ok { background: var(--ok); }
.chart-fill.warn { background: var(--warn); }
.chart-fill.danger { background: var(--danger); }
.chart-value { font-size: 0.82rem; text-align: right; color: var(--fg-muted); font-variant-numeric: tabular-nums; }

.chart-cols { display: flex; align-items: flex-end; gap: 3px; height: 130px; }
.chart-col { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; position: relative; }
.chart-col-fill { background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; }
.chart-col-fill.ok { background: var(--ok); }
.chart-col-fill.danger { background: var(--danger); }
.chart-axis { display: flex; gap: 3px; margin-top: 0.3rem; }
.chart-axis span { flex: 1 1 0; text-align: center; font-size: 0.64rem; color: var(--fg-faint); }

.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; overflow-x: auto; padding-bottom: 0.4rem; }
.heat-cell { width: 12px; height: 12px; border-radius: 2px; background: var(--bg-input); }
.heat-cell.l1 { background: rgba(167, 139, 250, 0.25); }
.heat-cell.l2 { background: rgba(167, 139, 250, 0.45); }
.heat-cell.l3 { background: rgba(167, 139, 250, 0.7); }
.heat-cell.l4 { background: var(--accent); }

/* ----------------------------------------------------------------- list -- */

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.7rem 0.25rem;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--bg-hover); }
.list-main { flex: 1 1 auto; min-width: 0; }
.list-title { font-weight: 550; margin-bottom: 0.1rem; }
.list-meta { font-size: 0.8rem; color: var(--fg-faint); display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.list-actions { display: flex; gap: 0.35rem; flex: 0 0 auto; }

/* -------------------------------------------------------------- modals -- */

.overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  z-index: 100;
  overflow-y: auto;
}
.modal {
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  margin: auto;
}
.modal-wide { max-width: 780px; }
.modal-head {
  padding: 1.1rem 1.3rem 0.5rem;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
}
.modal-body { padding: 0.5rem 1.3rem 1.3rem; overflow-y: auto; }
.modal-foot {
  padding: 0.9rem 1.3rem;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 0.5rem;
  background: var(--bg);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* -------------------------------------------------------------- toasts -- */

.toasts {
  position: fixed; bottom: 1.2rem; right: 1.2rem;
  display: flex; flex-direction: column; gap: 0.5rem;
  z-index: 200; max-width: 360px;
}
.toast {
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  animation: slide-in 0.2s ease-out;
}
.toast.ok { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
@keyframes slide-in { from { transform: translateX(16px); opacity: 0; } }

/* --------------------------------------------------------------- empty -- */

.empty {
  text-align: center; padding: 2.5rem 1rem; color: var(--fg-faint);
}
.empty-title { font-size: 1rem; color: var(--fg-muted); margin-bottom: 0.3rem; font-weight: 550; }
.empty-text { font-size: 0.87rem; max-width: 380px; margin: 0 auto; }

/* --------------------------------------------------------------- misc --- */

.banner {
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  border: 1px solid;
  font-size: 0.88rem;
  display: flex; gap: 0.7rem; align-items: flex-start;
}
.banner-warn { background: rgba(251, 191, 36, 0.09); border-color: rgba(251, 191, 36, 0.3); }
.banner-danger { background: rgba(248, 113, 113, 0.09); border-color: rgba(248, 113, 113, 0.3); }
.banner-info { background: rgba(96, 165, 250, 0.09); border-color: rgba(96, 165, 250, 0.3); }
.banner-accent { background: var(--accent-glow); border-color: rgba(167, 139, 250, 0.35); }

.divider { height: 1px; background: var(--border); margin: 1rem 0; border: none; }

.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.2rem; }
.tab {
  padding: 0.5rem 0.9rem;
  border: none; background: none; cursor: pointer;
  color: var(--fg-muted); font-size: 0.9rem; font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* --------------------------------------------------------------- auth --- */

.auth-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(167, 139, 250, 0.09), transparent 55%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 430px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.9rem;
}
.auth-mark {
  width: 44px; height: 44px; border-radius: 12px; margin-bottom: 1.1rem;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  box-shadow: 0 0 28px var(--accent-glow);
}
.auth-switch { text-align: center; margin-top: 1.2rem; font-size: 0.87rem; color: var(--fg-muted); }

/* The recovery code is read aloud and written down, so it gets monospace,
   generous letter spacing, and select-all on click. */
.recovery-code {
  font-family: var(--mono);
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  background: var(--bg-input);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
  word-break: break-all;
  user-select: all;
  line-height: 1.9;
}

/* --------------------------------------------------------- responsive -- */

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .nav {
    position: sticky; top: 0; height: auto; z-index: 50;
    flex-direction: row; align-items: center; gap: 0.4rem;
    overflow-x: auto; padding: 0.6rem;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .nav-brand, .nav-section, .nav-foot { display: none; }
  .nav-link { width: auto; white-space: nowrap; padding: 0.4rem 0.7rem; }
  .main { padding: 1.1rem; }
  .cal-day { min-height: 62px; }
  .cal-chip { font-size: 0.62rem; }
  .chart-row { grid-template-columns: 74px 1fr 42px; }
}

@media print {
  .nav, .page-actions, .toasts { display: none; }
  .layout { grid-template-columns: 1fr; }
  body { background: #fff; color: #000; }
  .card { border-color: #ccc; break-inside: avoid; }
}

/* ------------------------------------------------------- preview banner -- */

/*
 * Shown while the master is previewing the sub's view. Deliberately loud: the
 * list is intentionally incomplete in this mode, and a quiet indicator would
 * make withheld tasks look like data loss.
 */
.preview-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.6rem 1rem;
  margin: 0 0 1rem;
  border: 1px solid var(--warn, #d9a441);
  border-left-width: 4px;
  border-radius: var(--radius, 8px);
  background: color-mix(in srgb, var(--warn, #d9a441) 12%, transparent);
  font-size: 0.85rem;
}

.preview-banner > .btn { margin-left: auto; }