* { box-sizing: border-box; }
html, body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #0f1620;
  color: #e6edf3;
  max-width: 100%;
  /* clip, not hidden: "hidden" on both html and body turns body into its own scroll box, and Chrome then
     sends the mouse wheel there, where there's nothing to scroll, so the page wouldn't scroll with the wheel. */
  overflow-x: clip;
}
/* Always leave room for the scrollbar on a computer, so the page doesn't shift sideways
   when you go between a short page (no scrollbar) and a long one. Phones have no scrollbar, so no change there. */
html { scrollbar-gutter: stable; }
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  background: #131c28;
  border-bottom: 1px solid #1f2b3a;
}
header h1 { margin: 0; font-size: 22px; color: #4da3ff; }
.user-info { font-size: 14px; color: #9fb3c8; }
.logout { color: #ff6b6b; margin-left: 14px; text-decoration: none; }
.logout:hover { text-decoration: underline; }

.logo { display: flex; align-items: center; gap: 12px; }
.logo-text {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #e6edf3;
}
.logo-text .accent { color: #4da3ff; }
.logo-icon {
  flex-shrink: 0;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.45));
}
.logo-compact { gap: 10px; }
.logo-compact .logo-icon { width: 34px; height: 34px; }
.logo-compact .logo-text { font-size: 20px; }
.logo-hero { flex-direction: column; gap: 14px; text-align: center; }
.logo-hero .logo-icon {
  width: 76px;
  height: 76px;
  animation: logoFloat 4s ease-in-out infinite;
}
.logo-hero .logo-text { font-size: 30px; }
.logo-text-block { text-align: center; }

@keyframes logoFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(2deg); }
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 28px;
  background: #131c28;
  border-bottom: 1px solid #1f2b3a;
}
.tab-link {
  padding: 12px 20px;
  color: #9fb3c8;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}
.tab-link.active {
  color: #4da3ff;
  border-bottom-color: #4da3ff;
}

main {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  padding: 28px;
}
@media (max-width: 900px) {
  main { grid-template-columns: 1fr; }
}

.sub-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  color: #9fb3c8;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.sub-divider::before, .sub-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #1f2b3a;
}
.sub-roster, .sub-history { opacity: 0.96; }
.sub-roster h2, .sub-history h2 { color: #9fb3c8; font-size: 15px; }

section h2 { margin-top: 0; font-size: 18px; color: #cfe3f7; }

.overview-main {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 1500px;
  margin: 0 auto;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 800px) {
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
}
.stat-card {
  background: linear-gradient(160deg, #161f2c 0%, #11181f 100%);
  border: 1px solid #1f2b3a;
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 3px solid #2a3a4c;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3);
}
.stat-value { font-size: 28px; font-weight: 800; color: #e6edf3; line-height: 1; }
.stat-label { font-size: 12px; color: #7d93a8; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-amber { border-top-color: #ffb84d; }
.stat-amber .stat-value { color: #ffb84d; }
.stat-blue { border-top-color: #4da3ff; }
.stat-blue .stat-value { color: #4da3ff; }
.stat-green { border-top-color: #4ddc8a; }
.stat-green .stat-value { color: #4ddc8a; }
.stat-slate { border-top-color: #9fb3c8; }
.stat-value.backup-time { font-size: 17px; }

.audit-actions { display: flex; gap: 8px; align-items: center; }
.audit-actions .btn.ghost { text-decoration: none; }

.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1100px) {
  .overview-grid { grid-template-columns: 1fr; }
}

.overview-window {
  background: linear-gradient(160deg, #161f2c 0%, #11181f 100%);
  border: 1px solid #1f2b3a;
  border-left: 3px solid #2a3a4c;
  border-radius: 10px;
  padding: 20px 24px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}
.accent-amber { border-left-color: #ffb84d; }
.accent-amber .overview-header h2 { color: #ffb84d; }
.accent-blue { border-left-color: #4da3ff; }
.accent-blue .overview-header h2 { color: #4da3ff; }
.accent-green { border-left-color: #4ddc8a; }
.accent-green .overview-header h2 { color: #4ddc8a; }

.pending-window { padding: 14px 18px; }
.pending-window .overview-header { margin-bottom: 8px; }
.pending-window .overview-header h2 { font-size: 15px; }
.pending-count {
  display: inline-block;
  background: #ffb84d;
  color: #1b1308;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 6px;
}
.pending-scroll {
  max-height: 180px;
  overflow-y: auto;
}
.pending-window table th, .pending-window table td { padding: 6px 8px; font-size: 12px; }
.overview-list { max-width: 100%; }
.overview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}
.overview-header .btn { text-decoration: none; }
.overview-header h2 {
  margin: 0;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.overview-note { color: #7d93a8; font-size: 12px; margin-top: 12px; }
.period-range {
  color: #4da3ff;
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 14px;
}

input[type="date"] {
  padding: 5px 4px;
  border-radius: 5px;
  border: 1px solid #2a3a4c;
  background: #0f1620;
  color: #e6edf3;
  font-size: 11px;
  width: 100%;
  max-width: 108px;
  min-width: 0;
}

.roster-list, .history-list, .overview-list {
  overflow-x: auto;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #131c28;
  border-radius: 8px;
  table-layout: auto;
}
th, td {
  padding: 8px 8px;
  text-align: left;
  border-bottom: 1px solid #1f2b3a;
  font-size: 13px;
  word-break: break-word;
}
th {
  color: #7d93a8;
  font-weight: 600;
  white-space: nowrap;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
tbody tr:last-child td { border-bottom: none; }
.empty { color: #5b6f82; text-align: center; }

.entry-row { display: none; background: rgba(255, 255, 255, 0.02); }
.entry-row.show { display: table-row; }
.entry-row:hover { background: rgba(255, 255, 255, 0.02); }
.entry-row > td { padding: 10px 8px 14px 28px; border-bottom: 1px solid #1f2b3a; }
.mini-table {
  background: #0f1620;
  border: 1px solid #1f2b3a;
  border-radius: 6px;
}
.mini-table th, .mini-table td { padding: 5px 8px; font-size: 12px; }
.mini-table tbody tr:last-child td { border-bottom: none; }
.toggle-entries {
  padding: 3px 7px;
  font-size: 11px;
  line-height: 1;
}

.actions { display: flex; gap: 4px; flex-wrap: wrap; }
.inline { display: inline; }

.memo-input {
  padding: 5px 6px;
  border-radius: 5px;
  border: 1px solid #2a3a4c;
  background: #0f1620;
  color: #e6edf3;
  font-size: 12px;
  width: 110px;
  min-width: 0;
}

.personnel-logins {
  max-width: 100%;
}
.personnel-logins table { min-width: 640px; }
.personnel-logins th, .personnel-logins td { padding: 14px 12px; font-size: 14px; }
.create-login { max-width: 420px; }

.edit-personnel-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.edit-personnel-form input {
  padding: 7px 9px;
  border-radius: 5px;
  border: 1px solid #2a3a4c;
  background: #0f1620;
  color: #e6edf3;
  font-size: 13px;
  width: 140px;
}
.edit-personnel-form select {
  padding: 7px 9px;
  border-radius: 5px;
  border: 1px solid #2a3a4c;
  background: #0f1620;
  color: #e6edf3;
  font-size: 13px;
}

.role-badge {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.role-admin { background: #4da3ff33; color: #6db4ff; }
.role-standard { background: #2e9e5b33; color: #4ddc8a; }
.role-viewer { background: #5b6f8233; color: #9fb3c8; }

.row-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-start;
}
.row-actions .add-hours-form input { width: 50px; }
.row-actions .btn.export-officer { font-size: 11px; padding: 4px 9px; }

.add-hours-form {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}
.add-hours-form input {
  width: 64px;
  min-width: 0;
  padding: 5px 6px;
  border-radius: 5px;
  border: 1px solid #2a3a4c;
  background: #0f1620;
  color: #e6edf3;
  font-size: 12px;
}

@media (max-width: 700px) {
  th, td { padding: 6px 5px; font-size: 12px; }
  .btn { padding: 5px 8px; font-size: 12px; }
  header, .tabs, main, .overview-main { padding-left: 14px; padding-right: 14px; }
}

.btn {
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
}
.btn.yes { background: #2e9e5b; }
.btn.no { background: #b8862e; }
.btn.no-mtb { background: #c0392b; }
.btn.remove { background: #3a4756; }
.btn.add { background: #4da3ff; color: #0f1620; }
.btn.undo { background: #5b4ea3; }
.btn.export-officer { background: #2e6fd6; text-decoration: none; display: inline-block; }
.btn.ghost {
  background: transparent;
  border: 1px solid #2a3a4c;
  color: #9fb3c8;
}
.btn.ghost:hover { background: #1a2632; opacity: 1; }
.btn:hover { opacity: 0.85; }

.pending-actions {
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.pending-window .add-hours-form input { width: 50px; }
.pending-delete { background: #7a2e2e; }

.undone-row { opacity: 0.45; }
.undone-label { font-size: 12px; color: #5b6f82; font-style: italic; }

.personnel-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.personnel-form label {
  font-size: 13px;
  color: #9fb3c8;
  margin-top: 8px;
}
.personnel-form input[type="text"],
.personnel-form input[type="password"],
.personnel-form select {
  padding: 9px 10px;
  border-radius: 6px;
  border: 1px solid #2a3a4c;
  background: #0f1620;
  color: #e6edf3;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-direction: row;
}
.checkbox-label input { width: auto; }
.personnel-form button { margin-top: 16px; align-self: flex-start; }

.add-form {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.add-form input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #2a3a4c;
  background: #0f1620;
  color: #e6edf3;
}

.sync-form { margin-top: 8px; }

.badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}
.badge.yes { background: #2e9e5b33; color: #4ddc8a; }
.badge.no { background: #b8862e33; color: #e0ad5a; }
.badge.no_mtb { background: #c0392b33; color: #ff7b6e; }

.flash {
  margin: 16px 28px 0;
  padding: 10px 14px;
  background: #c0392b33;
  border: 1px solid #c0392b;
  color: #ff9b8f;
  border-radius: 6px;
}

.login-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  overflow: hidden;
  background: radial-gradient(circle at 30% 20%, #16233a 0%, #0f1620 55%, #0a0f16 100%);
}

.bg-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  perspective: 900px;
}
.bg-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(77, 163, 255, 0.18);
  transform-style: preserve-3d;
  animation: ringSpin 26s linear infinite;
}
.ring-1 { width: 520px; height: 520px; top: -120px; left: -140px; animation-duration: 30s; }
.ring-2 { width: 720px; height: 720px; bottom: -220px; right: -200px; border-color: rgba(255, 184, 77, 0.12); animation-duration: 40s; animation-direction: reverse; }
.ring-3 { width: 360px; height: 360px; bottom: 10%; left: 8%; border-color: rgba(110, 220, 160, 0.12); animation-duration: 22s; }

@keyframes ringSpin {
  0% { transform: rotateX(55deg) rotateZ(0deg); }
  100% { transform: rotateX(55deg) rotateZ(360deg); }
}

.login-stage { perspective: 1200px; position: relative; z-index: 1; }

.login-box {
  background: linear-gradient(160deg, #182334 0%, #121b27 100%);
  padding: 40px 44px;
  border-radius: 16px;
  width: 340px;
  text-align: center;
  border: 1px solid #25344a;
  transform: rotateX(4deg) rotateY(-2deg);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.04) inset,
    0 1px 0 rgba(255, 255, 255, 0.06),
    0 20px 40px rgba(0, 0, 0, 0.55),
    0 40px 80px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(77, 163, 255, 0.06);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.login-box:hover {
  transform: rotateX(1deg) rotateY(0deg) translateY(-2px);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.05) inset,
    0 1px 0 rgba(255, 255, 255, 0.08),
    0 26px 50px rgba(0, 0, 0, 0.6),
    0 50px 90px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(77, 163, 255, 0.12);
}

.login-box h1.logo-text { margin-bottom: 0; }
.subtitle { color: #7d93a8; margin-top: 4px; margin-bottom: 24px; font-size: 13px; letter-spacing: 0.4px; }
.login-box form { display: flex; flex-direction: column; gap: 4px; text-align: left; margin-top: 22px; }
.login-box label { font-size: 13px; color: #9fb3c8; margin-top: 8px; }
.login-box input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #2a3a4c;
  background: #0f1620;
  color: #e6edf3;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 2px 6px rgba(0, 0, 0, 0.3) inset;
}
.login-box input:focus {
  outline: none;
  border-color: #4da3ff;
  box-shadow: 0 0 0 3px rgba(77, 163, 255, 0.18);
}
.login-box button {
  margin-top: 20px;
  padding: 11px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(160deg, #6db4ff 0%, #2e6fd6 100%);
  color: #08101c;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(46, 111, 214, 0.45), 0 1px 0 rgba(255, 255, 255, 0.2) inset;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.login-box button:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 20px rgba(46, 111, 214, 0.55), 0 1px 0 rgba(255, 255, 255, 0.25) inset;
}
.login-box button:active { transform: translateY(0); }
