/* ================================================
   CARLINE.CSS — Belltower Carline
   Shared by carline.html (display) and carline-input.html (mobile input)
================================================ */

/* ---------- Variables ---------- */
:root {
  --cl-bg:              #f0f4f8;
  --cl-surface:         #ffffff;
  --cl-border:          #e2e8f0;
  --cl-text:            #0f172a;
  --cl-text-sub:        #475569;
  --cl-text-muted:      #94a3b8;
  --cl-primary:         #2563eb;
  --cl-primary-dark:    #1d4ed8;

  --cl-waiting-bg:      #f8fafc;
  --cl-waiting-border:  #cbd5e1;
  --cl-waiting-text:    #475569;
  --cl-waiting-hdr:     #0b2d4f;

  --cl-card-name-size:  20px;

  --cl-called-bg:       #d1fae5;
  --cl-called-border:   #6ee7b7;
  --cl-called-text:     #065f46;
  --cl-called-hdr:      #059669;

  --cl-recalled-bg:     #fef3c7;
  --cl-recalled-border: #fcd34d;
  --cl-recalled-text:   #92400e;
  --cl-recalled-hdr:    #b45309;

  --cl-header-bg:       linear-gradient(135deg, #0b2d4f 0%, #1a3a5c 55%, #0e3660 100%);
  --cl-header-h:        76px;
  --cl-bar-h:           56px;
  --cl-bus-bar-h:       0px;
  --cl-radius:          10px;
  --cl-font: Inter, ui-sans-serif, system-ui, -apple-system,
             Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif;
}

/* Font-size scale (toggled via data-fontsize on <html>) */
[data-fontsize="sm"] { --cl-card-name-size: 15px; }
[data-fontsize="md"] { --cl-card-name-size: 20px; }
[data-fontsize="lg"] { --cl-card-name-size: 27px; }

[data-theme="dark"] {
  --cl-bg:              #0f172a;
  --cl-surface:         #1e293b;
  --cl-border:          #334155;
  --cl-text:            #f1f5f9;
  --cl-text-sub:        #cbd5e1;
  --cl-text-muted:      #64748b;

  --cl-waiting-bg:      #1e293b;
  --cl-waiting-border:  #334155;
  --cl-waiting-text:    #94a3b8;
  --cl-waiting-hdr:     #475569;

  --cl-called-bg:       #064e3b;
  --cl-called-border:   #059669;
  --cl-called-text:     #6ee7b7;
  --cl-called-hdr:      #047857;

  --cl-recalled-bg:     #451a03;
  --cl-recalled-border: #b45309;
  --cl-recalled-text:   #fde68a;
  --cl-recalled-hdr:    #92400e;

  --cl-header-bg:       linear-gradient(135deg, #0b1929 0%, #0f2236 55%, #091d32 100%);
}

/* ---------- Reset ---------- */
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--cl-font);
  background: var(--cl-bg);
  color: var(--cl-text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Loading ---------- */
.cl-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 12px;
  font-size: 15px;
  color: var(--cl-text-muted);
}
.cl-spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--cl-border);
  border-top-color: var(--cl-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- App shell (display) ---------- */
#clApp {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ---------- Header ---------- */
#clHeader {
  background: var(--cl-header-bg);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 10px;
  height: var(--cl-header-h);
  flex-shrink: 0;
  z-index: 20;
}

