:root {
  --ink: #1f2933;
  --muted: #667085;
  --line: #dce3ea;
  --paper: #fff;
  --background: #eaf3fb;
  --accent: #2f6faf;
  --accent-light: #e8f1f8;
  --navy: #173b63;
  --danger: #a33a3a;
  --shadow: 0 10px 30px rgba(31, 41, 51, .07);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button, .button-link { border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 9px; padding: 10px 14px; cursor: pointer; text-decoration: none; }
button:hover, .button-link:hover { border-color: #aeb5bf; }
button:disabled { opacity: .45; cursor: default; }
button.primary, .button-link { background: var(--accent); color: white; border-color: var(--accent); }
button.quiet { background: transparent; }
[hidden] { display: none !important; }

.site-header { background: var(--paper); border-bottom: 1px solid var(--line); padding: 28px clamp(20px, 5vw, 64px); display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.eyebrow { margin: 0 0 7px; color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 700; }
.brand-title { margin: 0 0 4px; color: var(--navy); font-size: clamp(22px, 3vw, 32px); line-height: 1.12; letter-spacing: -.025em; font-weight: 700; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 4vw, 42px); letter-spacing: -.03em; }
.subtitle { color: var(--muted); margin-bottom: 0; }
.user-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#signedInAs { margin-right: 8px; font-size: 14px; font-weight: 650; }
main { width: min(1450px, calc(100% - 32px)); margin: 28px auto 48px; }
.login-card, .summary-card, .admin-tools { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.login-card { width: min(480px, 100%); margin: 7vh auto; padding: 28px; }
.login-card h2 { margin-bottom: 22px; }
.login-form, .password-form { display: grid; gap: 16px; }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 650; }
input, select, textarea { min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; background: white; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(47,111,175,.25); border-color: var(--accent); }
.message { min-height: 1.2em; margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.message.error, .error { color: var(--danger); }
.message.success { color: #256747; }
.legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 20px; color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.legend span { display: flex; align-items: center; gap: 7px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.attending { background: var(--accent); }
.dot.will-teach { background: var(--navy); }
.dot.unavailable { background: #a8afb8; }
.admin-tools { margin: 0 0 18px; padding: 18px 20px; display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.admin-tools p:last-child { color: var(--muted); margin: 6px 0 0; font-size: 13px; }
.admin-tools .eyebrow { margin-bottom: 6px; }
.schedule-card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.month-controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 20px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 650; }
.month-controls > div { display: flex; flex-wrap: wrap; gap: 8px; }
.month-controls button { padding: 7px 11px; color: var(--navy); font-size: 12px; }
.month-controls button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.month-section + .month-section { border-top: 1px solid var(--line); }
.month-section > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 17px 20px; color: var(--navy); background: #f4f9fd; cursor: pointer; font-size: 17px; font-weight: 700; }
.month-section > summary::-webkit-details-marker { display: none; }
.month-section > summary::before { content: "›"; margin-right: 2px; font-size: 22px; line-height: 1; transition: transform .15s ease; }
.month-section[open] > summary::before { transform: rotate(90deg); }
.month-section > summary span:first-of-type { flex: 1; }
.month-count { color: var(--muted); font-size: 12px; font-weight: 500; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 1420px; }
th, td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: center; vertical-align: middle; }
th { background: #f5f8fb; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .045em; position: sticky; top: 0; z-index: 2; }
th:first-child, td:first-child { text-align: left; min-width: 112px; position: sticky; left: 0; background: white; z-index: 1; }
th:first-child { background: #f5f8fb; z-index: 3; }
tbody tr:last-child td { border-bottom: 0; }
.date-cell strong { display: block; font-size: 13px; }
.date-cell span { color: var(--muted); font-size: 12px; }
.topic-heading, .topic-cell { min-width: 235px; }
.topic-cell { text-align: left; }
.topic-input { display: block; width: 100%; min-height: 50px; resize: vertical; font-size: 12px; line-height: 1.4; }
.topic-readonly { white-space: pre-wrap; font-size: 12px; line-height: 1.4; }
.muted { color: #98a2b3; }
.status { width: 100%; min-width: 112px; padding: 8px 5px; text-align: center; font-size: 11px; font-weight: 650; }
.status:disabled { opacity: 1; color: var(--ink); background: #f6f7f9; }
.status.attending { background: var(--accent-light); border-color: #c8dbea; color: var(--accent); }
.status.will-teach { background: #fff4c2; border-color: #e5cf75; color: var(--navy); }
.status.unavailable { background: #f4f5f6; color: #747b84; }
.assignment-cell { min-width: 150px; }
.assignment-input { width: 100%; min-width: 140px; font-size: 12px; }
.assignment-cell .not-assigned { color: #b42318; }
.summary-card { margin-top: 26px; padding: 22px; }
.summary-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.summary-heading h2 { margin-bottom: 0; }
#summaryPeriod { color: var(--muted); font-size: 13px; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 10px; margin-top: 18px; }
.person-summary { border: 1px solid var(--line); border-radius: 12px; padding: 13px; }
.person-summary strong { display: block; margin-bottom: 7px; }
.person-summary span { color: var(--muted); font-size: 12px; line-height: 1.65; }
footer { width: min(1450px, calc(100% - 32px)); margin: 0 auto 28px; color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; gap: 20px; }
dialog { width: min(440px, calc(100% - 24px)); border: 1px solid var(--line); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(18, 31, 45, .42); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.setup-main { width: min(900px, calc(100% - 28px)); margin: 6vh auto; }
.setup-main .login-card { width: 100%; margin: 0; }
code { overflow-wrap: anywhere; }

@media (max-width: 700px) {
  .site-header { padding: 22px 18px; align-items: flex-start; flex-direction: column; }
  main { width: calc(100% - 20px); margin-top: 20px; }
  .user-bar { width: 100%; }
  #signedInAs { width: 100%; }
  .admin-tools { align-items: flex-start; flex-direction: column; }
  .month-controls { align-items: flex-start; flex-direction: column; padding: 11px 14px; }
  .summary-card { padding: 17px; }
  footer { width: calc(100% - 20px); flex-direction: column; }
}

@media print {
  body { background: white; }
  .site-header { padding: 0 0 12px; border: 0; }
  .user-bar, .legend, .admin-tools, .summary-card, footer, .message { display: none !important; }
  main { width: 100%; margin: 0; }
  .schedule-card { border: 0; box-shadow: none; overflow: visible; }
  .month-section > summary { padding: 8px 0; }
  details.month-section:not([open]) > :not(summary) { display: block !important; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; font-size: 8px; }
  th, td { padding: 4px 3px; }
  th, th:first-child, td:first-child { position: static; }
  th:first-child, td:first-child { min-width: 80px; }
  .topic-heading, .topic-cell { min-width: 110px; }
  .status, .assignment-input { min-width: 0; padding: 3px 2px; font-size: 7px; }
  .status:disabled { opacity: 1; }
  .topic-input { min-height: 25px; resize: none; padding: 3px; }
  @page { size: landscape; margin: 0.35in; }
}
