/* app.css — self-contained design system for template apps.
   No external requests, no build step. Change the tokens below to re-skin
   every page; component classes are consumed by templates/*.html. */

/* ---------- tokens ---------- */

:root {
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shell-width: 60rem;

  /* TaxDome brand palette, harvested from taxdome.com (Sep 2026): brand blue
     #2851f5 with its darker press state #1433e1, ink navy #000724, the
     page tint #f5f8ff and the soft blue border #dce2f9. Marketing-site
     values — the closest available source until a brand kit exists. */
  --bg: #f5f8ff;
  --surface: #ffffff;
  --surface-2: #eef1fc;
  --border: #dce2f9;
  --text: #000724;
  --text-muted: #50505e;

  --accent: #2851f5;
  --accent-hover: #1433e1;
  --accent-contrast: #ffffff;
  --focus-ring: rgba(40, 81, 245, 0.7);

  --success: #1e7f4f;
  --success-soft: #e2f3ea;
  --warning: #8a6116;
  --warning-soft: #faf0d9;
  --danger: #b3372f;
  --danger-soft: #f9e5e3;
  --info: #2b5f8f;
  --info-soft: #e3eef7;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark mode keeps the brand hue but lifts it: #2851f5 is too dark to
       carry text or fills against a dark surface, so the accent moves to a
       lighter tint of the same blue and the neutrals take the ink navy's
       hue rather than a plain grey. */
    --bg: #070c22;
    --surface: #0f1533;
    --surface-2: #1a2144;
    --border: #2b3566;
    --text: #e8ebf7;
    --text-muted: #a3a8c2;

    --accent: #8fa8ff;
    --accent-hover: #adc0ff;
    --accent-contrast: #000724;
    --focus-ring: rgba(143, 168, 255, 0.7);

    --success: #57c28b;
    --success-soft: #1c3529;
    --warning: #d9a94e;
    --warning-soft: #3b2f18;
    --danger: #e08079;
    --danger-soft: #402523;
    --info: #7ab3dd;
    --info-soft: #1f3242;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  }
}

/* ---------- base ---------- */

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

html {
  color-scheme: light dark;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

h1, h2, h3 {
  line-height: 1.2;
  margin: 0 0 var(--space-3);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

p { margin: 0 0 var(--space-3); }

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-sm);
}

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}

.muted { color: var(--text-muted); }

/* ---------- page shell ---------- */

.shell {
  width: 100%;
  max-width: var(--shell-width);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

main.shell {
  flex: 1;
  padding-block: var(--space-6);
}

/* ---------- header / nav ---------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 3.5rem;
  flex-wrap: wrap;
  padding-block: var(--space-2);
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.brand:hover { text-decoration: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.nav-links a { color: var(--text); }

/* The header logout control is a one-button POST form (logout is state-changing,
   so it must not be a GET link). display:contents makes the form transparent to
   the flex layout, so the button sits exactly like the old link did. */
.nav-links form { display: contents; }

.nav-user {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: var(--space-4);
  font-size: 0.875rem;
}

/* ---------- hero (landing) ---------- */

.hero {
  padding-block: var(--space-6) var(--space-5);
  max-width: 44rem;
}

.lead {
  font-size: 1.125rem;
  color: var(--text-muted);
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
  margin-block-end: var(--space-5);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--space-4);
  margin-block-end: var(--space-5);
}

.card-grid .card { margin-block-end: 0; }

.stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
}

.page-head { margin-block-end: var(--space-4); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.btn:hover { text-decoration: none; }

.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.9rem; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover { background: var(--surface-2); }

/* Semantic action buttons (admin session list): amber for a reversible
   caution (archive), green for undoing one (restore) — distinct from
   .btn-primary/.btn-secondary's neutral emphasis scale. */
.btn-warning {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: var(--warning);
}

.btn-warning:hover { background: var(--warning); color: var(--surface); }

.btn-success {
  background: transparent;
  color: var(--success);
  border-color: var(--success);
}

.btn-success:hover { background: var(--success); color: var(--surface); }

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

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

.field { margin-block-end: var(--space-4); }

label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-block-end: var(--space-1);
}

input,
select,
textarea {
  width: 100%;
  max-width: 28rem;
  padding: 0.5rem 0.7rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

input::placeholder,
textarea::placeholder { color: var(--text-muted); }

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid var(--focus-ring);
  outline-offset: 0;
  border-color: var(--accent);
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
}

.field-hint {
  margin: var(--space-1) 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* validation state: add .is-invalid to the control and show .field-error */
.is-invalid,
input:user-invalid,
select:user-invalid,
textarea:user-invalid {
  border-color: var(--danger);
}

.field-error {
  margin: var(--space-1) 0 0;
  font-size: 0.85rem;
  color: var(--danger);
}

.form-actions {
  display: flex;
  gap: var(--space-3);
  margin-block-start: var(--space-4);
}

/* ---------- tables ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}

thead th {
  background: var(--surface-2);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover td { background: var(--surface-2); }

/* ---------- admin row list (v0.4 Live) ----------
   A table's columns force horizontal scroll at phone width — this is a list
   of records with actions, not tabular data, so it stacks as cards instead:
   each row wraps its own content, never the page. */

.admin-list { display: grid; gap: var(--space-3); }

.admin-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: grid;
  gap: var(--space-2);
}

.admin-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
}

.admin-row-title { font-weight: 600; }

.admin-row-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.admin-row-flags { display: flex; flex-wrap: wrap; gap: var(--space-1); }

.admin-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-block-start: var(--space-1);
}

/* ---------- alerts ---------- */

.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-block-end: var(--space-5);
}

.alert-info    { background: var(--info-soft);    color: var(--info);    border-color: currentColor; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: currentColor; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: currentColor; }
.alert-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: currentColor; }

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

.badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-muted);
  margin-inline-end: var(--space-1);
}

.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-info    { background: var(--info-soft);    color: var(--info); }

/* ---------- forced dark theme (offsite agenda, D9) ----------
   The rest of the app follows the visitor's OS preference (the
   prefers-color-scheme block above). The agenda page is a hard dark-theme
   requirement regardless of that preference, so it re-applies the same dark
   token values unconditionally via a body class instead of a media query.
   Add `{% block body_class %}theme-dark{% endblock %}` in a template to opt in. */
body.theme-dark {
  --bg: #070c22;
  --surface: #0f1533;
  --surface-2: #1a2144;
  --border: #2b3566;
  --text: #e8ebf7;
  --text-muted: #a3a8c2;

  --accent: #8fa8ff;
  --accent-hover: #adc0ff;
  --accent-contrast: #000724;
  --focus-ring: rgba(143, 168, 255, 0.7);

  --success: #57c28b;
  --success-soft: #1c3529;
  --warning: #d9a94e;
  --warning-soft: #3b2f18;
  --danger: #e08079;
  --danger-soft: #402523;
  --info: #7ab3dd;
  --info-soft: #1f3242;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ---------- agenda (offsite v0.1 Read) ----------
   Must-attend accent per D9/D20: a bold flat poster colour on the card
   itself, not a text badge alone — the badge below is a secondary,
   accessibility-minded cue on top of the colour, not a replacement for it.
   Must-attend is TaxDome's own mustard accent, harvested from taxdome.com
   (Sep 2026), where it appears as a bright pop colour. Pick uses the core
   brand blue (--accent, same source) so a self-picked session reads as
   "on-brand, chosen" rather than a fourth unrelated hue. taxdome.com
   carries no red accent, so overlap (D19: outranks both of the others,
   hence the most alarming colour) keeps the same vividness/lightness
   family as must-attend rather than a generic red, so all three read as
   one system. */
:root {
  --must-attend-bg: #ffcb0d;
  --must-attend-text: #241d02;
  --pick-bg: #2851f5;
  --pick-text: #ffffff;
  --overlap-bg: #ef4444;
  --overlap-text: #1a0605;
}

.day-tabs {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  margin-block-end: var(--space-4);
  padding-block-end: var(--space-2);
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.day-tabs::-webkit-scrollbar { display: none; }

.day-tab {
  flex: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
}

/* Five tabs of "Mon, 16 Nov" don't fit a phone width — show the day number
   only below 480px, the full label from there up. */
.day-tab__full { display: none; }
.day-tab__short { display: inline; }

@media (min-width: 480px) {
  .day-tab__full { display: inline; }
  .day-tab__short { display: none; }
}

.day-tab:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }

.day-tab--active {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}

.agenda-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.session-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.session-card[open] { box-shadow: var(--shadow-md); }

.session-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  padding: var(--space-4);
  cursor: pointer;
  list-style: none;
}

/* Default markers vary by engine (▶/▸/nothing); the layout above already
   signals "expandable" via cursor + hover, so hide the marker everywhere. */
.session-summary::-webkit-details-marker { display: none; }
.session-summary::marker { content: ""; }

.session-title {
  font-weight: 700;
  flex: 1 1 100%;
}

.session-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.session-flag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
}

.session-detail {
  padding: 0 var(--space-4) var(--space-4);
  border-top: 1px solid var(--border);
  padding-block-start: var(--space-3);
}

.session-field { margin: 0 0 var(--space-2); }
.session-field:last-child { margin-block-end: 0; }
.session-field-label { font-weight: 600; }

/* Bold flat fill, no gradient/tint (D20) — text and meta inherit the
   contrast colour so nothing inside the card needs its own override. */
.session-card--must-attend {
  background: var(--must-attend-bg);
  border-color: var(--must-attend-bg);
  color: var(--must-attend-text);
}

.session-card--must-attend .session-meta,
.session-card--must-attend .muted {
  color: var(--must-attend-text);
  opacity: 0.85;
}

.session-card--must-attend .session-detail {
  border-top-color: rgba(0, 0, 0, 0.2);
}

/* v0.2 Pick — self-picked sessions get their own bold flat colour (D19/D20
   palette), distinct from must-attend red. */
.session-card--picked {
  background: var(--pick-bg);
  border-color: var(--pick-bg);
  color: var(--pick-text);
}

.session-card--picked .session-meta,
.session-card--picked .muted {
  color: var(--pick-text);
  opacity: 0.85;
}

.session-card--picked .session-detail {
  border-top-color: rgba(0, 0, 0, 0.2);
}

/* v0.3 Clash — overlap outranks must-attend and picked (D19; colours
   moved to coral-red/mustard Sep 2026 for the brand palette, ranking
   unchanged): this rule block comes last so its cascade order wins
   regardless of which other state class is also present on the card. */
.session-card--overlap {
  background: var(--overlap-bg);
  border-color: var(--overlap-bg);
  color: var(--overlap-text);
}

.session-card--overlap .session-meta,
.session-card--overlap .muted {
  color: var(--overlap-text);
  opacity: 0.85;
}

.session-card--overlap .session-detail {
  border-top-color: rgba(0, 0, 0, 0.2);
}

.session-flag--overlap {
  background: rgba(0, 0, 0, 0.25);
}

.session-overlap-note {
  margin: 0;
  padding: 0 var(--space-4) var(--space-3);
  font-size: 0.85rem;
  font-weight: 600;
}

.session-actions {
  padding: 0 var(--space-4) var(--space-4);
}

.session-card--must-attend .session-actions,
.session-card--picked .session-actions,
.session-card--overlap .session-actions {
  padding-block-start: 0;
}
