:root {
  color-scheme: light;
  --forest: #08422f;
  --forest-action: #0b5f45;
  --brand-panel: #08422f;
  --on-brand: #fffefa;
  --accent-button: #0b5f45;
  --on-accent: #fffefa;
  --leaf: #128a63;
  --mint: #e7f4ee;
  --mint-strong: #c2e4d5;
  --paper: #f5f4f0;
  --surface: #fffefa;
  --surface-raised: #ffffff;
  --ink: #17211d;
  --muted: #5b6761;
  --line: #d9dfdb;
  --line-strong: #aab5ae;
  --danger: #a33b36;
  --danger-bg: #f8e8e5;
  --warning: #8a5a12;
  --warning-bg: #fff3d4;
  --shadow-action: 0 18px 50px rgba(8, 66, 47, 0.16);
  --radius-control: 10px;
  --radius-surface: 16px;
  --ease-state: cubic-bezier(0.16, 1, 0.3, 1);
  --sidebar: 236px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --forest: #d8f1e7;
  --forest-action: #75c8a9;
  --brand-panel: #10271f;
  --on-brand: #edf4f0;
  --accent-button: #75c8a9;
  --on-accent: #102219;
  --leaf: #66bc9b;
  --mint: #173c30;
  --mint-strong: #245444;
  --paper: #111714;
  --surface: #18201c;
  --surface-raised: #1d2722;
  --ink: #edf4f0;
  --muted: #b7c4bd;
  --line: #35423b;
  --line-strong: #65756c;
  --danger: #ffaca4;
  --danger-bg: #472622;
  --warning: #ffd991;
  --warning-bg: #43351b;
  --shadow-action: 0 18px 50px rgba(0, 0, 0, 0.34);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --forest: #d8f1e7;
    --forest-action: #75c8a9;
    --brand-panel: #10271f;
    --on-brand: #edf4f0;
    --accent-button: #75c8a9;
    --on-accent: #102219;
    --leaf: #66bc9b;
    --mint: #173c30;
    --mint-strong: #245444;
    --paper: #111714;
    --surface: #18201c;
    --surface-raised: #1d2722;
    --ink: #edf4f0;
    --muted: #b7c4bd;
    --line: #35423b;
    --line-strong: #65756c;
    --danger: #ffaca4;
    --danger-bg: #472622;
    --warning: #ffd991;
    --warning-bg: #43351b;
    --shadow-action: 0 18px 50px rgba(0, 0, 0, 0.34);
  }
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-height: 100dvh; background: var(--paper); color: var(--ink); }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--leaf);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 50;
  transform: translateY(-150%);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  padding: 10px 14px;
}
.skip-link:focus { transform: translateY(0); }

