﻿:root {
  color-scheme: light;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: #f6f7fb;
  color: #1c1c1c;
}

body {
  margin: 0;
  background: #f6f7fb;
}

body.overlay-open {
  overflow: hidden;
}

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
}

.settings-page main.container {
  width: 100%;
  max-width: none;
  padding-left: 2rem;
  padding-right: 2rem;
}

.site-header {
  background: #0b2d4f;
  color: #fff;
  padding: 1rem 0;
}

.site-header .brand {
  margin: 0;
  font-size: 1.4rem;
}

.site-header nav a {
  color: #cfe6ff;
  margin-left: 1rem;
  text-decoration: none;
}

.deadline-info {
  margin-top: 0.6rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
  color: #cfe6ff;
  font-size: 0.95rem;
}

.deadline-info .deadline-label {
  font-weight: 700;
}

.deadline-info .deadline-time {
  font-weight: 600;
}

.deadline-info .deadline-countdown {
  background: rgba(255, 255, 255, 0.15);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
}

main {
  padding: 2rem 0 4rem;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  margin-bottom: 1.5rem;
}

.form {
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.5rem;
  font-weight: 600;
}

input, select, textarea {
  padding: 0.6rem 0.7rem;
  border: 1px solid #d3d7e0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}

textarea {
  resize: vertical;
  min-height: 5.5rem;
}

.button {
  background: #0b2d4f;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1.2rem;
  text-decoration: none;
  cursor: pointer;
  display: inline-block;
}

.button.secondary {
  background: #e4ecf7;
  color: #0b2d4f;
}

.button.danger {
  background: #b42318;
  color: #fff;
}

.button.secondary.active {
  background: #cfe0f5;
  border: 1px solid #0b2d4f;
}

.inline-form {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.bulk-wide > .inline-form {
  position: relative;
  z-index: 1;
}

#bulkForm fieldset > :not(.bulk-table-scroll) {
  position: relative;
  z-index: 1;
}

.inline-field {
  display: grid;
  gap: 0.3rem;
  font-weight: 600;
}

.registrar-block {
  display: grid;
  gap: 0.6rem;
  padding: 0.9rem;
  border: 1px solid #e6e8ee;
  border-radius: 12px;
  background: #f9fbff;
}

.registrar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.checkbox-inline input {
  margin: 0;
}

.registrar-hint {
  margin: 0;
  font-size: 0.9rem;
}

.registrar-hint.is-error {
  color: #b42318;
  font-weight: 700;
}

.bulk-wide {
  width: 100vw;
  max-width: none;
  margin-left: calc(50% - 50vw);
  background: #fff;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.station-header {
  display: grid;
  gap: 0.2rem;
  align-items: start;
}

.select-all {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #4a5c74;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab-button {
  border: 1px solid #c8d4e4;
  background: #f2f5fa;
  color: #0b2d4f;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.tab-button.active {
  background: #0b2d4f;
  color: #fff;
  border-color: #0b2d4f;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.stations {
  display: grid;
  gap: 0.5rem;
  border: 1px solid #d9dee8;
  padding: 1rem;
  border-radius: 10px;
}

.station-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 500;
}

.station-tooltip-trigger {
  position: relative;
  display: inline-block;
  cursor: help;
  text-decoration: underline dotted #7f8da3;
  text-underline-offset: 0.15rem;
}

.station-tooltip-trigger:focus {
  outline: 2px solid #7aa8d8;
  outline-offset: 2px;
}

.station-tooltip-popup {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.45rem);
  transform: translateX(-50%);
  z-index: 50;
  display: none;
  width: min(28rem, 70vw);
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: #10243b;
  color: #f8fbff;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.45;
  white-space: pre-line;
  max-height: 11rem;
  overflow-y: auto;
}

.station-tooltip-popup::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  border-width: 0.45rem 0.4rem 0;
  border-style: solid;
  border-color: #10243b transparent transparent;
}

.bulk-table-scroll .station-tooltip-popup {
  top: calc(100% + 0.45rem);
  bottom: auto;
}

.bulk-table-scroll .station-tooltip-popup::before {
  top: auto;
  bottom: 100%;
  border-width: 0 0.4rem 0.45rem;
  border-color: transparent transparent #10243b;
}

.station-tooltip-trigger:hover .station-tooltip-popup,
.station-tooltip-trigger:focus-within .station-tooltip-popup {
  display: block;
}

.station-option.is-full {
  opacity: 0.6;
}

.station-capacity {
  margin-left: auto;
  font-size: 0.85rem;
  color: #4a5c74;
}

.station-capacity.full {
  color: #b42318;
  font-weight: 700;
}

.station-meta {
  color: #4a5c74;
  font-size: 0.9rem;
}

