/* dtitinerary — the rep's workspace (light). Source of truth: DESIGN.md
   Signature: the rail — the trip drawn as a line of stations (route strip, day timeline, step progress). */

:root {
  --bg: #F1F2EF;          /* mist */
  --surface: #FFFFFF;
  --surface-2: #F7F8F5;
  --ink: #17150F;         /* brand black */
  --ink-2: #4F4B44;
  --ink-3: #6F6A61;
  --rule: #E1E2DD;
  --rule-2: #C9CBC4;
  --field: #8A8C85;       /* input borders, 3.4:1 on white */
  --night: #121110;       /* top bar */
  --brass: #D9B77E;       /* the one action colour */
  --brass-hover: #CFA968;
  --brass-deep: #7C5A1C;  /* brass as text on light */
  --brass-wash: #F7EFDF;
  --tea: #256B4A;   --tea-wash: #E4F1EA;
  --signal: #B3261E; --signal-wash: #FCEBEA;
  --amber: #7A4E00; --amber-wash: #FFF3D4;

  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-ui: "Figtree", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --fs-h1: clamp(1.5rem, 1.3rem + .8vw, 1.875rem);
  --fs-h2: 1.25rem;
  --fs-body: .9375rem;
  --fs-small: .8125rem;
  --fs-micro: .6875rem;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r: 12px; --r-sm: 8px; --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(23, 21, 15, .06);
  --shadow-float: 0 18px 50px -18px rgba(23, 21, 15, .35);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --max: 1320px;
  --gutter: 16px;
  --head-h: 56px;
}
@media (min-width: 900px) { :root { --gutter: 24px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-ui); font-size: var(--fs-body); line-height: 1.5; -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
h1, .display { font-family: var(--font-display); font-weight: 500; font-size: var(--fs-h1); letter-spacing: -.012em; font-variation-settings: "SOFT" 50; }
h2 { font-size: var(--fs-h2); font-family: var(--font-display); font-weight: 500; font-variation-settings: "SOFT" 50; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--brass-deep); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
.num, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.subtle { color: var(--ink-3); }
.small { font-size: var(--fs-small); }
.eyebrow { font-size: var(--fs-micro); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brass-deep); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; left: 8px; top: -60px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: var(--r-sm); z-index: 100; }
.skip-link:focus { top: 8px; }

