/* ── Design tokens ── */
:root {
  --bg:         #0d1117;
  --surface:    #161b22;
  --surface2:   #1c2330;
  --border:     #30363d;
  --accent:     #39d353;       /* green — CW/radio feel */
  --accent-dim: #1a4a26;
  --amber:      #f0a500;
  --amber-dim:  #3a2800;
  --red:        #e05252;
  --red-dim:    #3a1010;
  --text:       #e6edf3;
  --text-muted: #7d8590;
  --mono:       'Share Tech Mono', monospace;
  --head:       'Barlow Condensed', sans-serif;
  --body:       'Barlow', sans-serif;
  --radius:     4px;
  --cell-w:     140px;
  --cell-h:     58px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  min-height: 100vh;
}

/* ── Header ── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.site-header .logo {
  font-family: var(--mono);
  font-size: 1.4rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.site-header .logo span { color: var(--amber); }

.event-info {
  flex: 1;
}

.event-info h1 {
  font-family: var(--head);
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.event-info .meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--mono);
  margin-top: 2px;
}

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.75rem;
  font-family: var(--mono);
}

.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch {
  width: 12px; height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Main layout ── */
main {
  padding: 20px 16px 60px;
  max-width: 100%;
  overflow-x: auto;
}

.grid-wrapper {
  min-width: max-content;
}

/* ── Grid table ── */
.schedule-grid {
  border-collapse: collapse;
  width: 100%;
}

.schedule-grid th,
.schedule-grid td {
  border: 1px solid var(--border);
}

/* Corner + time column header */
.schedule-grid .th-corner {
  background: var(--bg);
  width: 72px;
  min-width: 72px;
  position: sticky;
  left: 0;
  z-index: 3;
}

/* Station header cells */
.schedule-grid .th-station {
  background: var(--surface2);
  padding: 10px 12px;
  text-align: center;
  min-width: var(--cell-w);
  position: sticky;
  top: 0;
  z-index: 2;
}

.th-station .st-name {
  font-family: var(--head);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  display: block;
}

.th-station .st-meta {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--amber);
  margin-top: 2px;
}

/* Time label column */
.schedule-grid .td-time {
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
  padding: 4px 10px 4px 6px;
  white-space: nowrap;
  height: var(--cell-h);
  min-width: 88px;
  width: 88px;
  vertical-align: middle;
  position: sticky;
  left: 0;
  z-index: 1;
  border-right: 2px solid var(--border);
}

/* Signup cells */
.cell {
  height: var(--cell-h);
  min-width: var(--cell-w);
  padding: 6px 8px;
  vertical-align: middle;
  cursor: pointer;
  transition: background 0.12s, transform 0.08s;
  position: relative;
  background: var(--surface);
}

.cell:hover { background: var(--surface2); }

.cell.open {
  background: var(--surface);
}

.cell.open:hover {
  background: var(--accent-dim);
  outline: 1px dashed var(--accent);
  outline-offset: -2px;
}

.cell.taken {
  background: var(--accent-dim);
  cursor: default;
}

.cell.taken:hover { background: var(--accent-dim); }

.cell-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: 100%;
  justify-content: center;
}

.cell-callsign {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: bold;
  color: var(--accent);
  letter-spacing: 0.1em;
}

.cell-name {
  font-size: 0.72rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-open-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--border);
  text-align: center;
}

.cell.open:hover .cell-open-label {
  color: var(--accent);
}

/* Day boundary row — thick top border to visually separate days */
.schedule-grid tr.day-boundary .td-time,
.schedule-grid tr.day-boundary .cell {
  border-top: 2px solid var(--amber);
}

/* Date portion in the time column (e.g. "Sat 6/27") */
.td-time .td-date {
  display: block;
  font-size: 0.65rem;
  color: var(--amber);
  letter-spacing: 0.04em;
  margin-bottom: 1px;
}

/* Loading skeleton shimmer */
.cell.loading {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  pointer-events: none;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
  max-width: 420px;
  padding: 28px;
  position: relative;
  animation: modal-in 0.18s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.modal-close {
  position: absolute;
  top: 14px; right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: background 0.1s;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }

.modal h2 {
  font-family: var(--head);
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.modal .slot-info {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--amber);
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 0.75rem;
  font-family: var(--mono);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
}

input[type="text"],
input[type="email"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--body);
  font-size: 0.95rem;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.12s;
}

input[type="text"]:focus,
input[type="email"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

input.callsign-input {
  font-family: var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 1rem;
}

.form-error {
  font-size: 0.75rem;
  color: var(--red);
  margin-top: 5px;
  display: none;
}
.form-error.visible { display: block; }

.btn-submit {
  width: 100%;
  background: var(--accent);
  color: #0d1117;
  border: none;
  border-radius: var(--radius);
  font-family: var(--head);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 11px;
  cursor: pointer;
  margin-top: 8px;
  transition: filter 0.12s, transform 0.08s;
}

.btn-submit:hover { filter: brightness(1.1); }
.btn-submit:active { transform: scale(0.98); }
.btn-submit:disabled { filter: brightness(0.5); cursor: not-allowed; }

/* Taken-slot view inside modal */
.taken-card {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.taken-card .tc-callsign {
  font-family: var(--mono);
  font-size: 1.4rem;
  color: var(--accent);
  letter-spacing: 0.12em;
}

.taken-card .tc-name {
  font-size: 0.95rem;
  margin-top: 4px;
}

.taken-card .tc-email {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--mono);
  margin-top: 2px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 22px;
  font-size: 0.85rem;
  font-family: var(--mono);
  z-index: 200;
  transition: transform 0.25s ease, opacity 0.25s;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { border-color: var(--accent); color: var(--accent); }
.toast.error   { border-color: var(--red);   color: var(--red); }

/* Responsive tweaks */
@media (max-width: 600px) {
  :root { --cell-w: 110px; --cell-h: 54px; }
  .site-header { padding: 12px 14px; }
  .event-info h1 { font-size: 1.2rem; }
  main { padding: 12px 8px 60px; }
}