.cl-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 0;
}
.cl-school-name {
  font-weight: 700;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cl-event-date {
  font-size: 12px;
  opacity: 0.6;
  white-space: nowrap;
}
.cl-status-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
  flex-shrink: 0;
}
.cl-status-badge.open   { background: #16a34a; }
.cl-status-badge.closed { background: #64748b; }

.cl-header-spacer { flex: 1; }

.cl-campus-label {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 6px;
  padding: 3px 9px;
  white-space: nowrap;
  flex-shrink: 0;
}

.cl-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.cl-icon-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 9px;
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  cursor: pointer;
  color: #fff;
  transition: background 120ms;
}
.cl-icon-btn:hover { background: rgba(255,255,255,0.22); }
.cl-signout-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 9px;
  height: 48px;
  padding: 0 16px;
  font-size: 14px;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  transition: background 120ms;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cl-signout-btn:hover { background: rgba(255,255,255,0.22); }
.cl-signout-btn svg { flex-shrink: 0; }

.cl-dismiss-btn {
  height: 48px;
  padding: 0 16px;
  border: none;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
}
.cl-dismiss-btn.start { background: #16a34a; color: #fff; }
.cl-dismiss-btn.start:hover { background: #15803d; }
.cl-dismiss-btn.close { background: #dc2626; color: #fff; }
.cl-dismiss-btn.close:hover { background: #b91c1c; }
.cl-dismiss-btn[hidden] { display: none !important; }

.cl-input-link-btn {
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 9px;
  height: 48px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 120ms;
}
.cl-input-link-btn:hover { background: rgba(255,255,255,0.22); }

/* ---------- Class bar (display page) ---------- */
#classBar {
  background: var(--cl-surface);
  border-bottom: 1px solid var(--cl-border);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 8px;
  height: var(--cl-bar-h);
  flex-shrink: 0;
  overflow-x: auto;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.cl-bar-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cl-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.cl-class-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(37,99,235,0.1);
  color: var(--cl-primary);
  border: 1px solid rgba(37,99,235,0.2);
  border-radius: 99px;
  padding: 7px 12px 7px 16px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.cl-pill-remove {
  background: rgba(37,99,235,0.15);
  border: none;
  border-radius: 50%;
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 12px;
  color: var(--cl-primary);
  line-height: 1;
  padding: 0;
}
.cl-pill-remove:hover { background: rgba(37,99,235,0.3); }
.cl-add-class-wrap { position: relative; flex-shrink: 0; }
.cl-add-class-btn {
  background: transparent;
  border: 1.5px dashed var(--cl-border);
  border-radius: 99px;
  padding: 7px 16px;
  font-size: 14px;
  color: var(--cl-text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 120ms, color 120ms;
}
.cl-add-class-btn:hover { border-color: var(--cl-primary); color: var(--cl-primary); }
.cl-class-dropdown {
  position: fixed;
  background: var(--cl-surface);
  border: 1px solid var(--cl-border);
  border-radius: var(--cl-radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  z-index: 200;
  min-width: 240px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
}
.cl-class-dropdown[hidden] { display: none; }
.cl-dropdown-item {
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--cl-text);
}
.cl-dropdown-item:hover { background: var(--cl-bg); }
.cl-dropdown-item .item-count { font-size: 13px; color: var(--cl-text-muted); }
.cl-bar-spacer { flex: 1; }

/* ---------- Bus arrival bar (display page) ---------- */
#busArrivalBar {
  background: #f0fdf4;
  border-bottom: 1px solid #bbf7d0;
  display: flex;
  align-items: center;
  padding: 6px 12px;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
[data-theme="dark"] #busArrivalBar {
  background: #052e16;
  border-bottom-color: #14532d;
}
.cl-bus-arrival-pill {
  display: inline-flex;
  align-items: center;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
[data-theme="dark"] .cl-bus-arrival-pill {
  background: #14532d;
  color: #86efac;
  border-color: #166534;
}

/* ---------- 3-Column display grid ---------- */
#displayGrid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 14px;
  min-height: 0;
  overflow: hidden;
}

.cl-status-col {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--cl-border);
  min-height: 0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.09);
}

.cl-status-col-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.cl-status-col-hdr::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 92% -25%, rgba(255,255,255,0.18), transparent 55%),
    radial-gradient(ellipse at 8% 130%,  rgba(0,0,0,0.18),       transparent 50%);
  pointer-events: none;
}
.cl-status-col-hdr.waiting {
  background: linear-gradient(135deg, #0b2d4f 0%, #1a3a5c 100%);
  color: #fff;
}
.cl-status-col-hdr.called {
  background: linear-gradient(135deg, #047857 0%, #059669 100%);
  color: #fff;
}
.cl-status-col-hdr.recalled {
  background: linear-gradient(135deg, #92400e 0%, #b45309 100%);
  color: #fff;
}

.cl-col-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.88;
  position: relative;
  z-index: 1;
}
.cl-col-badge {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 10px;
  padding: 5px 16px;
  min-width: 58px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.cl-status-col-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  background: var(--cl-bg);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Empty state within column */
.cl-col-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--cl-text-muted);
  font-size: 13px;
  padding: 20px;
  text-align: center;
}

/* Class group divider (multi-class view) */
.cl-class-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--cl-text-muted);
  padding: 6px 4px 2px;
  border-top: 1px solid var(--cl-border);
  margin-top: 4px;
}
.cl-class-group-label:first-child { border-top: none; margin-top: 0; }

