:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #dbe3ef;
  --brand: #111827;
  --accent: #2563eb;
  --ok: #0f766e;
  --danger: #b91c1c;
  --warn: #b45309;
  --shadow: 0 20px 55px rgba(15, 23, 42, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: radial-gradient(circle at top, #ffffff 0, var(--bg) 42%, #e7edf7 100%);
  color: var(--ink);
}

button, input, select, textarea {
  font: inherit;
}

.app-shell {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 50px;
}

.center-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(219, 227, 239, .9);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  text-align: center;
}

.brand-title {
  margin: 0 0 8px;
  font-size: clamp(2.15rem, 7vw, 3.5rem);
  letter-spacing: .12em;
  font-weight: 900;
}

.sub-title {
  color: var(--muted);
  margin: 0 0 28px;
  font-weight: 700;
  letter-spacing: .06em;
}

.field-label {
  display: block;
  text-align: left;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}

.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 15px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 16px;
}

.btn {
  border: 0;
  border-radius: 16px;
  padding: 12px 16px;
  min-height: 46px;
  font-weight: 900;
  cursor: pointer;
  color: #fff;
  background: var(--brand);
  transition: transform .15s ease, opacity .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.full { width: 100%; }
.btn.secondary { background: #334155; }
.btn.ghost { background: #eef2f7; color: var(--ink); }
.btn.ok { background: var(--ok); }
.btn.danger { background: var(--danger); }
.btn.warn { background: var(--warn); }
.btn.small { min-height: 36px; padding: 8px 11px; border-radius: 12px; font-size: .86rem; }

.notice {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 700;
  text-align: left;
}
.notice.error { background: #fef2f2; color: #991b1b; }
.notice.success { background: #ecfdf5; color: #065f46; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.page-title {
  margin: 0;
  letter-spacing: .08em;
  font-size: clamp(1.7rem, 5vw, 2.6rem);
}

.station-name {
  margin-top: 6px;
  color: var(--muted);
  font-weight: 900;
}

.officer-name {
  margin-top: 8px;
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-weight: 900;
}

.scan-zone {
  min-height: 280px;
  display: grid;
  place-items: center;
  text-align: center;
}

.scan-button {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--brand);
  display: grid;
  place-items: center;
  gap: 12px;
  font-weight: 900;
}
.scan-button svg { width: 118px; height: 118px; filter: drop-shadow(0 15px 30px rgba(15, 23, 42, .18)); }

.grid {
  display: grid;
  gap: 14px;
}
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.section-title {
  margin: 0 0 12px;
  font-size: 1.05rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.date-group {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 14px;
  background: #fff;
}
.date-head {
  padding: 12px 14px;
  background: #0f172a;
  color: #fff;
  font-weight: 900;
}
.list-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}
.list-row:first-child { border-top: 0; }
.row-main { font-weight: 900; }
.row-sub { color: var(--muted); font-size: .92rem; margin-top: 2px; }
.row-time { color: #0f766e; font-weight: 900; white-space: nowrap; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .62);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 100;
}
.modal {
  width: min(480px, 100%);
  max-height: min(720px, calc(100vh - 36px));
  overflow: auto;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .28);
  padding: 22px;
}
.modal h2 { margin: 0 0 14px; }
.modal p { color: var(--muted); }
.station-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.station-buttons .btn { min-height: 70px; font-size: 1.05rem; }

.scanner-modal {
  width: min(680px, 100%);
  background: #020617;
  color: #fff;
}
.video-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: #000;
  aspect-ratio: 3 / 4;
}
.video-wrap video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame {
  position: absolute;
  inset: 14%;
  border: 4px solid rgba(255, 255, 255, .86);
  border-radius: 24px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .22);
}

.admin-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.admin-card h2 { margin-top: 0; }
.hint {
  margin: -4px 0 14px;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.45;
}
.textarea {
  min-height: 128px;
  resize: vertical;
  line-height: 1.45;
}
.bulk-box {
  margin-top: 14px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 12px;
  background: #f8fafc;
}
.bulk-box summary {
  cursor: pointer;
  font-weight: 900;
}
.bulk-box .hint { margin-top: 10px; }
.compact-actions {
  justify-content: flex-start;
  margin-top: 10px;
}
.search-row {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 10px;
  align-items: end;
}
.table-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.assignment-search-row { grid-template-columns: 1fr auto; }
.pager {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
}
.pager span {
  color: var(--muted);
  font-weight: 900;
}
.admin-row {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  background: #fff;
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.moderator-row { grid-template-columns: 1fr auto; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef2ff;
  color: #3730a3;
  font-size: .78rem;
  font-weight: 900;
  margin-right: 4px;
}
.hidden { display: none !important; }

@media (max-width: 720px) {
  .app-shell { width: min(100% - 22px, 980px); padding-top: 16px; }
  .card { padding: 18px; border-radius: 20px; }
  .topbar { flex-direction: column; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .search-row { grid-template-columns: 1fr; }
  .admin-row, .list-row { grid-template-columns: 1fr; }
  .row-actions { justify-content: flex-start; }
  .row-time { white-space: normal; }
}