/* ------------------------------------------------------------------ top bar */
.topbar { background: var(--night); color: #F4EEE4; height: var(--head-h); position: sticky; top: 0; z-index: 40; }
.topbar-inner { max-width: var(--max); margin: 0 auto; height: 100%; padding: 0 var(--gutter); display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; min-width: 0; }
.brand img { height: 24px; width: auto; }
.brand-app { font-size: var(--fs-small); color: #A9A092; padding-left: 12px; border-left: 1px solid #3A352F; white-space: nowrap; }
.topnav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.topnav a, .topnav button { color: #D9D2C5; text-decoration: none; font: 500 var(--fs-small)/1 var(--font-ui); padding: 10px 12px; border-radius: var(--r-sm); background: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.topnav a:hover, .topnav button:hover { color: #fff; background: #221F1B; }
.topnav a[aria-current="page"] { color: #fff; box-shadow: inset 0 -2px 0 var(--brass); border-radius: 0; }
.topnav .btn-primary { background: var(--brass); color: var(--ink); padding: 0 14px; margin-left: 8px; height: 34px; border-radius: var(--r-pill); }
.topnav .btn-primary:hover { background: var(--brass-hover); color: var(--ink); }
.inline-form { display: inline; margin: 0; }
@media (max-width: 719px) {
  .brand-app, .topnav .hide-sm { display: none; }
}

/* ------------------------------------------------------------------ layout */
.wrap { max-width: var(--max); margin: 0 auto; padding: var(--s5) var(--gutter) var(--s7); }
.wrap-narrow { max-width: 980px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: var(--s5); }
.page-head p { color: var(--ink-2); margin-top: 6px; }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--r-pill); border: 1px solid transparent; font: 600 .875rem/1 var(--font-ui); text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease); }
.btn-primary { background: var(--brass); color: var(--ink); }
.btn-primary:hover { background: var(--brass-hover); color: var(--ink); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--rule-2); }
.btn-secondary:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-ghost { background: none; color: var(--ink-2); padding: 0 10px; }
.btn-ghost:hover { background: rgba(23, 21, 15, .06); color: var(--ink); }
.btn-danger { background: none; color: var(--signal); padding: 0 10px; }
.btn-danger:hover { background: var(--signal-wash); color: var(--signal); }
.btn-sm { height: 32px; padding: 0 12px; font-size: var(--fs-small); }
.btn-lg { height: 48px; padding: 0 22px; font-size: .9375rem; }
.btn-block { width: 100%; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: var(--r-sm); background: none; border: 0; color: var(--ink-3); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.btn-icon:hover { background: rgba(23, 21, 15, .07); color: var(--ink); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }

/* ------------------------------------------------------------------ tags */
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--r-pill); font-size: .75rem; font-weight: 600; line-height: 1; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--rule); }
.tag-brass { background: var(--brass-wash); color: var(--brass-deep); border-color: #EAD9B8; }
.tag-ok { background: var(--tea-wash); color: var(--tea); border-color: #C9E2D4; }
.tag-warn { background: var(--amber-wash); color: var(--amber); border-color: #F2DFAE; }
.tag-bad { background: var(--signal-wash); color: var(--signal); border-color: #F4C9C5; }
.tag .ic { width: 12px; height: 12px; }

/* ------------------------------------------------------------------ forms */
.form-section { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); padding: var(--s5); }
.form-section + .form-section { margin-top: var(--s4); }
.form-section > h2 { font-size: 1.0625rem; margin-bottom: 4px; }
.form-section > .lede { color: var(--ink-3); font-size: var(--fs-small); margin-bottom: var(--s4); }
.grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.grid > * { grid-column: span 12; }
@media (min-width: 720px) {
  .span-2 { grid-column: span 2 !important; } .span-3 { grid-column: span 3 !important; } .span-4 { grid-column: span 4 !important; } .span-6 { grid-column: span 6 !important; } .span-8 { grid-column: span 8 !important; }
}
.field label, .label { display: block; font-size: var(--fs-small); font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.field .opt { font-weight: 400; color: var(--ink-3); }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=search], input[type=password], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--field); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: 400 .9375rem/1.4 var(--font-ui);
}
textarea { resize: vertical; min-height: 84px; }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2317150F' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(217, 183, 126, .45); }
.help { font-size: var(--fs-small); color: var(--ink-3); margin-top: 6px; }
.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--signal); font-size: var(--fs-small); font-weight: 600; }
.field.has-error input, .field.has-error select { border-color: var(--signal); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--ink); flex: none; }
.check-title { font-weight: 600; font-size: .9375rem; }
.stepper-num { display: flex; align-items: stretch; border: 1px solid var(--field); border-radius: var(--r-sm); overflow: hidden; height: 42px; background: var(--surface); }
.stepper-num input { border: 0; border-radius: 0; text-align: center; min-height: 40px; -moz-appearance: textfield; }
.stepper-num input::-webkit-inner-spin-button { -webkit-appearance: none; }
.stepper-num button { width: 40px; flex: none; border: 0; background: var(--surface-2); font-size: 1.125rem; cursor: pointer; color: var(--ink); }
.stepper-num button:hover { background: var(--brass-wash); }
.stepper-num:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(217, 183, 126, .45); }

