:root {
  --bg-main: #f4f7fb;
  --ink: #14213d;
  --muted: #5e6b82;
  --panel: #ffffff;
  --panel-border: #e5ecf5;
  --primary: #0d6efd;
  --primary-deep: #0757d9;
  --success: #16885b;
  --warning: #c94f2d;
  --hero-a: #081f5f;
  --hero-b: #0f3aa6;
  --accent-red: #d72638;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% 0%, #e6f0ff 0%, transparent 35%),
    radial-gradient(circle at 90% 20%, #ffe8e5 0%, transparent 35%),
    var(--bg-main);
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(17, 37, 86, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 37, 86, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

.glow {
  position: fixed;
  border-radius: 999px;
  filter: blur(10px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.glow-a {
  width: 320px;
  height: 320px;
  background: #9ec5ff;
  top: -120px;
  right: -80px;
}

.glow-b {
  width: 280px;
  height: 280px;
  background: #ffbca8;
  bottom: -100px;
  left: -90px;
}

main {
  position: relative;
  z-index: 1;
}

.hero-shell {
  position: relative;
  background: linear-gradient(135deg, var(--hero-a) 0%, var(--hero-b) 70%);
  border-radius: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 1.5rem;
  color: #f7fbff;
  box-shadow: 0 20px 45px rgba(8, 31, 95, 0.28);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #d4e6ff;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 0.32rem 0.62rem;
  border-radius: 0.6rem;
}

.hero-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.02em;
  margin: 0;
}

.hero-subtitle {
  max-width: 670px;
  color: #dce9ff;
}

.theme-fab {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.14);
  color: #f6fbff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  transition: transform 0.2s ease, background 0.25s ease, border-color 0.25s ease;
}

.theme-fab:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.22);
}

.panel-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 1rem;
  box-shadow: 0 12px 30px rgba(16, 44, 110, 0.08);
  padding: 1.1rem;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.panel-subcard {
  background: #f9fbff;
  border: 1px solid #e2ebf7;
  border-radius: 0.8rem;
  padding: 0.7rem;
}

.trip-row {
  transform-origin: top center;
}

.trip-row.trip-enter {
  animation: tripIn 280ms ease-out both;
}

.trip-row.trip-exit {
  animation: tripOut 220ms ease-in both;
}

@keyframes tripIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes tripOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}

.card-head {
  border-bottom: 1px solid #ecf1f8;
  padding-bottom: 0.7rem;
}

.soft-pill {
  font-size: 0.75rem;
  color: #2c4f86;
  background: #eaf2ff;
  border: 1px solid #d2e4ff;
  border-radius: 999px;
  padding: 0.24rem 0.55rem;
}

.metric-card {
  background: #ffffff;
  border: 1px solid #e0e9f5;
  border-radius: 0.9rem;
  padding: 0.85rem;
  box-shadow: 0 8px 18px rgba(17, 47, 117, 0.07);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.metric-accent {
  background: linear-gradient(135deg, #fff6f3 0%, #ffe6de 100%);
  border-color: #ffcfc0;
}

.metric-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  color: #6a7892;
  font-weight: 700;
}

.metric-number {
  margin-top: 0.45rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: #0f1f45;
}

.progress-ring {
  --p: 0%;
  --ring-color: var(--primary);
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--ring-color) var(--p), #e7eef8 0);
  position: relative;
  margin: 0 auto;
  transition: background 0.7s ease;
}

.progress-ring.is-complete {
  --ring-color: #18a26a;
}

.progress-ring::before {
  content: "";
  position: absolute;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #ecf1f8;
}

.progress-ring span {
  position: relative;
  z-index: 1;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #123065;
}

.timeline-shell {
  position: relative;
  height: 120px;
}

.timeline-track {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 18px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #b9cffd 0%, #81abff 45%, #5f8ff4 100%);
}

.timeline-node {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  text-align: center;
  width: 120px;
}

.timeline-node .dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-block;
  border: 3px solid #fff;
  box-shadow: 0 2px 7px rgba(23, 56, 127, 0.3);
}

.dot-start {
  background: #3e7bfa;
}

.dot-mid {
  background: #1d5fe8;
}

.dot-end {
  background: var(--accent-red);
}

.node-label {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.74rem;
  font-weight: 700;
  color: #2f4367;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.node-date {
  display: block;
  margin-top: 0.22rem;
  font-size: 0.76rem;
  color: #5f6d87;
}

#timelineArrival {
  left: 8%;
}

#timelinePr {
  left: 50%;
}

#timelineApp {
  left: 92%;
}

.form-label {
  font-size: 0.84rem;
  color: #3d506f;
  margin-bottom: 0.4rem;
}

.form-control,
.form-select {
  border-radius: 0.68rem;
  border-color: #d8e3f2;
  padding: 0.62rem 0.75rem;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: #95b8ff;
  box-shadow: 0 0 0 0.2rem rgba(77, 136, 255, 0.17);
}

.btn-primary {
  border: 0;
  border-radius: 0.68rem;
  padding: 0.66rem 0.9rem;
  font-weight: 700;
  background: linear-gradient(120deg, var(--primary) 0%, var(--primary-deep) 100%);
}

.btn-outline-primary,
.btn-outline-danger,
.btn-outline-light,
.btn-outline-secondary {
  border-radius: 0.62rem;
}

.remove-trip {
  padding-inline: 0.45rem;
}

.theme-icon {
  font-size: 0.98rem;
  line-height: 1;
}

