:root {
  --paper: #f4f0e6;
  --paper-2: #ebe4d6;
  --card: #fffcf7;
  --ink: #1c2433;
  --navy: #1c2c4e;
  --muted: #6e675d;
  --line: #e3dbcc;
  --teal: #0f7668;
  --teal-deep: #0c5c51;
  --teal-soft: #e5f3ef;
  --orange: #d86a2a;
  --danger: #a33b32;
  --danger-soft: #fdecea;
  --ok-soft: #e7f6f1;
  --shadow: 0 1px 2px rgba(28, 36, 51, 0.04), 0 16px 40px rgba(28, 36, 51, 0.06);
  --serif: "Source Serif 4", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Source Sans 3", "Segoe UI", sans-serif;
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(15, 118, 104, 0.08), transparent 50%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
}

a { color: var(--teal-deep); }
a:hover { color: var(--navy); }

.skip {
  position: absolute;
  left: 12px;
  top: 12px;
  transform: translateY(-200%);
  background: var(--navy);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 5;
}
.skip:focus { transform: none; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 16px;
  padding: 18px 28px 8px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.logo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--navy);
  color: #f6f1e6;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 22px;
}
.brand-name {
  display: block;
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1;
  font-weight: 600;
}
.brand-sub {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.top-actions { display: flex; align-items: center; gap: 10px; }
.chip {
  border: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.7);
  color: var(--navy);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
  text-decoration: none;
}
a.chip:hover { color: var(--navy); background: white; }