/* ------------------------------------------------------------------ alerts & flash */
.flash { display: grid; gap: 8px; margin-bottom: var(--s4); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid var(--rule); background: var(--surface); font-size: .875rem; }
.alert .ic { margin-top: 2px; }
.alert-success { background: var(--tea-wash); border-color: #C9E2D4; color: #17402D; }
.alert-success .ic { color: var(--tea); }
.alert-error { background: var(--signal-wash); border-color: #F4C9C5; color: #6E1712; }
.alert-error .ic { color: var(--signal); }
.alert-info { background: var(--surface); }
.alert-info .ic { color: var(--brass-deep); }
.alert-warning { background: var(--amber-wash); border-color: #F2DFAE; color: #4E3200; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-pill); font-size: var(--fs-small); font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s var(--ease); z-index: 90; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------------ the rail (signature) */
.rail { --dot: 12px; display: flex; align-items: flex-start; position: relative; padding-top: 2px; min-width: 0; }
.rail::before { content: ""; position: absolute; left: 0; right: 0; top: calc(2px + var(--dot) / 2 - 1px); height: 2px; background: var(--brass); }
.rail-stop { flex: 1 1 0; min-width: 64px; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; gap: 4px; }
.rail-stop:first-child { align-items: flex-start; text-align: left; }
.rail-stop:last-child { align-items: flex-end; text-align: right; }
.rail-dot { width: var(--dot); height: var(--dot); border-radius: 50%; background: var(--brass); border: 2px solid var(--brass); position: relative; }
.rail-stop.is-gate .rail-dot { background: var(--surface); }
.rail-name { font-size: var(--fs-small); font-weight: 600; line-height: 1.2; }
.rail-stop.is-gate .rail-name { font-weight: 500; color: var(--ink-2); }
.rail-sub { font-size: var(--fs-micro); color: var(--ink-3); font-weight: 600; letter-spacing: .04em; }
.rail-scroll { overflow-x: auto; scrollbar-width: none; }
.rail-scroll::-webkit-scrollbar { display: none; }
.rail-scroll .rail { min-width: max-content; gap: 8px; }
.rail-scroll .rail-stop { min-width: 90px; }

/* ------------------------------------------------------------------ builder head: trip + 4 steps */
.buildhead { background: var(--surface); border-bottom: 1px solid var(--rule); position: sticky; top: var(--head-h); z-index: 30; }
.buildhead-inner { max-width: var(--max); margin: 0 auto; padding: 10px var(--gutter); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 24px; align-items: center; }
.bh-trip { min-width: 0; display: flex; align-items: center; gap: 12px; }
.bh-back { color: var(--ink-3); }
.bh-name { font-family: var(--font-display); font-weight: 500; font-size: 1.125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variation-settings: "SOFT" 50; }
.bh-meta { font-size: var(--fs-small); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bh-actions { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.save-state { font-size: var(--fs-small); color: var(--ink-3); min-width: 5.5em; text-align: right; }
.save-state.is-error { color: var(--signal); font-weight: 600; }
.steps { grid-column: 1 / -1; display: flex; align-items: center; gap: 0; list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { flex: 1 1 0; position: relative; }
.steps li + li::before { content: ""; position: absolute; left: -50%; right: 50%; top: 13px; height: 2px; background: var(--rule-2); z-index: 0; }
.steps li.is-done + li::before, .steps li.is-current::before { background: var(--brass); }
.steps a, .steps span.step-link { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; color: var(--ink-3); font-size: var(--fs-small); font-weight: 600; padding-bottom: 2px; }
.step-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--rule-2); font-size: .75rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.steps .is-done .step-dot { background: var(--brass); border-color: var(--brass); color: var(--ink); }
.steps .is-current .step-dot { border-color: var(--ink); color: var(--ink); background: var(--brass-wash); box-shadow: 0 0 0 3px rgba(217, 183, 126, .35); }
.steps .is-current a { color: var(--ink); }
.steps a:hover { color: var(--ink); }
@media (max-width: 719px) {
  .buildhead-inner { grid-template-columns: minmax(0, 1fr); }
  .bh-actions { justify-content: space-between; }
  .bh-actions .btn-primary { margin-left: auto; }
  .step-label { font-size: .6875rem; }
}

/* ------------------------------------------------------------------ dashboard */
.dash-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: var(--s4); }
.search { position: relative; flex: 1 1 280px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input { padding-left: 38px; }
.segmented { display: inline-flex; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-pill); padding: 3px; gap: 2px; }
.segmented a { text-decoration: none; color: var(--ink-2); font-size: var(--fs-small); font-weight: 600; padding: 7px 12px; border-radius: var(--r-pill); white-space: nowrap; }
.segmented a[aria-current="true"] { background: var(--ink); color: #fff; }
.segmented a .count { color: var(--ink-3); font-weight: 500; margin-left: 4px; }
.segmented a[aria-current="true"] .count { color: #CFC7B9; }
.trips { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.trips-head, .trip-row { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.3fr) minmax(0, 1.1fr) minmax(0, 1.2fr) 90px; gap: 16px; align-items: center; padding: 12px 18px; }
.trips-head { font-size: var(--fs-micro); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--rule); background: var(--surface-2); }
.trip-row { border-bottom: 1px solid var(--rule); text-decoration: none; color: inherit; position: relative; }
.trip-row:last-child { border-bottom: 0; }
.trip-row:hover { background: #FBFBF9; }
.trip-row:hover .tr-name { text-decoration: underline; text-decoration-color: var(--brass); text-underline-offset: 4px; }
.tr-name { font-weight: 600; }
.tr-sub { font-size: var(--fs-small); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-line { display: flex; align-items: center; gap: 6px; font-size: var(--fs-small); color: var(--ink-2); flex-wrap: wrap; }
.tr-line i { width: 14px; height: 2px; background: var(--brass); display: inline-block; }
.tr-when { font-size: var(--fs-small); }
.tr-updated { font-size: var(--fs-small); color: var(--ink-3); text-align: right; }
@media (max-width: 899px) {
  .trips-head { display: none; }
  .trip-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .trip-row > :nth-child(1) { grid-column: 1 / 2; }
  .trip-row > :nth-child(4) { grid-column: 2 / 3; grid-row: 1; justify-self: end; }
  .trip-row > :nth-child(2), .trip-row > :nth-child(3) { grid-column: 1 / -1; }
  .trip-row > :nth-child(5) { display: none; }
}
.empty { text-align: center; padding: var(--s7) var(--s5); color: var(--ink-2); }
.empty h2 { margin-bottom: 8px; }
.empty .btn { margin-top: var(--s4); }

/* ------------------------------------------------------------------ trip step */
.trip-form-wrap { max-width: 860px; margin: 0 auto; }
.aside-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); padding: var(--s4) var(--s5); position: sticky; top: calc(var(--head-h) + 132px); }
.aside-card h2 { font-size: 1rem; margin-bottom: 10px; }
.aside-card ul { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: var(--fs-small); display: grid; gap: 6px; }
.form-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: var(--s4); }
.rep-new { margin-top: 10px; padding: 12px; border: 1px dashed var(--rule-2); border-radius: var(--r-sm); background: var(--surface-2); }
.rep-new summary { cursor: pointer; font-size: var(--fs-small); font-weight: 600; color: var(--brass-deep); }

/* ------------------------------------------------------------------ plan: route strip */
.route-strip { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); padding: 14px 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 20px; align-items: center; }
.route-strip .rail-scroll { padding: 2px 0; }
.route-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 719px) { .route-strip { grid-template-columns: minmax(0, 1fr); } .route-tools { justify-content: flex-start; } }

.route-editor { background: var(--surface); border: 1px solid var(--ink); border-radius: var(--r); margin-top: 10px; box-shadow: var(--shadow-float); overflow: hidden; }
.re-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--rule); }
.re-body { display: grid; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .re-body { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } .re-templates { border-right: 1px solid var(--rule); } }
.re-templates, .re-custom { padding: 14px 18px; min-width: 0; }
.re-templates h3, .re-custom h3 { margin-bottom: 10px; }
.tpl-list { display: grid; gap: 6px; max-height: 360px; overflow: auto; margin-top: 10px; padding-right: 4px; }
.tpl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; text-align: left; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; font: inherit; color: inherit; }
.tpl:hover { border-color: var(--ink-3); }
.tpl.is-current { border-color: var(--brass); background: var(--brass-wash); }
.tpl-name { font-weight: 600; }
.tpl-len { font-size: var(--fs-small); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tpl-stops { grid-column: 1 / -1; font-size: var(--fs-small); color: var(--ink-3); }
.stops-edit { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.stop-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) 118px auto; gap: 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--surface); }
.stop-row .rail-dot { margin: 0 auto; }
.stop-row .stepper-num { height: 34px; }
.stop-row .stepper-num input { min-height: 32px; padding: 4px; font-size: .875rem; }
.stop-row .stepper-num button { width: 32px; }
.stop-name { font-weight: 600; font-size: .875rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop-actions { display: flex; }
.gate-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.add-stop { display: flex; gap: 8px; }
.re-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--rule); background: var(--surface-2); }

