/* ==========================================================================
   Ghoomgali Itinerary Maker - application chrome
   A minimal, monochrome tool interface - black / white / grey, system sans
   throughout, generous spacing. This governs the app shell only: the
   itinerary document itself (doc.css) stays in Ghoom Gali's own brand
   colours and type, since that is the deliverable, not the tool.
   ========================================================================== */

:root{
  --black:#1d1d1f; --gray-900:#1d1d1f; --gray-700:#48484a; --gray-500:#86868b;
  --gray-300:#d2d2d7; --gray-200:#e5e5e7; --gray-100:#f5f5f7; --gray-50:#fafafa;
  --white:#ffffff;

  --ink:var(--black); --muted:var(--gray-500); --line:var(--gray-300);
  --surface:var(--gray-100);

  /* Ghoom Gali Mint stands in for "blue" - the one accent every interactive
     control uses (buttons, active tabs, focus rings, success). Everything
     else - text, cards, backgrounds - stays black / white / grey. */
  --accent:#41BF8F; --accent-dark:#2FA374; --accent-tint:#EAF7F1;
  --warn:#C4855A;

  /* Ghoom Gali's own PRIMARY palette colour - Abyss, the darkest in the
     system - used specifically for the call-to-action buttons themselves
     (Generate, Download PDF). Everything else interactive stays Mint. */
  --cta:#0C2027; --cta-hover:#1C3A32;

  --font:-apple-system,BlinkMacSystemFont,'SF Pro Display','SF Pro Text','Helvetica Neue',Helvetica,Arial,sans-serif;

  --topbar-h:56px; --bar-h:56px; --mobiletabs-h:46px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; background:var(--white); color:var(--ink);
  font-family:var(--font); font-size:14px; line-height:1.5;
  -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;
  overflow:hidden;
}
button{font-family:inherit; cursor:pointer}
::selection{background:var(--black); color:#fff}

/* An explicit display on .overlay, .toast and .item-tools would otherwise beat
   the UA rule for [hidden] and leave them permanently on screen. */
[hidden]{display:none !important}

/* Onboarding wizard -------------------------------------------------------
   First visit only: full-page trip details, then the plan. The fields
   themselves are the very same DOM nodes used in the sidebar afterwards -
   moved in by JS, then moved back on Generate - so there is exactly one
   copy of every input's state, never two to keep in sync.

   Styled as a preview of the document itself, not a generic form: the same
   Abyss background, Newsreader serif with a gold accent word, and the faint
   circular arcs the itinerary's own cover page uses - so setting up a trip
   already looks like the brand, the way the AI trip planners researched for
   this all commit to a bold, particular look rather than a plain form. */
.onboarding{
  min-height:calc(100vh - var(--topbar-h)); background:#0C2027; color:#EEE9E3;
  display:flex; flex-direction:column; align-items:center;
  padding:56px 24px 100px; overflow-y:auto; position:relative;
}
.onboard-arc{
  position:absolute; border-radius:50%; border:1px solid rgba(65,191,143,.18);
  pointer-events:none;
}
.onboard-arc.a1{width:820px; height:820px; right:-320px; top:-280px}
.onboard-arc.a2{width:1200px; height:1200px; left:-480px; bottom:-680px; border-color:rgba(65,191,143,.1)}

.onboard-card{width:100%; max-width:600px; position:relative; z-index:1}
.onboard-logo{width:112px; height:auto; display:block; margin:0 auto 40px}

.onboard-progress{display:flex; justify-content:center; gap:7px; margin-bottom:32px}
.onboard-dot{width:7px; height:7px; border-radius:50%; background:rgba(238,233,227,.24); transition:.2s}
.onboard-dot.active{background:#E7C547; width:20px; border-radius:4px}

.onboard-step{display:none}
.onboard-step.active{display:block}
.onboard-back{
  background:none; border:none; padding:0; margin-bottom:18px;
  font-size:13px; font-weight:500; color:rgba(238,233,227,.55); cursor:pointer;
}
.onboard-back:hover{color:#E7C547}

.onboard-head{margin-bottom:28px; text-align:center}
.onboard-head h1{
  font-family:'Newsreader',Georgia,'Times New Roman',serif; font-weight:300; font-size:38px;
  letter-spacing:-.015em; line-height:1.15; margin:0 0 12px; color:#EEE9E3;
}
.onboard-head h1 em{font-style:italic; color:#E7C547}
.onboard-head p{
  font-size:14px; color:rgba(238,233,227,.62); line-height:1.55; margin:0 auto; max-width:46ch;
}
.onboard-head p b{color:#EEE9E3; font-weight:600}

.onboard-slot{margin-top:4px}
/* The moved field-groups no longer need their own bottom margin here - the
   page's own padding already gives it room to breathe. */
.onboard-slot .field-group{margin-bottom:0}
.onboard-slot .group-title,
.onboard-slot .group-hint{display:none}

/* Text that sits directly on the dark page (not inside a white input) needs
   its own lighter palette - the sidebar's grey reads fine on white, not on
   Abyss. Scoped to .onboarding so nothing outside the wizard is touched. */
.onboarding .field span{color:rgba(238,233,227,.6)}
.onboarding .field span em{color:rgba(238,233,227,.4)}
.onboarding .theme-label{color:rgba(238,233,227,.6)}
.onboarding .theme-hint{color:rgba(238,233,227,.5)}
.onboarding .btn-link{color:#EEE9E3; text-decoration-color:rgba(238,233,227,.35)}
.onboarding .btn-link:hover{color:#E7C547; text-decoration-color:#E7C547}
.onboarding .counter{color:rgba(238,233,227,.45)}
.onboarding .tips{border-top-color:rgba(238,233,227,.16)}
.onboarding .tips summary{color:rgba(238,233,227,.7)}
.onboarding .tips ul,
.onboarding .tips p{color:rgba(238,233,227,.55)}
.onboarding .tips li b{color:#EEE9E3}
/* The dark CTA rule that makes sense on the light sidebar would disappear
   against this same dark page - Mint takes over as the primary colour for
   any button rendered inside the wizard specifically. */
.onboarding .btn-primary{background:var(--accent); border-color:var(--accent)}
.onboarding .btn-primary:hover{background:var(--accent-dark); border-color:var(--accent-dark)}

.onboard-actions{display:flex; align-items:center; justify-content:flex-end; margin-top:24px}
.btn-onboard{width:auto; padding:13px 30px}

@media (max-width:600px){
  .onboarding{padding:40px 20px 60px}
  .onboard-logo{width:92px; margin-bottom:32px}
  .onboard-head h1{font-size:28px}
}

/* Top bar --------------------------------------------------------------- */
.topbar{
  height:var(--topbar-h); background:var(--black); color:var(--white);
  display:flex; align-items:center; gap:12px; padding:0 20px;
  overflow-x:auto; scrollbar-width:none;
}
.topbar::-webkit-scrollbar{display:none}
.topbar-logo{height:20px; width:auto; display:block; opacity:.95; flex:none}
.topbar-divider{width:1px; height:16px; background:rgba(255,255,255,.16); flex:none}
.trip-name{
  font-size:13px; font-weight:600; letter-spacing:-.01em; color:rgba(255,255,255,.9);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:220px; flex:none;
}
.topbar-spacer{flex:1; min-width:12px}
.save-state{
  font-size:12px; font-weight:500; color:rgba(255,255,255,.5);
  opacity:0; transition:opacity .3s; display:flex; align-items:center; gap:6px; flex:none;
}
.save-state::before{
  content:""; width:5px; height:5px; border-radius:50%; background:var(--accent); flex:none;
}
.save-state.on{opacity:1}
.history-btns{display:flex; gap:2px; flex:none}
/* Neutral default (used on the white preview bar); the topbar override right
   below swaps it for a version that reads on the dark bar instead. */
.btn-icon{
  background:var(--white); border:1px solid var(--gray-300); color:var(--gray-700);
  font-size:13px; width:28px; height:28px; border-radius:8px; line-height:1; transition:.15s; flex:none;
  display:grid; place-items:center;
}
.btn-icon:hover{border-color:var(--accent); color:var(--accent-dark)}
.btn-icon:disabled{opacity:.35; cursor:not-allowed}
.topbar .btn-icon{
  background:transparent; border-color:rgba(255,255,255,.18); color:rgba(255,255,255,.75);
}
.topbar .btn-icon:hover{background:rgba(255,255,255,.1); color:var(--white); border-color:rgba(255,255,255,.18)}
.topbar .btn-icon:disabled{opacity:.3}
.btn-ghost{
  background:transparent; border:1px solid rgba(255,255,255,.22); color:var(--white);
  font-size:12.5px; font-weight:500; padding:7px 14px; border-radius:999px; transition:.15s; flex:none;
  white-space:nowrap;
}
.btn-ghost:hover{background:rgba(255,255,255,.1); border-color:rgba(65,191,143,.6)}
.topbar .dropdown{flex:none}
.topbar .btn-outline{white-space:nowrap}

/* Preview-panel controls rendered inside the dark topbar need light text -
   the shared .btn-outline/.dropdown-menu rules elsewhere assume a white
   surface, so this scopes just enough to read correctly here. */
.topbar .btn-outline{background:transparent; color:var(--white); border-color:rgba(255,255,255,.28)}
.topbar .btn-outline:hover{background:rgba(255,255,255,.1); border-color:var(--accent)}

/* Split layout ------------------------------------------------------------ */
.split{
  display:grid; grid-template-columns:minmax(380px,40%) 1fr;
  height:calc(100vh - var(--topbar-h));
}
.panel{min-width:0; min-height:0; display:flex; flex-direction:column}
.panel-input{background:var(--white); border-right:1px solid var(--gray-200)}
.panel-scroll{overflow-y:auto; padding:22px 26px 64px; scrollbar-width:thin}

/* Build navigation ------------------------------------------------------- */
.build-tabs{
  flex:none; display:flex; gap:2px; padding:10px 18px 0; background:var(--white);
  border-bottom:1px solid var(--gray-200); overflow-x:auto; scrollbar-width:none;
}
.build-tabs::-webkit-scrollbar{display:none}
.build-tab{
  flex:none; background:none; border:none; padding:9px 13px 12px;
  font-size:13px; font-weight:600; color:var(--muted); border-bottom:2px solid transparent;
  white-space:nowrap; transition:.15s;
}
.build-tab:hover{color:var(--ink)}
.build-tab.active{color:var(--black); border-bottom-color:var(--cta)}
.build-section{display:none}
.build-section.active{display:block}

/* Form ---------------------------------------------------------------- */
.field-group{margin-bottom:34px}
.group-title{
  font-family:var(--font); font-weight:650; font-size:19px;
  margin:0 0 5px; letter-spacing:-.015em; color:var(--black);
}
.group-hint{margin:0 0 16px; font-size:12.5px; color:var(--muted); line-height:1.55}
.group-hint b{color:var(--ink); font-weight:600}
.grid-2{display:grid; grid-template-columns:1fr 1fr; gap:10px}
.field{display:flex; flex-direction:column; gap:6px}
.field-wide{grid-column:1 / -1}
.field span{
  font-size:11.5px; font-weight:500; color:var(--muted);
}
.field span em{font-style:normal; opacity:.7}
.field input{
  font-family:var(--font); font-size:14px; color:var(--ink);
  padding:10px 12px; border:1px solid var(--gray-300); border-radius:9px;
  background:var(--white); transition:.15s; width:100%;
}
.field input:focus{outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(65,191,143,.16)}
.field input::placeholder{color:var(--gray-500)}

#raw{
  width:100%; min-height:290px; resize:vertical;
  font-family:var(--font); font-size:13px; line-height:1.7; color:var(--ink);
  padding:14px; border:1px solid var(--gray-300); border-radius:10px; background:var(--gray-50);
  transition:.15s;
}
#raw:focus{outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(65,191,143,.16); background:var(--white)}
#raw::placeholder{color:var(--gray-500)}

.raw-actions{display:flex; align-items:center; justify-content:space-between; margin:9px 0 16px}
.btn-link{
  background:none; border:none; padding:0; color:var(--black);
  font-size:12.5px; font-weight:500; text-decoration:underline; text-underline-offset:3px;
  text-decoration-color:var(--gray-300);
}
.btn-link:hover{text-decoration-color:var(--accent)}
.counter{font-size:11.5px; color:var(--muted)}

/* Buttons ------------------------------------------------------------- */
.btn-primary{
  width:100%; background:var(--cta); color:var(--white); border:1px solid var(--cta);
  font-size:14.5px; font-weight:590; letter-spacing:-.005em;
  padding:14px 18px; border-radius:999px; transition:.15s;
}
.btn-primary:hover{background:var(--cta-hover); border-color:var(--cta-hover)}
.btn-primary:active{transform:scale(.985)}
.btn-primary:disabled{opacity:.35; cursor:not-allowed}
.btn-sm{width:auto; font-size:13px; padding:8px 16px; font-weight:590}
.btn-outline{
  background:var(--white); color:var(--black); border:1px solid var(--gray-300);
  border-radius:999px; transition:.15s; font-weight:590;
}
.btn-outline:hover{border-color:var(--accent); background:var(--accent-tint)}

/* Costing panel --------------------------------------------------------- */
.grid-3{display:grid; grid-template-columns:repeat(3,1fr); gap:10px}

.cost-review{
  margin:16px 0 0; padding:4px 14px; border-radius:10px;
  background:var(--gray-50); border:1px solid var(--gray-200);
}
.cost-review .row{
  display:flex; align-items:baseline; justify-content:space-between; gap:12px;
  padding:9px 0; border-bottom:1px solid var(--gray-200);
}
.cost-review .row:last-child{border-bottom:none}
.cost-review dt{font-size:12.5px; color:var(--muted)}
.cost-review dd{
  margin:0; font-size:12.5px; font-variant-numeric:tabular-nums; color:var(--ink); white-space:nowrap;
}
.cost-review .row--sum dt{font-weight:600; color:var(--ink)}
.cost-review .row--sum dd{font-weight:700}
.cost-review .row--grand{
  border-top:1px solid var(--gray-300); border-bottom:none; margin-top:2px; padding-top:12px;
}
.cost-review .row--grand dt{font-weight:700; color:var(--black)}
.cost-review .row--grand dd{font-size:14.5px; font-weight:700; color:var(--black)}
.cost-review .row--discount dt{color:var(--ink)}
.cost-review .row--discount dd{color:var(--accent-dark); font-weight:600}
.cost-review .row--margin dt::after{
  content:'internal'; margin-left:7px; font-size:9.5px; font-weight:500;
  color:var(--gray-500); background:var(--gray-200); border-radius:4px; padding:1px 6px;
}
.cost-empty{padding:12px 0; font-size:12.5px; color:var(--muted)}

.check{display:flex; align-items:flex-start; gap:9px; margin-top:16px; cursor:pointer}
.check input{margin:2px 0 0; accent-color:var(--accent); flex:none}
.check span{font-size:12.5px; color:var(--muted); line-height:1.5}
.check em{
  font-style:normal; font-size:9.5px; font-weight:500; color:var(--gray-500);
  background:var(--gray-200); border-radius:4px; padding:1px 6px; margin-left:5px;
}

/* Activity library -------------------------------------------------------- */
.lib-toolbar{display:flex; align-items:center; gap:12px; flex-wrap:wrap}
.lib-status{font-size:11.5px; color:var(--accent-dark)}

.lib-empty{
  margin-top:14px; padding:18px; border:1px dashed var(--gray-300); border-radius:10px;
  font-size:12.5px; color:var(--muted); text-align:center; line-height:1.6;
}

.lib-dest-row{display:flex; gap:6px; flex-wrap:wrap; margin-top:16px}
.lib-dest{
  font-size:12.5px; font-weight:500;
  padding:7px 13px; border-radius:999px; border:1px solid var(--gray-300); background:var(--white);
  color:var(--gray-700); cursor:pointer; transition:.14s;
}
.lib-dest:hover{border-color:var(--accent)}
.lib-dest.active{background:var(--accent); border-color:var(--accent); color:var(--white)}

.lib-body{margin-top:14px}
.lib-cat-tabs{display:flex; gap:4px; border-bottom:1px solid var(--gray-200); margin-bottom:14px}
.lib-tab{
  font-size:12.5px; font-weight:500; color:var(--muted);
  padding:8px 4px; margin-right:16px; border-bottom:2px solid transparent; background:none;
}
.lib-tab.active{color:var(--accent-dark); font-weight:600; border-bottom-color:var(--accent)}
.lib-tab .lib-tab-n{font-size:11px; color:var(--gray-500); margin-left:3px; font-weight:400}

.lib-day-target{display:flex; align-items:center; gap:9px; flex-wrap:wrap; margin-bottom:12px}
.lib-day-label{font-size:11.5px; font-weight:500; color:var(--muted)}
.lib-days{display:flex; gap:5px; flex-wrap:wrap}
.lib-day-chip{
  font-size:12px; font-weight:500; padding:6px 12px; border-radius:999px;
  border:1px solid var(--gray-300); background:var(--white); color:var(--gray-700); cursor:pointer; transition:.14s;
}
.lib-day-chip:hover{border-color:var(--accent)}
.lib-day-chip.active{background:var(--accent); border-color:var(--accent); color:var(--white); font-weight:600}
.lib-day-add{
  font-size:12px; font-weight:500; padding:6px 12px; border-radius:999px;
  border:1px dashed var(--gray-300); background:none; color:var(--gray-700); cursor:pointer;
}
.lib-day-add:hover{border-color:var(--accent); background:var(--accent-tint); color:var(--accent-dark)}

/* A compact route-style preview of what's already in the selected day -
   dots on a connecting line, the same shape as the reference's route
   screen, just drawn from the day being built rather than a finished trip. */
.lib-day-plan{margin-bottom:12px}
.lib-day-plan-empty{font-size:12px; color:var(--gray-500); padding:4px 0 10px}
.lib-day-plan-row{position:relative; display:flex; align-items:flex-start; gap:10px; padding:0 0 12px 2px}
.lib-day-plan-row::before{
  content:""; position:absolute; left:4px; top:14px; bottom:-1px; width:1px; background:var(--gray-300);
}
.lib-day-plan-row:last-child::before{display:none}
.lib-day-plan-dot{flex:none; width:9px; height:9px; margin-top:3px; border-radius:50%; background:var(--accent)}
.lib-day-plan-body{flex:1; min-width:0}
.lib-day-plan-name{font-size:12.5px; font-weight:600; color:var(--ink); line-height:1.4}
.lib-day-plan-meta{font-size:11px; color:var(--muted); margin-top:1px}
.lib-day-plan-price{
  flex:none; font-size:11.5px; font-variant-numeric:tabular-nums; color:var(--gray-700); padding-top:1px;
}
.lib-day-plan-footer{
  display:flex; align-items:baseline; justify-content:space-between; margin-top:2px; padding:10px 0 0 2px;
  border-top:1px solid var(--gray-200); font-size:12px; color:var(--muted);
}
.lib-day-plan-footer b{color:var(--ink); font-weight:600; font-variant-numeric:tabular-nums}

.lib-items{max-height:340px; overflow-y:auto; display:flex; flex-direction:column; gap:8px}
.lib-item{
  display:flex; align-items:center; gap:11px; padding:10px 12px;
  border:1px solid var(--gray-200); border-radius:11px; background:var(--white); transition:.14s;
}
.lib-item:hover{border-color:var(--gray-500)}
.lib-item-thumb{
  flex:none; width:42px; height:42px; border-radius:10px; overflow:hidden;
  background-color:var(--gray-100); background-position:center; background-size:cover; background-repeat:no-repeat;
  display:grid; place-items:center; color:var(--gray-500); font-size:14px; font-weight:600;
}
.lib-item-body{flex:1; min-width:0}
.lib-item-name{font-size:13px; font-weight:600; color:var(--ink); line-height:1.35}
.lib-item-meta{font-size:11.5px; color:var(--muted); margin-top:2px; line-height:1.4}
.lib-item-price{
  font-size:11.5px; font-variant-numeric:tabular-nums; color:var(--gray-700); margin-top:3px;
}
.lib-item-add{
  flex:none; width:30px; height:30px; border-radius:50%; border:none;
  background:var(--accent); color:var(--white); font-size:17px; line-height:1;
  cursor:pointer; transition:.14s; display:grid; place-items:center;
}
.lib-item-add:hover{background:var(--accent-dark)}
.lib-item-add:disabled{background:var(--gray-300); color:var(--gray-500); cursor:not-allowed}
.lib-item.added{border-color:var(--accent)}

/* Layout picker ------------------------------------------------------------ */
.layout-picker{display:grid; grid-template-columns:1fr 1fr; gap:9px}
.layout-opt{
  text-align:left; padding:12px 14px; border:1px solid var(--gray-300); border-radius:10px;
  background:var(--white); transition:.15s; cursor:pointer;
}
.layout-opt b{display:block; font-size:12.5px; font-weight:600; color:var(--ink)}
.layout-opt em{display:block; font-style:normal; font-size:11px; color:var(--muted); margin-top:3px; line-height:1.4}
.layout-opt:hover{border-color:var(--accent)}
.layout-opt.active{border-color:var(--accent); background:var(--accent-tint)}
.layout-opt.active b{color:var(--accent-dark)}

/* Theme picker ---------------------------------------------------------- */
.theme-picker{display:flex; align-items:center; gap:10px; margin-top:16px}
.theme-label{font-size:11.5px; font-weight:500; color:var(--muted)}
.swatches{display:flex; align-items:center; gap:7px}
.swatch{
  width:24px; height:24px; border-radius:50%; border:2px solid transparent;
  cursor:pointer; padding:0; transition:.15s; flex:none;
}
.swatch--auto{
  width:auto; height:24px; border-radius:999px; padding:0 11px; border:1px solid var(--gray-300);
  background:var(--white); font-size:11px; font-weight:500; color:var(--gray-700);
}
/* These three keep the itinerary's own brand colours - they are choosing the
   document's accent, so they are the one place actual colour belongs. */
.swatch--mint{background:#41BF8F}
.swatch--chai{background:#C4855A}
.swatch--lantern{background:#E7C547}
.swatch.active{border-color:var(--accent-dark)}
.swatch--auto.active{border-color:var(--accent); color:var(--accent-dark); font-weight:600}
.swatch:hover{transform:scale(1.1)}
.theme-hint{margin-top:8px}

/* Tips ---------------------------------------------------------------- */
.tips{margin-top:20px; border-top:1px solid var(--gray-200); padding-top:16px}
.tips summary{
  cursor:pointer; font-size:12.5px; font-weight:500; color:var(--gray-700); list-style:none;
}
.tips summary::-webkit-details-marker{display:none}
.tips summary::before{content:"+ "; color:var(--accent-dark)}
.tips[open] summary::before{content:"– "}
.tips ul{margin:12px 0 8px; padding-left:18px; font-size:12.5px; color:var(--muted); line-height:1.8}
.tips li b{color:var(--ink); font-weight:600}
.tips p{font-size:12.5px; color:var(--muted); margin:0 0 8px; line-height:1.6}
.tips code{
  font-family:ui-monospace,'SF Mono',Menlo,monospace; font-size:11px; background:var(--gray-100);
  padding:1px 5px; border-radius:4px; color:var(--gray-700);
}

/* Preview bar --------------------------------------------------------- */
.panel-preview{background:var(--gray-100)}
.preview-bar{
  height:var(--bar-h); flex:none; background:var(--white); border-bottom:1px solid var(--gray-200);
  display:flex; align-items:center; justify-content:space-between; padding:0 18px; gap:12px;
}
.preview-bar-left{display:flex; align-items:baseline; gap:10px; min-width:0}
.preview-bar-left strong{
  font-size:13px; font-weight:600; color:var(--black);
}
.preview-hint{font-size:12px; color:var(--gray-500); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.preview-bar-right{display:flex; align-items:center; gap:8px; flex:none}

.page-indicator{font-size:11.5px; color:var(--muted); font-variant-numeric:tabular-nums; white-space:nowrap}

.zoom{display:flex; align-items:center; gap:2px; margin-right:4px}
.zoom button{
  width:26px; height:26px; border:1px solid var(--gray-300); background:var(--white);
  border-radius:7px; color:var(--gray-700); font-size:15px; line-height:1;
}
.zoom button:hover{border-color:var(--accent); color:var(--accent-dark)}
#zoomLabel{font-size:11.5px; color:var(--muted); width:36px; text-align:center}

/* Dropdown ------------------------------------------------------------ */
.dropdown{position:relative}
.dropdown-menu{
  position:absolute; right:0; top:calc(100% + 8px); width:290px; z-index:50;
  background:var(--white); border:1px solid var(--gray-200); border-radius:13px;
  box-shadow:0 18px 44px rgba(0,0,0,.14); padding:6px; overflow:hidden;
}
.dropdown-menu button{
  display:block; width:100%; text-align:left; background:none; border:none;
  padding:10px 12px; border-radius:9px; transition:.14s;
}
.dropdown-menu button:hover{background:var(--accent-tint)}
.dropdown-menu b{display:block; font-size:13px; font-weight:600; color:var(--ink)}
.dropdown-menu em{display:block; font-style:normal; font-size:11.5px; color:var(--muted); margin-top:1px}
.dropdown-menu hr{border:none; border-top:1px solid var(--gray-200); margin:6px 8px}

/* Paper canvas -------------------------------------------------------- */
.paper-scroll{
  flex:1; min-height:0; overflow:auto; padding:28px;
  display:flex; flex-direction:column; align-items:center;
  background:var(--gray-100);
}
.doc{display:flex; flex-direction:column; align-items:center; gap:22px; transform-origin:top center}

.empty-state{margin:auto; text-align:center; max-width:340px; padding:40px 20px}
.empty-state img{width:44px; height:44px; opacity:.3; filter:grayscale(1); margin-bottom:18px}
.empty-state h3{
  font-family:var(--font); font-weight:650; font-size:20px; margin:0 0 8px;
  color:var(--black); letter-spacing:-.01em;
}
.empty-state p{font-size:13px; color:var(--muted); line-height:1.65; margin:0}
.empty-state b{color:var(--ink)}

/* Floating entry toolbar ---------------------------------------------- */
.item-tools{
  position:fixed; z-index:60; display:flex; gap:2px; padding:4px;
  background:var(--black); border-radius:10px; box-shadow:0 8px 22px rgba(0,0,0,.28);
}
.item-tools button{
  background:none; border:none; color:rgba(255,255,255,.8);
  font-size:12px; font-weight:500;
  padding:6px 9px; border-radius:6px; transition:.14s;
}
.item-tools button:hover{background:var(--accent); color:var(--white)}
.item-tools button.danger:hover{background:#ff453a; color:#fff}

/* Toast --------------------------------------------------------------- */
.toast{
  position:fixed; left:50%; bottom:26px; transform:translate(-50%,14px);
  background:var(--black); color:var(--white); padding:12px 20px; border-radius:999px;
  font-size:13px; font-weight:500; z-index:90; opacity:0; transition:.28s; pointer-events:none;
  box-shadow:0 14px 34px rgba(0,0,0,.3); display:flex; align-items:center; gap:9px;
}
.toast.on{opacity:1; transform:translate(-50%,0)}
.toast::before{
  content:""; width:7px; height:7px; border-radius:50%; background:var(--accent); flex:none;
}
.toast.warn::before{background:var(--warn)}

/* Progress overlay ---------------------------------------------------- */
.overlay{
  position:fixed; inset:0; background:rgba(0,0,0,.55); backdrop-filter:blur(6px);
  z-index:100; display:grid; place-items:center;
}
.overlay-card{
  background:var(--white); border-radius:18px; padding:34px 40px; text-align:center; min-width:290px;
  box-shadow:0 30px 70px rgba(0,0,0,.3);
}
.overlay-card h3{
  font-family:var(--font); font-weight:650; font-size:18px; margin:16px 0 6px; letter-spacing:-.01em;
}
.overlay-card p{margin:0; font-size:12.5px; color:var(--muted)}
.spinner{
  width:32px; height:32px; margin:0 auto; border-radius:50%;
  border:2.5px solid var(--gray-200); border-top-color:var(--accent);
  animation:spin .8s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg)}}

/* Itinerary tab ----------------------------------------------------------
   The centrepiece: compact, editable day cards instead of one long form.
   Each activity is a single row until clicked open - the same progressive
   disclosure used everywhere else in this redesign. */
.itin-intro{margin-bottom:18px}
.itin-intro .group-title{margin-bottom:5px}
.itin-empty{
  padding:24px 18px; border:1px dashed var(--gray-300); border-radius:12px;
  font-size:12.5px; color:var(--muted); text-align:center; line-height:1.6;
}

.itin-days{display:flex; flex-direction:column; gap:14px; margin-bottom:12px}
.itin-day{border:1px solid var(--gray-200); border-radius:14px; background:var(--white); padding:14px 14px 12px}
.itin-day-head{display:flex; align-items:center; gap:10px; margin-bottom:8px}
.itin-day-num{
  flex:none; font-family:ui-monospace,'SF Mono',Menlo,monospace; font-size:10.5px; font-weight:700;
  letter-spacing:.03em; color:var(--white); background:var(--cta); border-radius:6px;
  padding:4px 7px; cursor:pointer; transition:.15s;
}
.itin-day-num:hover{background:var(--cta-hover)}
.itin-day-title{
  flex:1; min-width:0; border:none; background:none; font-size:14.5px; font-weight:650;
  color:var(--ink); padding:4px 2px; border-radius:6px; transition:.15s;
}
.itin-day-title:focus{outline:none; background:var(--gray-50)}
.itin-day-when{
  display:block; width:100%; border:none; background:none; font-size:12px; color:var(--muted);
  padding:0 2px 8px; margin-top:-4px;
}
.itin-day-when:focus{outline:none; color:var(--ink)}

.itin-items{display:flex; flex-direction:column; gap:6px; margin-bottom:8px}
.itin-activity{border:1px solid var(--gray-200); border-radius:10px; background:var(--gray-50); transition:.15s}
.itin-activity:hover{border-color:var(--gray-300)}
.itin-activity.open{border-color:var(--accent); background:var(--white)}
.itin-activity.dragging{opacity:.4}
.itin-activity.drag-over{border-color:var(--accent-dark); box-shadow:0 0 0 2px var(--accent-tint)}

.itin-activity-summary{
  display:flex; align-items:center; gap:9px; padding:9px 10px; cursor:pointer;
}
.itin-activity-drag{flex:none; color:var(--gray-300); font-size:13px; cursor:grab; line-height:1}
.itin-activity-time{
  flex:none; font-family:ui-monospace,'SF Mono',Menlo,monospace; font-size:10px; color:var(--gray-500);
  max-width:78px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.itin-activity-title{
  flex:1; min-width:0; font-size:13px; font-weight:600; color:var(--ink);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.itin-activity-price{
  flex:none; font-size:11.5px; color:var(--gray-700); font-variant-numeric:tabular-nums;
}

.itin-activity-detail{padding:2px 12px 14px; display:flex; flex-direction:column; gap:10px}
.itin-field{display:flex; flex-direction:column; gap:5px}
.itin-field span{font-size:11px; font-weight:500; color:var(--muted)}
.itin-field input, .itin-field textarea{
  font-family:var(--font); font-size:13px; color:var(--ink); width:100%;
  padding:8px 10px; border:1px solid var(--gray-300); border-radius:8px; background:var(--white);
  transition:.15s; resize:vertical;
}
.itin-field input:focus, .itin-field textarea:focus{
  outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(65,191,143,.16);
}
.itin-photo-field{flex-direction:row; align-items:center; justify-content:space-between}

.itin-add-activity, .itin-add-day{position:relative}
.itin-add-btn, #btnAddDay{
  width:100%; text-align:left; background:none; border:1px dashed var(--gray-300); border-radius:9px;
  color:var(--gray-700); font-size:12.5px; font-weight:500; padding:9px 12px; transition:.15s;
}
.itin-add-btn:hover, #btnAddDay:hover{border-color:var(--accent); background:var(--accent-tint); color:var(--accent-dark)}
#btnAddDay{text-align:center; margin-bottom:20px}

/* Contextual ••• menus - shared by day cards and activity rows, and by the
   add-activity control, so secondary actions stay out of the way until
   asked for. */
.itin-day-menu, .itin-activity-menu{position:relative; flex:none}
.itin-menu-btn{
  background:none; border:none; color:var(--gray-500); font-size:13px; font-weight:700;
  width:24px; height:24px; border-radius:6px; line-height:1;
}
.itin-menu-btn:hover{background:var(--gray-100); color:var(--ink)}
.itin-menu-pop{
  position:absolute; right:0; top:calc(100% + 4px); min-width:170px; z-index:55;
  background:var(--white); border:1px solid var(--gray-200); border-radius:11px;
  box-shadow:0 14px 34px rgba(0,0,0,.16); padding:5px; overflow:hidden;
}
.itin-add-menu{left:0; right:auto}
.itin-menu-pop button{
  display:block; width:100%; text-align:left; background:none; border:none;
  padding:8px 10px; border-radius:7px; font-size:12.5px; color:var(--ink); transition:.12s;
}
.itin-menu-pop button:hover{background:var(--accent-tint)}
.itin-menu-pop button.danger{color:#c0392b}
.itin-menu-pop button.danger:hover{background:#fdecea}

.itin-raw-advanced{margin-top:22px}

/* A brief highlight when a Build-panel click scrolls the preview to the
   matching page or card, so the connection between the two is visible. */
#doc .flash-highlight{outline:2px solid var(--accent); outline-offset:3px; border-radius:4px}

/* Activity library search -------------------------------------------------- */
.lib-search{
  width:100%; margin-bottom:12px; font-family:var(--font); font-size:13px; color:var(--ink);
  padding:9px 12px; border:1px solid var(--gray-300); border-radius:9px; background:var(--white);
  transition:.15s;
}
.lib-search:focus{outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(65,191,143,.16)}

/* Quotation summary -------------------------------------------------------- */
.quo-summary{
  margin:14px 0 16px; padding:4px 14px; border-radius:12px;
  background:var(--gray-50); border:1px solid var(--gray-200);
}
.quo-summary .row{
  display:flex; align-items:baseline; justify-content:space-between; gap:12px;
  padding:10px 0; border-bottom:1px solid var(--gray-200);
}
.quo-summary .row:last-child{border-bottom:none}
.quo-summary dt{font-size:12.5px; color:var(--muted)}
.quo-summary dd{margin:0; font-size:12.5px; font-variant-numeric:tabular-nums; color:var(--ink)}
.quo-summary .row--discount dd{color:var(--accent-dark); font-weight:600}
.quo-summary .row--grand{border-top:1px solid var(--gray-300); border-bottom:none; margin-top:2px; padding-top:13px}
.quo-summary .row--grand dt{font-weight:700; color:var(--black); font-size:13.5px}
.quo-summary .row--grand dd{font-size:17px; font-weight:700; color:var(--black)}
.quo-empty{padding:12px 0; font-size:12.5px; color:var(--muted)}
.quo-inputs{margin-bottom:6px}
.quo-advanced{margin-top:16px; border-top:1px solid var(--gray-200); padding-top:14px}
.quo-advanced summary{
  cursor:pointer; font-size:12.5px; font-weight:500; color:var(--gray-700); list-style:none;
}
.quo-advanced summary::-webkit-details-marker{display:none}
.quo-advanced summary::before{content:"+ "; color:var(--accent-dark)}
.quo-advanced[open] summary::before{content:"– "}
.quo-margin-field{margin-top:14px}

/* Document lists ------------------------------------------------------------ */
.doc-list{display:flex; flex-direction:column; gap:7px; margin-top:12px; margin-bottom:10px}
.doc-list-empty{font-size:12px; color:var(--gray-500); padding:2px 0 4px}
.doc-list-row{display:flex; align-items:center; gap:8px}
.doc-list-row input{
  flex:1; font-family:var(--font); font-size:13px; color:var(--ink);
  padding:9px 11px; border:1px solid var(--gray-300); border-radius:8px; background:var(--white); transition:.15s;
}
.doc-list-row input:focus{outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(65,191,143,.16)}
.doc-list-del{
  flex:none; width:28px; height:28px; border-radius:50%; border:none; background:var(--gray-100);
  color:var(--gray-500); font-size:15px; line-height:1;
}
.doc-list-del:hover{background:#fdecea; color:#c0392b}

/* Mobile tabs ----------------------------------------------------------- */
/* Hidden by default (desktop shows both panels side by side already). Below
   the breakpoint the same two panels become two full-screen "screens", the
   way the reference app moves from one screen to the next. */
.mobile-tabs{display:none}
.mobile-tab{
  flex:1; padding:0; height:var(--mobiletabs-h); font-size:14px; font-weight:600;
  color:var(--gray-500); background:none; border:none; border-bottom:2px solid transparent;
}
.mobile-tab.active{color:var(--black); border-bottom-color:var(--accent)}

/* Deliberately NOT inside a width-based media query. PDF export renders each
   page through html2canvas with an explicit internal width of 794px - under
   the 960px breakpoint - so any hide-the-inactive-screen rule written as a
   plain @media selector gets re-evaluated by that narrow internal context
   too, and (since the desktop DOM never carries a "tab-preview" class) would
   silently blank every exported page. Gating this purely on a JS-applied
   class, set only when the real window is actually narrow, keeps the export
   pass unaffected by its own internal viewport. */
.mobile-panel-hidden{position:absolute; inset:0; visibility:hidden; pointer-events:none}

/* Narrow screens --------------------------------------------------------- */
@media (max-width:960px){
  .mobile-tabs{
    display:flex; background:var(--white); border-bottom:1px solid var(--gray-200);
    position:sticky; top:0; z-index:40;
  }

  .split{
    position:relative; display:block; overflow:hidden;
    height:calc(100vh - var(--topbar-h) - var(--mobiletabs-h));
  }
  .panel{height:100%}

  .panel-input{border-right:none}
  .panel-scroll{padding:22px 18px 100px}

  /* The primary action stays reachable no matter how far the form has
     scrolled - the same persistent bottom button the reference app uses. */
  #btnGenerate{
    position:fixed; left:16px; right:16px; bottom:16px; z-index:45;
    box-shadow:0 10px 26px rgba(0,0,0,.2);
  }

  .preview-hint{display:none}
  .preview-bar{padding:0 14px}
  .preview-bar-right{gap:6px}
  .preview-bar-left strong{font-size:12.5px}
  .page-indicator{display:none}

  .build-tabs{padding:8px 14px 0}
  .trip-name{max-width:120px}
}

@media (max-width:520px){
  .grid-2, .grid-3, .layout-picker{grid-template-columns:1fr}
  .field input, #raw{font-size:15px}
  .btn-primary, .btn-outline, .btn-sm{min-height:40px}
  .paper-scroll{padding:16px}
  .itin-activity-time{max-width:52px}
  .trip-name{display:none}
  .topbar{gap:8px; padding:0 14px}
  .topbar .btn-outline.btn-sm{padding:7px 11px}
  .btn-ghost{padding:7px 10px; font-size:11.5px}
}
