:root {
  --font-sans: "Avenir Next", "Trebuchet MS", "Gill Sans", sans-serif;
  --window-top: #32343a;

  --bg: #0a1530;
  --bg-soft: #0d1d3c;
  --panel: #081a3a;
  --panel-2: #0c2347;
  --border: #5a7395;
  --text: #d9e3f3;
  --muted: #9eb0ca;

  --btn: #324c69;
  --btn-hover: #406081;
  --btn-strong: #0d73ff;
  --btn-strong-hover: #2a87ff;

  --drop-border: #17c5ff;
  --drop-bg: #061530;

  --ok: #56e296;
  --warn: #f1c04f;
  --bad: #f07a7a;

  --status-idle: #0d73ff;
  --status-error: #cc3d3d;
}

html[data-theme="light"] {
  --window-top: #d1d5db;

  --bg: #eef2f7;
  --bg-soft: #e7edf6;
  --panel: #ffffff;
  --panel-2: #ffffff;
  --border: #c4cedd;
  --text: #0f1f38;
  --muted: #4a5f7c;

  --btn: #e8edf4;
  --btn-hover: #d6e0ec;
  --btn-strong: #0d73ff;
  --btn-strong-hover: #2a87ff;

  --drop-border: #0d73ff;
  --drop-bg: #f1f8ff;

  --ok: #117a3b;
  --warn: #9b5c0f;
  --bad: #b72222;

  --status-idle: #0d73ff;
  --status-error: #cc3d3d;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  color: var(--text);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
}

.window-titlebar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 46px;
  background: var(--window-top);
  display: grid;
  grid-template-columns: 96px 1fr 96px;
  align-items: center;
  padding: 0 10px;
}

.traffic-lights {
  display: inline-flex;
  gap: 8px;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}

.dot.red {
  background: #fb5f56;
}

.dot.yellow {
  background: #fdbc2d;
}

.dot.green {
  background: #29c641;
}

.window-title {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
}

html[data-theme="light"] .window-title {
  color: #2f3747;
}

.page-wrap {
  padding: 14px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3.3rem);
  line-height: 1.1;
  letter-spacing: 0.01em;
}

.header-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.header-controls form {
  margin: 0;
}

.user-pill {
  border: 1px solid rgba(90, 115, 149, 0.45);
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--muted);
  background: rgba(7, 18, 40, 0.35);
}

.btn,
.action-btn,
.icon-btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--btn);
  color: var(--text);
  font-weight: 600;
  font-size: 1.03rem;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn:hover,
.action-btn:hover,
.icon-btn:hover {
  background: var(--btn-hover);
}

.btn.muted,
.action-btn {
  background: var(--btn);
  border-color: rgba(90, 115, 149, 0.35);
}

.btn.small {
  padding: 8px 12px;
  font-size: 0.95rem;
}

.status-badge {
  min-width: 72px;
  border-radius: 8px;
  padding: 10px 14px;
  text-align: center;
  font-weight: 700;
  color: #ffffff;
}

.status-badge.status-idle {
  background: var(--status-idle);
}

.status-badge.status-error {
  background: var(--status-error);
}

.status-banner {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(17, 47, 94, 0.6);
  padding: 10px 12px;
  margin-bottom: 10px;
  white-space: pre-wrap;
}

html[data-theme="light"] .status-banner {
  background: #eef6ff;
}

.status-banner.status-error {
  border-color: #d97777;
  background: rgba(120, 16, 16, 0.25);
}

.main-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 12px;
}

.column-left {
  display: grid;
  gap: 12px;
  align-content: start;
}

.panel-group,
.panel-live,
.logs-panel,
.employee-shell {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  padding: 10px 12px 12px;
}

.panel-group h2,
.panel-live h2 {
  margin: -2px 0 10px;
  font-size: 1.95rem;
  font-weight: 600;
}

.panel-group h2 {
  font-size: 1.9rem;
}

.panel-live h2 {
  font-size: 1.9rem;
}

.panel-note {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.3;
}

.upload-form {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.upload-form input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  border: 0;
  clip: rect(0, 0, 0, 0);
  overflow: hidden;
}

.upload-cta {
  width: 100%;
  border: 3px dashed var(--drop-border);
  border-radius: 14px;
  background: var(--drop-bg);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  display: grid;
  gap: 6px;
  transition: transform 0.12s ease, background 0.12s ease;
}

.upload-cta:hover {
  background: rgba(12, 62, 124, 0.25);
}

.upload-cta.dragover {
  transform: scale(1.01);
  background: rgba(15, 87, 165, 0.25);
}

.upload-cta:disabled {
  opacity: 0.8;
  cursor: progress;
}

.upload-cta-title {
  font-size: 1.2rem;
  font-weight: 800;
}

.upload-cta-subtitle {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--muted);
}

.upload-selection {
  margin: 0;
}

.upload-progress-shell {
  display: grid;
  gap: 8px;
}