.points-row {
  font-size: 1rem;
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.flash-list {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.flash {
  padding: 0.8rem 1rem;
  border-radius: 8px;
  font-weight: 600;
}

.flash-success {
  background: #e0f6e7;
  color: #1f6b3a;
}

.flash-error {
  background: #ffe3e3;
  color: #8f1a1a;
}

.row-alert {
  background: #fff3f3;
}

.row-warn {
  background: #fff7e6;
}

.row-unscheduled {
  background: #ffd6d6;
  border-left: 6px solid #b42318;
  font-weight: 700;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th,
.table td {
  padding: 0.6rem;
  border-bottom: 1px solid #e6e8ee;
  text-align: left;
}

.sheet th {
  background: #f2f5fa;
  font-weight: 700;
}

.sheet input,
.sheet select {
  width: 100%;
  min-width: 130px;
}

.sheet .station-cell {
  text-align: center;
  min-width: 90px;
}

.cell-status {
  display: block;
  font-size: 0.75rem;
  color: #4a5c74;
  margin-top: 0.2rem;
}

.cell-status.full {
  color: #b42318;
  font-weight: 700;
}

.cell-status.overcap {
  color: #b42318;
  font-weight: 700;
}

.station-cell.cell-overcap {
  background: #ffe1e1;
}

.sheet tr.row-invalid {
  background: #fff7e6;
}

.sheet tr.row-overcap {
  background: #ffecec;
}

.row-index {
  font-weight: 700;
}

.pill {
  display: inline-block;
  background: #eef3fa;
  color: #0b2d4f;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  margin: 0 0.2rem 0.2rem 0;
  font-size: 0.85rem;
}

.cell {
  display: grid;
  gap: 0.2rem;
}

.cell-entry {
  display: grid;
  gap: 0.1rem;
  padding: 0.25rem 0;
  border-bottom: 1px dashed #e0e6ef;
}

.cell-entry:last-child {
  border-bottom: none;
}

.meta {
  font-size: 0.85rem;
  color: #4a5c74;
}

.muted {
  color: #96a1b2;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.stat-label {
  margin: 0;
  color: #4a5c74;
}

.stat-value {
  margin: 0.2rem 0 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.section-label {
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.min-suggestion {
  font-size: 0.85rem;
  color: #4a5c74;
}

.table-scroll {
  overflow-x: auto;
}

.bulk-table-scroll {
  position: relative;
  z-index: 2;
  margin-top: 1rem;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.report-list {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
  color: #4a5c74;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(36px, 1fr));
  gap: 0.3rem;
}

.slot-check {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: #4a5c74;
}

.slot-divider td {
  border-top: 3px solid #000;
}

@media print {
  .slot-divider {
    break-after: avoid;
    page-break-after: avoid;
  }

  .slot-divider + tr {
    break-before: avoid;
    page-break-before: avoid;
  }
}

.solver-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 15, 26, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 2rem;
}

.solver-overlay.is-active {
  display: flex;
}

.solver-card {
  background: #0f172a;
  color: #f8fafc;
  border-radius: 16px;
  padding: 2rem;
  width: min(640px, 92vw);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
  display: grid;
  gap: 1rem;
}

.solver-card h2 {
  margin: 0;
  font-size: 1.6rem;
}

.solver-progress {
  height: 10px;
  background: rgba(148, 163, 184, 0.3);
  border-radius: 999px;
  overflow: hidden;
}

.solver-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #22c55e);
  transition: width 0.1s linear;
}

.solver-names {
  height: 120px;
  overflow: hidden;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.7);
  padding: 1rem;
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  color: #cbd5f5;
}

.namescroll {
  opacity: 0.7;
}

.solver-log {
  background: rgba(15, 23, 42, 0.7);
  border-radius: 12px;
  padding: 0.8rem 1rem;
}

.solver-log .section-label {
  margin: 0 0 0.4rem;
  color: #cbd5f5;
}

.solver-log-body {
  display: grid;
  gap: 0.35rem;
  max-height: 130px;
  overflow-y: auto;
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
  color: #e2e8f0;
}

.solver-log-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.solver-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.solver-overlay .button.secondary {
  background: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

.attendance-table {
  font-size: 0.82rem;
}

.attendance-table th,
.attendance-table td {
  padding: 0.35rem 0.45rem;
  vertical-align: top;
  white-space: nowrap;
}

.attendance-table.attendance-red tbody tr:nth-child(odd) {
  background: #fff4f4;
}

.attendance-table.attendance-blue tbody tr:nth-child(odd) {
  background: #f3f8ff;
}

.attendance-table.attendance-green tbody tr:nth-child(odd) {
  background: #f1fbf1;
}

.attendance-page .attendance-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.attendance-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-weight: 700;
}

.attendance-pill-date {
  margin-left: auto;
}

.attendance-page.attendance-red .attendance-pill {
  background: #fff4f4;
  color: #2b2b2b;
}

.attendance-page.attendance-blue .attendance-pill {
  background: #f3f8ff;
  color: #2b2b2b;
}

.attendance-page.attendance-green .attendance-pill {
  background: #f1fbf1;
  color: #2b2b2b;
}

.attendance-check {
  width: 28px;
  text-align: center;
}

.attendance-box {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid #4a5c74;
  border-radius: 2px;
}

.attendance-dept {
  max-width: 140px;
}

.attendance-dept-text {
  display: inline-block;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: top;
}

.print-page {
  break-after: page;
  page-break-after: always;
}

@media print {
  .no-print {
    display: none;
  }

  .site-header {
    display: none;
  }

  @page {
    margin: 0mm;
  }

  body {
    background: #fff;
  }

  .card {
    box-shadow: none;
  }

  main {
    padding: 0 0 0;
  }

  .print-page {
    padding-top: 5mm;
  }

  .print-page:first-of-type {
    padding-top: 0;
  }

  .attendance-page .attendance-header {
    margin-bottom: 0.4rem;
  }
}
