:root {
  --coal: #0b171d;
  --coal-2: #14252d;
  --ink: #18262c;
  --muted: #718087;
  --line: #dfe6e8;
  --canvas: #f3f5f5;
  --surface: #ffffff;
  --red: #cf1f32;
  --red-dark: #a91425;
  --red-soft: #fcecef;
  --gold: #d9aa3d;
  --gold-soft: #fff5db;
  --green: #178447;
  --green-soft: #eaf7ef;
  --shadow: 0 18px 50px rgba(11, 23, 29, .1);
  --radius: 14px;
}
[data-theme="dark"] {
  --ink: #e7eef0;
  --muted: #9dafb7;
  --line: #2c414a;
  --canvas: #101d23;
  --surface: #17272e;
  --red-soft: #3a2028;
  --gold-soft: #392f19;
  --green-soft: #173526;
  color-scheme: dark;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #fff;
}
.login-card {
  width: min(100%, 390px);
  display: flex;
  align-items: stretch;
  flex-direction: column;
  padding: 42px 40px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(11, 23, 29, .12);
}
.login-logo { width: 82px; height: 108px; object-fit: contain; align-self: center; margin-bottom: 22px; }
.login-card > .section-kicker { text-align: center; }
.login-card h1 { margin: 2px 0 8px; text-align: center; font-family: Georgia, "Times New Roman", serif; font-size: 30px; }
.login-card > p:not(.login-error) { margin: 0 0 28px; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.55; }
.login-field { display: grid; gap: 7px; margin-bottom: 15px; }
.login-field span { color: #536269; font-size: 10px; font-weight: 800; }
.login-field input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  color: var(--ink);
  background: #f8faf9;
}
.login-field input:focus { border-color: #dd7b87; background: #fff; box-shadow: 0 0 0 3px rgba(207,31,50,.1); }
.login-error { margin: 0 0 14px; color: var(--red-dark); font-size: 11px; font-weight: 700; line-height: 1.4; }
.login-button { min-height: 46px; justify-content: center; margin-top: 3px; }
.signed-in-user { color: var(--muted); font-size: 10px; font-weight: 800; }
.logout-button { min-width: 76px; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  z-index: 10;
  inset: 0 auto 0 0;
  width: 310px;
  display: flex;
  flex-direction: column;
  color: #fff;
  background: var(--coal);
  box-shadow: 8px 0 30px rgba(2, 12, 16, .08);
  overflow: hidden;
}
.school-brand {
  min-height: 104px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 19px 24px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.school-brand img {
  width: 66px;
  height: 88px;
  object-fit: contain;
  filter: drop-shadow(0 5px 8px rgba(0,0,0,.25));
}
.school-brand strong { display: block; max-width: 168px; font-size: 15px; line-height: 1.25; }
.school-brand span { display: block; margin-top: 4px; color: #d697a1; font-size: 10px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.sidebar-menu-toggle {
  width: calc(100% - 32px);
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 14px 16px;
  padding: 0 13px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 9px;
  color: #dce4e7;
  background: rgba(255,255,255,.055);
  font-size: 11px;
  font-weight: 800;
  transition: .18s ease;
}
.sidebar-menu-toggle svg { width: 28px; height: 28px; stroke-width: 2.2; }
.sidebar-menu-toggle:hover {
  border-color: color-mix(in srgb, var(--red) 58%, transparent);
  background: color-mix(in srgb, var(--red) 14%, transparent);
}
.sidebar-drawer {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: rgba(255,255,255,.24) transparent;
  scrollbar-width: thin;
  transform: translateX(-105%);
  opacity: 0;
  pointer-events: none;
  transition: transform .24s ease, opacity .18s ease;
}
.sidebar.open .sidebar-drawer { transform: none; opacity: 1; pointer-events: auto; }
.upload-panel, .history-panel { padding: 0; }
.sidebar-section { border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-section > summary { padding: 14px 18px; cursor: pointer; list-style: none; transition: background .17s ease; }
.sidebar-section > summary::-webkit-details-marker { display: none; }
.sidebar-section > summary::after { content: "+"; margin-left: auto; color: #8fa1aa; font-size: 17px; font-weight: 500; }
.sidebar-section[open] > summary { background: rgba(255,255,255,.045); }
.sidebar-section[open] > summary::after { content: "−"; color: #dc7380; }
.sidebar-section > summary:hover { background: rgba(255,255,255,.055); }
.sidebar-section-content { padding: 0 18px 16px; animation: section-open .18s ease-out; }
@keyframes section-open { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }
.history-panel { min-height: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-kicker { display: block; margin-bottom: 5px; color: var(--red); font-size: 9px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.sidebar .section-kicker { color: var(--red); }
.section-heading h2 { margin: 0; font-size: 14px; letter-spacing: -.01em; }
.upload-dropzone {
  min-height: 142px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 18px;
  border: 1px dashed rgba(255,255,255,.23);
  border-radius: 12px;
  text-align: center;
  background: rgba(255,255,255,.035);
  transition: .2s ease;
  cursor: pointer;
}
.upload-dropzone:hover, .upload-dropzone.dragging { border-color: #e06d7b; background: rgba(207,31,50,.1); transform: translateY(-1px); }
.upload-icon {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 10px;
  color: #fff;
  background: var(--red);
}
.upload-dropzone strong { font-size: 13px; }
.upload-dropzone > span:last-child { margin-top: 5px; color: #8fa1aa; font-size: 10px; }
.history-heading { margin-bottom: 0; }
.history-count {
  min-width: 24px;
  padding: 4px 7px;
  border-radius: 999px;
  color: #cbd5da;
  background: rgba(255,255,255,.08);
  text-align: center;
  font-size: 10px;
  font-weight: 800;
}
.history-list { max-height: 42vh; min-height: 0; overflow-y: auto; padding-right: 3px; scrollbar-color: #44555d transparent; scrollbar-width: thin; }
.history-empty { padding: 26px 8px; color: #778991; text-align: center; font-size: 11px; line-height: 1.5; }
.history-entry { position: relative; margin-bottom: 8px; }
.history-item {
  width: 100%;
  display: block;
  padding: 12px 42px 12px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #d9e1e4;
  background: transparent;
  text-align: left;
  transition: .17s ease;
}
.history-item:hover { background: rgba(255,255,255,.055); }
.history-item.active { border-color: rgba(223,87,103,.45); background: rgba(207,31,50,.12); }
.history-delete {
  position: absolute;
  top: 8px;
  right: 7px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #8fa1aa;
  background: transparent;
  transition: .17s ease;
}
.history-delete:hover, .history-delete:focus-visible { color: #fff; background: var(--red); }
.history-delete:disabled { cursor: wait; opacity: .65; }
.history-delete svg { width: 15px; height: 15px; }
.history-item-top { display: flex; align-items: flex-start; gap: 9px; }
.history-file-icon { color: #db6d7a; flex: 0 0 auto; margin-top: 1px; }
.history-file-copy { min-width: 0; flex: 1; }
.history-file-copy strong { display: block; overflow: hidden; font-size: 11px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.history-file-copy span { display: block; margin-top: 3px; color: #81939b; font-size: 9px; }
.history-progress-copy { display: flex; justify-content: space-between; margin: 10px 0 5px; color: #9cadb4; font-size: 9px; }
.mini-progress { height: 3px; overflow: hidden; border-radius: 5px; background: rgba(255,255,255,.1); }
.mini-progress span { display: block; height: 100%; border-radius: inherit; background: var(--red); }
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,.07);
  color: #81939b;
  font-size: 10px;
}
.configure-button {
  width: calc(100% - 32px);
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 13px;
  flex: 0 0 auto;
  margin: auto 16px 16px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 9px;
  color: #e3eaed;
  background: rgba(255,255,255,.055);
  font-size: 11px;
  font-weight: 800;
  transition: .18s ease;
}
.configure-button:hover {
  border-color: color-mix(in srgb, var(--red) 58%, transparent);
  background: color-mix(in srgb, var(--red) 14%, transparent);
}
.configure-button svg { width: 20px; height: 20px; }
.settings-card { width: min(590px, 100%); }
.settings-fields { display: grid; gap: 20px; }
.settings-fields input[type="file"] { height: auto; padding: 11px; }
.settings-fields small { color: var(--muted); font-size: 9px; font-weight: 500; }
.theme-options { display: flex; gap: 10px; margin: 0; padding: 0; border: 0; }
.theme-options legend { margin-bottom: 8px; color: #536269; font-size: 10px; font-weight: 800; }
.theme-options label { min-width: 105px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 11px; font-weight: 700; }
.accent-colour-control { display: flex; align-items: center; gap: 12px; }
.accent-colour-control input {
  width: 58px;
  height: 42px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
}
.accent-colour-control output {
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
}
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: #4eb78a; box-shadow: 0 0 0 4px rgba(78,183,138,.1); }

.main-area { min-height: 100vh; margin-left: 310px; }
.toolbar {
  position: sticky;
  z-index: 5;
  top: 0;
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px clamp(20px, 3vw, 42px);
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px);
}
.toolbar-clock {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--coal);
  font-variant-numeric: tabular-nums;
}
.toolbar-clock svg {
  width: 25px;
  height: 25px;
  padding: 5px;
  border-radius: 8px;
  color: var(--red);
  background: rgba(207,31,50,.08);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}
.toolbar-clock div { display: flex; align-items: baseline; gap: 8px; }
.toolbar-date { color: #617078; font-size: 11px; font-weight: 700; }
.toolbar-time { font-size: 17px; font-weight: 900; letter-spacing: -.025em; }
.search-field { position: relative; width: min(500px, 48vw); margin-right: auto; }
.search-field > svg { position: absolute; top: 50%; left: 14px; color: #84939a; transform: translateY(-50%); pointer-events: none; }
.search-field input {
  width: 100%;
  height: 43px;
  padding: 0 62px 0 43px;
  outline: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #f8faf9;
  transition: .18s ease;
  font-size: 12px;
}
.search-field input:focus { border-color: #dd7b87; background: #fff; box-shadow: 0 0 0 3px rgba(207,31,50,.1); }
.search-field kbd {
  position: absolute;
  top: 50%;
  right: 10px;
  padding: 4px 6px;
  border: 1px solid #dfe5e7;
  border-radius: 5px;
  color: #8a979d;
  background: #fff;
  transform: translateY(-50%);
  font-family: inherit;
  font-size: 9px;
}
.toolbar-actions { display: flex; gap: 8px; margin-left: auto; }
.primary-button, .secondary-button, .icon-button {
  min-height: 41px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 800;
  transition: .18s ease;
}
.primary-button { padding: 0 15px; border: 1px solid var(--red); color: #fff; background: var(--red); box-shadow: 0 6px 16px rgba(207,31,50,.15); }
.primary-button:hover { border-color: var(--red-dark); background: var(--red-dark); transform: translateY(-1px); }
.primary-button:disabled, .secondary-button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.secondary-button { padding: 0 15px; border: 1px solid var(--line); color: #425159; background: #fff; }
.secondary-button:hover { border-color: #bdc9cd; background: #f8faf9; }
.icon-button { width: 41px; padding: 0; border: 1px solid var(--line); color: #586870; background: #fff; }
.icon-button:hover { color: var(--red); border-color: #e7b3b9; background: var(--red-soft); }
.mobile-menu { display: none; }
.content { padding: 34px clamp(20px, 3vw, 42px) 50px; }
.register-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 25px; }
.register-heading h1 { margin: 0; color: var(--coal); font-size: clamp(25px, 3vw, 35px); letter-spacing: -.045em; line-height: 1.1; overflow-wrap: anywhere; }
.register-heading p { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.progress-summary { width: 225px; flex: 0 0 auto; }
.progress-copy { display: flex; justify-content: space-between; margin-bottom: 7px; color: #75838a; font-size: 10px; }
.progress-copy strong { color: var(--red-dark); }
.progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: #e2e8e9; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--red); transition: width .3s ease; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin-bottom: 17px; }
.stat-card {
  min-height: 92px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.8);
}
.stat-icon { width: 41px; height: 41px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 11px; }
.stat-icon.dark { color: #fff; background: var(--coal); }
.stat-icon.red { color: var(--red-dark); background: var(--red-soft); }
.stat-icon.gold { color: #946c13; background: var(--gold-soft); }
.stat-card strong { display: block; color: var(--coal); font-size: 22px; line-height: 1; }
.stat-card div span { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; font-weight: 700; }
.table-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.table-card-heading { display: grid; grid-template-columns: auto minmax(220px, 500px) auto; align-items: center; gap: 20px; padding: 18px 21px; border-bottom: 1px solid var(--line); }
.table-card-heading h2 { margin: 0; color: var(--coal); font-size: 14px; }
.table-card-heading p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.table-search { width: 100%; margin: 0 auto; }
.table-heading-actions { display: flex; align-items: center; gap: 12px; }
.table-hint { display: block; margin-top: 6px; color: #8b989e; font-size: 9px; }
#addAttendeeButton svg { color: var(--red); stroke-width: 2.2; }
.table-scroll {
  max-height: min(58vh, 620px);
  overflow: auto;
  scrollbar-color: #b8c3c7 #f2f5f5;
  scrollbar-width: thin;
}
table { width: 100%; min-width: 760px; border-collapse: collapse; }
thead { position: sticky; z-index: 2; top: 0; background: #f8faf9; box-shadow: 0 1px 0 var(--line); }
th {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  color: #809096;
  text-align: left;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}
td {
  max-width: 270px;
  padding: 14px 18px;
  border-bottom: 1px solid #e9edef;
  color: #4a5960;
  font-size: 10px;
  vertical-align: middle;
}
tbody tr { transition: .15s ease; cursor: pointer; }
tbody tr:hover { background: #fdf6f7; }
tbody tr:last-child td { border-bottom: 0; }
.row-number { color: #9aa6ab; font-variant-numeric: tabular-nums; }
.attendee-name { color: var(--coal); font-size: 11px; font-weight: 800; }
.cell-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signature-cell { min-width: 152px; display: flex; align-items: center; gap: 9px; }
.signature-thumb { width: 54px; height: 29px; object-fit: contain; border: 1px solid #e7c9cd; border-radius: 5px; background: #fff; }
.signature-date { min-width: 112px; display: inline-block; color: #65747b; font-size: 10px; font-weight: 700; white-space: nowrap; }
.row-action-heading, .row-action-cell {
  position: sticky;
  z-index: 1;
  right: 0;
  width: 88px;
  min-width: 88px;
  text-align: center;
  background: #fff;
  box-shadow: -8px 0 12px -12px rgba(11,23,29,.35);
}
.row-action-heading { z-index: 3; background: #f8faf9; }
tbody tr:hover .row-action-cell { background: #fdf6f7; }
.undo-signature-button {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid #e7b3b9;
  border-radius: 7px;
  color: var(--red-dark);
  background: var(--red-soft);
  font-size: 9px;
  font-weight: 800;
}
.undo-signature-button:hover { border-color: var(--red); background: #f9dfe3; }
.undo-signature-button:disabled { opacity: .55; cursor: wait; }
.undo-signature-button svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.no-row-action { color: #abb5b9; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 999px; font-size: 8px; font-weight: 900; letter-spacing: .02em; text-transform: uppercase; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.signed { color: var(--green); background: var(--green-soft); }
.status.pending { color: #936a10; background: var(--gold-soft); }
.empty-state { display: none; padding: 68px 24px; text-align: center; }
.empty-state.visible { display: block; }
.empty-mark { width: 49px; height: 49px; display: grid; place-items: center; margin: 0 auto 15px; border-radius: 14px; color: var(--red); background: var(--red-soft); }
.empty-mark svg { width: 23px; height: 23px; }
.empty-state h2 { margin: 0 0 7px; color: var(--coal); font-size: 16px; }
.empty-state p { max-width: 440px; margin: 0 auto 18px; color: var(--muted); font-size: 10px; line-height: 1.6; }

.sidebar-scrim { display: none; }
.modal-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 17, 22, .7);
  backdrop-filter: blur(6px);
}
.modal-backdrop.open { display: flex; }
.signature-card { width: min(740px, 100%); overflow: hidden; border-radius: 17px; background: #fff; box-shadow: 0 28px 80px rgba(0,0,0,.3); animation: modal-in .2s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 22px 25px 17px; border-bottom: 1px solid var(--line); }
.modal-identity { display: flex; align-items: center; gap: 13px; }
.modal-identity img { width: 39px; height: 49px; object-fit: contain; }
.modal-header h2 { margin: 0; color: var(--coal); font-size: 22px; letter-spacing: -.035em; }
.modal-header p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.modal-body { padding: 20px 25px 24px; }
.attendee-form-card { width: min(680px, 100%); }
.attendee-fields { max-height: min(58vh, 520px); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; overflow-y: auto; }
.attendee-field { display: grid; gap: 7px; color: #536269; font-size: 10px; font-weight: 800; }
.attendee-field input {
  width: 100%;
  height: 43px;
  padding: 0 12px;
  outline: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: #f8faf9;
  font-size: 12px;
  font-weight: 500;
}
.attendee-field input:focus { border-color: #dd7b87; background: #fff; box-shadow: 0 0 0 3px rgba(207,31,50,.1); }
.new-sheet-card { width: min(620px, 100%); }
.new-sheet-name-field { display: block; margin: 2px 0 5px; }
.new-sheet-name-input {
  width: min(100%, 390px);
  padding: 2px 0 5px;
  border: 0;
  border-bottom: 2px solid #dce2e4;
  border-radius: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.1;
}
.new-sheet-name-input::placeholder { color: #77838a; opacity: 1; }
.new-sheet-name-input:focus { border-bottom-color: var(--red); }
.new-sheet-builder { display: grid; gap: 20px; }
.column-count-field { max-width: 190px; }
.field-group-label { display: block; margin-bottom: 10px; color: #536269; font-size: 10px; font-weight: 800; }
.new-sheet-heading-fields { max-height: min(42vh, 360px); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; overflow-y: auto; padding: 3px; }
.export-option-card { width: min(560px, 100%); }
.export-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.export-choice { min-height: 92px; align-items: flex-start; flex-direction: column; padding: 18px; text-align: left; }
.export-choice > svg { width: 23px; height: 23px; margin-bottom: 5px; }
.export-choice strong { font-size: 13px; }
.export-choice span { font-size: 9px; font-weight: 600; opacity: .75; }
.export-format-card { width: min(760px, 100%); }
.export-format-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.drive-export-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.canvas-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 9px; color: #56656c; font-size: 10px; }
.canvas-heading span { color: #8c999f; }
.canvas-frame { position: relative; overflow: hidden; border: 1px solid #cdd7da; border-radius: 11px; background: #fff; }
#signatureCanvas { width: 100%; height: 275px; display: block; cursor: crosshair; touch-action: none; }
.signature-line { position: absolute; right: 32px; bottom: 48px; left: 32px; border-bottom: 1px dashed #d6dfe1; pointer-events: none; }
.sign-here { position: absolute; right: 32px; bottom: 32px; color: #c0c9cc; font-size: 7px; font-weight: 900; letter-spacing: .12em; pointer-events: none; }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; padding: 15px 25px 20px; border-top: 1px solid var(--line); background: #f8faf9; }
.danger-text { color: var(--red-dark); }
.save-button { min-width: 145px; }
.toast {
  position: fixed;
  z-index: 50;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 44px));
  padding: 12px 15px;
  border: 1px solid #efc5ca;
  border-radius: 10px;
  color: var(--red-dark);
  background: #fff5f6;
  box-shadow: var(--shadow);
  font-size: 10px;
  font-weight: 800;
  opacity: 0;
  transform: translateY(10px);
  transition: .2s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.toast.error { color: #8a4e11; border-color: #ecd4a0; background: #fffaf0; }

[data-theme="dark"] .login-screen,
[data-theme="dark"] .login-card,
[data-theme="dark"] .toolbar,
[data-theme="dark"] .signature-card,
[data-theme="dark"] .modal-footer,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .table-card,
[data-theme="dark"] .attendee-field input,
[data-theme="dark"] .login-field input { color: var(--ink); background: var(--surface); }
[data-theme="dark"] .toolbar { background: rgba(23,39,46,.94); }
[data-theme="dark"] .toolbar-clock,
[data-theme="dark"] .modal-header h2,
[data-theme="dark"] .empty-state h2,
[data-theme="dark"] .register-heading h1 { color: var(--ink); }
[data-theme="dark"] .table-card-heading,
[data-theme="dark"] .modal-footer { background: #132229; }
[data-theme="dark"] th { color: #b9c7cc; background: #132229; }
[data-theme="dark"] td { color: #dbe5e8; }
[data-theme="dark"] tbody tr:hover { background: #1d3038; }
[data-theme="dark"] .theme-options legend,
[data-theme="dark"] .attendee-field { color: #b9c7cc; }

@media (max-width: 980px) {
  .main-area { margin-left: 310px; }
  .table-card-heading { grid-template-columns: auto minmax(180px, 1fr); }
  .table-heading-actions { grid-column: 1 / -1; justify-content: flex-end; }
}
@media (max-width: 700px) {
  .login-card { padding: 34px 24px; }
  .signed-in-user { display: none; }
  .export-options { grid-template-columns: 1fr; }
  .drive-export-options { grid-template-columns: 1fr; }
  .sidebar { width: 100%; height: auto; bottom: auto; overflow: visible; }
  .sidebar-drawer {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: calc(100vh - 197px);
    max-height: calc(100dvh - 197px);
    overflow-y: auto;
    touch-action: pan-y;
    background: var(--coal);
    box-shadow: 0 16px 35px rgba(2,12,16,.24);
    transform: translateY(-12px);
  }
  .sidebar.open .sidebar-drawer { transform: translateY(0); }
  .main-area { margin-left: 0; padding-top: 197px; }
  .table-scroll { max-height: 56vh; }
  .table-card-heading { grid-template-columns: 1fr; }
  .table-search, .table-heading-actions { grid-column: auto; }
  .table-heading-actions { align-items: flex-end; flex-direction: column; gap: 7px; }
  .attendee-fields { grid-template-columns: 1fr; }
  .new-sheet-heading-fields { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; flex-wrap: wrap; }
  .toolbar-clock { min-height: 41px; flex: 1; }
  .toolbar-clock div { align-items: flex-start; flex-direction: column; gap: 1px; }
  .toolbar-date { font-size: 10px; }
  .toolbar-time { font-size: 15px; }
  .search-field { width: calc(100% - 55px); order: 1; }
  .table-search { width: 100%; order: initial; }
  .mobile-menu { order: 0; }
  .toolbar-actions { width: 100%; order: 2; }
  .toolbar-actions button { flex: 1; }
  .register-heading { align-items: flex-start; flex-direction: column; }
  .progress-summary { width: 100%; }
  .stat-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 74px; }
  .table-hint { display: none; }
  .canvas-heading { flex-direction: column; }
  #signatureCanvas { height: 230px; }
}
@media (max-width: 430px) {
  .content { padding-right: 14px; padding-left: 14px; }
  .toolbar { padding-right: 14px; padding-left: 14px; }
  .toolbar-actions button span { display: none; }
  .toolbar-actions button { min-width: 0; }
  .modal-header, .modal-body, .modal-footer { padding-right: 17px; padding-left: 17px; }
  .modal-footer .secondary-button, .modal-footer .primary-button { flex: 1; min-width: 0; }
}
@media (orientation: landscape) and (max-height: 600px) {
  .school-brand {
    min-height: 72px;
    gap: 10px;
    padding: 9px 18px;
  }
  .school-brand img { width: 49px; height: 65px; }
  .school-brand strong { font-size: 13px; }
  .school-brand span { margin-top: 2px; font-size: 8px; }
  .sidebar-menu-toggle {
    min-height: 36px;
    margin-top: 8px;
    margin-bottom: 8px;
  }
  .toolbar {
    min-height: 54px;
    gap: 10px;
    padding-top: 6px;
    padding-bottom: 6px;
  }
  .toolbar-clock svg { width: 22px; height: 22px; }
  .toolbar-time { font-size: 15px; }
  .primary-button, .secondary-button, .icon-button { min-height: 36px; }
  .content { padding-top: 14px; padding-bottom: 24px; }
  .register-heading {
    align-items: center;
    flex-direction: row;
    gap: 18px;
    margin-bottom: 10px;
  }
  .register-heading h1 { font-size: 22px; }
  .register-heading p { margin-top: 3px; }
  .progress-summary { width: 190px; }
  .progress-copy { margin-bottom: 4px; }
  .progress-track { height: 5px; }
  .stat-grid { gap: 9px; margin-bottom: 10px; }
  .stat-card {
    min-height: 56px;
    gap: 10px;
    padding: 8px 12px;
  }
  .stat-icon { width: 34px; height: 34px; border-radius: 9px; }
  .stat-card strong { font-size: 18px; }
  .stat-card div span { margin-top: 3px; }
  .table-card-heading { gap: 12px; padding: 8px 14px; }
  .table-card-heading p { margin-top: 2px; }
  .search-field input { height: 36px; }
  .table-scroll { max-height: max(58vh, calc(100dvh - 255px)); }
  th { padding-top: 8px; padding-bottom: 8px; }
  td { padding-top: 9px; padding-bottom: 9px; }
}
@media (orientation: landscape) and (max-height: 600px) and (max-width: 700px) {
  .sidebar {
    width: 142px;
    height: 100vh;
    bottom: 0;
    overflow: hidden;
    transition: width .24s ease;
  }
  .sidebar.open { width: min(310px, calc(100vw - 16px)); }
  .school-brand {
    justify-content: center;
    padding-right: 10px;
    padding-left: 10px;
  }
  .school-brand > div {
    width: 0;
    overflow: hidden;
    opacity: 0;
    transition: width .2s ease, opacity .16s ease;
  }
  .sidebar.open .school-brand { justify-content: flex-start; padding-right: 18px; padding-left: 18px; }
  .sidebar.open .school-brand > div { width: auto; opacity: 1; }
  .sidebar-menu-toggle {
    justify-content: center;
    gap: 0;
    width: calc(100% - 20px);
    margin-right: 10px;
    margin-left: 10px;
    padding-right: 0;
    padding-left: 0;
  }
  .sidebar-menu-toggle span { display: none; }
  .sidebar.open .sidebar-menu-toggle {
    justify-content: flex-start;
    width: calc(100% - 36px);
    margin-right: 18px;
    margin-left: 18px;
    padding-right: 13px;
    padding-left: 13px;
  }
  .sidebar.open .sidebar-menu-toggle span { display: inline; }
  .sidebar-drawer {
    position: absolute;
    top: 135px;
    left: 0;
    width: 100%;
    height: calc(100% - 135px);
    max-height: none;
    flex: none;
  }
  .main-area {
    margin-left: 142px;
    padding-top: 0;
  }
  .toolbar { align-items: center; flex-wrap: nowrap; }
  .toolbar-clock { min-height: 36px; }
  .toolbar-clock div { align-items: baseline; flex-direction: row; gap: 6px; }
  .toolbar-actions { width: auto; order: initial; }
  .toolbar-actions button { flex: none; }
  .register-heading { align-items: center; flex-direction: row; }
  .progress-summary { width: 190px; }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .table-card-heading { grid-template-columns: auto minmax(180px, 1fr) auto; }
  .table-search, .table-heading-actions { grid-column: auto; }
  .table-heading-actions { align-items: center; flex-direction: row; }
}

/* Cascading sidebar: keep the sheet wide until the register menu is needed. */
@media (min-width: 701px), (orientation: landscape) and (max-width: 700px) and (max-height: 600px) {
  .sidebar {
    width: 82px;
    overflow: hidden;
    transition: width .24s ease;
  }
  .sidebar.open { width: min(310px, calc(100vw - 16px)); }
  .school-brand {
    justify-content: center;
    gap: 0;
    padding-right: 16px;
    padding-left: 16px;
  }
  .school-brand > div {
    width: 0;
    overflow: hidden;
    opacity: 0;
    transition: width .2s ease, opacity .16s ease;
  }
  .sidebar.open .school-brand {
    justify-content: flex-start;
    gap: 14px;
    padding-right: 24px;
    padding-left: 24px;
  }
  .sidebar.open .school-brand > div {
    width: auto;
    opacity: 1;
  }
  .sidebar-menu-toggle {
    justify-content: center;
    gap: 0;
    width: calc(100% - 20px);
    margin-right: 10px;
    margin-left: 10px;
    padding-right: 0;
    padding-left: 0;
  }
  .sidebar-menu-toggle span {
    width: 0;
    overflow: hidden;
    opacity: 0;
    white-space: nowrap;
    transition: width .2s ease, opacity .16s ease;
  }
  .sidebar.open .sidebar-menu-toggle {
    justify-content: flex-start;
    width: calc(100% - 32px);
    margin-right: 16px;
    margin-left: 16px;
    padding-right: 13px;
    padding-left: 13px;
  }
  .sidebar.open .sidebar-menu-toggle span {
    width: auto;
    opacity: 1;
  }
  .configure-button {
    justify-content: center;
    width: calc(100% - 20px);
    margin-right: 10px;
    margin-left: 10px;
    padding-right: 0;
    padding-left: 0;
  }
  .configure-button span { display: none; }
  .sidebar.open .configure-button {
    justify-content: flex-start;
    width: calc(100% - 32px);
    margin-right: 16px;
    margin-left: 16px;
    padding-right: 14px;
    padding-left: 14px;
  }
  .sidebar.open .configure-button span { display: inline; }
  .main-area {
    margin-left: 82px;
    padding-top: 0;
  }
}