/* Tokens are overridden per install from the branding page; these are the
   fallbacks. Same family as the chores app, minus the playfulness. */
:root {
  --ink:      #16233A;
  --ink-soft: #5C6B85;
  --paper:    #EEF1F6;
  --card:     #FFFFFF;
  --rule:     #CFD6E2;
  --accent:   #1F4E79;
  --green:    #216B4F;
  --amber:    #B57A18;
  --red:      #A33A2C;

  --green-bg: #E4F0EA;
  --amber-bg: #FBF0DC;
  --red-bg:   #F8E7E4;

  --display: "Archivo", system-ui, sans-serif;
  --body:    "Public Sans", system-ui, sans-serif;
  --mono:    "Roboto Mono", ui-monospace, monospace;

  /* Everything tappable clears 44px so this works on a tablet. */
  --tap: 44px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

main { max-width: 860px; margin: 0 auto; padding: 24px 18px 96px; }
main.wide { max-width: 1180px; }

h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(26px, 5vw, 36px);
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}

h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 32px 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
h2::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  margin: 0 0 6px;
}

p { margin: 0 0 12px; }
a { color: var(--accent); }
.sub { color: var(--ink-soft); font-size: 14px; margin: 0 0 16px; }
.muted { color: var(--ink-soft); }
.right { text-align: right; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- app header */

.bar {
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  align-items: center;
  justify-content: space-between;
}

.mark {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.logos { display: flex; align-items: center; gap: 10px; }
.logos img { height: 30px; width: auto; max-width: 120px; display: block; }
.mark-rule { width: 22px; height: 3px; background: #fff; display: block; }

.bar nav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; }
.bar nav a, .linkish {
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  opacity: 0.82;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
}
.bar nav a:hover, .linkish:hover { opacity: 1; border-bottom-color: currentColor; }
.linkish {
  background: none; border: 0; font-family: var(--body); cursor: pointer;
}
.inline { display: inline; }

/* ------------------------------------------------------------ section bar */

.section-bar {
  background: var(--card);
  border-bottom: 1px solid var(--rule);
  padding: 8px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-soft);
}
.section-bar.section-test {
  background: var(--amber-bg);
  border-bottom: 2px solid var(--amber);
  color: var(--amber);
  font-weight: 600;
}
body.in-test { background: #F3F1EA; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 10px 18px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: var(--card);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--paper); }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }
.btn-danger { color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.btn-quiet { border-color: var(--rule); color: var(--ink-soft); }
.btn-small { min-height: 34px; padding: 4px 12px; font-size: 13px; }
.btn[disabled], .btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn-row.end { justify-content: flex-end; }

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

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--rule);
  border-radius: 3px;
  padding: 16px 18px;
  margin: 0 0 14px;
}
.card-draft     { border-left-color: var(--ink-soft); }
.card-locked    { border-left-color: var(--amber); }
.card-finalized { border-left-color: var(--green); }

.card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: baseline;
  justify-content: space-between;
}

.panel {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 16px 18px;
  margin: 0 0 16px;
}
.panel-quiet { background: transparent; border-style: dashed; }

.note {
  background: var(--paper);
  border-left: 3px solid var(--rule);
  padding: 10px 14px;
  margin: 0 0 14px;
  font-size: 15px;
}

/* ----------------------------------------------------------------- status */

.tag {
  display: inline-block;
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink-soft);
  white-space: nowrap;
}
.tag-draft     { background: var(--paper);    color: var(--ink-soft); }
.tag-locked    { background: var(--amber-bg); color: var(--amber); }
.tag-finalized { background: var(--green-bg); color: var(--green); }
.tag-open      { background: var(--amber-bg); color: var(--amber); }
.tag-submitted { background: var(--green-bg); color: var(--green); }

.chip {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink-soft);
  white-space: nowrap;
}

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

label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin: 0 0 4px; }
input[type=text], input[type=password], input[type=date], input[type=number],
input[type=email], input[type=file], select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 9px 12px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--card);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
}
textarea { min-height: 74px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.field { margin: 0 0 12px; }
.fields { display: flex; flex-wrap: wrap; gap: 12px; }
.fields > .field { flex: 1 1 220px; margin: 0; }
.fields > .field.narrow { flex: 0 1 130px; }
.hint { font-size: 12px; color: var(--ink-soft); margin: 4px 0 0; font-weight: 400; }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
}
.check input { width: 22px; height: 22px; min-height: 0; flex: none; }

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