/* ------------------------------------------------------------------ plan: checks */
.checks { margin-top: 12px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); }
.checks > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 12px 18px; font-weight: 600; }
.checks > summary::-webkit-details-marker { display: none; }
.checks > summary .chev { margin-left: auto; transition: transform .2s; color: var(--ink-3); }
.checks[open] > summary .chev { transform: rotate(180deg); }
.check-list { list-style: none; margin: 0; padding: 0 18px 12px; display: grid; gap: 6px; }
.check-item { display: flex; gap: 10px; align-items: flex-start; font-size: .875rem; line-height: 1.45; padding: 8px 10px; border-radius: var(--r-sm); }
.check-item .ic { margin-top: 2px; }
.check-item.lvl-block { background: var(--signal-wash); color: #6E1712; }
.check-item.lvl-block .ic { color: var(--signal); }
.check-item.lvl-warn { background: var(--amber-wash); color: #4E3200; }
.check-item.lvl-warn .ic { color: var(--amber); }
.check-item.lvl-info { background: var(--surface-2); color: var(--ink-2); }
.check-item.lvl-info .ic { color: var(--ink-3); }
.check-item a { color: inherit; font-weight: 600; }
.check-ok { display: flex; gap: 8px; align-items: center; color: var(--tea); font-weight: 600; }

/* ------------------------------------------------------------------ plan: board */
.board { display: grid; gap: var(--s4); grid-template-columns: minmax(0, 1fr); margin-top: var(--s4); align-items: start; }
@media (min-width: 1000px) { .board { grid-template-columns: minmax(0, 1fr) 400px; } }
@media (min-width: 1200px) { .board { grid-template-columns: minmax(0, 1fr) 440px; } }

.timeline { list-style: none; margin: 0; padding: 0 0 0 30px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 11px; top: 18px; bottom: 18px; width: 2px; background: var(--brass); }
.tday { position: relative; margin-bottom: 12px; }
.tday-node { position: absolute; left: -26px; top: 16px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brass); }
.tday.is-station .tday-node { background: var(--brass); width: 20px; height: 20px; left: -28px; top: 14px; box-shadow: 0 0 0 4px var(--bg); }
.tday.is-last .tday-node { background: var(--surface); border-style: solid; }
.tday-station { font-size: var(--fs-micro); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brass-deep); margin: 0 0 6px 2px; }
.tday-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--shadow-1); transition: border-color .15s, box-shadow .15s; }
.tday.is-selected .tday-card { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(217, 183, 126, .28); }
.tday-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 12px 14px 8px; cursor: pointer; }
.tday-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.tday-num { font-family: var(--font-display); font-size: 1.125rem; font-weight: 500; font-variation-settings: "SOFT" 50; }
.tday-date { color: var(--ink-3); font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.tday-dest { font-weight: 600; font-size: .875rem; }
.tday-dest select { min-height: 30px; height: 30px; padding: 2px 30px 2px 8px; font-size: .8125rem; font-weight: 600; width: auto; max-width: 220px; }
.tday-menu { display: flex; gap: 2px; align-items: center; }
.tday-transfer { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; font-size: var(--fs-small); color: var(--ink-2); }
.tday-transfer .ic { color: var(--ink-3); }
.load { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; font-size: .75rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.load-bar { flex: 1 1 auto; max-width: 220px; height: 6px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--rule); overflow: hidden; display: flex; }
.load-bar span { display: block; height: 100%; }
.load-bar .drive { background: repeating-linear-gradient(90deg, var(--rule-2) 0 4px, transparent 4px 7px); }
.load-bar .see { background: var(--brass); }
.load.is-over { color: var(--amber); font-weight: 600; }
.load.is-over .see { background: #D08A2E; }
.tday-body { padding: 0 14px 12px; }
.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; min-height: 44px; border-radius: var(--r-sm); }
.items.is-empty { border: 1.5px dashed var(--rule-2); display: grid; place-items: center; color: var(--ink-3); font-size: var(--fs-small); padding: 10px; text-align: center; }
.items.is-empty::before { content: attr(data-empty); }
.item { display: grid; grid-template-columns: 18px 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 6px 6px 4px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--surface); }
.item:hover { border-color: var(--rule-2); }
.item-grip { color: var(--rule-2); cursor: grab; display: grid; place-items: center; height: 100%; }
.item:hover .item-grip { color: var(--ink-3); }
.thumb { width: 44px; height: 34px; border-radius: 6px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-3); border: 1px solid var(--rule); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-main { min-width: 0; }
.item-name { font-weight: 600; font-size: .875rem; line-height: 1.3; }
.item-meta { display: flex; gap: 4px 8px; flex-wrap: wrap; align-items: center; font-size: .75rem; color: var(--ink-3); margin-top: 2px; }
.item-meta .tag { height: 20px; font-size: .6875rem; padding: 0 6px; }
.item-note { font-size: .75rem; color: var(--ink-2); font-style: italic; margin-top: 2px; }
.item-actions { display: flex; align-items: center; }
.item-actions select { min-height: 30px; height: 30px; font-size: .75rem; padding: 2px 26px 2px 8px; width: 92px; background-position: right 8px center; }
@media (hover: hover) and (min-width: 1000px) {
  .item-actions select { opacity: 0; transition: opacity .15s; }
  .item:hover .item-actions select, .item:focus-within .item-actions select { opacity: 1; }
}
.item-group { font-size: .6875rem; color: var(--brass-deep); font-weight: 700; }
.place .btn-add[disabled] { opacity: 1; background: var(--tea-wash); border-color: #C9E2D4; color: var(--tea); cursor: default; }
.lib-placeholder { padding: var(--s5); text-align: center; color: var(--ink-3); font-size: var(--fs-small); }
.more-hotels .btn { padding-left: 0; }
.item.is-custom .thumb { background: var(--brass-wash); color: var(--brass-deep); border-color: #EAD9B8; }
.tday-foot { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tday-foot .btn { height: 30px; font-size: .8125rem; }
.tday-notes { margin-top: 8px; display: grid; gap: 6px; }
.tday-notes input, .tday-notes textarea { font-size: .8125rem; min-height: 34px; }
.tday-checks { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.tday-checks .check-item { font-size: .8125rem; padding: 6px 8px; }
.sortable-ghost { opacity: .35; }
.sortable-chosen { box-shadow: var(--shadow-float); }
.sortable-drag { transform: rotate(1deg); }

/* ------------------------------------------------------------------ plan: library */
.library { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); position: sticky; top: calc(var(--head-h) + 118px); max-height: calc(100vh - var(--head-h) - 134px); display: flex; flex-direction: column; overflow: hidden; }
.lib-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--rule); display: grid; gap: 10px; }
.lib-target { display: flex; align-items: center; gap: 8px; font-size: .875rem; }
.lib-target strong { font-weight: 700; }
.lib-target select { width: auto; min-height: 32px; height: 32px; padding: 2px 30px 2px 10px; font-size: .8125rem; font-weight: 600; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 30px; padding: 0 12px; border-radius: var(--r-pill); border: 1px solid var(--rule-2); background: var(--surface); color: var(--ink-2); font: 600 .75rem/1 var(--font-ui); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.lib-scope { display: flex; justify-content: space-between; align-items: center; font-size: .75rem; color: var(--ink-3); }
.lib-list { list-style: none; margin: 0; padding: 10px; overflow: auto; display: grid; gap: 8px; align-content: start; flex: 1 1 auto; }
.place { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 10px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--surface); }
.place:hover { border-color: var(--rule-2); }
.place.is-used { background: var(--surface-2); }
.place .thumb { width: 64px; height: 48px; }
.place-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.place-name { font-weight: 600; font-size: .875rem; line-height: 1.3; }
.place-name .star { color: var(--brass-deep); display: inline-block; vertical-align: -1px; margin-right: 3px; }
.place-meta { font-size: .75rem; color: var(--ink-3); margin-top: 2px; }
.place-facts { font-size: .75rem; color: var(--ink-2); margin-top: 4px; display: grid; gap: 1px; }
.place-facts b { font-weight: 600; color: var(--ink); }
.place-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.place-tags .tag { height: 20px; font-size: .6875rem; padding: 0 6px; }
.place-summary { font-size: .75rem; color: var(--ink-2); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.place.is-open .place-summary { -webkit-line-clamp: unset; }
.place-closed { color: var(--signal); font-weight: 600; font-size: .75rem; margin-top: 4px; }
.place .btn-add { flex: none; height: 30px; padding: 0 10px; font-size: .75rem; }
.lib-empty { text-align: center; color: var(--ink-3); font-size: var(--fs-small); padding: var(--s5) var(--s3); }
.lib-foot { padding: 10px 16px; border-top: 1px solid var(--rule); font-size: .75rem; color: var(--ink-3); background: var(--surface-2); }

/* mobile: the library becomes a sheet */
.sheet-backdrop { display: none; }
@media (max-width: 999px) {
  .library { position: fixed; left: 0; right: 0; bottom: 0; top: auto; max-height: 82vh; border-radius: 16px 16px 0 0; z-index: 60; transform: translateY(105%); transition: transform .25s var(--ease); box-shadow: var(--shadow-float); }
  .library.is-open { transform: translateY(0); }
  .sheet-backdrop { display: block; position: fixed; inset: 0; background: rgba(23, 21, 15, .4); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .sheet-backdrop.is-on { opacity: 1; pointer-events: auto; }
  .lib-close { display: inline-flex !important; }
  .timeline { padding-left: 24px; }
  .timeline::before { left: 7px; }
  .tday-node { left: -22px; }
  .tday.is-station .tday-node { left: -24px; }
  .item { grid-template-columns: 14px 40px minmax(0, 1fr) auto; gap: 8px; }
  .thumb { width: 40px; height: 32px; }
}
.lib-close { display: none !important; }
.fab { position: fixed; right: 16px; bottom: 16px; z-index: 50; box-shadow: var(--shadow-float); }
@media (min-width: 1000px) { .fab { display: none; } }

/* ------------------------------------------------------------------ stays */
.stays-grid { display: grid; gap: var(--s4); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1040px) { .stays-grid { grid-template-columns: minmax(0, 1fr) 300px; } }
.stay { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.stay + .stay { margin-top: var(--s4); }
.stay-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; padding: 14px 18px; border-bottom: 1px solid var(--rule); align-items: center; }
.stay-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.stay-title h2 { font-size: 1.125rem; }
.stay-when { font-size: var(--fs-small); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.stay-chosen { font-size: var(--fs-small); color: var(--ink-2); }
.stay-chosen strong { color: var(--ink); }
.stay-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 18px; border-bottom: 1px solid var(--rule); background: var(--surface-2); }
.stay-tools .chips { flex: 1 1 auto; }
.stay-tools select { width: auto; min-height: 32px; height: 32px; padding: 2px 30px 2px 10px; font-size: .8125rem; }
.hotels { list-style: none; margin: 0; padding: 0; }
.hotel { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 4px 14px; padding: 12px 18px; border-bottom: 1px solid var(--rule); cursor: pointer; align-items: start; }
.hotel:last-child { border-bottom: 0; }
.hotel:hover { background: #FBFBF9; }
.hotel.is-selected { background: var(--brass-wash); box-shadow: inset 3px 0 0 var(--brass); }
.hotel input[type=radio] { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--ink); }
.hotel-name { font-weight: 600; }
.hotel-name .chain { font-weight: 500; color: var(--ink-3); }
.hotel-meta { font-size: var(--fs-small); color: var(--ink-3); }
.hotel-blurb { font-size: var(--fs-small); color: var(--ink-2); margin-top: 2px; }
.hotel-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.hotel-price { text-align: right; white-space: nowrap; }
.hotel-price strong { font-size: 1rem; font-variant-numeric: tabular-nums; }
.hotel-price span { display: block; font-size: .75rem; color: var(--ink-3); }
.custom-hotel { padding: 12px 18px; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 14px; align-items: center; border-top: 1px dashed var(--rule-2); }
.custom-hotel input[type=radio] { width: 18px; height: 18px; accent-color: var(--ink); }
.more-hotels { padding: 10px 18px; border-top: 1px solid var(--rule); }
.sum-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); padding: 16px 18px; position: sticky; top: calc(var(--head-h) + 132px); }
.sum-card h2 { font-size: 1rem; margin-bottom: 10px; }
.sum-rows { display: grid; gap: 6px; font-size: .875rem; }
.sum-row { display: flex; justify-content: space-between; gap: 10px; }
.sum-row span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }
.sum-total { border-top: 1px solid var(--rule); padding-top: 10px; margin-top: 6px; font-size: 1rem; }
.sum-note { font-size: .75rem; color: var(--ink-3); margin-top: 10px; }

