:root {
  --text: #e7edf7;
  --muted: #9aa8bf;
  --line: rgba(148, 163, 184, 0.18);
  --line-strong: rgba(148, 163, 184, 0.24);
  --accent: #d8e1ef;
  --accent-soft: #9db0ce;
  --accent-contrast: #101725;
  --danger: #df9d9d;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --body-bg:
    radial-gradient(circle at top left, rgba(157, 176, 206, 0.12), transparent 24%),
    linear-gradient(145deg, #080d15 0%, #0d1420 50%, #101827 100%);
  --card-bg: linear-gradient(180deg, rgba(16, 23, 35, 0.98), rgba(18, 26, 38, 0.96));
  --field-bg: rgba(255, 255, 255, 0.03);
}

html[data-theme="light"] {
  --text: #1c2433;
  --muted: #68778e;
  --line: rgba(15, 23, 42, 0.12);
  --line-strong: rgba(15, 23, 42, 0.18);
  --accent: #d7e0ef;
  --accent-soft: #9fb3d3;
  --accent-contrast: #17202f;
  --danger: #b55656;
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.12);
  --body-bg:
    radial-gradient(circle at top left, rgba(159, 179, 211, 0.18), transparent 24%),
    linear-gradient(145deg, #eef3f8 0%, #f7f9fc 50%, #edf2f8 100%);
  --card-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 253, 0.96));
  --field-bg: rgba(15, 23, 42, 0.03);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background: var(--body-bg);
}

button,
input {
  font: inherit;
}

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

.login-layout {
  width: min(100%, 360px);
}

.login-card {
  padding: 26px 24px 24px;
  border-radius: var(--radius-xl);
  background: var(--card-bg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-copy {
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent-soft);
}

.login-card h1 {
  margin: 0 0 10px;
  font-family: "IBM Plex Serif", serif;
  font-size: 2rem;
  line-height: 1.12;
}

.login-subtitle {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.theme-toggle {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--field-bg);
  color: var(--text);
  cursor: pointer;
}

.theme-toggle-label {
  font-weight: 700;
}

.theme-toggle-value {
  color: var(--muted);
  font-weight: 800;
}

.auth-error {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(223, 157, 157, 0.12);
  color: var(--danger);
  font-weight: 700;
}

.auth-success {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(127, 196, 145, 0.14);
  color: #7fc491;
  font-weight: 700;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--field-bg);
  color: var(--text);
}

.login-form input::placeholder {
  color: color-mix(in srgb, var(--muted) 82%, transparent);
}

.login-form input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent-soft) 28%, transparent);
  border-color: color-mix(in srgb, var(--accent-soft) 38%, transparent);
}

.login-form button {
  margin-top: 2px;
  height: 42px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: var(--accent-contrast);
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}

.page-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--card-bg) 78%, transparent);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.sidebar-top h1 {
  margin: 0;
  font-family: "IBM Plex Serif", serif;
  font-size: 1.65rem;
  line-height: 1.15;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav a,
.panel-header a,
.button {
  color: inherit;
  text-decoration: none;
}

.nav a {
  padding: 11px 13px;
  border-radius: 14px;
  color: var(--muted);
  border: 1px solid transparent;
}

.nav a.active,
.nav a:hover {
  color: var(--text);
  background: var(--field-bg);
  border-color: var(--line);
}

.sidebar-controls,
.logout-form {
  display: grid;
  gap: 10px;
}

.sidebar-user {
  color: var(--muted);
}

.logout-button,
.button,
.maintenance-form button {
  height: 42px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--field-bg);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.main-content {
  min-width: 0;
  padding: 24px;
}

.hero,
.content-grid,
.workspace-grid,
.stats-grid,
.analytics-grid {
  display: grid;
  gap: 18px;
}

.hero {
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.9fr);
  align-items: stretch;
  margin-bottom: 22px;
}

.hero-copy,
.hero-side,
.panel,
.empty-panel,
.section-title {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  box-shadow: var(--shadow);
}

.hero-copy,
.hero-side,
.panel,
.empty-panel {
  padding: 22px;
}

.hero-copy h2,
.section-title h2 {
  margin: 0 0 10px;
  font-family: "IBM Plex Serif", serif;
  font-size: 2rem;
  line-height: 1.15;
}

.lead,
.section-description,
.empty-panel p,
.soft-empty,
.locked-state p,
.panel-note,
.timeline-item p,
.bus-details dd,
.login-subtitle {
  color: var(--muted);
}

.hero-actions,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.button-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: var(--accent-contrast);
  border-color: transparent;
}

.button-secondary {
  background: transparent;
}

.button-small {
  height: 36px;
  padding-inline: 12px;
  border-radius: 12px;
}

.hero-side {
  display: grid;
  gap: 14px;
}

.hero-badge,
.panel-note {
  color: var(--muted);
  font-size: 0.92rem;
}

.hero-metric strong,
.stat-card strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
  margin: 8px 0 6px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.stat-card {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--card-bg);
}

.stat-card.warning { border-color: color-mix(in srgb, #e8c36d 35%, var(--line)); }
.stat-card.success { border-color: color-mix(in srgb, #7fc491 35%, var(--line)); }
.stat-card.neutral-card { border-color: var(--line); }

.section-title {
  padding: 20px 22px;
  margin-bottom: 18px;
}

.workspace-grid,
.content-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

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

.panel-header h3 {
  margin: 0;
  font-size: 1.08rem;
}

.empty-panel {
  display: flex;
  align-items: center;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--field-bg);
  white-space: nowrap;
}

.status.success { color: #7fc491; }
.status.warning { color: #e8c36d; }
.status.danger { color: #df9d9d; }
.status.neutral { color: var(--muted); }

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.bars {
  display: grid;
  gap: 14px;
}

.bar-row {
  display: grid;
  gap: 8px;
}

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

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--field-bg);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.bus-card {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--field-bg);
}

.bus-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.bus-number {
  margin: 0 0 6px;
  color: var(--muted);
}

.bus-details {
  margin: 0;
  display: grid;
  gap: 10px;
}

.bus-details > div {
  display: grid;
  gap: 2px;
}

.bus-details dt {
  font-size: 0.82rem;
  color: var(--muted);
}

.bus-details dd {
  margin: 0;
}

.maintenance-form {
  display: grid;
  gap: 14px;
}

.maintenance-form label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.maintenance-form input,
.maintenance-form select,
.maintenance-form textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--field-bg);
  color: var(--text);
}

.maintenance-form textarea {
  resize: vertical;
  min-height: 110px;
}

.empty-state,
.locked-state,
.soft-empty {
  padding: 16px;
  border-radius: 16px;
  border: 1px dashed var(--line);
  background: var(--field-bg);
}

@media (max-width: 1100px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .hero,
  .workspace-grid,
  .content-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