.action-btn {
  border: 1px solid #c8d8f3;
  border-radius: 0.66rem;
  background: linear-gradient(180deg, #f7fbff 0%, #edf4ff 100%);
  color: #173e7a;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.43rem 0.62rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  box-shadow: 0 4px 14px rgba(20, 70, 155, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.action-btn:disabled {
  opacity: 0.58;
  box-shadow: none;
}

.action-btn:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(20, 70, 155, 0.18);
}

.result-metric {
  border-radius: 0.78rem;
  border: 1px solid #e8eef8;
  background: #fcfdff;
  padding: 0.68rem 0.8rem;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.result-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #5f6d85;
  font-weight: 700;
}

.result-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: #12264d;
}

.status-badge {
  border-radius: 0.62rem;
  font-weight: 700;
  font-size: 0.86rem;
  padding: 0.5rem 0.68rem;
}

.status-good {
  background: #dff9ed;
  color: var(--success);
}

.status-warn {
  background: #ffe7e0;
  color: var(--warning);
}

.next-steps {
  border: 1px solid #c8e7d8;
  background: #f3fff8;
  border-radius: 0.78rem;
  padding: 0.85rem;
}

.next-steps h4 {
  font-size: 0.9rem;
  margin-bottom: 0.45rem;
  color: #0d6c44;
}

.next-steps p {
  margin-bottom: 0.45rem;
  color: #215943;
}

.next-steps a {
  font-weight: 700;
}

.report-table {
  margin-bottom: 0;
}

.report-table th {
  width: 48%;
  color: #2e446b;
}

.report-table td,
.report-table th {
  background: transparent !important;
}

@media (max-width: 991px) {
  .progress-ring {
    width: 108px;
    height: 108px;
  }

  .progress-ring::before {
    width: 78px;
    height: 78px;
  }
}

@media (max-width: 768px) {
  .hero-shell {
    padding: 1.2rem;
  }

  .timeline-shell {
    height: 140px;
  }

  .timeline-node {
    width: 96px;
  }

  .node-date {
    font-size: 0.72rem;
  }
}

html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="dark"] body {
  background: radial-gradient(circle at 10% 0%, #101c34 0%, transparent 35%),
    radial-gradient(circle at 90% 20%, #2f1620 0%, transparent 35%),
    #0c1324;
  color: #e7edff;
}

html[data-theme="dark"] .bg-grid {
  background-image:
    linear-gradient(rgba(136, 167, 231, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(136, 167, 231, 0.08) 1px, transparent 1px);
}

html[data-theme="dark"] .hero-shell {
  background: linear-gradient(135deg, #071433 0%, #102c72 70%);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.38);
}

html[data-theme="dark"] .theme-fab {
  border-color: rgba(210, 229, 255, 0.28);
  background: rgba(173, 201, 255, 0.12);
  color: #f3f8ff;
}

html[data-theme="dark"] .theme-fab:hover {
  background: rgba(173, 201, 255, 0.2);
}

html[data-theme="dark"] .panel-card {
  background: #121d36;
  border-color: #243556;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .panel-subcard {
  background: #0f1a31;
  border-color: #2b3d62;
}

html[data-theme="dark"] .card-head {
  border-bottom-color: #2b3c61;
}

html[data-theme="dark"] .soft-pill {
  color: #c8daff;
  background: #1a2d52;
  border-color: #304875;
}

html[data-theme="dark"] .metric-card {
  background: #131f39;
  border-color: #2b3d63;
}

html[data-theme="dark"] .metric-accent {
  background: linear-gradient(135deg, #2a1f2a 0%, #33232b 100%);
  border-color: #613842;
}

html[data-theme="dark"] .metric-kicker,
html[data-theme="dark"] .result-label,
html[data-theme="dark"] .node-date,
html[data-theme="dark"] .text-muted {
  color: #a8b7d6 !important;
}

html[data-theme="dark"] .metric-number,
html[data-theme="dark"] .result-value,
html[data-theme="dark"] .node-label,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] .form-label {
  color: #e5edff;
}

html[data-theme="dark"] .timeline-track {
  background: linear-gradient(90deg, #526b97 0%, #4d70b8 45%, #6786ca 100%);
}

html[data-theme="dark"] .dot-start {
  background: #6ea5ff;
}

html[data-theme="dark"] .dot-mid {
  background: #4b88ff;
}

html[data-theme="dark"] .dot-end {
  background: #ff6d8a;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
  background: #0d1730;
  border-color: #30446d;
  color: #eaf0ff;
}

html[data-theme="dark"] .form-control::-webkit-calendar-picker-indicator {
  filter: invert(1) contrast(0.9);
}

html[data-theme="dark"] .form-check-input {
  background-color: #122140;
  border-color: #365180;
}

html[data-theme="dark"] .result-metric {
  background: #101b34;
  border-color: #283a5e;
}

html[data-theme="dark"] .action-btn {
  border-color: #325087;
  background: linear-gradient(180deg, #1b2d54 0%, #162749 100%);
  color: #d3e4ff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .next-steps {
  border-color: #1f5a41;
  background: #0e2b21;
}

html[data-theme="dark"] .next-steps h4,
html[data-theme="dark"] .next-steps p {
  color: #bfead8;
}

html[data-theme="dark"] .report-table th {
  color: #ccd9f8;
}

@media print {
  body {
    background: #fff;
  }

  body * {
    visibility: hidden !important;
  }

  #printReportCard,
  #printReportCard * {
    visibility: visible !important;
  }

  #printReportCard {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
  }
}
