:root {
  color-scheme: light;
  --ink: #17211f;
  --muted: #66736f;
  --line: #dfe6e1;
  --surface: #ffffff;
  --soft: #f5f7f3;
  --panel: #fbfcf9;
  --green: #24835c;
  --green-bg: #e7f4ec;
  --yellow: #9b6c08;
  --yellow-bg: #fff3cc;
  --red: #aa3d38;
  --red-bg: #fae5e2;
  --blue: #2f668f;
  --teal: #1f786f;
  --shadow: 0 18px 50px rgba(34, 49, 44, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(47, 102, 143, 0.12), transparent 34%),
    linear-gradient(220deg, rgba(31, 120, 111, 0.11), transparent 38%),
    var(--soft);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html {
  scroll-behavior: smooth;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  padding: 24px;
  background: rgba(255, 255, 255, 0.76);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: white;
  background: linear-gradient(145deg, var(--blue), var(--teal));
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.trip-card strong {
  display: block;
}

.brand span,
.trip-card span,
.hint,
small,
.label {
  color: var(--muted);
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.nav-item span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
}

.trip-card {
  margin-top: auto;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.main {
  width: min(1400px, 100%);
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 4.6rem);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

.summary-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(94px, 1fr));
  gap: 10px;
  min-width: 340px;
}

.summary-metrics div {
  padding: 12px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-metrics span {
  display: block;
  font-weight: 800;
}

.control-row {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.search {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.search {
  flex: 1;
  max-width: 420px;
  gap: 8px;
  padding-inline: 12px;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.day-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.day-card {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 34px;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 72px;
  padding: 12px 14px;
  color: inherit;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  text-align: left;
}

.day-card:hover,
.day-card.selected {
  background: white;
  border-color: #aac6bf;
}

.day-card.green {
  border-left-color: var(--green);
}

.day-card.yellow {
  border-left-color: var(--yellow);
}

.day-card.red {
  border-left-color: var(--red);
}

.day-number {
  display: none;
}

.day-date {
  display: grid;
  gap: 2px;
  align-content: center;
  min-height: 48px;
  padding: 8px 9px;
  border-radius: 8px;
  background: #edf3f0;
}

.day-date strong {
  font-weight: 800;
  line-height: 1;
}

.day-date span {
  color: var(--muted);
  font-size: 0.76rem;
}

.day-main strong {
  display: block;
  overflow-wrap: anywhere;
}

.day-arrow {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--muted);
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.day-main span,
.day-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.day-meta {
  text-align: right;
}

.day-dialog {
  width: min(560px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 28px));
  padding: 0;
  background: transparent;
  border: 0;
}

.day-dialog::backdrop {
  background: rgba(16, 25, 23, 0.42);
  backdrop-filter: blur(4px);
}

.dialog-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(16, 25, 23, 0.28);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  margin-top: 8px;
  font-size: 1.24rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.status-badge.green {
  color: var(--green);
  background: var(--green-bg);
}

.status-badge.yellow {
  color: var(--yellow);
  background: var(--yellow-bg);
}

.status-badge.red {
  color: var(--red);
  background: var(--red-bg);
}

.status-badge.neutral {
  color: var(--muted);
  background: #eef2ef;
}

.day-detail {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.detail-block {
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-block span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-block strong {
  overflow-wrap: anywhere;
}

.route-panel {
  margin-top: 18px;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 18px;
  margin-top: 18px;
}

.route-strip {
  display: flex;
  gap: 8px;
  padding: 18px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.route-stop {
  position: relative;
  flex: 0 0 86px;
  min-width: 76px;
  min-height: 112px;
  padding: 12px 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  scroll-snap-align: start;
  text-align: left;
}

.route-stop::before {
  content: "";
  position: absolute;
  top: 30px;
  left: -9px;
  width: 10px;
  height: 2px;
  background: #9db2ad;
}

.route-stop:first-child::before {
  display: none;
}

.route-dot {
  display: block;
  width: 13px;
  height: 13px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: var(--blue);
}

.route-stop.green .route-dot {
  background: var(--green);
}

.route-stop.yellow .route-dot {
  background: var(--yellow);
}

.route-stop.red .route-dot {
  background: var(--red);
}

.route-stop strong,
.route-stop span {
  display: block;
  font-size: 0.82rem;
}

.route-stop span {
  color: var(--muted);
}

.lodging-list,
.budget-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.lodging-row,
.budget-row {
  display: grid;
  gap: 8px;
  padding: 13px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.lodging-row {
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
}

.lodging-row span,
.budget-row span {
  color: var(--muted);
  font-size: 0.86rem;
}

.lodging-row strong,
.budget-row strong {
  overflow-wrap: anywhere;
}

.budget-row {
  grid-template-columns: minmax(0, 1fr) 120px;
  align-items: center;
}

.budget-input {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: right;
}

.compact .day-card {
  grid-template-columns: 78px minmax(0, 1fr) 32px;
  padding: 9px 12px;
}

.compact .day-date {
  min-height: 40px;
  padding-block: 6px;
}

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

  .sidebar {
    position: sticky;
    z-index: 10;
    height: auto;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.92);
    border-right: 0;
    border-bottom: 1px solid var(--line);
    gap: 12px;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .nav-item {
    justify-content: center;
    min-height: 40px;
    padding: 9px 8px;
    font-size: 0.9rem;
  }

  .nav-item span {
    display: none;
  }

  .trip-card {
    display: none;
  }

  .main {
    padding: 18px;
    width: 100%;
  }

  .topbar,
  .control-row {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-metrics {
    min-width: 0;
  }

  .search {
    max-width: none;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .lower-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  body {
    background: var(--soft);
  }

  .sidebar {
    top: 0;
    padding: 10px 10px 8px;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 0.86rem;
  }

  .brand span {
    display: none;
  }

  .nav-list {
    display: flex;
    gap: 6px;
    margin-inline: -2px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .nav-item {
    flex: 0 0 auto;
    min-width: 86px;
    min-height: 38px;
    border-color: var(--line);
    background: rgba(255, 255, 255, 0.72);
    scroll-snap-align: start;
  }

  .nav-item.active {
    background: var(--ink);
    color: white;
    border-color: var(--ink);
  }

  .main {
    padding: 14px 10px 22px;
  }

  .topbar {
    gap: 14px;
    margin-bottom: 14px;
  }

  .eyebrow {
    font-size: 0.76rem;
  }

  h1 {
    font-size: 2rem;
    line-height: 1.02;
  }

  .control-row {
    margin-bottom: 12px;
  }

  .search {
    min-height: 46px;
    width: 100%;
  }

  .nav-list,
  .summary-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .summary-metrics {
    gap: 8px;
  }

  .summary-metrics div {
    padding: 10px;
  }

  .summary-metrics div:last-child {
    grid-column: 1 / -1;
  }

  .panel {
    box-shadow: 0 10px 26px rgba(34, 49, 44, 0.08);
  }

  .panel-heading {
    min-height: 52px;
    padding: 13px 14px;
  }

  .icon-button {
    width: 40px;
    height: 40px;
  }

  .day-list,
  .day-detail,
  .lodging-list,
  .budget-list {
    padding: 10px;
  }

  .day-card {
    grid-template-columns: 76px minmax(0, 1fr) 32px;
    gap: 10px;
    min-height: 66px;
    padding: 12px;
  }

  .day-main strong {
    line-height: 1.22;
  }

  .day-main span,
  .day-meta {
    font-size: 0.82rem;
  }

  .day-meta,
  .day-main span {
    display: none;
  }

  .day-date {
    min-height: 42px;
    padding: 7px 8px;
  }

  .detail-block {
    padding: 12px;
  }

  .route-panel,
  .lower-grid {
    margin-top: 12px;
  }

  .route-strip {
    padding: 10px;
  }

  .route-stop {
    flex-basis: 96px;
    min-height: 98px;
    padding: 10px;
  }

  .route-stop::before {
    top: 25px;
  }

  .lodging-row {
    grid-template-columns: 1fr;
  }

  .budget-row {
    grid-template-columns: 1fr;
  }

  .budget-input {
    min-height: 42px;
    text-align: left;
  }

  .day-dialog {
    width: 100vw;
    max-width: none;
    max-height: 92vh;
    margin: auto 0 0;
  }

  .dialog-card {
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
  }

  .dialog-header {
    padding: 14px;
  }

  .dialog-header h2 {
    font-size: 1.08rem;
  }
}

@media (max-width: 390px) {
  .main {
    padding-inline: 8px;
  }

  h1 {
    font-size: 1.76rem;
  }

  .summary-metrics span {
    font-size: 0.94rem;
  }

  .nav-item {
    min-width: 78px;
    font-size: 0.84rem;
  }

  .day-card {
    grid-template-columns: 70px minmax(0, 1fr) 30px;
    padding: 10px;
  }

  .day-date strong {
    font-size: 0.9rem;
  }

  .day-date span {
    font-size: 0.7rem;
  }
}