/* ---------- Student cards (display) ---------- */
.cl-student-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  box-shadow: 0 2px 6px rgba(0,0,0,0.07);
  transition: background 220ms, border-color 220ms, color 220ms, box-shadow 220ms;
  cursor: default;
  user-select: none;
}
.cl-student-card.waiting {
  background: var(--cl-surface);
  border: 1px solid var(--cl-waiting-border);
  border-left: 4px solid var(--cl-waiting-hdr);
  color: var(--cl-waiting-text);
}
.cl-student-card.called {
  background: var(--cl-surface);
  border: 1px solid var(--cl-called-border);
  border-left: 4px solid var(--cl-called-hdr);
  color: var(--cl-called-text);
}
.cl-student-card.recalled {
  background: var(--cl-surface);
  border: 1px solid var(--cl-recalled-border);
  border-left: 4px solid var(--cl-recalled-hdr);
  color: var(--cl-recalled-text);
}
.cl-student-card.loaded {
  opacity: 0.3;
  text-decoration: line-through;
  background: var(--cl-waiting-bg);
  border-color: transparent;
  color: var(--cl-text-muted);
}

.cl-card-icon { flex-shrink: 0; width: 20px; display: flex; align-items: center; justify-content: center; }

.cl-card-body {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.cl-card-name {
  font-size: var(--cl-card-name-size, 20px);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.cl-card-grade {
  font-size: 0.65em;
  font-weight: 400;
  opacity: 0.55;
}
.cl-card-meta {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.cl-card-tag {
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: 3px 10px;
  border-radius: 8px;
  background: rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.08);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.cl-card-time-pill {
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(0,0,0,0.12);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

/* --- Flash animations --- */
@keyframes callFlash {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,0.8); }
  40%  { box-shadow: 0 0 0 12px rgba(16,185,129,0.1); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
@keyframes recallFlash {
  0%   { box-shadow: 0 0 0 0 rgba(245,158,11,0.8); }
  40%  { box-shadow: 0 0 0 12px rgba(245,158,11,0.1); }
  100% { box-shadow: 0 0 0 0 rgba(245,158,11,0); }
}
.cl-student-card.new-call   { animation: callFlash   0.7s ease-out; }
.cl-student-card.new-recall { animation: recallFlash 0.7s ease-out; }

/* ---------- Waiting column progress bar ---------- */
.cl-col-progress {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 4px;
  background: rgba(0,0,0,0.18);
  overflow: hidden;
}
.cl-col-progress-fill {
  height: 100%;
  background: rgba(255,255,255,0.72);
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
  border-radius: 0 99px 99px 0;
  width: 0%;
}

/* ---------- Column body — status tinting ---------- */
.cl-status-col[data-tab="called"]   .cl-status-col-body { background: #ecfdf5; }
.cl-status-col[data-tab="recalled"] .cl-status-col-body { background: #fffbeb; }
[data-theme="dark"] .cl-status-col[data-tab="called"]   .cl-status-col-body { background: #042f1e; }
[data-theme="dark"] .cl-status-col[data-tab="recalled"] .cl-status-col-body { background: #1c1100; }

/* ---------- All-done celebration ---------- */
.cl-col-celebration {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 20px;
  margin: 10px 8px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  text-align: center;
  color: #15803d;
}
.cl-col-celebration-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #dcfce7;
  display: flex; align-items: center; justify-content: center;
  color: #16a34a;
}
.cl-col-celebration-title { font-size: 15px; font-weight: 800; }
.cl-col-celebration-sub   { font-size: 12px; opacity: 0.7; }
[data-theme="dark"] .cl-col-celebration {
  background: #052e16; border-color: #166534; color: #86efac;
}
[data-theme="dark"] .cl-col-celebration-icon {
  background: #14532d; color: #4ade80;
}

/* ---------- Class pill — teacher initials avatar ---------- */
.cl-pill-avatar {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  border: 1px solid rgba(255,255,255,0.3);
  font-size: 8px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  letter-spacing: 0;
}

/* Clock in header */
.cl-clock {
  font-size: 20px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  padding: 0 8px;
}

/* Font-size toggle button active state */
.cl-icon-btn.active,
.cl-icon-btn.cl-fontsize-btn {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

/* Log panel */
.cl-log-panel {
  position: fixed;
  right: 0;
  top: calc(var(--cl-header-h) + var(--cl-bar-h) + var(--cl-bus-bar-h));
  bottom: 0;
  width: 270px;
  background: var(--cl-surface);
  border-left: 1px solid var(--cl-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transform: translateX(100%);
  transition: transform 260ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -6px 0 24px rgba(0,0,0,0.1);
}
.cl-log-panel.open { transform: translateX(0); }

#clApp.log-open #displayGrid { padding-right: 280px; }

.cl-log-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--cl-border);
  flex-shrink: 0;
}
.cl-log-hdr-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cl-text-muted);
}
.cl-log-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--cl-text-muted);
  font-size: 15px;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: background 120ms;
}
.cl-log-close:hover { background: var(--cl-bg); color: var(--cl-text); }

.cl-log-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.cl-log-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--cl-text-muted);
  font-size: 13px;
}
.cl-log-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--cl-border);
  border-left: 3px solid transparent;
}
.cl-log-item:last-child { border-bottom: none; }
.cl-log-item.called   { border-left-color: #16a34a; }
.cl-log-item.recalled { border-left-color: #d97706; }
.cl-log-item-icon { flex-shrink: 0; display: flex; align-items: center; }
.cl-log-item-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--cl-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cl-log-item-time {
  font-size: 11px;
  color: var(--cl-text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

/* No-class empty state */
#displayNoClass {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--cl-text-muted);
  font-size: 15px;
  text-align: center;
  padding: 40px;
  display: none;
}
#displayNoClass strong { color: var(--cl-text-sub); }

/* ================================================
   INPUT PAGE (carline-input.html)
================================================ */

/* App shell for input page */
#inputApp {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* Input page header — two-row layout */
#inputHeader {
  background: var(--cl-header-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 6px 14px 8px;
  flex-shrink: 0;
}

.inp-header-top {
  text-align: center;
  padding-bottom: 4px;
}

.inp-header-top .cl-school-name {
  font-size: 13px;
  font-weight: 700;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inp-header-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.inp-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.inp-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

#campusSelector {
  font-size: 13px;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.15);
  color: #fff;
  cursor: pointer;
  flex-shrink: 1;
  min-width: 80px;
  max-width: 160px;
}
#campusSelector option {
  background: #fff;
  color: #1e293b;
}

/* Input page main area */
#inputMain {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}

/* Tag section */
.inp-tag-section {
  background: var(--cl-surface);
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-bottom: 1px solid var(--cl-border);
}

.inp-tag-display {
  background: #0b2d4f;
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  text-align: center;
  font-size: 48px;
  font-weight: 800;
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,0.18);
  padding: 10px 16px;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 180ms, color 180ms, box-shadow 180ms;
  line-height: 1;
  position: relative;
  overflow: hidden;
}
.inp-tag-display::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 115%, rgba(37,99,235,0.22), transparent 65%);
  pointer-events: none;
}
.inp-tag-display::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.2);
  opacity: 0;
  transition: opacity 200ms;
  pointer-events: none;
}
.inp-tag-display.has-value {
  border-color: rgba(37,99,235,0.55);
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(37,99,235,0.15);
}
.inp-tag-display.has-value::after {
  opacity: 1;
  animation: inp-dot-pulse 1.5s ease-in-out infinite;
}
@keyframes inp-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(245,158,11,0.22); }
  50%       { box-shadow: 0 0 0 6px rgba(245,158,11,0.06); }
}
[data-theme="dark"] .inp-tag-display {
  background: #060f1c;
  border-color: rgba(255,255,255,0.05);
}

