@layer reset, base, layout, components, responsive;
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p, dl, dd { margin: 0; }
  button, input, select, textarea { font: inherit; }
  button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
  button { cursor: pointer; }
  svg { width: 19px; height: 19px; flex: 0 0 auto; }
  a { color: inherit; text-decoration: none; }
  button { color: inherit; }
  [hidden] { display: none !important; }
}
@layer base {
  :root { color-scheme: dark; --ground: #151b19; --surface: #1d2521; --raised: #26312a; --line: #35433b; --ink: #edf2eb; --muted: #adb9b0; --accent: #b7d6a3; --accent-ink: #182416; --danger: #f3b7a5; --radius: 8px; }
  body { color: var(--ink); background: var(--ground); font-family: "Segoe UI", system-ui, sans-serif; font-size: 15px; line-height: 1.55; scrollbar-color: var(--line) var(--ground); }
  ::selection { background: var(--accent); color: var(--accent-ink); }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
  h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(30px, 3vw, 44px); line-height: 1.15; letter-spacing: -.025em; text-wrap: balance; }
  h2 { font-size: 18px; line-height: 1.4; font-weight: 600; }
  h3 { font-size: 15px; font-weight: 600; }
  small { font-size: 12px; }
  input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 5px; padding: 10px 12px; color: var(--ink); background: var(--ground); min-height: 44px; caret-color: var(--accent); }
  input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
  textarea { resize: vertical; }
  input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); flex-shrink: 0; }
  label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 500; }
  fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 18px; }
  p { max-width: 72ch; }
  .muted { color: var(--muted); }
  .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
  .skip-link { position: fixed; top: 8px; left: 8px; transform: translateY(-200%); z-index: 10; background: var(--accent); color: var(--accent-ink); padding: 12px; }
  .skip-link:focus { transform: translateY(0); }
}
@layer layout {
  .workspace { min-height: 100svh; }
  .sidebar { overflow-y: auto; width: 236px; padding: 32px 22px 24px; border-right: 1px solid var(--line); background: var(--surface); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; }
  .main-column { margin-left: 236px; min-height: 100svh; display: flex; flex-direction: column; }
  .topbar { min-height: 76px; border-bottom: 1px solid var(--line); padding: 16px 40px; display: flex; justify-content: space-between; align-items: center; gap: 15px; font-size: 13px; color: var(--muted); }
  .topbar > div { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
  main#content { padding: 38px 40px 60px; flex: 1; width: 100%; max-width: 1580px; margin-inline: auto; min-width: 0; outline: none; }
  .page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 22px; margin-bottom: 34px; }
  .page-heading p { margin-top: 12px; }
  .page-heading > button { flex-shrink: 0; }
  .overview-summary { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 38px; background: var(--surface); }
  .preparation { padding: 26px 28px; }
  .budget-glance { padding: 26px 28px; border-left: 1px solid var(--line); }
  .overview-columns { display: grid; grid-template-columns: minmax(0, 1fr) 276px; gap: 36px; }
  .overview-columns > * { min-width: 0; }
  .trip-notes { border-left: 1px solid var(--line); padding-left: 28px; }
  .section-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
  .section-description { font-size: 13px; color: var(--muted); margin-top: 8px; margin-bottom: 18px; }
  footer { margin: 0 40px; padding: 18px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
  .welcome { max-width: 1200px !important; padding: 50px 48px !important; }
  .login-layout { display: grid; grid-template-columns: 1.2fr 1fr; gap: 80px; align-items: center; margin-top: 15vh; }
  .login-layout h1 { font-size: clamp(38px, 4vw, 58px); }
  .login-form { padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 18px; }
  .intro { margin-top: 22px; color: var(--muted); font-size: 18px; }
}
@layer components {
  .wordmark { display: inline-flex; gap: 7px; align-items: center; font-size: 18px; font-weight: 600; letter-spacing: -.5px; }
  .wordmark span { color: var(--accent); font-size: 23px; font-weight: 400; }
  .trip-picker { margin-top: 36px; color: var(--muted); font-size: 11px; }
  .trip-picker select { font-size: 13px; color: var(--ink); background: var(--surface); padding-inline: 9px; text-overflow: ellipsis; }
  .add-trip { justify-content: flex-start !important; font-size: 13px; padding-left: 0 !important; margin-top: 8px; }
  nav { display: grid; gap: 5px; margin: 28px -8px 20px; }
  nav a { min-height: 46px; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 5px; color: var(--muted); transition: background .16s ease-out, color .16s ease-out; }
  nav a:hover { color: var(--ink); background: var(--raised); }
  nav a[aria-current="page"] { background: #344732; color: #d9edcc; }
  .nav-count { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; }
  .sidebar-bottom { margin-top: auto; color: var(--muted); font-size: 12px; }
  .sidebar-bottom p { margin-bottom: 20px; }
  .sidebar-bottom button { padding-left: 0; }
  button { border: 0; }
  .primary, .secondary, .subtle, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; padding: 10px 16px; border-radius: 5px; font-size: 13px; font-weight: 600; transition: background .16s ease-out, transform .16s ease-out; }
  .primary { background: var(--accent); color: var(--accent-ink); }
  .primary:hover { background: #c8e4b7; transform: translateY(-1px); }
  .secondary { border: 1px solid var(--line); background: transparent; }
  .secondary:hover, .subtle:hover, .icon-button:hover { background: var(--raised); }
  .subtle, .icon-button { background: transparent; color: var(--muted); }
  .icon-button { padding: 8px; width: 38px; min-height: 38px; }
  button:active { transform: translateY(1px); }
  button:disabled { cursor: default; opacity: .6; transform: none; }
  .text-link { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--accent); background: transparent; padding: 0; min-height: 32px; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 5px; transition: text-decoration-color .15s; }
  .text-link:hover { text-decoration-color: currentColor; }
  .text-link svg { width: 16px; }
  .badge { display: inline-flex; padding: 5px 9px; border-radius: 4px; background: var(--raised); color: #d0dbd3; font-size: 11px; line-height: 1.5; font-weight: 500; max-width: 100%; }
  .badge.green { color: #c8e5b5; background: #30432e; }
  progress { appearance: none; width: 100%; height: 8px; display: block; border: none; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 28px; }
  progress::-webkit-progress-bar { background: var(--line); }
  progress::-webkit-progress-value { background: var(--accent); }
  progress::-moz-progress-bar { background: var(--accent); }
  .preparation .section-head span { font-size: 12px; color: var(--muted); }
  .preparation-bottom { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; margin-bottom: 15px; font-size: 13px; }
  .preparation-bottom span { color: var(--muted); }
  .budget-glance h2 { font-size: 13px; color: var(--muted); font-weight: 400; }
  .budget-range { font-size: 26px; line-height: 1.5; letter-spacing: -.6px; margin: 8px 0; font-variant-numeric: tabular-nums; }
  .budget-range span { color: var(--muted); }
  .task-list { border-top: 1px solid var(--line); }
  .task-row { width: 100%; padding: 18px 4px; background: transparent; text-align: left; display: flex; align-items: flex-start; gap: 13px; border-bottom: 1px solid var(--line); border-radius: 0; transition: background .15s; }
  .task-row:hover { background: var(--surface); }
  .task-state { width: 19px; height: 19px; border: 1px solid #809183; border-radius: 4px; flex-shrink: 0; margin-top: 4px; }
  .task-state.complete { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
  .task-state svg { width: 17px; height: 17px; }
  .task-text { min-width: 0; display: flex; flex-direction: column; gap: 4px; flex: 1; }
  .task-text strong { font-size: 14px; line-height: 1.5; font-weight: 500; overflow-wrap: anywhere; }
  .task-text > .muted { font-size: 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .task-code { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
  .task-meta { flex-shrink: 0; max-width: 140px; display: flex; flex-direction: column; align-items: flex-end; gap: 7px; font-size: 11px; text-align: right; }
  .critical { color: #e2c492; }
  .overdue { color: var(--danger); }
  .trip-notes dl { margin-top: 20px; }
  .trip-notes dl > div { padding: 0 0 20px; }
  dt { font-size: 12px; color: var(--muted); }
  dd { font-size: 24px; margin-top: 4px; font-variant-numeric: tabular-nums; }
  dd span { font-size: 13px; color: var(--muted); }
  .note { font-size: 13px; color: var(--muted); margin: 16px 0; }
  .baseline-note { border-top: 1px solid var(--line); padding-top: 22px; margin-top: 24px; }
  .baseline-note p { font-size: 12px; color: var(--muted); margin-top: 8px; }
  .filters { display: flex; align-items: flex-end; gap: 16px; margin: 26px 0 22px; }
  .search-field { flex: 1; }
  .filters > label:not(.search-field):not(.check-filter) { width: 190px; }
  .check-filter { display: flex; align-items: center; flex-direction: row; gap: 9px; min-height: 44px; font-size: 13px; }
  .filters .check-filter { padding-bottom: 2px; }
  .itinerary, .booking-list { display: grid; gap: 18px; }
  .flight, .booking, .payment { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
  .flight-route { display: grid; grid-template-columns: 1fr 100px 1fr; align-items: center; margin-top: 24px; gap: 24px; }
  .flight-route > div { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
  .flight-route > div:last-child { text-align: right; align-items: flex-end; }
  .flight-route small { color: var(--muted); }
  .flight-time { font-size: 32px; font-weight: 500; font-variant-numeric: tabular-nums; }
  .flight-route > .flight-line { align-items: center; font-size: 11px; color: var(--muted); }
  .flight-line svg { width: 80px; height: 40px; stroke-width: 1; }
  .booking > p { margin-top: 12px; font-size: 13px; color: var(--muted); }
  details { margin-top: 16px; font-size: 13px; }
  summary { cursor: pointer; color: var(--accent); padding: 5px 0; min-height: 32px; }
  details p { padding-top: 10px; overflow-wrap: anywhere; white-space: pre-line; }
  .financial-summary { display: flex; gap: 44px; border-block: 1px solid var(--line); padding: 24px 0; }
  .financial-summary > div { display: flex; flex-direction: column; gap: 8px; }
  .financial-summary span { color: var(--muted); font-size: 13px; }
  .financial-summary strong { font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }
  .table-wrap { overflow-x: auto; margin-top: 24px; }
  table { width: 100%; border-collapse: collapse; min-width: 760px; text-align: left; font-size: 13px; }
  thead { color: var(--muted); font-size: 11px; }
  th { font-weight: 500; }
  th, td { border-bottom: 1px solid var(--line); padding: 18px 14px; vertical-align: top; font-variant-numeric: tabular-nums; }
  th:first-child, td:first-child { padding-left: 0; }
  th:last-child, td:last-child { padding-right: 0; }
  td { white-space: nowrap; }
  tbody th { min-width: 180px; max-width: 270px; }
  td small, th small { display: block; color: var(--muted); font-size: 11px; margin-top: 5px; }
  .journal-summary { margin-bottom: 30px; padding-bottom: 24px; border-bottom: 1px solid var(--line); display: flex; align-items: baseline; gap: 24px; flex-wrap: wrap; }
  .journal-summary strong { font-size: 32px; font-weight: 400; font-variant-numeric: tabular-nums; }
  .journal-summary span { font-size: 13px; color: var(--muted); }
  .payment { margin-bottom: 18px; }
  .payment h2 { font-size: 16px; }
  .payment-amount { font-size: 24px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .payment > p { font-size: 12px; margin-top: 10px; }
  .allocation { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-top: 1px solid var(--line); padding: 12px 0 0; margin-top: 12px; font-size: 13px; }
  .allocation strong { white-space: nowrap; font-weight: 500; }
  .empty { padding: 70px 0; }
  .empty p { margin: 14px 0 22px; color: var(--muted); }
  .empty.compact { padding: 40px 10px; }
  .loading { padding: 70px 0; color: var(--muted); }
  .notice { position: fixed; bottom: 24px; right: 24px; max-width: min(500px, calc(100vw - 48px)); padding: 14px 20px; background: var(--accent); color: var(--accent-ink); border-radius: 5px; box-shadow: 0 6px 30px #0005; z-index: 5; }
  dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100svh - 40px); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); background: var(--surface); padding: 28px; box-shadow: 0 20px 70px #0007; }
  dialog::backdrop { background: #080d0bc9; }
  dialog .section-head { margin-bottom: 24px; }
  dialog form { display: grid; gap: 18px; }
  .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .form-error { color: var(--danger); font-size: 13px; }
  .form-error:empty { display: none; }
  .form-actions { display: flex; gap: 10px; padding-top: 12px; }
  .login-form small { color: var(--muted); }
}
@layer responsive {
  @media (min-width: 1600px) { main#content { padding-top: 50px; } }
  @media (max-width: 1150px) {
    .sidebar { width: 210px; padding-inline: 18px; }
    .main-column { margin-left: 210px; }
    main#content { padding: 30px 26px 45px; }
    .topbar { padding-inline: 26px; }
    footer { margin-inline: 26px; }
    .overview-columns { grid-template-columns: minmax(0, 1fr); }
    .trip-notes { padding: 24px 0 0; border-left: 0; border-top: 1px solid var(--line); }
    .trip-notes dl { display: flex; gap: 40px; flex-wrap: wrap; }
    .overview-summary { grid-template-columns: minmax(0, 1.3fr) minmax(210px, 1fr); }
    .preparation, .budget-glance { padding: 22px; }
    .budget-range { font-size: 22px; }
    .preparation .section-head { align-items: flex-start; flex-direction: column; gap: 4px; }
    .filters { flex-wrap: wrap; }
    .financial-summary { flex-direction: column; gap: 20px; }
  }
  @media (max-width: 760px) {
    .sidebar { position: static; width: 100%; padding: 20px 20px 0; border-right: 0; border-bottom: 1px solid var(--line); }
    .wordmark { font-size: 17px; }
    .trip-picker { margin-top: 20px; }
    .sidebar .add-trip { align-self: flex-start; }
    nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin: 15px -8px 0; scrollbar-width: thin; padding-bottom: 8px; }
    nav a { flex-direction: column; justify-content: center; min-width: 0; flex: 1; min-height: 62px; gap: 6px; padding: 9px 3px; font-size: 11px; text-align: center; }
    .nav-count { display: none; }
    .sidebar-bottom { display: flex; justify-content: flex-end; position: absolute; top: 14px; right: 14px; }
    .sidebar-bottom p { display: none; }
    .sidebar-bottom button { font-size: 11px; padding: 8px; }
    .main-column { margin-left: 0; }
    .topbar { min-height: 52px; padding: 8px 20px; }
    .connection { display: none; }
    main#content { padding: 28px 20px 44px; }
    footer { margin-inline: 20px; }
    .page-heading { flex-wrap: wrap; gap: 16px; margin-bottom: 26px; }
    .page-heading p { font-size: 13px; }
    .page-heading > button { width: 100%; }
    .overview-summary { grid-template-columns: 1fr; margin-bottom: 30px; }
    .preparation .section-head { flex-direction: row; align-items: center; }
    .budget-glance { border-left: 0; border-top: 1px solid var(--line); }
    .budget-range br { display: none; }
    .budget-range { font-size: clamp(21px, 5.8vw, 26px); }
    .overview-columns { gap: 28px; }
    .section-head { gap: 10px; align-items: flex-start; }
    .section-head h2 { font-size: 16px; }
    .task-row { gap: 10px; }
    .task-meta { max-width: 108px; gap: 6px; }
    .task-text strong { font-size: 13px; }
    .task-meta .badge { font-size: 10px; padding: 4px 6px; }
    .filters { gap: 12px; }
    .filters .search-field, .filters > label:not(.search-field):not(.check-filter) { width: 100%; flex-basis: 100%; }
    .trip-notes dl { gap: 20px; }
    .flight, .booking, .payment { padding: 18px; }
    .flight-route { grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr); gap: 8px; }
    .flight-route .muted, .flight-route small { font-size: 10px; overflow-wrap: anywhere; }
    .flight-route > .flight-line span { display: none; }
    .flight-line svg { width: 24px; }
    .flight-time { font-size: 26px; }
    .booking .section-head, .payment .section-head { flex-direction: column; }
    .journal-summary { gap: 10px; }
    .payment-amount { font-size: 22px; }
    .allocation { font-size: 12px; }
    .welcome { padding: 28px 24px !important; }
    .login-layout { grid-template-columns: 1fr; gap: 32px; margin-top: 55px; }
    .login-layout h1 { font-size: 38px; }
    .intro { font-size: 15px; }
    .login-form { padding: 24px; }
    dialog { padding: 20px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-actions > button { flex: 1; }
  }
  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
}

@layer components {
  .heading-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
  .budget-edit { color: var(--accent); text-align: left; background: transparent; padding: 3px 0; text-underline-offset: 4px; line-height: inherit; }
  .budget-edit:hover { text-decoration: underline; }
  .flight > .text-link, .booking > .text-link { margin-top: 16px; }
  .form-section { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 0; }
  .form-section > summary { font-weight: 600; padding-block: 10px; }
  .optional-fields { display: grid; gap: 16px; margin-top: 12px; }
  .repeater-row { display: grid; gap: 12px; padding: 18px 0; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
  .repeater-row .text-link { justify-self: start; }
}
@layer responsive {
  @media (max-width: 760px) {
    .heading-actions { width: 100%; justify-content: flex-start; }
    .heading-actions > button { flex: 1; }
  }
}

@layer components {
  .payment-actions { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-top: 18px; }
  .payment-void { background: transparent; }
  .allocation small { display: block; color: var(--muted); margin-top: 5px; }
  .currency-summary { margin-bottom: 24px; }
  .pending-notice { border: 1px solid #a58d5f; padding: 22px; margin-bottom: 24px; border-radius: var(--radius); }
  .pending-notice p { color: var(--muted); font-size: 13px; margin: 10px 0 18px; }
  .recovery-details { display: grid; gap: 8px; margin: 8px 0; }
  .recovery-details dd { font-size: 20px; }
}

@layer components {
  .journey-section { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }
  .journey-section h2 { margin-bottom: 16px; }
  .journey-section p { margin-block: 12px; }
  .journey-section .heading-actions { justify-content: flex-start; margin-top: 16px; }
  .snapshot-content { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.6; max-height: 50vh; overflow-y: auto; }
  .result-note { white-space: pre-wrap; overflow-wrap: anywhere; }
  .journey-section td small { display: block; margin-top: 6px; color: var(--muted); }
  .journey-section td { overflow-wrap: anywhere; }
}
@layer components {
  .snapshot-record { padding-block: 16px; border-bottom: 1px solid var(--line); }
  .snapshot-record p { margin-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
  .snapshot-record small { display: block; color: var(--muted); }
}
@layer components {
  .account-row { display: flex; gap: 20px; justify-content: space-between; align-items: center; padding-block: 22px; border-bottom: 1px solid var(--line); }
  .account-row h2 { margin-bottom: 8px; overflow-wrap: anywhere; }
}
@layer responsive {
  @media (max-width: 760px) {
    nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .sidebar-bottom { position: static; flex-direction: row; justify-content: flex-start; gap: 8px; margin-block: 8px; }
    .sidebar-bottom button { font-size: 12px; min-height: 44px; padding: 6px; }
    .account-row { align-items: flex-start; flex-direction: column; }
  }
}