table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--rule);
  margin: 0 0 16px;
}
table.data th {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tr.total td { font-weight: 700; background: var(--paper); }
table.data td.num, table.data th.num { text-align: right; font-family: var(--mono); }
.scroll-x { overflow-x: auto; }

/* -------------------------------------------------------- rating controls */

.rating { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.rating input { position: absolute; opacity: 0; width: 0; height: 0; }
.rating label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 52px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--card);
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.rating input:checked + label {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.rating input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.rating .scale-end { font-size: 12px; color: var(--ink-soft); align-self: center; }

.q {
  border-top: 1px solid var(--rule);
  padding: 16px 0 4px;
}
.q:first-of-type { border-top: 0; }
.q-prompt { font-size: 16px; font-weight: 500; margin: 0; }
.q.unanswered { background: var(--red-bg); margin: 0 -12px; padding: 16px 12px 4px; }
.q .note-field { margin: 10px 0 0; }
.q .note-field summary { font-size: 13px; color: var(--ink-soft); cursor: pointer; padding: 6px 0; }

/* ------------------------------------------------------------ score meter */

.meter { height: 8px; background: var(--paper); border-radius: 999px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); }

.figure {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.figure small { font-size: 14px; color: var(--ink-soft); }
.figures { display: flex; flex-wrap: wrap; gap: 28px; margin: 0 0 4px; }
.figures .kicker {
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 2px;
}

.stat-row { display: flex; flex-wrap: wrap; gap: 20px 32px; margin: 0 0 8px; }
.stat b { font-family: var(--mono); font-size: 20px; font-weight: 500; display: block; }
.stat span { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; }

/* ------------------------------------------------------- confirm-to-act */

.killswitch { display: inline-block; }
.killswitch > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 10px 18px;
  border: 1px solid var(--red);
  border-radius: 3px;
  color: var(--red);
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
.killswitch > summary::-webkit-details-marker { display: none; }
.killswitch[open] > summary { background: var(--red-bg); }
.killswitch .confirm {
  margin: 8px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--red);
  border-radius: 3px;
  background: var(--red-bg);
}
.killswitch .confirm p { font-size: 14px; margin: 0 0 10px; }

details.disclose > summary {
  cursor: pointer;
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  color: var(--accent);
  padding: 10px 0;
  min-height: var(--tap);
  display: flex;
  align-items: center;
}
details.disclose[open] > summary { margin-bottom: 8px; }

/* ------------------------------------------------------------------ tree */

.tree-group {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 3px;
  margin: 0 0 16px;
  padding: 14px 16px;
}
.tree-cat {
  border-left: 3px solid var(--rule);
  padding: 4px 0 4px 14px;
  margin: 12px 0 12px 4px;
}
.tree-q {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px dashed var(--rule);
}
.tree-q:first-of-type { border-top: 0; }
.tree-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: baseline;
  justify-content: space-between;
}
.tree-title { font-family: var(--display); font-weight: 700; font-size: 17px; }
.tree-cat .tree-title { font-size: 15px; }
.mini-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: 10px 0 0; }
.mini-form .field { margin: 0; flex: 1 1 200px; }
.mini-form .field.narrow { flex: 0 1 110px; }

/* --------------------------------------------------------------- flashes */