.upload-progress-shell .progress-track {
  height: 12px;
}

.upload-progress-shell .progress-text {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
}

.guest-manager {
  border-top: 1px solid rgba(90, 115, 149, 0.45);
  padding-top: 10px;
  margin-top: 2px;
  display: grid;
  gap: 8px;
}

.guest-manager h3 {
  margin: 0;
  font-size: 1.3rem;
}

.guest-form {
  display: grid;
  gap: 6px;
}

.guest-form label {
  font-size: 0.95rem;
  font-weight: 700;
}

.guest-list-shell {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 10, 32, 0.35);
  overflow: hidden;
}

.guest-table {
  font-size: 0.92rem;
}

.guest-actions {
  min-width: 280px;
}

.guest-row-form {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.guest-row-form:last-child {
  margin-bottom: 0;
}

.guest-row-form input[type="password"] {
  min-width: 130px;
  padding: 7px 9px;
  font-size: 0.88rem;
}

.btn.danger {
  border-color: rgba(191, 76, 76, 0.55);
  color: #ffd7d7;
}

.btn.danger:hover {
  background: rgba(153, 43, 43, 0.45);
}

.action-btn {
  width: 100%;
  margin-bottom: 8px;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(130, 146, 170, 0.2);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2da5ff, #6ce0ff);
}

.progress-fill.is-error {
  background: linear-gradient(90deg, #d25454, #f58e8e);
}

.progress-text {
  margin: 12px 0 4px;
  font-weight: 700;
  font-size: 1.15rem;
}

.subtle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.panel-live {
  display: grid;
  gap: 10px;
}

.fortnight {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 600;
}

.filter-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: 8px;
  align-items: center;
}

.filter-row label {
  font-weight: 600;
  font-size: 1.05rem;
}

input[type="text"],
input[type="password"],
textarea,
.employee-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 1rem;
  color: var(--text);
  background: rgba(7, 18, 40, 0.7);
}

html[data-theme="light"] input[type="text"],
html[data-theme="light"] input[type="password"],
html[data-theme="light"] textarea,
html[data-theme="light"] .employee-input {
  background: #ffffff;
}

.icon-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 1.2rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 10px;
}

.table-shell,
.missing-shell {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  min-height: 560px;
  background: rgba(0, 10, 32, 0.45);
}

.missing-shell h3 {
  margin: 0;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 1.5rem;
}

.missing-scroll {
  max-height: 590px;
  overflow: auto;
}

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

th,
td {
  border-bottom: 1px solid rgba(90, 115, 149, 0.4);
  padding: 9px 10px;
  text-align: left;
}

th {
  background: rgba(56, 81, 111, 0.95);
  font-weight: 700;
}

.empty {
  color: var(--muted);
}

td.ok {
  color: var(--ok);
  font-weight: 700;
}

td.warning {
  color: var(--warn);
  font-weight: 700;
}

td.exceeds {
  color: var(--bad);
  font-weight: 700;
}

.logs-row {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.1rem;
}

.logs-panel {
  margin-top: 10px;
}

.logs-panel pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95rem;
  color: var(--muted);
}

.employee-page .page-header h1 {
  font-size: clamp(2rem, 3vw, 2.7rem);
}

.employee-shell {
  display: grid;
  gap: 12px;
}

.employee-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto 1fr;
  gap: 8px;
  align-items: center;
}

.inline-label {
  font-size: 1rem;
  font-weight: 600;
}

.paste-panel {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(6, 18, 40, 0.35);
  padding: 8px;
  display: grid;
  gap: 8px;
}

.paste-panel textarea {
  min-height: 100px;
  resize: vertical;
}

.employee-table-wrap {
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 560px;
  overflow: auto;
}

.sel-col {
  width: 90px;
}

.employee-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.employee-input.is-invalid {
  background: rgba(190, 39, 39, 0.22);
  border-color: #f1a3a3;
}

.employee-input.is-duplicate {
  background: rgba(185, 109, 20, 0.24);
  border-color: #f3c67e;
}

.employee-input.is-missing {
  background: rgba(201, 149, 23, 0.21);
  border-color: #f3d88a;
}

.summary-line {
  margin: 4px 0 0;
  font-size: 1rem;
}

.validation-msg {
  margin: 0;
  color: var(--bad);
  font-size: 0.98rem;
  font-weight: 600;
}

.login-page {
  min-height: calc(100vh - 80px);
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(560px, 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  padding: 18px;
  display: grid;
  gap: 12px;
}

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

.auth-header h1 {
  margin: 0;
  font-size: 1.9rem;
}

.auth-form {
  display: grid;
  gap: 8px;
}

.auth-form label {
  font-weight: 600;
}

@media (max-width: 1280px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .table-shell,
  .missing-shell {
    min-height: 0;
  }

  .filter-row {
    grid-template-columns: 1fr;
  }

  .employee-toolbar {
    grid-template-columns: 1fr;
  }

  .header-controls {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}