.wrap { width: min(760px, calc(100% - 32px)); margin: 12px auto 32px; flex: 1; min-width: 0; }
.wrap.wide { width: min(1180px, calc(100% - 32px)); }

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
h1, h2 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
h1 { font-size: 40px; line-height: 1.1; }
h2 { font-size: 26px; }
.lede { margin: 0 0 18px; color: #3d4553; max-width: 62ch; }
.fine { color: var(--muted); font-size: 14px; margin: 12px 0 0; }

.card, .auth-card, .hero {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.hero { padding: 36px; }
.narrow { max-width: 640px; margin-inline: auto; }
.auth-card { max-width: 520px; margin: 24px auto; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin: 8px 0 18px;
}
.count-pill {
  margin: 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--navy);
  font-weight: 600;
  white-space: nowrap;
}
.page-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head-actions .btn { margin-top: 0; }

.split {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.split > * { min-width: 0; }

.stack { display: flex; flex-direction: column; gap: 8px; }
label { font-weight: 600; font-size: 14px; margin-top: 6px; }
input {
  width: 100%;
  border: 1px solid #d9d0c2;
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
}
select {
  width: 100%;
  border: 1px solid #d9d0c2;
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
}
input:focus, select:focus {
  outline: 3px solid rgba(15, 118, 104, 0.28);
  border-color: var(--teal);
}
input[readonly] {
  background: #f7f3eb;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.2;
}
.btn:focus-visible { outline: 3px solid rgba(28, 44, 78, 0.35); outline-offset: 2px; }
.btn-navy { background: var(--navy); color: #f7f3ea; }
.btn-navy:hover { background: #15233f; color: white; }
.btn-teal { background: var(--teal); color: white; margin-top: 8px; }
.btn-teal:hover { background: var(--teal-deep); color: white; }
.btn-lg { width: 100%; padding: 12px 16px; margin-top: 8px; }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--navy);
}
.btn-ghost:hover { background: #f6f1e7; color: var(--navy); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #8c2f28; color: white; }
.btn-danger-ghost {
  background: transparent;
  border-color: #f0c7c2;
  color: var(--danger);
}
.btn-danger-ghost:hover { background: var(--danger-soft); color: var(--danger); }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.form-actions .btn { margin-top: 0; }

.banner {
  border-radius: 14px;
  padding: 12px 14px;
  margin: 0 0 16px;
  font-weight: 600;
}
.banner-ok { background: var(--ok-soft); color: var(--teal-deep); }
.banner-err { background: var(--danger-soft); color: #8d2d28; }
.banner-note { background: #f6f1e7; color: var(--navy); }

.meter-block { margin: 8px 0 20px; }
.meter-labels, .meter-caption {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.meter-labels span:first-child { color: #b42318; font-weight: 700; }
.meter-labels span:last-child { color: #0e6e73; font-weight: 700; }
.meter {
  position: relative;
  height: 12px;
  margin: 8px 0;
  border-radius: 999px;
  background: linear-gradient(90deg,
    #c4453c 0%,
    #d86a2a 16%,
    #e0a23a 34%,
    #c6b15a 48%,
    #8aa356 64%,
    #3d8f72 80%,
    #0e7c74 100%);
}
.meter-knob {
  position: absolute;
  top: 50%;
  left: 78%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  border: 2px solid #1c2433;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.meter-caption {
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  display: block;
}

.table-scroll { overflow-x: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 12px 10px;
  border-bottom: 1px solid #efe8dc;
  vertical-align: middle;
}
tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); padding: 28px 10px; }
.roster .email,
.roster .who-name { white-space: nowrap; }
.roster .btn { padding: 6px 10px; font-size: 14px; }
.missing { color: var(--danger); font-weight: 700; }
.pill-primary {
  display: inline-block;
  margin-top: 4px;
  background: var(--navy);
  color: #f7f3ea;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.add-form { margin-top: 16px; max-width: 420px; }
.sections { display: flex; flex-direction: column; gap: 18px; }
.when { white-space: nowrap; color: #3d4553; font-size: 15px; }
.who { display: flex; align-items: center; gap: 10px; }
.who-name { display: block; font-weight: 700; }
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #f7f3ea;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}
.avatar-0 { background: #0f7668; }
.avatar-1 { background: #1e3a5f; }
.avatar-2 { background: #c45c26; }
.avatar-3 { background: #3d6b4f; }
.avatar-4 { background: #8a4b2f; }
.avatar-5 { background: #245c6b; }
.status {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 700;
  text-transform: capitalize;
  background: var(--teal-soft);
  color: var(--teal-deep);
}
.status-disabled { background: #eeeae3; color: var(--muted); }
.status-active { background: #e5f5d8; color: #3d6b4f; }
.row-actions { width: 1%; white-space: nowrap; }
.row-actions-inner { display: flex; gap: 8px; justify-content: flex-end; }

.token-box {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.token-row { display: flex; gap: 8px; align-items: center; }
.token-row input { flex: 1; }
.danger-card { border-color: #f0cfcb; }

.ticker {
  margin-top: auto;
  width: 100%;
  box-sizing: border-box;
  background: #1a1d24;
  color: #f3efe6;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 22px;
  font-size: 14px;
}
.ticker p { margin: 0; }
.events {
  background: #b42318;
  color: white;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 4px 8px;
  flex: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  h1 { font-size: 32px; }
  .top { padding: 16px 16px 4px; }
  .brand-name { font-size: 24px; }
  .brand-sub { letter-spacing: 0.04em; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .ticker { align-items: flex-start; }
  .token-row { flex-direction: column; align-items: stretch; }

  .roster thead { display: none; }
  .roster,
  .roster tbody,
  .roster tr,
  .roster td { display: block; width: auto; }
  .roster tr {
    padding: 12px 0;
    border-bottom: 1px solid #efe8dc;
  }
  .roster tr:last-child { border-bottom: 0; }
  .roster td { border: 0; padding: 4px 0; }
  .roster td.empty { padding: 16px 0; }
  .roster .email,
  .roster .who-name { white-space: normal; }
  .roster .email { font-size: 15px; }
  .roster .when { white-space: normal; }
  .roster .row-actions { width: auto; }
  .row-actions-inner { justify-content: flex-start; margin-top: 4px; }
}

.card-gap { margin-top: 18px; }
.bill-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
.bill-hit {
  display: block;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}
.bill-hit:hover { border-color: var(--teal); color: var(--ink); }
.issue-card { border-top: 1px solid var(--line); padding: 14px 0; }
.issue-card h3 { margin: 0 0 4px; font-family: var(--serif); font-size: 22px; }
.issue-card-head { display: flex; gap: 12px; align-items: flex-start; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; }
textarea {
  width: 100%;
  border: 1px solid #d9d0c2;
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
}
textarea:focus { outline: 3px solid rgba(15, 118, 104, 0.28); border-color: var(--teal); }
.email-preview {
  white-space: pre-wrap;
  background: #f7f3eb;
  border-radius: 12px;
  padding: 14px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 14px;
}
input[type="radio"],
input[type="checkbox"] { width: auto; }
.holiday-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}
.inline-form { flex-direction: row; flex-wrap: wrap; align-items: end; }
.inline-form input { width: 8rem; }
.choice input { width: 1.1rem; height: 1.1rem; margin: 0; }
.choice { justify-content: flex-start; padding: 14px 16px; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-row .btn { width: 100%; margin-top: 0; padding: 14px; }
.btn-nay { background: #9a3412; color: #fff; }
.lib-head, .lib-row {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) 4.5rem 3rem 15rem 8rem 5.5rem;
  gap: 10px;
  align-items: center;
}
.lib-head {
  color: #5c564c;
  font-size: 13px;
  font-weight: 700;
  margin: 12px 0 0;
  padding: 0 10px;
  border: 1px solid transparent;
}
.lib-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  margin: 8px 0;
  background: #fff;
}
.lib-check { margin: 0; }
.lib-row .fine { display: block; }
.overlap { color: #9a3412; }
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}
.filter-row > div { flex: 1 1 9rem; min-width: 0; }
.filter-row .btn { flex: 0 0 auto; margin-top: 0; }
.source-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.source-split .card { margin: 0; min-width: 0; }
.source-split .argument-card, .source-split a { overflow-wrap: anywhere; }
@media (max-width: 860px) {
  .filter-row, .lib-head, .lib-row, .source-split { grid-template-columns: 1fr; }
  .lib-head { display: none; }
}
.btn-nay:hover { background: #7c2d12; color: #fff; }
.email-preview { overflow-wrap: anywhere; max-width: 100%; }
.wrap { display: flex; flex-direction: column; gap: 16px; }
.choice {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 14px 16px;
  font-weight: 700;
  background: white;
}
.argument, .argument-card p { white-space: pre-wrap; }
.argument-card { border-radius: 14px; padding: 12px 14px; margin: 10px 0; }
.argument-for { background: var(--teal-soft); }
.argument-against { background: #f8f0e4; }
.grade-form { display: flex; flex-wrap: wrap; gap: 8px; }
.grade-form input { width: auto; min-width: 0; flex: 1; }
.link-list { padding-left: 18px; }
.builder { align-items: start; }
.day-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.day-row input { width: 100%; max-width: 100%; min-width: 0; }
.day-stack { grid-template-columns: minmax(0, 1fr); }
.class-days { font-weight: 700; }
tr.is-missing td:first-child { box-shadow: inset 3px 0 0 #c45c26; }
@media (max-width: 640px) {
  .choice-row { grid-template-columns: 1fr; }
  .grade-form { flex-direction: column; }
  .grade-form input { width: 100%; }
  .day-row { grid-template-columns: 1fr; }
  .holiday-row { flex-direction: column; align-items: stretch; }
}
