/* ============================================================
   SeatFlow — styles.css  (clean, Tailwind-inspired design)
   ============================================================ */
:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --danger: #ef4444;
  --warn: #f59e0b;
  --ok: #16a34a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 4px 14px rgba(15,23,42,.06);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif;
  display: flex; flex-direction: column; overflow: hidden;
}

/* ---------- Topbar ---------- */
#topbar {
  display: flex; align-items: center; gap: 20px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 18px; height: 54px; flex: 0 0 auto; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.brand-icon { font-size: 20px; }
#tabs { display: flex; gap: 4px; }
.tab-btn {
  border: none; background: none; padding: 8px 14px; border-radius: 8px;
  font: inherit; font-weight: 600; color: var(--muted); cursor: pointer;
}
.tab-btn:hover { background: #eef2ff; color: var(--primary); }
.tab-btn.active { background: var(--primary); color: #fff; }
.topbar-right { margin-left: auto; color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 10px; }

#view { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

/* ---------- Buttons / inputs ---------- */
.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 7px 14px; border-radius: 8px; font: inherit; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { background: #f8fafc; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.93); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f1f5f9; color: var(--text); }
.btn-sm { padding: 4px 9px; font-size: 12.5px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input, select.input, textarea.input {
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px;
  font: inherit; background: var(--surface); color: var(--text); min-width: 0;
}
.input:focus { outline: 2px solid #c7d2fe; border-color: var(--primary); }
label.lbl { display: block; font-weight: 600; font-size: 12.5px; color: var(--muted); margin: 12px 0 4px; }
label.lbl:first-child { margin-top: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

/* ---------- Toolbar strips ---------- */
.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.toolbar .sep { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
.toolbar .lbl-inline { font-size: 12px; font-weight: 600; color: var(--muted); }

/* ---------- Chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: color-mix(in srgb, var(--chip) 15%, white);
  color: var(--chip); border: 1px solid color-mix(in srgb, var(--chip) 35%, white);
  margin: 1px 2px;
}
.badge-dot {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 3px; border-radius: 6px;
  font-size: 10px; font-weight: 700; color: #fff;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow);
  width: 460px; max-width: 95vw; max-height: 90vh; display: flex; flex-direction: column;
}
.modal-wide { width: 780px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 8px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-x { border: none; background: none; font-size: 15px; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.modal-x:hover { background: #f1f5f9; }
.modal-body { padding: 6px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; }
.confirm-msg { margin: 8px 0; }
.prompt-input { width: 100%; }

/* ---------- Toasts ---------- */
#toast-root { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #1e293b; color: #fff; padding: 9px 16px; border-radius: 9px;
  font-weight: 600; font-size: 13px; opacity: 0; transform: translateY(8px);
  transition: all .25s; box-shadow: var(--shadow); max-width: 80vw;
}
.toast.show { opacity: 1; transform: none; }
.toast-error { background: var(--danger); }
.toast-success { background: var(--ok); }
.toast-warn { background: var(--warn); color: #1e293b; }

/* ---------- Generic page scaffolding ---------- */
.page { flex: 1; overflow: auto; padding: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.card h2 { margin: 0 0 4px; font-size: 15.5px; }
.card .hint { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; }
.empty-note { color: var(--muted); text-align: center; padding: 30px 10px; }

/* ---------- Students table ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--border);
}
.data-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:hover td { background: #f8fafc; }
.data-table .name-cell { font-weight: 600; cursor: pointer; }
.data-table .name-cell:hover { color: var(--primary); }

/* ---------- Student form ---------- */
.tag-picker { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-opt {
  border: 1.5px solid var(--border); border-radius: 999px; padding: 3px 11px;
  cursor: pointer; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface);
  user-select: none;
}
.tag-opt.on { border-color: var(--chip); background: color-mix(in srgb, var(--chip) 14%, white); color: var(--chip); }
.rel-list { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.rel-item {
  display: inline-flex; align-items: center; gap: 5px; background: #f1f5f9;
  border-radius: 999px; padding: 3px 6px 3px 11px; font-size: 12px; font-weight: 600;
}
.rel-item button { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 11px; padding: 1px 4px; border-radius: 99px;}
.rel-item button:hover { background: #e2e8f0; color: var(--danger); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: 13px; }
.switch input { width: 36px; height: 20px; appearance: none; background: #cbd5e1; border-radius: 999px; position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input:checked { background: var(--primary); }
.switch input::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: left .15s;
}
.switch input:checked::after { left: 18px; }

/* ---------- Admin: field list ---------- */
.field-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; background: #fff;
}
.field-row .f-icon { font-size: 18px; width: 26px; text-align: center; }
.field-row .f-name { font-weight: 700; }
.field-row .f-type { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.field-row .f-opts { color: var(--muted); font-size: 12px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt-editor-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.opt-editor-row input[type=color] { width: 34px; height: 30px; border: 1px solid var(--border); border-radius: 6px; padding: 1px; background: #fff; cursor: pointer; }
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type-card {
  border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: pointer;
}
.type-card:hover { border-color: #c7d2fe; }
.type-card.on { border-color: var(--primary); background: #eef2ff; }
.type-card .t-name { font-weight: 700; font-size: 13px; }
.type-card .t-desc { font-size: 11.5px; color: var(--muted); }

/* ---------- Import ---------- */
.import-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .import-grid { grid-template-columns: 1fr; } }
.map-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.map-table th, .map-table td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; }
.map-table th { background: #f8fafc; }
.drop-zone {
  border: 2px dashed #cbd5e1; border-radius: 12px; padding: 26px; text-align: center;
  color: var(--muted); cursor: pointer; transition: all .15s;
}
.drop-zone:hover, .drop-zone.over { border-color: var(--primary); background: #eef2ff; color: var(--primary); }
.preview-scroll { overflow: auto; max-height: 300px; border: 1px solid var(--border); border-radius: 8px; }

/* ============================================================
   Canvas (shared by Layout editor and Seating chart)
   ============================================================ */
.canvas-wrap {
  flex: 1; overflow: auto; position: relative; background: #e8edf4;
}
.canvas {
  position: relative; margin: 24px auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow);
  background-image: radial-gradient(#dbe3ee 1px, transparent 1px);
  background-size: 20px 20px;
}

/* Tables */
.table-el {
  position: absolute; border-radius: 12px; background: #fdfaf3;
  border: 2px solid #d6c9a8; display: flex; flex-direction: column;
  box-shadow: 0 2px 6px rgba(15,23,42,.07);
}
.table-el .t-label {
  text-align: center; font-weight: 700; font-size: 12px; color: #8a744b;
  padding: 3px 4px 1px; user-select: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.table-el .t-seats { flex: 1; display: grid; gap: 5px; padding: 5px; min-height: 0; }
.table-el.conflict { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239,68,68,.30); }
.table-el.selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.28); }

/* Seats */
.seat {
  border: 1.5px dashed #cbd5e1; border-radius: 8px; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden; position: relative; min-height: 0; min-width: 0;
  font-size: 11.5px; text-align: center; padding: 2px 3px;
}
.seat.occupied { border-style: solid; cursor: grab; }
.seat.drag-over { border-color: var(--primary); background: #eef2ff; border-style: solid; }
.seat .s-name { font-weight: 700; line-height: 1.15; width: 100%; overflow: hidden; }
.seat .s-badges { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; margin-top: 2px; }
.seat .s-badges .badge-dot { min-width: 15px; height: 14px; font-size: 9px; border-radius: 5px; }
.seat.dimmed { opacity: .25; }
.seat.hilite { box-shadow: 0 0 0 3px rgba(250,204,21,.8); }
.seat.together-warn { border-color: var(--warn); box-shadow: 0 0 0 2px rgba(245,158,11,.4); }
.seat .s-x {
  position: absolute; top: 1px; right: 1px; border: none; background: none; color: var(--muted);
  font-size: 10px; cursor: pointer; padding: 1px 4px; border-radius: 5px; display: none;
}
.seat:hover .s-x { display: block; }
.seat .s-x:hover { background: #fee2e2; color: var(--danger); }

/* Furniture */
.furn-el {
  position: absolute; border-radius: 10px; background: #eef2f7;
  border: 2px solid #b6c2d4; display: flex; align-items: center; justify-content: center;
  gap: 6px; font-weight: 700; font-size: 12px;
  color: #52627a; user-select: none; overflow: hidden;
}
.furn-el.selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.28); }
.furn-el .f-ico { font-size: 16px; }

/* Layout editor interactions */
.canvas.editing .table-el, .canvas.editing .furn-el { cursor: move; }
.resize-handle {
  position: absolute; width: 14px; height: 14px; right: -7px; bottom: -7px;
  background: var(--primary); border: 2px solid #fff; border-radius: 50%;
  cursor: nwse-resize; z-index: 5;
}
.canvas-size-handle {
  position: absolute; width: 18px; height: 18px; right: -9px; bottom: -9px;
  background: var(--muted); border: 2px solid #fff; border-radius: 50%; cursor: nwse-resize; z-index: 6;
}

/* ---------- Layout page structure ---------- */
.split { flex: 1; display: flex; overflow: hidden; }
.side-panel {
  width: 270px; flex: 0 0 auto; background: var(--surface);
  border-left: 1px solid var(--border); overflow-y: auto; padding: 14px;
}
.side-panel h4 { margin: 0 0 8px; font-size: 13px; }
.side-panel .prop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- Seating page ---------- */
.roster-panel {
  width: 230px; flex: 0 0 auto; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden;
}
.roster-panel .rp-head { padding: 10px 12px 6px; border-bottom: 1px solid var(--border); }
.roster-panel .rp-list { flex: 1; overflow-y: auto; padding: 8px; }
.roster-panel.drag-over { background: #eef2ff; }
.student-chip {
  display: flex; align-items: center; gap: 7px; padding: 6px 9px; margin-bottom: 5px;
  border: 1px solid var(--border); border-radius: 9px; background: #fff; cursor: grab;
  font-weight: 600; font-size: 12.5px;
}
.student-chip:active { cursor: grabbing; }
.student-chip .sc-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.student-chip .sc-badges { margin-left: auto; display: flex; gap: 2px; }
.student-chip.dimmed { opacity: .3; }
.student-chip.hilite { box-shadow: 0 0 0 2px rgba(250,204,21,.8); }

.hl-panel {
  width: 250px; flex: 0 0 auto; background: var(--surface);
  border-left: 1px solid var(--border); overflow-y: auto; padding: 12px;
}
.hl-group { margin-bottom: 14px; }
.hl-group h5 { margin: 0 0 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.hl-opt {
  display: flex; align-items: center; gap: 7px; padding: 5px 8px; border-radius: 8px;
  cursor: pointer; font-size: 12.5px; font-weight: 600; border: 1px solid transparent;
}
.hl-opt:hover { background: #f8fafc; }
.hl-opt.on { background: #fef9c3; border-color: #fde047; }
.hl-opt .hl-dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.hl-opt .hl-count { margin-left: auto; color: var(--muted); font-size: 11px; }

.conflict-bar {
  background: #fef2f2; border-bottom: 1px solid #fecaca; color: #b91c1c;
  padding: 6px 16px; font-size: 12.5px; font-weight: 600; display: flex; gap: 14px; flex-wrap: wrap;
}
.conflict-bar.warn-only { background: #fffbeb; border-color: #fde68a; color: #b45309; }

/* ---------- Fullscreen mode ---------- */
.fs-active { background: #0f172a !important; }
.fs-active .canvas {
  background: #ffffff; margin: 0; border-radius: 0; border: none;
  transform-origin: top left;
}
.fs-toolbar {
  position: fixed; top: 14px; right: 16px; z-index: 50;
  background: rgba(15,23,42,.82); color: #fff; border-radius: 12px;
  padding: 9px 14px; display: flex; align-items: center; gap: 12px; font-size: 13px;
  opacity: .25; transition: opacity .2s;
}
.fs-toolbar:hover { opacity: 1; }
.fs-toolbar label { font-weight: 600; }
.fs-toolbar .btn { background: rgba(255,255,255,.14); border-color: transparent; color: #fff; }
.fs-toolbar .btn:hover { background: rgba(255,255,255,.25); }

/* Bigger seat text in fullscreen */
.fs-active .seat { font-size: 14px; }
.fs-active .table-el .t-label { font-size: 14px; }

/* Repeat-pair badge on tables */
.repeat-badge {
  position: absolute; top: -9px; right: -9px; z-index: 4;
  background: var(--warn); color: #fff; font-size: 10.5px; font-weight: 800;
  border-radius: 999px; padding: 2px 7px; box-shadow: 0 1px 3px rgba(15,23,42,.25);
  cursor: default; white-space: nowrap;
}
.repeat-badge.hot { background: var(--danger); }

/* ---------- Misc ---------- */
.pill-select { display: inline-flex; gap: 4px; background: #f1f5f9; padding: 3px; border-radius: 9px; }
.pill-select button {
  border: none; background: none; padding: 4px 11px; border-radius: 7px; font: inherit;
  font-weight: 600; font-size: 12px; color: var(--muted); cursor: pointer;
}
.pill-select button.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(15,23,42,.12); }
.kbd { background:#f1f5f9; border:1px solid var(--border); border-bottom-width:2px; border-radius:5px; padding:0 5px; font-size:11px; font-family:monospace; }

/* ============================================================
   Tap-to-place (touch & desktop)
   ============================================================ */
.seat.picked, .student-chip.picked {
  box-shadow: 0 0 0 3px var(--primary), 0 0 0 6px rgba(79,70,229,.25) !important;
  border-color: var(--primary) !important; z-index: 3;
}
.seat.placeable {
  border-color: var(--primary); border-style: dashed;
  background: repeating-linear-gradient(45deg, #eef2ff, #eef2ff 6px, #fff 6px, #fff 12px);
  animation: placePulse 1.2s ease-in-out infinite;
}
@keyframes placePulse { 50% { border-color: #a5b4fc; } }
.moving-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--primary); color: #fff; padding: 8px 16px; font-size: 13px; font-weight: 600;
}
.moving-banner b { text-decoration: underline; }
.moving-banner .btn { background: rgba(255,255,255,.16); border-color: transparent; color: #fff; }

/* ============================================================
   Sync (phone ↔ desktop) UI
   ============================================================ */
#sync-btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px;
  padding: 5px 10px; font: inherit; font-weight: 600; font-size: 12.5px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; color: var(--muted);
}
#sync-btn:hover { background: #f8fafc; }
#sync-btn.on { color: var(--ok); border-color: #bbf7d0; background: #f0fdf4; }
#sync-btn .sync-dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; }
#sync-btn.on .sync-dot { background: var(--ok); animation: syncPulse 2s infinite; }
#sync-btn.err .sync-dot { background: var(--danger); }
@keyframes syncPulse { 50% { opacity: .35; } }
.sync-code {
  font-family: monospace; font-size: 34px; font-weight: 800; letter-spacing: 6px;
  text-align: center; background: #f1f5f9; border: 2px dashed var(--border);
  border-radius: 12px; padding: 14px; margin: 8px 0; color: var(--primary);
}
.sync-url {
  font-family: monospace; font-size: 12.5px; word-break: break-all; background: #f8fafc;
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin: 4px 0;
}

/* ============================================================
   Mobile drawers + floating action buttons
   ============================================================ */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 40; }
.mobile-fab { display: none; }
.drawer-close { display: none; }   /* only meaningful inside a mobile bottom sheet */

/* Desktop default: full tab labels (mobile media query overrides below) */
.tab-btn .tab-short { display: none; }
.tab-btn .tab-full { display: inline; }

/* ============================================================
   Responsive — phones & small tablets
   ============================================================ */
@media (max-width: 820px) {
  /* Topbar: brand + sync, tabs move to a bottom nav */
  #topbar { height: 50px; padding: 0 10px; gap: 8px; }
  .brand-name { display: none; }
  #save-indicator { display: none; }

  #tabs {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
    background: var(--surface); border-top: 1px solid var(--border);
    display: flex; gap: 0; height: 56px; padding: 0;
    box-shadow: 0 -2px 10px rgba(15,23,42,.08);
  }
  .tab-btn {
    flex: 1; border-radius: 0; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 2px; font-size: 10px; padding: 4px 2px; line-height: 1.1;
  }
  .tab-btn::before { content: attr(data-icon); font-size: 20px; }
  .tab-btn.active { background: none; color: var(--primary); box-shadow: inset 0 -3px 0 var(--primary); }
  .tab-btn:hover { background: none; }
  /* show only the short label on mobile */
  .tab-btn .tab-full { display: none; }
  .tab-btn .tab-short { display: inline; }

  body { padding-bottom: 56px; }

  /* Toolbars scroll horizontally instead of stacking tall */
  .toolbar {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: 8px 10px; gap: 6px; scrollbar-width: thin;
  }
  .toolbar .lbl-inline { display: none; }
  .toolbar .grow { display: none; }
  .btn, .input, select.input { min-height: 38px; }       /* comfy tap targets */
  .btn-sm { padding: 7px 11px; font-size: 13px; }

  /* Seating: canvas is full-bleed; roster & filters become bottom sheets */
  .split { position: relative; }
  .roster-panel, .hl-panel {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
    width: auto; max-height: 66vh; border: none; border-radius: 18px 18px 0 0;
    box-shadow: 0 -4px 24px rgba(15,23,42,.22);
    transform: translateY(105%); transition: transform .25s ease;
  }
  .roster-panel.open, .hl-panel.open { transform: translateY(0); }
  .roster-panel { display: flex; flex-direction: column; }
  .hl-panel { display: block; padding: 14px 14px 26px; overflow-y: auto; }
  .drawer-close { display: inline-flex; }

  .mobile-fab {
    display: flex; flex-direction: column; gap: 10px;
    position: fixed; right: 14px; bottom: 70px; z-index: 39;
  }
  .fab-btn {
    width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer;
    background: var(--primary); color: #fff; font-size: 22px; position: relative;
    box-shadow: 0 4px 14px rgba(79,70,229,.4);
  }
  .fab-btn .fab-count {
    position: absolute; top: -3px; right: -3px; background: var(--danger); color: #fff;
    font-size: 11px; font-weight: 800; min-width: 20px; height: 20px; border-radius: 999px;
    display: flex; align-items: center; justify-content: center; padding: 0 4px; border: 2px solid #fff;
  }

  /* Layout editor: stack the properties panel under the canvas */
  .split { flex-direction: column; }
  .side-panel { width: 100%; border-left: none; border-top: 1px solid var(--border); max-height: 40vh; }
  .canvas-wrap { min-height: 46vh; }

  /* Bigger touch targets in the layout editor */
  .resize-handle { width: 22px; height: 22px; right: -11px; bottom: -11px; }
  .canvas-size-handle { width: 26px; height: 26px; }
  .seat .s-x { display: block; font-size: 13px; padding: 2px 6px; }

  /* Pages: roomier padding, single-column cards */
  .page { padding: 12px; }
  .import-grid { grid-template-columns: 1fr; }
  .modal { width: 96vw; }
  .modal-wide { width: 96vw; }

  /* Students table: let it scroll horizontally rather than crush columns */
  .data-table { min-width: 640px; }

  /* Fullscreen toolbar sits a bit larger and always visible on touch */
  .fs-toolbar { opacity: .9; top: 8px; right: 8px; flex-wrap: wrap; max-width: 94vw; }
}

/* ============================================================
   Wheel of Names
   ============================================================ */
.wheel-split { overflow: hidden; }
.wheel-host {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center;
  background: #e8edf4; overflow: auto; padding: 14px;
}
.wheel-stage {
  display: flex; flex-direction: column; align-items: center; gap: 10px; position: relative;
  width: 100%;   /* gives .wheel-round a real percentage basis */
}
.wheel-heading {
  font-size: 19px; font-weight: 800; color: var(--text); text-align: center;
  max-width: 90vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wheel-round {
  position: relative; aspect-ratio: 1 / 1;
  width: min(100%, 60vh); max-width: 620px; flex: 0 0 auto;
}
.wheel-stage.big .wheel-round { width: min(94vw, 80vh); max-width: none; }
.wheel-canvas { position: absolute; inset: 0; border-radius: 50%; filter: drop-shadow(0 6px 18px rgba(15,23,42,.18)); }
.wheel-confetti { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.wheel-pointer {
  position: absolute; right: -14px; top: 50%; transform: translateY(-50%);
  font-size: 30px; line-height: 1; color: var(--danger); z-index: 3;
  filter: drop-shadow(0 2px 3px rgba(15,23,42,.35)); pointer-events: none;
}
.wheel-hub {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 21%; height: 21%; border-radius: 50%; z-index: 3;
  border: 5px solid #fff; background: var(--primary); color: #fff; cursor: pointer;
  font: inherit; font-weight: 800; font-size: clamp(10px, 2.1vh, 17px); letter-spacing: .04em;
  box-shadow: 0 3px 12px rgba(15,23,42,.3);
}
.wheel-hub:hover { background: var(--primary-hover); }
.wheel-hub:active { transform: translate(-50%, -50%) scale(.95); }
.wheel-stage.spinning .wheel-hub { pointer-events: none; opacity: .8; }
.wheel-status { font-size: 13px; color: var(--muted); font-weight: 600; text-align: center; }

/* Winner card — lives inside the stage so it also shows in fullscreen */
.wheel-winner {
  position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center;
  background: rgba(15,23,42,.55); border-radius: 14px; padding: 10px;
}
.wheel-winner[hidden] { display: none; }   /* must beat the display:flex above */
.ww-card {
  background: #fff; border-radius: 18px; padding: 22px 30px; text-align: center;
  box-shadow: 0 12px 40px rgba(15,23,42,.35); animation: wwPop .28s cubic-bezier(.2,1.4,.4,1);
  max-width: 92%;
}
@keyframes wwPop { from { transform: scale(.7); opacity: 0; } }
.ww-label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.ww-name { font-size: clamp(26px, 5.4vh, 54px); font-weight: 800; color: var(--primary); margin: 6px 0 4px; line-height: 1.1; }
.ww-sub { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.ww-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* Name list side panel */
.wheel-names { width: 260px; }
.wh-name {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px;
  cursor: pointer; font-size: 13px; font-weight: 600; user-select: none;
}
.wh-name:hover { background: #f8fafc; }
.wh-swatch { width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; }
.wh-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wh-name.done .wh-label { text-decoration: line-through; color: var(--muted); }
.wh-name.off { opacity: .45; }
.wh-name.off .wh-label { font-style: italic; }
.wh-toggle {
  border: none; background: none; cursor: pointer; color: var(--muted); font-size: 12px;
  padding: 2px 5px; border-radius: 6px; opacity: .5;
}
.wh-name:hover .wh-toggle { opacity: 1; }
.wh-toggle:hover { background: #e2e8f0; color: var(--text); }
.wh-name.off .wh-toggle { opacity: 1; color: var(--danger); }

/* Customize modal */
.cust-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.pal-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px;
  border: 1.5px solid transparent; cursor: pointer; margin-bottom: 3px;
}
.pal-row:hover { background: #f8fafc; }
.pal-row.on { border-color: var(--primary); background: #eef2ff; }
.pal-swatches { display: flex; gap: 2px; flex: 0 0 auto; }
.pal-swatches i { width: 13px; height: 18px; border-radius: 3px; display: block; }
.pal-name { font-size: 12.5px; font-weight: 600; }

/* Wheel-only fullscreen */
.wheel-fs {
  position: fixed; inset: 0; z-index: 90; background: #0f172a;
  display: flex; align-items: center; justify-content: center;
}
.wheel-fs .wheel-fs-host { display: flex; align-items: center; justify-content: center; }
.wheel-fs .wheel-heading { color: #fff; font-size: clamp(20px, 4vh, 40px); }
.wheel-fs .wheel-status { color: #94a3b8; font-size: 15px; }
.wheel-fs-bar {
  position: fixed; top: 14px; right: 16px; z-index: 95;
  background: rgba(15,23,42,.82); border-radius: 12px; padding: 8px 12px;
  display: flex; align-items: center; gap: 8px; opacity: .3; transition: opacity .2s;
}
.wheel-fs-bar:hover { opacity: 1; }
.wheel-fs-bar .btn { background: rgba(255,255,255,.14); border-color: transparent; color: #fff; }
.wheel-fs-bar .btn:hover { background: rgba(255,255,255,.26); }

/* ============================================================
   Topbar: class picker + lock button
   ============================================================ */
#class-picker { display: flex; align-items: center; gap: 6px; }
#class-picker .cp-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
#class-picker select { font-weight: 700; padding: 5px 8px; min-width: 130px; }
#lock-btn, #backup-btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px;
  padding: 5px 9px; font-size: 13px; cursor: pointer;
}
#lock-btn:hover { background: #fef2f2; border-color: #fecaca; }
#backup-btn:hover { background: #eff6ff; border-color: #bfdbfe; }
#backup-btn.warn { background: #fffbeb; border-color: #fde68a; }

/* Merge-from-another-computer picker */
.merge-list { display: flex; flex-direction: column; gap: 5px; max-height: 190px; overflow-y: auto; }
.merge-item {
  display: flex; align-items: flex-start; gap: 9px; padding: 8px 11px;
  border: 1px solid var(--border); border-radius: 9px; cursor: pointer; background: #fff; font-size: 12.5px;
}
.merge-item:hover { border-color: #c7d2fe; }
.merge-item input { margin-top: 2px; }
.merge-item.dupe { opacity: .6; background: #f8fafc; }
.merge-meta { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }

/* Auto-Seat rule editor + summary */
.opt-editor-block { border: 1px solid var(--border); border-radius: 9px; padding: 8px; margin-bottom: 8px; background: #fff; }
.opt-editor-block .opt-editor-row { margin-bottom: 0; }
.opt-rule-row { display: flex; align-items: center; gap: 7px; margin-top: 7px; padding-left: 2px; flex-wrap: wrap; }
.opt-rule-lbl { font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.opt-rule-row select { font-size: 12px; padding: 4px 7px; }
.opt-rule-desc { font-size: 11px; color: var(--muted); flex: 1; min-width: 120px; }

.rules-box { margin-top: 14px; border: 1px solid #bfdbfe; background: #eff6ff; border-radius: 10px; padding: 10px 12px; }
.rules-head { font-size: 12.5px; font-weight: 700; color: #1d4ed8; margin-bottom: 6px; }
.rules-list { margin: 0; padding: 0; list-style: none; font-size: 12.5px; }
.rules-list li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.rules-list li span { color: var(--muted); font-size: 11.5px; text-align: right; }

/* Import dry-run preview */
.imp-pill {
  font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 3px 10px;
  border: 1px solid var(--border); background: #f8fafc; color: var(--muted);
}
.imp-pill.ok    { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.imp-pill.new   { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.imp-pill.bad   { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.imp-pill.muted { background: #f8fafc; }

.imp-preview-table { font-size: 12px; }
.imp-preview-table td { vertical-align: top; }
.imp-sub { color: var(--muted); font-size: 11px; }
.imp-row.bad td   { background: #fef2f2; }
.imp-row.new td   { background: #f8fbff; }
.imp-row.muted td { opacity: .55; }
.imp-val { display: inline-block; font-size: 11.5px; }
.imp-val.new  { color: #1d4ed8; }
.imp-val.blank { color: var(--muted); }

/* Roster sync diff */
.diff-list { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.diff-row {
  display: grid; grid-template-columns: 240px 1fr; gap: 12px; align-items: baseline;
  padding: 9px 12px; border-radius: 9px; font-size: 12.5px; border: 1px solid var(--border);
}
.diff-row b { font-size: 12.5px; }
.diff-row span { color: var(--muted); }
.diff-row.add    { background: #f0fdf4; border-color: #bbf7d0; }
.diff-row.rejoin { background: #eff6ff; border-color: #bfdbfe; }
.diff-row.change { background: #fffbeb; border-color: #fde68a; }
.diff-row.drop   { background: #fef2f2; border-color: #fecaca; }
.diff-row.same   { background: #f8fafc; }
.diff-row.empty  { opacity: .5; background: #f8fafc; border-color: var(--border); }
@media (max-width: 820px) { .diff-row { grid-template-columns: 1fr; gap: 2px; } }

/* Archived students */
.data-table tr.archived-row td { background: #f8fafc; color: var(--muted); }
.data-table tr.archived-row .name-cell { font-style: italic; }

/* Data safety panel */
.safety-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.safety-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: #fff; }
.safety-card h4 { margin: 0 0 8px; font-size: 13px; }
.safety-card .hint { font-size: 11.5px; }
.safety-state {
  font-size: 12px; font-weight: 600; border-radius: 8px; padding: 7px 10px; margin-bottom: 8px;
  background: #f1f5f9; color: var(--muted);
}
.safety-state.ok   { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.safety-state.warn { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

/* ============================================================
   Lock screen
   ============================================================ */
#lock-screen {
  position: fixed; inset: 0; z-index: 300; background: #0f172a;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.lock-card {
  background: var(--surface); border-radius: 18px; padding: 30px 32px; width: 380px; max-width: 94vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.5); text-align: center;
}
.lock-card .lock-icon { font-size: 42px; }
.lock-card h2 { margin: 6px 0 4px; font-size: 19px; }
.lock-card .input { width: 100%; margin: 12px 0 4px; text-align: center; font-size: 17px; letter-spacing: 2px; }
.lock-err { color: var(--danger); font-size: 12.5px; font-weight: 600; min-height: 18px; margin-bottom: 6px; }
.lock-card.shake { animation: shake .35s; }
@keyframes shake {
  25% { transform: translateX(-8px); } 50% { transform: translateX(8px); }
  75% { transform: translateX(-5px); }
}

/* Security panel bits */
.sec-status { padding: 9px 12px; border-radius: 9px; font-size: 12.5px; }
.sec-status.on  { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.sec-status.off { background: #fffbeb; border: 1px solid #fde68a; color: #b45309; }
.sec-warn {
  background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
  border-radius: 9px; padding: 10px 12px; font-size: 12.5px; line-height: 1.5;
}
.sec-note { margin-top: 16px; border-top: 1px dashed var(--border); padding-top: 12px; font-size: 12.5px; }
.sec-note ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.sec-note li { margin-bottom: 3px; }

/* ============================================================
   Attendance / participation / growth / groups
   ============================================================ */
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px; }
.att-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 8px 11px; border: 1.5px solid #bbf7d0; background: #f0fdf4; color: #15803d;
  border-radius: 9px; cursor: pointer; font-size: 12.5px; font-weight: 600; user-select: none;
}
.att-chip .att-mark { font-weight: 800; }
.att-chip.absent { border-color: #fecaca; background: #fef2f2; color: #b91c1c; text-decoration: line-through; }
.att-chip.tardy  { border-color: #fde68a; background: #fffbeb; color: #b45309; }

.tally-bar { display: inline-block; height: 9px; width: calc(var(--n) * 9px); background: var(--primary); border-radius: 3px; vertical-align: middle; margin-right: 5px; }
.spark { display: inline-flex; align-items: flex-end; gap: 2px; height: 26px; }
.spark-bar { width: 8px; min-height: 3px; border-radius: 2px 2px 0 0; }

.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-top: 14px; }
.group-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #f8fafc; }
.group-card h5 { margin: 0 0 6px; font-size: 12.5px; }
.group-card h5 span { color: var(--muted); font-weight: 500; }
.group-card ul { margin: 0; padding: 0; list-style: none; font-size: 12.5px; }
.group-card li { padding: 2px 0; display: flex; align-items: center; gap: 6px; }
.g-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }

/* Seat extras: absence, tally, quick-score */
.seat.absent { opacity: .45; background: repeating-linear-gradient(45deg,#f1f5f9,#f1f5f9 5px,#fff 5px,#fff 10px) !important; }
.seat .s-absent-mark { position: absolute; top: 1px; left: 2px; color: var(--danger); font-size: 10px; font-weight: 800; }
.seat.tardy { border-color: var(--warn) !important; box-shadow: inset 0 0 0 2px #fde68a; }
.seat .s-tardy-mark { position: absolute; top: 1px; left: 2px; font-size: 9px; }
.seat .s-tally {
  position: absolute; bottom: 1px; right: 2px; background: var(--primary); color: #fff;
  font-size: 9.5px; font-weight: 800; border-radius: 999px; min-width: 15px; text-align: center; padding: 0 3px;
}
.seat .s-tally.zero { background: var(--danger); }
.seat-flash {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: var(--ok); background: rgba(255,255,255,.75);
  animation: flashUp .9s ease-out forwards; pointer-events: none;
}
@keyframes flashUp { to { transform: translateY(-14px); opacity: 0; } }

.qs-grid { display: grid; gap: 8px; }
.qs-btn {
  border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 12%, white); color: var(--c);
  border-radius: 10px; padding: 12px; font: inherit; font-weight: 700; cursor: pointer; text-align: left;
}
.qs-btn:hover { background: color-mix(in srgb, var(--c) 22%, white); }
.qs-btn.on { background: var(--c); color: #fff; }

/* Print menu */
.print-menu { display: flex; flex-direction: column; gap: 8px; }
.print-menu .btn { justify-content: flex-start; text-align: left; padding: 11px 14px; flex-wrap: wrap; }
.print-menu .btn span { color: var(--muted); font-weight: 500; font-size: 11.5px; width: 100%; }

/* Projector timer */
.timer-widget {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 60;
  background: rgba(15,23,42,.9); border-radius: 16px; padding: 14px 22px; text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,.4);
}
.timer-display { font-size: 62px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; line-height: 1; }
.timer-display.low { color: #fbbf24; }
.timer-display.done { color: #ef4444; animation: timerDone .7s infinite; }
@keyframes timerDone { 50% { opacity: .35; } }
.timer-controls { display: flex; gap: 5px; justify-content: center; margin-top: 10px; }
.timer-controls .btn { background: rgba(255,255,255,.14); border-color: transparent; color: #fff; }
.timer-controls .btn:hover { background: rgba(255,255,255,.28); }
.timer-controls .btn-primary { background: var(--primary); }

/* ============================================================
   Desks / pods — separate desks instead of one shared table
   ============================================================ */
.table-el.as-desks {
  background: transparent; border-color: transparent; box-shadow: none;
}
.table-el.as-desks .t-seats { gap: 12px; }
.table-el.as-desks .t-label { color: #7c8798; }
/* each desk gets its own surface */
.table-el.as-desks .seat {
  border: 2px solid #cbb894; border-radius: 6px; border-style: solid;
  background: #fdfaf3; box-shadow: 0 2px 4px rgba(15,23,42,.10);
}
.table-el.as-desks .seat.empty { background: #fbfaf6; border-style: dashed; border-color: #d8cdb4; }
.table-el.as-desks.selected { border-color: var(--primary); border-style: dashed; }
.table-el.as-desks.conflict { border-color: var(--danger); border-style: dashed; }

/* Rotation: keep text readable, and give the handles room */
.seat .s-inner { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; }
.furn-el .f-inner { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.table-el .t-label span { display: inline-block; }

.rotate-handle {
  position: absolute; top: -26px; left: 50%; margin-left: -11px;
  width: 22px; height: 22px; border-radius: 50%; z-index: 6;
  background: var(--primary); color: #fff; border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; cursor: grab; box-shadow: 0 1px 4px rgba(15,23,42,.3);
}
.rotate-handle:active { cursor: grabbing; }

/* Preset picker in Add Tables / Desks */
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.preset-card {
  border: 1.5px solid var(--border); border-radius: 10px; padding: 10px; cursor: pointer;
  text-align: center; background: #fff;
}
.preset-card:hover { border-color: #c7d2fe; }
.preset-card.on { border-color: var(--primary); background: #eef2ff; }
.preset-card .p-name { font-weight: 700; font-size: 12.5px; margin-top: 6px; }
.preset-card .p-desc { font-size: 11px; color: var(--muted); }
.preset-art { display: flex; align-items: center; justify-content: center; height: 46px; }
.pa { display: inline-flex; flex-direction: column; gap: 3px; padding: 3px; border-radius: 4px; }
.pa .pa-row { display: flex; gap: 3px; }
.pa i { width: 13px; height: 10px; border-radius: 2px; background: #cbb894; display: block; }
.pa-table { background: #e6d9bd; gap: 2px; }
.pa-table .pa-row { gap: 2px; }
.pa-desks { gap: 5px; }
.pa-desks .pa-row { gap: 5px; }

/* ============================================================
   Orientation strip + tap-mode banners
   ============================================================ */
.orient-strip {
  padding: 5px 16px; font-size: 12px; font-weight: 600;
  background: #f1f5f9; color: var(--muted); border-bottom: 1px solid var(--border);
}
.orient-strip.teacher { background: #eef2ff; color: var(--primary); border-color: #c7d2fe; }
.mode-banner {
  padding: 7px 16px; font-size: 12.5px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.mode-banner.attend { background: #ecfdf5; color: #047857; border-bottom: 1px solid #a7f3d0; flex-wrap: wrap; }
.mode-banner .att-live {
  background: #fff; border: 1px solid #a7f3d0; border-radius: 999px;
  padding: 2px 10px; font-weight: 700; font-size: 12px; white-space: nowrap;
}
.mode-banner.attend .btn { background: #fff; border-color: #a7f3d0; }
.mode-banner.attend .btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.mode-banner.tally  { background: #eef2ff; color: var(--primary); border-bottom: 1px solid #c7d2fe; }
.mode-banner.score  { background: #fffbeb; color: #b45309; border-bottom: 1px solid #fde68a; }

/* ============================================================
   Attendance report
   ============================================================ */
/* Editing a day other than today */
.att-daybar {
  border-radius: 9px; padding: 8px 12px; margin-bottom: 10px;
  font-size: 12.5px; border: 1px solid var(--border); background: #f8fafc;
}
.att-daybar.past { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.att-daybar.todo { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.att-missing {
  border: 1px solid #fde68a; background: #fffbeb; border-radius: 9px;
  padding: 9px 12px; font-size: 12.5px; color: #b45309;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.att-missing .btn { background: #fff; }
.att-day[data-open-day] { cursor: pointer; }
.att-day[data-open-day]:hover { background: #eef2ff; color: var(--primary); }

.att-rep-head .sec-status { display: block; }
.att-rep-table th.att-day {
  text-align: center; padding: 4px 3px; min-width: 26px; line-height: 1.1; vertical-align: bottom;
}
.att-rep-table th.att-day span { display: block; font-size: 9px; opacity: .7; }
.att-rep-table th.att-day b { font-size: 11.5px; }
.att-rep-table th.att-day.na { opacity: .4; }
.att-rep-table .att-name-col {
  position: sticky; left: 0; background: var(--surface); z-index: 1;
  min-width: 130px; box-shadow: 1px 0 0 var(--border);
}
.att-rep-table tr:hover .att-name-col { background: #f8fafc; }
.att-cell {
  text-align: center; cursor: pointer; font-weight: 700; padding: 5px 3px; user-select: none;
}
.att-cell.pr { color: #16a34a; }
.att-cell.ab { color: #ef4444; background: #fef2f2; }
.att-cell.td { color: #b45309; background: #fffbeb; }
.att-cell.na { color: #cbd5e1; }
.att-cell:hover { outline: 2px solid var(--primary); outline-offset: -2px; }

/* ============================================================
   Print output
   ============================================================ */
#print-root { display: none; }
.print-doc { font-family: "Segoe UI", system-ui, sans-serif; color: #000; }
.print-title { font-size: 22px; margin: 0 0 2px; }
.print-sub { font-size: 12px; color: #444; margin: 0 0 14px; }
.print-note { font-size: 11px; color: #444; margin-top: 10px; font-style: italic; }
.print-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.print-table th, .print-table td { border: 1px solid #999; padding: 4px 6px; text-align: left; }
.print-table th { background: #eee; }
.print-blank { min-width: 150px; }
.print-box { text-align: center; font-size: 15px; }
.print-chart { position: relative; overflow: hidden; }
.print-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.print-group { border: 1px solid #999; border-radius: 8px; padding: 8px 12px; break-inside: avoid; }
.print-group h3 { margin: 0 0 4px; font-size: 13px; }
.print-group ol { margin: 0; padding-left: 20px; font-size: 12px; }
.page-break { break-after: page; page-break-after: always; height: 0; }

.tents { display: flex; flex-direction: column; gap: 0; }
.tent { border-bottom: 1px dashed #999; padding: 0; break-inside: avoid; }
.tent-half { height: 105px; display: flex; align-items: center; justify-content: center; }
.tent-half span { font-size: 34px; font-weight: 800; }
.tent-half.flip { transform: rotate(180deg); }
.tent-fold { border-top: 1px dotted #bbb; }

@media print {
  @page { margin: 12mm; }
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing { overflow: visible; height: auto; display: block; padding: 0; }
  body.printing #print-root { display: block; }
  .print-groups { grid-template-columns: 1fr 1fr; }
  .tent { page-break-inside: avoid; }
}

@media (max-width: 820px) {
  #class-picker .cp-label { display: none; }
  #class-picker select { min-width: 104px; font-size: 12px; }
  .att-grid { grid-template-columns: 1fr 1fr; }
  .group-grid { grid-template-columns: 1fr 1fr; }
  .timer-widget { bottom: 66px; padding: 10px 16px; }
  .timer-display { font-size: 44px; }
  .wheel-split { flex-direction: column; }
  .wheel-host { padding: 8px; flex: 0 0 auto; }
  /* leave room either side so the pointer isn't clipped */
  .wheel-round { width: min(87vw, 44vh); }
  /* keep toolbar controls at their natural width and let the strip scroll */
  .toolbar > * { flex: 0 0 auto; }
  .toolbar select.input { min-width: 120px; }
  .wheel-heading { font-size: 16px; }
  .wheel-names { width: 100%; max-height: 38vh; border-left: none; border-top: 1px solid var(--border); }
  .cust-grid { grid-template-columns: 1fr; gap: 4px; }
  .wheel-fs-bar { opacity: .92; top: 8px; right: 8px; }
}