.boot-shell { width: min(720px, calc(100% - 40px)); margin: 18vh auto; }
.skeleton { background: color-mix(in srgb, var(--line) 72%, transparent); border-radius: var(--radius-control); }
.skeleton-brand { width: 100px; height: 22px; }
.skeleton-title { width: min(460px, 90%); height: 54px; margin-top: 44px; }
.skeleton-line { width: min(580px, 100%); height: 18px; margin-top: 18px; }
@media (prefers-reduced-motion: no-preference) {
  .skeleton { animation: breathe 1.3s ease-in-out infinite alternate; }
  @keyframes breathe { from { opacity: .46; } to { opacity: .9; } }
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  padding: 11px 17px;
  font-weight: 680;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 180ms var(--ease-state), color 180ms var(--ease-state), border-color 180ms var(--ease-state), transform 180ms var(--ease-state);
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.button-primary { background: var(--accent-button); color: var(--on-accent); }
.button-primary:hover { background: var(--forest); }
.button-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.button-secondary:hover { background: var(--mint); border-color: var(--leaf); }
.button-quiet { background: transparent; border-color: transparent; color: var(--forest); }
.button-quiet:hover { background: var(--mint); }
.button-danger { background: var(--danger-bg); color: var(--danger); }
.button-full { width: 100%; }
.button-small { min-height: 38px; padding: 8px 12px; font-size: .875rem; }

.theme-button {
  width: 44px;
  min-width: 44px;
  padding: 0;
  font-size: .78rem;
  letter-spacing: .04em;
}

.login-page {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(390px, .88fr);
}
.login-story {
  min-height: 100dvh;
  padding: clamp(24px, 5vw, 72px);
  display: flex;
  flex-direction: column;
  background: var(--brand-panel);
  color: var(--on-brand);
  overflow: hidden;
  position: relative;
}
.login-story::after {
  content: "";
  position: absolute;
  right: -16%;
  bottom: -16%;
  width: min(50vw, 680px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: clamp(38px, 5vw, 76px) solid color-mix(in srgb, var(--surface) 10%, transparent);
  pointer-events: none;
}
.brand { font-family: Georgia, "Times New Roman", serif; font-weight: 700; letter-spacing: -.025em; font-size: 1.42rem; }
.login-copy { position: relative; z-index: 1; margin: auto 0; max-width: 760px; }
.login-copy h1 {
  margin: 0;
  max-width: 10ch;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.1rem, 7.4vw, 6rem);
  line-height: .94;
  letter-spacing: -.035em;
  text-wrap: balance;
}
.login-copy p { max-width: 46ch; margin: 24px 0 0; font-size: clamp(1rem, 1.4vw, 1.2rem); line-height: 1.55; color: color-mix(in srgb, currentColor 80%, transparent); }
.login-footnote { position: relative; z-index: 1; max-width: 58ch; font-size: .86rem; line-height: 1.45; color: color-mix(in srgb, currentColor 72%, transparent); }

.login-action {
  min-height: 100dvh;
  padding: clamp(24px, 5vw, 72px);
  display: flex;
  flex-direction: column;
  background: var(--paper);
}
.login-action-top { display: flex; justify-content: flex-end; }
.login-panel { width: min(100%, 500px); margin: auto; }
.login-panel h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 4vw, 3.2rem); letter-spacing: -.025em; line-height: 1.05; }
.login-panel > p { max-width: 45ch; color: var(--muted); line-height: 1.55; }
.trust-list { display: grid; gap: 0; margin: 28px 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.trust-list li { display: grid; grid-template-columns: 24px 1fr; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.trust-list b { color: var(--forest-action); }
.demo-notice { margin-top: 16px; padding: 13px 14px; border-radius: var(--radius-control); background: var(--warning-bg); color: var(--warning); font-size: .875rem; line-height: 1.45; }
.auth-progress { margin-top: 18px; padding: 18px; border-radius: var(--radius-surface); background: var(--surface); border: 1px solid var(--line); }
.auth-progress strong { display: block; margin-bottom: 6px; }
.auth-progress p { margin: 0; color: var(--muted); font-size: .9rem; }
.auth-progress .button { margin-top: 14px; }

.app-shell { min-height: 100dvh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 26px 18px 20px;
  display: flex;
  flex-direction: column;
  background: var(--brand-panel);
  color: var(--on-brand);
}
.sidebar .brand { padding: 0 10px 24px; }
.side-nav { display: grid; gap: 5px; }
.nav-button {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-control);
  padding: 10px 12px;
  text-align: left;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-weight: 630;
}
.nav-button[aria-current="page"], .nav-button:hover { background: color-mix(in srgb, var(--surface) 15%, transparent); }
.sidebar-footer { margin-top: auto; }
.sidebar-mode { padding: 12px; border-radius: var(--radius-control); background: color-mix(in srgb, var(--surface) 11%, transparent); font-size: .8rem; line-height: 1.4; }
.user-block { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 8px 4px 0; }
.user-initials { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--surface) 18%, transparent); font-weight: 750; }
.user-block div { min-width: 0; }
.user-block strong, .user-block small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-block small { opacity: .72; margin-top: 2px; }

.mobile-bar { display: none; }
.main { min-width: 0; padding: 32px clamp(20px, 4vw, 56px) 64px; }
.main-inner { width: min(1180px, 100%); margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; gap: 24px; margin-bottom: 30px; }
.page-head-copy { flex: 1; min-width: 0; }
.page-head h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.1rem, 4vw, 3.6rem); line-height: 1; letter-spacing: -.03em; }
.page-head p { margin: 10px 0 0; max-width: 66ch; color: var(--muted); line-height: 1.5; }
.page-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.mode-banner { margin-bottom: 22px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-radius: var(--radius-control); background: var(--warning-bg); color: var(--warning); font-size: .875rem; }
.mode-banner p { margin: 0; }
.mode-banner a { font-weight: 700; white-space: nowrap; }