.inp-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.inp-key {
  aspect-ratio: 1.6;
  border: 1px solid var(--cl-border);
  border-radius: 12px;
  background: linear-gradient(to bottom, #ffffff, #f1f5f9);
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  color: var(--cl-text);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: background 60ms, transform 60ms, box-shadow 60ms;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 0 0 #d1d5db, 0 1px 4px rgba(0,0,0,0.07);
}
.inp-key:active {
  transform: translateY(1px) scale(0.95);
  background: var(--cl-bg);
  box-shadow: none;
}
.inp-key.backspace {
  color: #dc2626;
  font-size: 20px;
  background: linear-gradient(to bottom, #fff5f5, #fee2e2);
  border-color: #fca5a5;
  box-shadow: 0 2px 0 0 #fca5a5, 0 1px 4px rgba(220,38,38,0.08);
}
[data-theme="dark"] .inp-key {
  background: linear-gradient(to bottom, #334155, #1e293b);
  box-shadow: 0 2px 0 0 #0f172a, 0 1px 4px rgba(0,0,0,0.3);
}
[data-theme="dark"] .inp-key:active {
  background: #0f172a;
  box-shadow: none;
}
[data-theme="dark"] .inp-key.backspace {
  background: linear-gradient(to bottom, #3f1212, #2d0f0f);
  border-color: #7f1d1d;
  box-shadow: 0 2px 0 0 #7f1d1d, 0 1px 4px rgba(0,0,0,0.3);
}

.inp-call-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.inp-call-btn {
  padding: 16px 12px;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: background 120ms, transform 60ms, box-shadow 120ms, opacity 120ms;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.03em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.inp-call-btn svg { flex-shrink: 0; }
.inp-call-btn:active { transform: scale(0.96); box-shadow: none !important; }
.inp-call-btn.call {
  background: linear-gradient(160deg, #059669 0%, #047857 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(5,150,105,0.35);
}
.inp-call-btn.call:hover { background: linear-gradient(160deg, #047857 0%, #065f46 100%); }
.inp-call-btn.recall {
  background: linear-gradient(160deg, #d97706 0%, #b45309 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(217,119,6,0.35);
}
.inp-call-btn.recall:hover { background: linear-gradient(160deg, #b45309 0%, #92400e 100%); }
.inp-call-btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

.inp-undo-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.inp-undo-btn {
  padding: 10px;
  border: 1px solid var(--cl-border);
  border-radius: 10px;
  background: var(--cl-surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--cl-text-sub);
  cursor: pointer;
  transition: background 120ms;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.inp-undo-btn:hover { background: var(--cl-bg); }
.inp-undo-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Bus groups section */
.inp-section {
  padding: 14px;
  border-top: 1px solid var(--cl-border);
}
.inp-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--cl-text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.inp-section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--cl-border);
}

.inp-bus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}
.inp-bus-btn {
  position: relative;
  padding: 10px 8px;
  border: 1.5px solid var(--cl-border);
  border-radius: 10px;
  background: var(--cl-surface);
  cursor: pointer;
  text-align: center;
  color: var(--cl-text);
  transition: background 120ms, border-color 120ms, color 120ms, box-shadow 120ms;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.inp-bus-btn:active { transform: scale(0.95); }
.inp-bus-btn-name { font-size: 13px; font-weight: 700; line-height: 1.3; display: flex; align-items: center; justify-content: center; gap: 4px; }
.inp-bus-btn-meta { font-size: 11px; color: var(--cl-text-muted); margin-top: 2px; }
.inp-bus-btn.called {
  background: var(--cl-called-bg);
  border-color: var(--cl-called-border);
  color: var(--cl-called-text);
  box-shadow: inset 0 2px 4px rgba(5,150,105,0.12);
}
.inp-bus-btn.called .inp-bus-btn-meta { color: var(--cl-called-text); opacity: 0.7; }
.inp-bus-btn.called::after {
  content: "✓";
  position: absolute;
  top: 4px;
  right: 7px;
  font-size: 10px;
  font-weight: 900;
  color: var(--cl-called-text);
  opacity: 0.75;
  line-height: 1;
}

/* Danger buttons */
.inp-danger-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.inp-danger-btn {
  padding: 9px 14px;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  background: #fff1f2;
  color: #dc2626;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 120ms;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
[data-theme="dark"] .inp-danger-btn {
  background: #3f1212;
  border-color: #7f1d1d;
  color: #fca5a5;
}
.inp-danger-btn:hover { background: #fee2e2; }
[data-theme="dark"] .inp-danger-btn:hover { background: #4c1515; }

/* Recent activity */
.inp-recent-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.inp-recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--cl-surface);
  border-radius: 8px;
  border: 1px solid var(--cl-border);
  border-left: 3px solid var(--cl-primary);
  font-size: 13px;
}
.inp-recent-item.recalled { border-left-color: var(--cl-recalled-hdr); }
.inp-recent-tag {
  font-weight: 800;
  font-size: 12px;
  color: var(--cl-primary);
  background: rgba(37,99,235,0.08);
  border-radius: 6px;
  padding: 2px 7px;
  min-width: 36px;
  text-align: center;
  white-space: nowrap;
}
.inp-recent-names { flex: 1; color: var(--cl-text-sub); font-size: 12px; }
.inp-recent-type {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(5,150,105,0.1);
  color: var(--cl-called-hdr);
  white-space: nowrap;
}
.inp-recent-time { font-size: 11px; color: var(--cl-text-muted); white-space: nowrap; }
.inp-recent-item.recalled .inp-recent-tag {
  color: var(--cl-recalled-hdr);
  background: rgba(180,83,9,0.1);
}
.inp-recent-item.recalled .inp-recent-names { color: var(--cl-text-sub); }
.inp-recent-item.recalled .inp-recent-type {
  background: rgba(217,119,6,0.1);
  color: var(--cl-recalled-hdr);
}

/* No event state */
.cl-no-event {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px;
  text-align: center;
  color: var(--cl-text-muted);
}
.cl-no-event h2 { color: var(--cl-text-sub); font-size: 18px; }
.cl-no-event p { font-size: 14px; max-width: 300px; }
.cl-start-btn {
  padding: 13px 28px;
  background: #059669;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 120ms;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.cl-start-btn:hover { background: #047857; }

/* ---------- Toast ---------- */
.cl-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: #1e293b;
  color: #f1f5f9;
  padding: 10px 22px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms, transform 200ms;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  max-width: 90vw;
  text-align: center;
}
[data-theme="dark"] .cl-toast { background: #f1f5f9; color: #0f172a; }
.cl-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ================================================
   ALL CALL BANNER
================================================ */
.cl-all-call-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: #f59e0b;
  color: #1c1917;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  animation: allcall-pulse 1.2s ease-in-out 4;
}

.cl-all-call-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.cl-all-call-text {
  flex: 1;
}

.cl-all-call-dismiss {
  background: rgba(0, 0, 0, 0.15);
  border: none;
  border-radius: 6px;
  color: inherit;
  font-size: 18px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}
.cl-all-call-dismiss:hover { background: rgba(0, 0, 0, 0.25); }

@keyframes allcall-pulse {
  0%, 100% { background: #f59e0b; }
  50%       { background: #dc8a09; }
}

/* Input page All Call button */
.inp-allcall-row {
  padding: 10px 16px 0;
}

.inp-allcall-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(160deg, #f59e0b 0%, #d97706 100%);
  color: #1c1917;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 12px rgba(245,158,11,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.inp-allcall-btn:hover  { background: linear-gradient(160deg, #d97706 0%, #b45309 100%); }
.inp-allcall-btn:active { transform: scale(0.98); box-shadow: none; }

/* ================================================
   DISPLAY PAGE — MOBILE TAB BAR
================================================ */
#displayTabBar {
  display: none; /* shown only by mobile media query below */
  background: var(--cl-surface);
  border-bottom: 1px solid var(--cl-border);
  flex-shrink: 0;
}
.cl-tab-btn {
  flex: 1;
  padding: 8px 4px 10px;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cl-text-muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: color 120ms, border-color 120ms;
  -webkit-tap-highlight-color: transparent;
}
.cl-tab-count {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.cl-tab-btn.waiting.active { color: var(--cl-waiting-hdr); border-bottom-color: var(--cl-waiting-hdr); }
.cl-tab-btn.called.active  { color: var(--cl-called-hdr);  border-bottom-color: var(--cl-called-hdr); }
.cl-tab-btn.recalled.active{ color: var(--cl-recalled-hdr);border-bottom-color: var(--cl-recalled-hdr);}

/* ================================================
   DISPLAY PAGE — MOBILE LAYOUT (≤ 767px)
================================================ */
@media (max-width: 767px) {
  /* Fix display header flex so school name shrinks instead of pushing buttons off */
  #clHeader .cl-header-left   { flex: 1; min-width: 0; overflow: hidden; }
  #clHeader .cl-header-spacer { display: none; }
  #clHeader .cl-header-right  { flex-shrink: 0; }

  /* Hide non-essential header items */
  .cl-event-date    { display: none; }
  #btnFullscreen    { display: none; }
  #clHeader #btnDarkMode { display: none; }

  /* Button labels hidden on mobile — leave icons only */
  .cl-btn-label { display: none; }

  /* Input Page link: show as icon-only (📱) */
  .cl-input-link-btn { padding: 0; width: 36px; justify-content: center; }

  /* Show tab bar (when not [hidden]) */
  #displayTabBar { display: flex; }

  /* Grid becomes single-column tab panel */
  #displayGrid {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
  }
  .cl-status-col {
    display: none;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    border-bottom: none;
  }
  #displayGrid[data-active-tab="waiting"]  .cl-status-col[data-tab="waiting"],
  #displayGrid[data-active-tab="called"]   .cl-status-col[data-tab="called"],
  #displayGrid[data-active-tab="recalled"] .cl-status-col[data-tab="recalled"] {
    display: flex;
  }

  /* Hide the column header (tab bar replaces it) */
  .cl-status-col-hdr { display: none; }

  /* Column body fills remaining screen */
  .cl-status-col-body { flex: 1; padding: 10px; }

  /* Larger cards on mobile */
  .cl-card-name { font-size: 17px; }
  .cl-card-tag  { font-size: 13px; }
  .cl-student-card { padding: 12px 14px; }
}

/* ================================================
   INPUT PAGE — DESKTOP RESPONSIVE
   On larger screens, center the app as a card
================================================ */
@media (min-width: 600px) {
  body:has(#inputApp) {
    background: var(--cl-border);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 100vh;
    padding: 24px 16px;
  }
  #inputApp {
    width: 100%;
    max-width: 480px;
    height: auto;
    min-height: 0;
    overflow: visible;
    border-radius: 14px;
    box-shadow: 0 4px 32px rgba(0,0,0,0.15);
    border: 1px solid var(--cl-border);
  }
  #inputMain {
    overflow-y: visible;
    height: auto;
  }
  #inputHeader {
    border-radius: 14px 14px 0 0;
  }
  .inp-tag-display {
    font-size: 36px;
    min-height: 66px;
    padding: 8px 14px;
  }
  .inp-key {
    font-size: 20px;
    aspect-ratio: 1.8;
  }
  .inp-call-btn {
    font-size: 15px;
    padding: 12px;
  }
  .inp-undo-btn {
    padding: 8px 10px;
    font-size: 12px;
  }
}