/* ------------------------------------------------------------------ send */
.send-grid { display: grid; gap: var(--s4); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1040px) { .send-grid { grid-template-columns: minmax(0, 1fr) 360px; } }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); }
.panel + .panel { margin-top: var(--s4); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--rule); }
.panel-head h2 { font-size: 1.0625rem; }
.panel-body { padding: 14px 18px; }
.price-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.price-table th, .price-table td { padding: 9px 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: middle; }
.price-table th { font-weight: 500; color: var(--ink-2); }
.price-table td.amt { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.price-table .sub { display: block; font-size: .75rem; color: var(--ink-3); font-weight: 400; }
.price-table input { max-width: 150px; min-height: 36px; height: 36px; text-align: right; font-variant-numeric: tabular-nums; margin-left: auto; display: block; }
.price-table tr.total th, .price-table tr.total td { border-bottom: 0; font-size: 1.0625rem; color: var(--ink); font-weight: 700; padding-top: 14px; }
.price-table details summary { cursor: pointer; }
.hotel-lines { font-size: .75rem; color: var(--ink-3); margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.price-table th { width: 72%; padding-right: 16px; }
.extra-line { display: grid; grid-template-columns: minmax(0, 1fr) 120px 32px; gap: 8px; margin-top: 6px; max-width: 520px; }
.extra-line input { max-width: none; text-align: left; }
.extra-line input { min-height: 36px; height: 36px; }
.two-col { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .two-col { grid-template-columns: 1fr 1fr; } }
.send-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); position: sticky; top: calc(var(--head-h) + 132px); overflow: hidden; }
.send-card .sc-top { padding: 16px 18px; border-bottom: 1px solid var(--rule); }
.sc-title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 500; line-height: 1.25; font-variation-settings: "SOFT" 50; }
.sc-meta { font-size: var(--fs-small); color: var(--ink-3); margin-top: 4px; }
.sc-price { padding: 14px 18px; border-bottom: 1px solid var(--rule); }
.sc-price .big { font-size: 1.75rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.sc-actions { padding: 14px 18px; display: grid; gap: 10px; }
.sc-links { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.seal { display: flex; gap: 12px; align-items: center; }
.seal-ring { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--brass); display: grid; place-items: center; color: var(--brass-deep); box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 5px rgba(217, 183, 126, .6); flex: none; }
.seal-code { font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.share-link { display: flex; gap: 6px; }
.share-link input { font-size: .8125rem; min-height: 38px; height: 38px; }
.danger-zone { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; margin-top: var(--s4); }

@media print { .topbar, .buildhead, .fab, .library { display: none !important; } body { background: #fff; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ------------------------------------------------------------------ login */
.login-wrap { display: grid; place-items: center; min-height: calc(100vh - var(--head-h)); padding-top: 0; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); padding: 28px; box-shadow: var(--shadow-1); }

/* ------------------------------------------------------------------ small screens: plan items stack their actions */
.item-group { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
@media (max-width: 599px) {
  .item { grid-template-columns: 14px 40px minmax(0, 1fr); align-items: start; }
  .item-grip { padding-top: 8px; }
  .item-actions { grid-column: 3; margin-top: -2px; gap: 2px; }
  .item-actions select { width: auto; }
  .checks-rules { display: none; }
  .tday-head { padding: 10px 12px 8px; }
  .tday-body { padding: 0 12px 12px; }
  .tday-menu select { max-width: 150px; }
  .bh-name { font-size: 1rem; }
}
@media (max-width: 719px) {
  .stay-head { grid-template-columns: minmax(0, 1fr); }
  .stay-head > label { justify-content: space-between; }
  .stay-head > label select { flex: 1 1 auto; max-width: 240px; }
  .hotel { grid-template-columns: 22px minmax(0, 1fr); }
  .hotel-price { grid-column: 2; text-align: left; }
  .hotel-price span { display: inline; margin-left: 6px; }
  .price-table th { width: auto; }
  .stay-tools { flex-direction: column; align-items: stretch; }
}

/* ------------------------------------------------------------------ packages (dashboard) */
.packages { margin-top: var(--s7); }
.pk-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: var(--s4); }
.pk-head h2 { font-size: 1.375rem; margin-bottom: 4px; }
.pk-filters { display: grid; gap: 8px; min-width: 0; max-width: 100%; }
.pk-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pk-link { display: flex; flex-direction: column; gap: 10px; height: 100%; padding: 14px 16px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.pk-link:hover { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(217, 183, 126, .25); color: var(--ink); }
.pk-top { display: flex; justify-content: space-between; align-items: center; }
.pk-pop { font-size: var(--fs-micro); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brass-deep); }
.pk-name { font-family: var(--font-display); font-size: 1.125rem; font-weight: 500; line-height: 1.25; font-variation-settings: "SOFT" 50; }
.pk-rail { --dot: 9px; }
.pk-rail .rail-stop { min-width: 0; }
.pk-rail .rail-name { font-size: .6875rem; }
.pk-sum { font-size: var(--fs-small); color: var(--ink-2); flex: 1 1 auto; }
.pk-foot { display: flex; justify-content: space-between; align-items: center; font-size: .75rem; border-top: 1px solid var(--rule); padding-top: 10px; }
.pk-go { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--brass-deep); }
.pk[hidden] { display: none; }

/* ------------------------------------------------------------------ stays: pick for me */
.pickbar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; background: var(--brass-wash); border: 1px solid #EAD9B8; border-radius: var(--r); padding: 12px 16px; margin-bottom: var(--s4); }
.pickbar-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--brass-deep); }
.pickbar-tiers { display: flex; gap: 6px; flex-wrap: wrap; }
.pickbar-meal { display: flex; align-items: center; gap: 8px; }
.pickbar-meal select { width: auto; min-height: 32px; height: 32px; padding: 2px 30px 2px 10px; font-size: .8125rem; }
.package-pick { border-color: #EAD9B8; background: linear-gradient(0deg, var(--surface), var(--surface)) padding-box; box-shadow: inset 3px 0 0 var(--brass); }
.tpl-chips { position: sticky; top: 0; background: var(--surface); padding: 2px 0 6px; z-index: 1; flex-wrap: wrap; overflow: visible; }
.rail-stop:only-child { align-items: center; text-align: center; }