.workspace { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 22px; align-items: start; }
.watch-column, .signal-column { min-width: 0; }
.section-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-label h2 { margin: 0; font-size: 1rem; }
.count { min-width: 26px; padding: 3px 7px; text-align: center; border-radius: 999px; background: var(--mint); color: var(--forest); font-size: .75rem; font-weight: 750; }
.watch-list { display: grid; gap: 8px; }
.watch-item {
  width: 100%;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 180ms var(--ease-state), background 180ms var(--ease-state), transform 180ms var(--ease-state);
}
.watch-item:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.watch-item[aria-current="true"] { border-color: var(--leaf); background: var(--mint); }
.watch-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.watch-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-word { color: var(--forest-action); font-size: .75rem; font-weight: 750; }
.status-word-paused { color: var(--muted); }
.watch-meta { display: block; margin-top: 7px; color: var(--muted); font-size: .82rem; line-height: 1.35; }
.new-watch { margin-top: 10px; }

.empty-panel { padding: 28px; border: 1px dashed var(--line-strong); border-radius: var(--radius-surface); background: color-mix(in srgb, var(--surface) 64%, transparent); }
.empty-panel h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.75rem; }
.empty-panel p { max-width: 54ch; margin: 10px 0 20px; color: var(--muted); line-height: 1.5; }

.signal-card { border-radius: var(--radius-surface); overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.signal-summary { padding: clamp(22px, 4vw, 36px); background: var(--brand-panel); color: var(--on-brand); }
.signal-summary-paused { background: var(--surface-raised); color: var(--ink); }
.signal-status { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 740; }
.signal-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--leaf); box-shadow: 0 0 0 5px color-mix(in srgb, var(--leaf) 18%, transparent); }
.signal-status-paused { color: var(--muted); }
.signal-status-paused::before { background: var(--line-strong); box-shadow: none; }
.signal-summary h2 { margin: 18px 0 0; max-width: 17ch; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 5vw, 4.3rem); line-height: .98; letter-spacing: -.035em; text-wrap: balance; }
.signal-summary > p { max-width: 58ch; margin: 16px 0 0; color: color-mix(in srgb, currentColor 76%, transparent); line-height: 1.5; }
.criteria { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0; margin: 0; }
.criteria div { padding: 18px 22px; border-bottom: 1px solid var(--line); }
.criteria div:nth-child(odd) { border-right: 1px solid var(--line); }
.criteria dt { color: var(--muted); font-size: .78rem; }
.criteria dd { margin: 5px 0 0; font-weight: 680; }
.signal-actions { display: flex; flex-wrap: wrap; gap: 9px; padding: 18px 22px; }

