* {
  box-sizing: border-box;
}

:root {
  --bg: #0b0d10;
  --panel: #12151a;
  --panel-2: #181c22;
  --border: #262b33;
  --text: #f4f6f8;
  --muted: #9098a3;
  --accent: #ff2d55;
  --success: #36d17c;
  --warning: #ffb84d;
  --danger: #ff5a65;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-width: 320px;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.view,
.portal-page {
  display: none;
}

.view.active,
.portal-page.active {
  display: block;
}

.login-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 18px;
}

.brand-block {
  margin-bottom: 24px;
}

.brand-mark {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -1px;
}

.brand-subtitle,
.topbar-kicker,
.eyebrow,
.hero-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
}

.login-card {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 18px;
  padding: 22px;
}

.login-card h1,
.page-heading h1 {
  margin: 0;
  font-size: 24px;
}

.muted {
  margin: 7px 0 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

label {
  display: block;
  margin: 14px 0 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 12px;
  padding: 14px;
  outline: none;
}

input:focus {
  border-color: var(--accent);
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 16px 0;
  color: var(--muted);
}

.remember-row input {
  width: 18px;
  height: 18px;
}

.primary-button,
.secondary-button,
.small-primary {
  border: 0;
  border-radius: 12px;
  font-weight: 700;
}

.primary-button {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: white;
}

.secondary-button {
  width: 100%;
  padding: 13px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.small-primary {
  padding: 10px 13px;
  background: var(--accent);
  color: white;
}

.error-message {
  min-height: 22px;
  margin-top: 14px;
  color: var(--danger);
  font-size: 13px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(18px, env(safe-area-inset-top)) 18px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 13, 16, 0.96);
  backdrop-filter: blur(12px);
}

.topbar-title {
  margin-top: 3px;
  font-size: 20px;
  font-weight: 800;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font-size: 20px;
}

.icon-button.compact {
  width: 38px;
  height: 38px;
}

.page-content {
  padding: 18px 16px calc(92px + var(--safe-bottom));
}

.hero-card {
  padding: 20px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.hero-value {
  margin-top: 7px;
  font-size: 30px;
  font-weight: 800;
}

.hero-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 2px 10px;
}

.section-header h2 {
  margin: 0;
  font-size: 17px;
}

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.list-row,
.empty-state {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 14px;
  padding: 15px;
}

.empty-state {
  color: var(--muted);
  line-height: 1.5;
}

.skeleton-row {
  min-height: 54px;
  opacity: 0.55;
}

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

.metric-card {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 14px;
  padding: 15px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
}

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

.eyebrow {
  margin-bottom: 4px;
}

.page-note {
  margin: -6px 0 12px;
}

.rota-row,
.route-card,
.holiday-card {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 14px;
  padding: 15px;
}

.rota-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rota-day {
  font-weight: 700;
}

.rota-date {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 72px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.status-working,
.status-approved {
  color: var(--success);
  background: rgba(54, 209, 124, 0.10);
}

.status-off {
  color: var(--muted);
  background: var(--panel-2);
}

.status-pending {
  color: var(--warning);
  background: rgba(255, 184, 77, 0.10);
}

.status-declined {
  color: var(--danger);
  background: rgba(255, 90, 101, 0.10);
}

.route-card-header,
.holiday-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.holiday-card-header {
  align-items: flex-start;
}

.holiday-card-header > div:first-child {
  min-width: 0;
  flex: 1;
}

.holiday-card-header .status-pill {
  margin-left: auto;
}

.route-card-header {
  margin-bottom: 12px;
}

.route-title,
.holiday-title {
  font-size: 17px;
  font-weight: 800;
}

.route-date,
.holiday-meta {
  color: var(--muted);
  font-size: 12px;
}

.holiday-meta {
  margin-top: 5px;
}

.route-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.route-metric {
  border-radius: 10px;
  background: var(--panel-2);
  padding: 10px;
}

.route-metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.route-metric strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 8px calc(8px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  background: rgba(11, 13, 16, 0.98);
  backdrop-filter: blur(12px);
}

.nav-item {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 7px 4px;
  border-radius: 10px;
  font-size: 11px;
}

.nav-item.active {
  color: var(--text);
  background: var(--panel);
}

.nav-icon {
  display: block;
  margin-bottom: 3px;
  font-size: 18px;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(11, 13, 16, 0.88);
  color: var(--text);
}

.loading-overlay.hidden,
.modal-backdrop.hidden {
  display: none;
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Holiday request mobile sheet */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.72);
}

.modal-sheet {
  width: 100%;
  padding: 12px 18px calc(22px + var(--safe-bottom));
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: var(--panel);
}

.modal-handle {
  width: 42px;
  height: 4px;
  margin: 0 auto 16px;
  border-radius: 99px;
  background: var(--border);
}

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

.modal-header h2 {
  margin: 0;
  font-size: 22px;
}

.date-input-wrap {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
  padding: 13px 14px;
}

.date-input-wrap input[type="date"] {
  display: block;
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  color-scheme: dark;
}

@media (min-width: 600px) {
  body::before {
    content: "LRG Driver Portal is designed for mobile devices.";
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: var(--bg);
    color: var(--muted);
    text-align: center;
  }
}