.flashes { margin: 0 0 18px; }
.flash {
  padding: 11px 14px;
  border-radius: 3px;
  font-size: 15px;
  margin: 0 0 8px;
  border-left: 3px solid;
}
.flash-ok    { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.flash-error { background: var(--red-bg);   border-color: var(--red);   color: var(--red); }

/* ------------------------------------------------------------------ login */

.login-wrap { max-width: 380px; margin: 8vh auto 0; }
.login-wrap .logos { justify-content: center; margin: 0 0 18px; }
.login-wrap .logos img { height: 40px; max-width: 150px; }

/* ------------------------------------------------------------------ print */

@media print {
  .bar, .section-bar, .flashes, .no-print, .btn, .btn-row, .killswitch { display: none !important; }
  body { background: #fff; }
  main, main.wide { max-width: none; padding: 0; }
  .panel, .card, table.data { border-color: #999; break-inside: avoid; }
  .print-only { display: block !important; }
  h2 { margin-top: 18px; }
  a { color: #000; text-decoration: none; }
}
.print-only { display: none; }

/* ----------------------------------------------------- rich text editing */

.rt {
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--card);
}
.rt-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.rt-btn {
  min-height: 36px;
  min-width: 40px;
  padding: 4px 10px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--card);
  color: var(--ink);
  font-family: var(--display);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.rt-btn:hover { background: var(--paper); border-color: var(--ink-soft); }
.rt-surface {
  min-height: 150px;
  padding: 12px 14px;
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  overflow-wrap: break-word;
}
.rt-surface:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.rt-surface:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-soft);
}
.rt-surface img { max-width: 100%; height: auto; }
/* Hidden only once the editor has taken over; without scripting the plain
   textarea stays visible and the field still works. */
textarea.rt-source { display: none; }

/* Consultant-authored HTML, wherever it is displayed. */
.rich { font-size: 16px; line-height: 1.6; }
.rich h1, .rich h2, .rich h3, .rich h4 {
  font-family: var(--display);
  text-transform: none;
  letter-spacing: normal;
  color: var(--ink);
  margin: 18px 0 8px;
  display: block;
}
.rich h2::after { content: none; }
.rich p { margin: 0 0 12px; }
.rich ul, .rich ol { margin: 0 0 12px; padding-left: 22px; }
.rich li { margin: 0 0 4px; }
.rich img { max-width: 100%; height: auto; border-radius: 3px; }
.rich a { color: var(--accent); }
.rich blockquote {
  margin: 0 0 12px;
  padding: 8px 14px;
  border-left: 3px solid var(--rule);
  color: var(--ink-soft);
}
.rich table { border-collapse: collapse; margin: 0 0 12px; }
.rich td, .rich th { border: 1px solid var(--rule); padding: 6px 10px; }

/* ------------------------------------------------------------ role choice */

.role-pick {
  display: block;
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  border-radius: 3px;
  background: var(--card);
  padding: 16px 18px;
  margin: 0 0 12px;
  text-decoration: none;
  color: var(--ink);
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: var(--body);
  font-size: 16px;
}
.role-pick:hover { background: var(--paper); }
.role-pick b {
  display: block;
  font-family: var(--display);
  font-size: 18px;
  margin: 0 0 2px;
}
.role-now {
  font-size: 12px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* ----------------------------------------------------------- time tracker */

.period {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 16px;
}
.period h2 { margin: 0; }
.period h2::after { content: none; }

.tt-worked    { color: var(--green); font-weight: 600; }
.tt-projected { color: var(--amber); font-weight: 600; }
td.tt-zero, .tt-zero { color: var(--rule); }

.week-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: baseline;
  justify-content: space-between;
  margin: 22px 0 8px;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  border-radius: 3px;
}
.week-head .num { font-size: 15px; }

/* ----------------------------------------------------------- print sheet */

.print-sheet { max-width: none; }
.print-note {
  border: 1px solid var(--rule);
  border-radius: 3px;
  height: 74px;
  margin: 10px 0 0;
  background:
    repeating-linear-gradient(to bottom,
      transparent 0 23px, var(--rule) 23px 24px);
}
.print-boxes { display: flex; gap: 10px; margin: 8px 0 0; }
.print-box {
  width: 46px;
  height: 46px;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
}
.print-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 40px;
  margin: 0 0 20px;
  padding: 0 0 14px;
  border-bottom: 2px solid var(--ink);
}
.print-meta .line {
  min-width: 220px;
  border-bottom: 1px solid var(--ink);
  padding: 18px 0 2px;
  font-size: 12px;
  color: var(--ink-soft);
}
@media print {
  .print-sheet .q, .print-sheet .panel { break-inside: avoid; }
  .print-sheet h2 { break-after: avoid; }
}

/* --------------------------------------------------- autosave indicator */

.autosave-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 10px 14px;
  margin: 16px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 -2px 10px rgba(22, 35, 58, 0.06);
}
.autosave { font-size: 14px; color: var(--ink-soft); }
.autosave.ok      { color: var(--green); }
.autosave.pending { color: var(--amber); }
.autosave.bad     { color: var(--red); font-weight: 600; }
@media print { .autosave-bar { display: none; } }

/* The save bar is sticky, so the end of the form needs room to clear it. */
form[data-autosave] { padding-bottom: 8px; }
.autosave-bar + .panel { margin-top: 12px; }

/* ------------------------------------------------------- speaker photos */

.face {
  width: 64px;
  height: 64px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--paper);
  border: 1px solid var(--rule);
  display: block;
  flex: none;
}
.face-lg { width: 110px; height: 110px; }
.face-sm { width: 40px; height: 40px; }

/* Initials, for anyone without a photo yet. */
.face-blank {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 700;
  color: var(--ink-soft);
  font-size: 20px;
  letter-spacing: 0.02em;
}
.face-lg.face-blank { font-size: 32px; }
.face-sm.face-blank { font-size: 14px; }

.speaker-head {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 10px;
}
.speaker-head h3 { margin: 0; }
.speaker-head .sub { margin: 2px 0 0; }

.photo-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.photo-form input[type=file] { max-width: 260px; }

@media print {
  .face, .face-lg, .face-sm { border-color: #999; }
}

/* Rating guidance, shown beside the rating it belongs to rather than behind
   a toggle — guidance nobody opens is guidance nobody follows. */
.guidance {
  margin: 6px 0 0;
  padding: 8px 12px;
  border-left: 3px solid var(--rule);
  background: var(--paper);
  border-radius: 0 3px 3px 0;
  font-size: 15px;
  color: var(--ink-soft);
}
.guidance p:last-child { margin-bottom: 0; }