.match-card { margin-bottom: 16px; padding: clamp(22px, 4vw, 34px); border-radius: var(--radius-surface); background: var(--mint); color: var(--ink); box-shadow: var(--shadow-action); }
.match-kicker { color: var(--forest-action); font-size: .84rem; font-weight: 780; }
.match-card h2 { margin: 10px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 4vw, 3.6rem); line-height: 1; letter-spacing: -.03em; }
.match-details { margin: 13px 0 0; font-size: 1.04rem; line-height: 1.5; }
.match-explanation { max-width: 62ch; margin: 14px 0 0; color: var(--muted); line-height: 1.5; }
.match-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.booking-card { margin-bottom: 16px; padding: clamp(22px, 4vw, 34px); border-radius: var(--radius-surface); background: var(--brand-panel); color: var(--on-brand); box-shadow: var(--shadow-action); }
.booking-status { display: inline-flex; align-items: center; gap: 8px; font-weight: 750; }
.booking-status::before { content: "✓"; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--leaf); color: var(--on-brand); }
.booking-card h2 { margin: 14px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2rem, 4vw, 3.6rem); line-height: 1; letter-spacing: -.03em; }
.booking-card > p { max-width: 62ch; line-height: 1.5; color: color-mix(in srgb, currentColor 80%, transparent); }
.booking-ledger { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 20px 0 0; border-top: 1px solid color-mix(in srgb, currentColor 25%, transparent); }
.booking-ledger div { min-width: 0; padding: 14px 0; border-bottom: 1px solid color-mix(in srgb, currentColor 25%, transparent); }
.booking-ledger div:first-child { padding-right: 18px; }
.booking-ledger dt { opacity: .72; font-size: .78rem; }
.booking-ledger dd { margin: 4px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.booking-note { margin-bottom: 0; font-size: .875rem; }

.activity-panel { margin-top: 22px; }
.activity-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.activity-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.activity-list p { margin: 0; line-height: 1.45; }
.activity-list time { color: var(--muted); font-size: .8rem; white-space: nowrap; }

.settings-panel { max-width: 760px; }
.settings-panel section { padding: 24px 0; border-bottom: 1px solid var(--line); }
.settings-panel h2 { margin: 0 0 8px; font-family: Georgia, "Times New Roman", serif; font-size: 1.65rem; }
.settings-panel p { margin: 0; max-width: 66ch; color: var(--muted); line-height: 1.55; }
.settings-panel .button { margin-top: 16px; }
.profile-form { display: grid; gap: 14px; max-width: 560px; margin-top: 20px; }
.profile-form .button { justify-self: start; margin-top: 0; }
.check-row { display: flex; align-items: flex-start; gap: 11px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--forest-action); }
.check-row span, .check-row strong, .check-row small { display: block; }
.check-row small { margin-top: 3px; color: var(--muted); }
.delivery-history { margin-top: 26px; }
.delivery-history h3 { margin: 0 0 8px; font-size: .95rem; }
.delivery-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.delivery-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.delivery-list span, .delivery-list strong, .delivery-list small { display: block; min-width: 0; }
.delivery-list small { margin-top: 3px; color: var(--muted); overflow-wrap: anywhere; }
.delivery-list time { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.empty-copy { margin-top: 8px !important; }
.integration-status { display: flex; align-items: flex-start; gap: 11px; margin-top: 16px; padding: 13px 14px; border-radius: var(--radius-control); background: var(--mint); }
.integration-status > span { width: 23px; height: 23px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--forest-action); color: var(--on-accent); font-weight: 800; }
.integration-status strong, .integration-status small { display: block; }
.integration-status small { margin-top: 3px; color: var(--muted); }
.integration-locked { background: var(--warning-bg); }
.integration-locked > span { background: var(--warning); color: var(--surface); }
.connection-summary { display: flex; align-items: flex-start; gap: 11px; margin-top: 16px; padding: 14px; border-radius: var(--radius-control); background: var(--mint); }
.connection-summary > span { width: 24px; height: 24px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--forest-action); color: var(--on-accent); font-weight: 800; }
.connection-summary strong, .connection-summary small { display: block; }
.connection-summary small { margin-top: 3px; color: var(--muted); overflow-wrap: anywhere; }

