:root {
  color-scheme: light;
  --paper: #f5f6f8;
  --card: #fff;
  --ink: #182027;
  --muted: #64717d;
  --faint: #8a96a1;
  --line: #e1e5e9;
  --soft-line: #edf0f3;
  --accent: #c14932;
  --accent-dark: #a53e2b;
  --accent-soft: #f9eeeb;
  --success: #16745d;
  --danger: #b93d42;
  --shadow: 0 10px 34px rgba(24, 32, 39, .055);
  --radius: 14px;
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: var(--paper); }
button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: inherit; }
.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; padding: 9px 12px; transform: translateY(-160%); background: var(--ink); color: white; border-radius: 7px; }
.skip-link:focus { transform: none; }
.app-shell { min-height: 100vh; }
.loading { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 14px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.topbar { position: sticky; z-index: 5; top: 0; display: flex; align-items: center; gap: 20px; height: 68px; padding: 0 max(22px, calc((100vw - 1336px) / 2)); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.95); backdrop-filter: blur(16px); }
.brand { display: inline-flex; flex-shrink: 0; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 8px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 750; letter-spacing: -.5px; }
.brand-name { display: flex; align-items: baseline; gap: 5px; font-size: 14px; font-weight: 700; letter-spacing: -.4px; }
.brand-name em { color: var(--accent); font-style: normal; font-weight: 600; }
.topbar-context { overflow: hidden; padding-left: 17px; border-left: 1px solid var(--line); color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.topbar-spacer { flex: 1; }
.topbar-user { color: var(--muted); font-size: 12px; }
.icon-button { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; transition: background .16s,border-color .16s,transform .16s; }
.icon-button:hover { border-color: #c7cfd6; background: #f8f9fa; }
.icon-button:active, .button:active { transform: scale(.985); }
.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border: 1px solid transparent; border-radius: 8px; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; transition: background .16s,border-color .16s,color .16s,transform .16s; }
.button-primary { background: var(--ink); color: #fff; }
.button-primary:hover { background: var(--accent); }
.button-quiet { border-color: var(--line); background: #fff; color: var(--muted); }
.button-quiet:hover { border-color: #c7cfd6; background: #f8f9fa; color: var(--ink); }
.button-danger { border-color: #f0d9d9; background: #fff; color: var(--danger); }
.button-danger:hover { background: #fff7f7; }
.button-small { min-height: 32px; padding: 0 10px; font-size: 12px; }
.content { width: min(1336px, 100%); margin: 0 auto; padding: 38px 26px 68px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 8px; color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: 1.4px; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(27px, 4vw, 38px); font-weight: 650; letter-spacing: -1.25px; line-height: 1.1; text-wrap: balance; }
h2 { margin-bottom: 8px; font-size: 20px; font-weight: 650; letter-spacing: -.55px; }
h3 { font-size: 14px; font-weight: 650; }
.page-heading p:last-child { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.welcome { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(250px,.6fr); gap: 16px; margin-bottom: 28px; }
.welcome-copy { position: relative; overflow: hidden; min-height: 194px; padding: 25px 27px 24px; border: 1px solid #e9dfdc; border-radius: var(--radius); background: linear-gradient(113deg,#fff 0%,#fff 67%,#fbf1ee 100%); box-shadow: var(--shadow); }
.welcome-copy::after { position: absolute; top: -85px; right: -42px; width: 245px; height: 245px; border: 1px solid rgba(193,73,50,.12); border-radius: 50%; box-shadow: 0 0 0 24px rgba(193,73,50,.035),0 0 0 52px rgba(193,73,50,.025); content: ""; }
.welcome-copy h2 { max-width: 460px; margin: 0 0 11px; font-size: clamp(20px,2.5vw,28px); letter-spacing: -.8px; line-height: 1.24; }
.welcome-copy p:last-child { max-width: 420px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.welcome-mark { display: flex; min-height: 194px; align-items: center; justify-content: center; gap: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ink); color: #fff; box-shadow: var(--shadow); }
.mark-route { width: 68px; height: 68px; }
.welcome-mark span { color: #a0abb5; font-size: 11px; letter-spacing: 1.5px; }
.metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-bottom: 35px; }
.metric { min-height: 87px; padding: 16px 19px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); }
.metric-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.metric strong { font-size: 24px; font-weight: 650; letter-spacing: -.8px; font-variant-numeric: tabular-nums; }
.metric-next { font-size: 16px !important; letter-spacing: -.2px !important; }
.planner-grid { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 17px; align-items: start; }
.new-trip-panel { position: sticky; top: 84px; }
.new-trip-panel h2 { margin-bottom: 17px; font-size: 18px; }
.stack-form { display: grid; gap: 12px; }
.stack-form label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 600; }
.stack-form input, .stack-form textarea { width: 100%; min-height: 40px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; outline: none; background: #fff; color: var(--ink); font-size: 12px; font-weight: 400; }
.stack-form textarea { min-height: 70px; resize: vertical; }
.stack-form input:focus, .stack-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(193,73,50,.1); }
.trip-page-heading { margin-top: 19px; }
.add-stop-panel { margin-top: 17px; }
.add-stop-panel h3 { margin: 0 0 14px; font-size: 16px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.section-heading h2 { margin: 0; font-size: 17px; }
.trip-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.trip-card { min-height: 202px; padding: 19px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); box-shadow: 0 1px 2px rgba(24,32,39,.025); transition: border-color .18s,transform .18s,box-shadow .18s; }
.trip-card:hover { transform: translateY(-2px); border-color: #d0d6dc; box-shadow: var(--shadow); }
.trip-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 23px; }
.trip-card .trip-destination { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: 11px; font-weight: 600; }
.trip-card h3 { min-height: 22px; margin: 0 0 7px; font-size: 17px; letter-spacing: -.4px; }
.trip-dates { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.trip-card-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 17px; padding-top: 13px; border-top: 1px solid var(--soft-line); color: var(--faint); font-size: 11px; }
.trip-link { color: var(--ink); font-size: 12px; font-weight: 600; text-decoration: none; }
.trip-link:hover { color: var(--accent); }
.empty-state { display: grid; min-height: 230px; place-items: center; padding: 30px; border: 1px dashed #cdd4db; border-radius: 12px; background: rgba(255,255,255,.5); text-align: center; }
.empty-mark { display: grid; width: 46px; height: 46px; place-items: center; margin: 0 auto 12px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-size: 18px; }
.empty-state h3 { margin: 0 0 7px; }
.empty-state p { max-width: 310px; margin: 0 auto 15px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.trip-overview { display: grid; grid-template-columns: minmax(0,1fr) 286px; gap: 18px; align-items: start; }
.trip-overview-main { min-width: 0; }
.trip-overview-aside { display: grid; gap: 13px; }
.panel { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.panel h3 { margin: 0 0 13px; }
.note-copy { color: var(--muted); font-size: 12px; line-height: 1.7; white-space: pre-wrap; }
.day-section { margin-bottom: 13px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.day-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 16px; background: #fafbfc; border-bottom: 1px solid var(--soft-line); }
.day-date { display: flex; align-items: baseline; gap: 9px; }
.day-date strong { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.day-date span { color: var(--muted); font-size: 11px; }
.stop-list { margin: 0; padding: 3px 16px 6px; list-style: none; }
.stop-item { position: relative; display: grid; grid-template-columns: 61px 17px minmax(0,1fr) auto; gap: 10px; align-items: start; padding: 13px 0; }
.stop-item + .stop-item { border-top: 1px solid var(--soft-line); }
.stop-time { padding-top: 2px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.stop-pin { position: relative; display: grid; width: 17px; height: 17px; place-items: center; }
.stop-pin::before { width: 8px; height: 8px; border: 2px solid var(--accent); border-radius: 50%; background: #fff; content: ""; }
.stop-copy { min-width: 0; }
.stop-copy strong { display: block; margin-bottom: 3px; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.stop-copy p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; overflow-wrap: anywhere; }
.stop-copy .stop-note { margin-top: 6px; color: var(--faint); white-space: pre-wrap; }
.stop-actions { display: flex; align-items: center; gap: 6px; }
.stop-map { color: var(--accent); font-size: 11px; text-decoration: none; white-space: nowrap; }
.day-empty { margin: 0 16px 14px 104px; color: var(--faint); font-size: 11px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { min-height: 18px; margin: 0; color: var(--danger); font-size: 12px; }
.dialog { width: min(500px,calc(100vw - 26px)); max-width: none; max-height: min(88dvh,760px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 15px; background: var(--card); color: var(--ink); box-shadow: 0 22px 80px rgba(10,17,24,.25); }
.dialog::backdrop { background: rgba(14,21,28,.48); backdrop-filter: blur(2px); }
.dialog-form { display: grid; gap: 14px; padding: 23px; }
.dialog-top { display: flex; align-items: start; justify-content: space-between; margin-bottom: 3px; }
.dialog-top h2 { margin: 0; font-size: 21px; }
.dialog-form label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 600; }
.dialog-form input, .dialog-form textarea, .auth-card input { width: 100%; min-height: 42px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 7px; outline: none; background: #fff; color: var(--ink); font-size: 13px; font-weight: 400; }
.dialog-form textarea { min-height: 82px; resize: vertical; }
.dialog-form input:focus, .dialog-form textarea:focus, .auth-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(193,73,50,.1); }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 3px; }
.search-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.search-row .button { min-height: 42px; }
.place-results { display: grid; gap: 6px; }
.place-result { width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 7px; background: white; text-align: left; cursor: pointer; }
.place-result:hover { border-color: #e0b2a7; background: #fdf8f6; }
.place-result strong, .place-result span { display: block; }
.place-result strong { margin-bottom: 4px; font-size: 12px; }
.place-result span { color: var(--muted); font-size: 10px; }
.muted-hint { margin: 0; color: var(--faint); font-size: 11px; font-weight: 400; line-height: 1.55; }
.toast { position: fixed; z-index: 30; right: 20px; bottom: 20px; max-width: min(420px,calc(100vw - 32px)); padding: 12px 15px; border: 1px solid var(--line); border-radius: 9px; background: var(--ink); color: white; box-shadow: var(--shadow); font-size: 12px; }
.auth-screen { display: grid; min-height: 100vh; grid-template-columns: minmax(0,1.1fr) minmax(360px,.9fr); }
.auth-story { position: relative; display: flex; min-height: 100vh; flex-direction: column; justify-content: space-between; overflow: hidden; padding: clamp(26px,5vw,68px); background: var(--ink); color: white; }
.auth-story::after { position: absolute; right: -125px; bottom: -160px; width: 440px; height: 440px; border: 1px solid rgba(242,132,108,.24); border-radius: 50%; box-shadow: 0 0 0 35px rgba(242,132,108,.055),0 0 0 80px rgba(242,132,108,.035); content: ""; }
.auth-story .brand-name { color: white; }
.auth-story .brand-mark { background: #29323a; }
.auth-copy { position: relative; z-index: 1; max-width: 490px; margin: auto 0; padding: 70px 0; }
.auth-copy .eyebrow { color: #f2846c; }
.auth-copy h1 { margin-bottom: 16px; font-size: clamp(35px,5vw,58px); line-height: 1.06; }
.auth-copy p { max-width: 400px; color: #aeb8c1; font-size: 14px; line-height: 1.75; }
.auth-route { position: absolute; z-index: 0; right: 9%; bottom: 20%; width: 180px; height: 180px; opacity: .8; }
.auth-foot { position: relative; z-index: 1; color: #7d8993; font-size: 10px; }
.auth-side { display: grid; place-items: center; padding: 28px; background: var(--paper); }
.auth-card { width: min(100%,390px); padding: 29px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.auth-card h2 { margin: 0 0 8px; font-size: 22px; }
.auth-card > p { margin-bottom: 21px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.auth-form { display: grid; gap: 13px; }
.auth-form label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 600; }
.auth-form .button { width: 100%; margin-top: 3px; }
.auth-form .form-error { min-height: 16px; }
.auth-security { display: flex; align-items: center; gap: 7px; margin-top: 16px; color: var(--faint); font-size: 10px; }
.auth-security::before { width: 6px; height: 6px; border-radius: 50%; background: var(--success); content: ""; }
.notice { padding: 11px 12px; border: 1px solid #f0d9d9; border-radius: 8px; background: #fff7f7; color: var(--danger); font-size: 11px; line-height: 1.55; }
.back-button { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; }
.back-button:hover { color: var(--ink); }

@media (max-width: 900px) {
  .trip-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .trip-overview { grid-template-columns: minmax(0,1fr) 240px; }
  .planner-grid { grid-template-columns: minmax(0,1fr) 260px; }
}
@media (max-width: 680px) {
  .topbar { height: 58px; gap: 12px; padding: 0 15px; }
  .brand-mark { width: 31px; height: 31px; }
  .brand-name { font-size: 13px; }
  .topbar-context { padding-left: 10px; font-size: 11px; }
  .topbar-user { display: none; }
  .content { padding: 26px 15px 48px; }
  .page-heading { align-items: start; flex-direction: column; gap: 14px; margin-bottom: 19px; }
  .page-heading > .button { width: 100%; }
  .welcome { grid-template-columns: 1fr; }
  .welcome-copy { min-height: 166px; padding: 21px; }
  .welcome-mark { display: none; }
  .metrics { gap: 7px; margin-bottom: 26px; }
  .metric { min-height: 76px; padding: 12px 10px; }
  .metric-label { min-height: 26px; font-size: 10px; line-height: 1.35; }
  .metric strong { font-size: 20px; }
  .trip-grid { grid-template-columns: 1fr; gap: 10px; }
  .planner-grid { grid-template-columns: 1fr; }
  .new-trip-panel { position: static; }
  .trip-card { min-height: 175px; padding: 16px; }
  .trip-overview { grid-template-columns: 1fr; }
  .trip-overview-aside { grid-template-columns: 1fr; }
  .auth-screen { min-height: 100dvh; grid-template-columns: 1fr; }
  .auth-story { display: none; }
  .auth-side { min-height: 100dvh; padding: 17px; }
  .auth-card { padding: 23px; }
  .field-row { grid-template-columns: 1fr; }
  .dialog-form { padding: 18px; }
  .stop-list { padding-right: 12px; padding-left: 12px; }
  .stop-item { grid-template-columns: 48px 14px minmax(0,1fr) auto; gap: 7px; }
  .day-empty { margin-left: 81px; }
}
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