.access-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 24px; border-block: 1px solid var(--line); }
.access-summary > div { min-width: 0; padding: 18px 20px; border-right: 1px solid var(--line); }
.access-summary > div:first-child { padding-left: 0; }
.access-summary > div:last-child { border-right: 0; }
.access-summary strong, .access-summary span { display: block; }
.access-summary strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.75rem; line-height: 1; }
.access-summary span { margin-top: 6px; color: var(--muted); font-size: .875rem; }
.create-school { margin-bottom: 28px; padding: 24px; display: grid; grid-template-columns: minmax(220px, .72fr) minmax(0, 1.28fr); gap: 28px; border-radius: var(--radius-surface); background: var(--brand-panel); color: var(--on-brand); }
.create-school h2, .school-detail h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.75rem; line-height: 1.2; }
.create-school p { max-width: 46ch; margin: 8px 0 0; color: color-mix(in srgb, currentColor 76%, transparent); line-height: 1.5; }
.create-school-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.create-school-form label { color: var(--on-brand); }
.create-school-form .button { margin-top: 25px; background: var(--surface); color: #08422f; }
.create-school-form .button:hover { background: var(--mint-strong); }
.invite-receipt { margin-bottom: 24px; padding: 20px 22px; border-radius: var(--radius-surface); background: var(--mint); box-shadow: var(--shadow-action); }
.invite-receipt > div:first-child { display: flex; align-items: flex-start; gap: 12px; }
.invite-check { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--forest-action); color: var(--on-accent); font-weight: 800; }
.invite-receipt h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.75rem; }
.invite-receipt p { margin: 5px 0 0; color: var(--muted); line-height: 1.5; }
.invite-link { margin-top: 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.invite-link .input { overflow: hidden; text-overflow: ellipsis; }
.admin-workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 28px; align-items: start; }
.school-rail, .school-detail { min-width: 0; }
.school-list { display: grid; gap: 7px; }
.school-item { width: 100%; min-height: 58px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.school-item:hover { border-color: var(--line-strong); }
.school-item[aria-current="true"] { border-color: var(--leaf); background: var(--mint); }
.school-item strong, .school-item small { display: block; }
.school-item small { margin-top: 4px; color: var(--muted); font-size: .75rem; }
.school-item > span:last-child { color: var(--muted); font-size: 1.75rem; font-weight: 400; }
.school-detail { padding: 0 0 32px; }
.school-detail-head { min-height: 110px; padding-bottom: 22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.school-detail-head h2 { margin-top: 9px; }
.school-detail-head p { margin: 6px 0 0; color: var(--muted); }
.invite-form { padding: 22px 0; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(150px, .6fr) auto; gap: 12px; align-items: start; border-bottom: 1px solid var(--line); }
.invite-form .button { margin-top: 25px; }
.admin-section { padding-top: 26px; }
.admin-section + .admin-section { margin-top: 8px; }
.admin-section .section-label h3 { margin: 0; font-size: 1rem; }
.member-list { border-top: 1px solid var(--line); }
.member-row { min-width: 0; padding: 13px 0; display: grid; grid-template-columns: 38px minmax(140px, 1fr) auto auto auto; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); }
.member-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); color: var(--forest); font-size: .75rem; font-weight: 750; }
.member-main, .member-main strong, .member-main small { min-width: 0; display: block; }
.member-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-main small { margin-top: 3px; color: var(--muted); font-size: .75rem; overflow-wrap: anywhere; }
.member-usage { display: flex; gap: 10px; color: var(--muted); font-size: .75rem; white-space: nowrap; }
.member-self { color: var(--muted); font-size: .75rem; font-weight: 700; }
.access-invitations { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.access-invitations li { padding: 12px 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); }
.access-invitations strong, .access-invitations small { display: block; }
.access-invitations small { margin-top: 3px; color: var(--muted); font-size: .75rem; }

dialog {
  width: min(680px, calc(100% - 24px));
  max-height: min(860px, calc(100dvh - 24px));
  padding: 0;
  border: 0;
  border-radius: var(--radius-surface);
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: var(--shadow-action);
}
dialog::backdrop { background: color-mix(in srgb, var(--brand-panel) 76%, transparent); }
.dialog-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; gap: 20px; padding: 22px 24px; border-bottom: 1px solid var(--line); background: var(--surface-raised); }
.dialog-head div { flex: 1; }
.dialog-head h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.8rem; }
.dialog-head p { margin: 6px 0 0; color: var(--muted); font-size: .9rem; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: var(--radius-control); background: transparent; cursor: pointer; font-size: 1.2rem; }
.watch-form { padding: 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 7px; }
.field-full { grid-column: 1 / -1; }
.field label, .fieldset-title { font-size: .875rem; font-weight: 690; }
.input, .select { min-height: 46px; width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius-control); padding: 10px 12px; background: var(--surface); color: var(--ink); }
.input:hover, .select:hover { border-color: var(--leaf); }
.field-error { min-height: 18px; color: var(--danger); font-size: .8rem; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { min-height: 43px; display: flex; align-items: center; justify-content: center; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); cursor: pointer; text-align: center; font-size: .88rem; }
.choice input:checked + span { border-color: var(--leaf); background: var(--mint); color: var(--forest); font-weight: 690; }
.choice input:focus-visible + span { outline: 2px solid var(--leaf); outline-offset: 2px; }
.weekday-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekday-grid .choice span { padding-inline: 4px; }
.notification-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.notification-option { position: relative; }
.notification-option input { position: absolute; opacity: 0; pointer-events: none; }
.notification-option > span { min-height: 82px; display: flex; flex-direction: column; justify-content: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); cursor: pointer; }
.notification-option strong, .notification-option small { display: block; }
.notification-option small { margin-top: 5px; color: var(--muted); line-height: 1.35; }
.notification-option input:checked + span { border-color: var(--leaf); background: var(--mint); color: var(--forest); }
.notification-option input:focus-visible + span { outline: 2px solid var(--leaf); outline-offset: 2px; }
.notification-option-locked > span { cursor: not-allowed; opacity: .7; background: var(--paper); }
.form-notice { margin: 20px 0 0; padding: 13px 14px; border-radius: var(--radius-control); background: var(--warning-bg); color: var(--warning); font-size: .84rem; line-height: 1.45; }
.form-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 9px; margin: 24px -24px -24px; padding: 16px 24px; border-top: 1px solid var(--line); background: var(--surface-raised); }

.toast-region { position: fixed; z-index: 60; right: 18px; bottom: 18px; display: grid; gap: 8px; width: min(380px, calc(100% - 36px)); }
.toast { padding: 13px 15px; border-radius: var(--radius-control); background: var(--ink); color: var(--surface); box-shadow: var(--shadow-action); font-size: .9rem; }
.toast-error { background: var(--danger); color: #fff; }

.screen-reader { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-story { min-height: auto; padding-bottom: 48px; }
  .login-copy { margin: 72px 0; }
  .login-copy h1 { max-width: 12ch; font-size: clamp(3rem, 12vw, 5.4rem); }
  .login-footnote { max-width: 70ch; }
  .login-action { min-height: auto; }
  .login-panel { margin: 60px auto; }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .mobile-bar { position: sticky; top: 0; z-index: 20; min-height: 64px; padding: 10px 16px; display: flex; align-items: center; gap: 8px; background: var(--brand-panel); color: var(--on-brand); }
  .mobile-bar .brand { margin-right: auto; }
  .mobile-nav { display: flex; gap: 4px; }
  .mobile-nav .nav-button { width: auto; min-height: 40px; padding: 8px 7px; font-size: .78rem; }
  .main { padding: 26px 18px 56px; }
  .workspace { grid-template-columns: 1fr; }
  .admin-workspace { grid-template-columns: 1fr; }
  .school-list { display: flex; overflow-x: auto; padding-bottom: 4px; }
  .school-item { min-width: min(280px, 82vw); }
  .watch-list { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 3px; }
  .watch-item { min-width: min(280px, 82vw); scroll-snap-align: start; }
  .new-watch { margin: 10px 0 18px; }
}

@media (max-width: 640px) {
  .page-head { display: block; }
  .page-actions { margin-top: 18px; justify-content: flex-start; }
  .page-actions .button { flex: 1; }
  .mode-banner { align-items: flex-start; flex-direction: column; }
  .criteria { grid-template-columns: 1fr; }
  .criteria div:nth-child(odd) { border-right: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .field-full { grid-column: auto; }
  .choice-grid { grid-template-columns: 1fr; }
  .weekday-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
  .activity-list li { grid-template-columns: 1fr; gap: 5px; }
  .delivery-list li { grid-template-columns: 1fr; gap: 5px; }
  .notification-options { grid-template-columns: 1fr; }
  .booking-ledger { grid-template-columns: 1fr; }
  .booking-ledger div:first-child { padding-right: 0; }
  .create-school { grid-template-columns: 1fr; }
  .create-school-form, .invite-form { grid-template-columns: 1fr; }
  .create-school-form .button, .invite-form .button { margin-top: 0; }
  .invite-link { grid-template-columns: 1fr; }
  .member-row { grid-template-columns: 38px minmax(0, 1fr) auto; }
  .member-usage { grid-column: 2 / -1; }
  .member-row .button, .member-self { grid-column: 2 / -1; justify-self: start; }
  .school-detail-head { display: block; }
  .school-detail-head .button { margin-top: 16px; }
  .match-actions .button, .signal-actions .button { width: 100%; }
  .login-story, .login-action { padding: 22px; }
}

@media (max-width: 400px) {
  .mobile-bar { padding-inline: 10px; gap: 4px; }
  .mobile-bar .brand { font-size: 1.12rem; }
  .mobile-nav { gap: 1px; }
  .mobile-nav .nav-button { padding-inline: 5px; font-size: .72rem; }
  .access-summary > div { padding-inline: 10px; }
  .access-summary > div:first-child { padding-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition-duration: 0.01ms !important; }
}
