/* ==========================================================================
   Kate & Marcus — wedding planner
   Design system carried over from the prototype: Fraunces / Inter / Space Mono,
   ivory-sage-rose-gold palette, dotted RSVP-card tear lines, seal monogram.
   Laid out against a 390x844 viewport (iPhone 14).
   ========================================================================== */

:root{
  --ivory:#FAF7F1;
  --ivory-2:#F3EEE4;
  --ink:#2B2A26;
  --ink-soft:#6b6a63;
  --sage:#7C8B6F;
  --sage-deep:#5E6E52;
  --sage-light:#E7ECE0;
  --rose:#C88787;
  --rose-light:#F3E3E1;
  --gold:#B89A5C;
  --gold-soft:#F3EBD9;
  --line:#DEDACF;
  --white:#FFFFFF;
  --danger:#B95C50;
  --radius:14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  /* Smallest comfortable touch target (44pt, per Apple's HIG). */
  --tap:44px;
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
html{
  /* Keeps the sticky nav from jumping as Safari's URL bar collapses. */
  height:100%;
  -webkit-text-size-adjust:100%;
}
body{
  background:var(--ivory);
  color:var(--ink);
  font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  -webkit-font-smoothing:antialiased;
  min-height:100vh;
  min-height:100dvh;
  /* No element should ever push the page sideways at 390px. */
  overflow-x:hidden;
}
.app{
  max-width:520px;
  margin:0 auto;
  min-height:100vh;
  min-height:100dvh;
  background:var(--ivory);
  display:flex;
  flex-direction:column;
  position:relative;
  overflow-x:hidden;
}
h1,h2,h3{
  font-family:'Fraunces',Georgia,serif;
  font-weight:600;
  margin:0;
  color:var(--ink);
}
.mono{font-family:'Space Mono',ui-monospace,monospace;}

/* ---------- Header ---------- */
header.top{
  /* The notch sits over the top of the page, so pad the status bar out of the
     way before the prototype's own 28px of breathing room. */
  padding:calc(28px + var(--safe-top)) 20px 18px;
  text-align:center;
  position:relative;
}
.seal{
  width:56px;height:56px;
  border-radius:50%;
  border:1.5px solid var(--gold);
  display:flex;align-items:center;justify-content:center;
  margin:0 auto 10px;
  background:var(--white);
  box-shadow:0 1px 0 rgba(0,0,0,0.03);
}
.seal span{
  font-family:'Fraunces',Georgia,serif;
  font-style:italic;
  font-size:18px;
  color:var(--gold);
  letter-spacing:0.5px;
}
header.top h1{font-size:26px;letter-spacing:0.2px;}
.countdown{
  margin-top:6px;
  font-size:13px;
  color:var(--ink-soft);
  line-height:1.45;
}
.countdown b{
  color:var(--sage-deep);
  font-family:'Space Mono',ui-monospace,monospace;
  font-weight:700;
}
.date-edit{
  background:none;border:none;
  text-decoration:underline dotted var(--ink-soft);
  color:var(--ink-soft);
  font-size:12px;
  margin-top:2px;
  cursor:pointer;
  font-family:'Inter',sans-serif;
  min-height:var(--tap);
  padding:0 12px;
}
.sync-dot{
  position:absolute;
  top:calc(14px + var(--safe-top));
  right:16px;
  font-size:10px;color:var(--ink-soft);
  display:flex;align-items:center;gap:5px;
  opacity:0.75;
}
.sync-dot i{
  width:6px;height:6px;border-radius:50%;
  background:var(--sage);display:inline-block;
  flex:none;
}
.sync-dot.saving i{background:var(--gold);}
.sync-dot.error i{background:var(--danger);}

/* Dotted divider — echoes an RSVP card's tear line */
.dotted{
  border:none;
  border-top:1.5px dotted var(--line);
  margin:18px 0;
}

main{
  flex:1;
  padding:0 16px 110px;
  width:100%;
  max-width:100%;
}
.tab-panel{display:none;}
.tab-panel.active{display:block;animation:fade .18s ease;}
@keyframes fade{from{opacity:0;transform:translateY(4px);}to{opacity:1;transform:translateY(0);}}
@media (prefers-reduced-motion: reduce){
  .tab-panel.active{animation:none;}
  *{transition:none !important;}
}

.card{
  background:var(--white);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:16px;
  margin-bottom:12px;
  max-width:100%;
}
.eyebrow{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:1.2px;
  color:var(--sage-deep);
  font-weight:600;
  margin-bottom:10px;
}
.hint{font-size:11.5px;color:var(--ink-soft);line-height:1.5;margin-top:8px;}

/* ---------- Home stats ---------- */
.stat-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:12px;}
.stat{
  background:var(--white);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:14px;
  min-width:0;
}
.stat .num{font-family:'Space Mono',ui-monospace,monospace;font-size:22px;font-weight:700;color:var(--sage-deep);}
.stat .label{font-size:11.5px;color:var(--ink-soft);margin-top:2px;}
.progress-track{
  height:8px;background:var(--sage-light);border-radius:6px;overflow:hidden;margin-top:8px;
}
.progress-fill{height:100%;background:var(--sage);border-radius:6px;transition:width .3s ease;}
.progress-fill.over{background:var(--danger);}

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  min-height:var(--tap);
  padding:10px 16px;
  border-radius:10px;
  border:1px solid var(--sage);
  background:var(--sage);
  color:var(--white);
  font-family:'Inter',sans-serif;
  font-size:14px;font-weight:600;
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}
.btn.ghost{background:transparent;color:var(--sage-deep);}
a.btn{text-decoration:none;}
.btn.small{padding:7px 14px;font-size:12.5px;}
.btn.danger{background:transparent;border-color:var(--line);color:var(--danger);}
.btn:disabled{opacity:.55;cursor:default;}
.btn-row{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px;}

input[type=text],input[type=number],input[type=date],input[type=tel],
input[type=email],input[type=password],select,textarea{
  width:100%;
  max-width:100%;
  min-width:0;
  min-height:var(--tap);
  padding:9px 10px;
  border-radius:8px;
  border:1px solid var(--line);
  background:var(--ivory-2);
  font-family:'Inter',sans-serif;
  /* 16px keeps iOS Safari from zooming the viewport on focus, which is what
     causes the "page is now wider than the screen" effect after typing. */
  font-size:16px;
  color:var(--ink);
  -webkit-appearance:none;
  appearance:none;
}
select{
  background-image:url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%236b6a63' stroke-width='1.5' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 10px center;
  background-size:11px;
  padding-right:28px;
}
textarea{min-height:66px;}
input[type=file]{
  width:100%;
  font-size:13px;
  font-family:'Inter',sans-serif;
  color:var(--ink-soft);
}
input[type=file]::file-selector-button{
  min-height:var(--tap);
  margin-right:10px;
  padding:0 14px;
  border-radius:10px;
  border:1px solid var(--sage);
  background:transparent;
  color:var(--sage-deep);
  font-family:'Inter',sans-serif;
  font-size:12.5px;
  font-weight:600;
}
label.field{display:block;font-size:11.5px;color:var(--ink-soft);margin:10px 0 3px;font-weight:600;}
.field-row{display:flex;gap:8px;}
.field-row > div{flex:1;min-width:0;}
label.check{
  display:flex;align-items:center;gap:10px;
  min-height:var(--tap);
  font-size:13px;color:var(--ink);
  cursor:pointer;
}
label.check input[type=checkbox]{
  width:24px;height:24px;flex:none;accent-color:var(--sage);margin:0;
}

/* ---------- Section title row ---------- */
.section-title{
  display:flex;align-items:center;justify-content:space-between;gap:8px;
  margin:18px 0 10px;
}
.section-title h2{font-size:19px;}

/* ---------- Guests ---------- */
/* Stacked rather than side-by-side: at 390px there isn't room for a name plus
   three 44pt pills and a delete button on one line. */
.guest-row{
  padding:12px 0;
  border-bottom:1px dotted var(--line);
}
.guest-row:last-child{border-bottom:none;}
.guest-head{
  display:flex;align-items:flex-start;justify-content:space-between;gap:8px;
}
.guest-name{font-weight:600;font-size:14.5px;overflow-wrap:anywhere;}
.guest-meta{font-size:11.5px;color:var(--ink-soft);margin-top:1px;overflow-wrap:anywhere;}
.rsvp-pills{display:flex;gap:6px;margin-top:8px;}
.pill{
  flex:1;
  min-height:var(--tap);
  min-width:var(--tap);
  padding:5px 9px;border-radius:22px;font-size:12.5px;font-weight:600;
  border:1px solid var(--line);background:var(--ivory-2);color:var(--ink-soft);
  cursor:pointer;
  font-family:'Inter',sans-serif;
  -webkit-tap-highlight-color:transparent;
}
.pill.yes.active{background:var(--sage);border-color:var(--sage);color:#fff;}
.pill.no.active{background:var(--danger);border-color:var(--danger);color:#fff;}
.pill.pending.active{background:var(--gold);border-color:var(--gold);color:#fff;}
.icon-btn{
  background:none;border:none;cursor:pointer;color:var(--ink-soft);
  min-width:var(--tap);min-height:var(--tap);
  display:flex;align-items:center;justify-content:center;
  font-size:16px;line-height:1;flex:none;
  -webkit-tap-highlight-color:transparent;
}

/* ---------- Priority, filters and headcount ---------- */
/* One tap cycles A -> B -> C -> unrated. Rating 150 guests is the actual job
   here, so this is a single 44pt target rather than another row of pills. */
.prio-chip{
  flex:none;
  min-width:var(--tap);min-height:var(--tap);
  border-radius:22px;
  border:1px solid var(--line);
  background:var(--ivory-2);
  color:var(--ink-soft);
  font-family:'Space Mono',ui-monospace,monospace;
  font-size:14px;font-weight:700;
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}
.prio-chip.p-A{background:var(--sage);border-color:var(--sage);color:#fff;}
.prio-chip.p-B{background:var(--gold);border-color:var(--gold);color:#fff;}
.prio-chip.p-C{background:var(--rose-light);border-color:var(--rose);color:var(--rose);}

.filter-row{display:flex;gap:6px;margin-bottom:10px;flex-wrap:wrap;}
.chip{
  flex:1;min-width:54px;min-height:var(--tap);
  border-radius:22px;border:1px solid var(--line);
  background:var(--white);color:var(--ink-soft);
  font-family:'Inter',sans-serif;font-size:13px;font-weight:600;
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}
.chip.active{background:var(--sage-deep);border-color:var(--sage-deep);color:#fff;}

.tier-row,.tier-head{
  display:grid;
  grid-template-columns:minmax(0,1fr) 52px 62px;
  gap:6px;align-items:center;
}
.tier-row{padding:9px 0;border-bottom:1px dotted var(--line);}
.tier-row:last-of-type{border-bottom:none;}
.tier-head{
  font-size:10.5px;color:var(--ink-soft);text-transform:uppercase;letter-spacing:.6px;
  padding-bottom:6px;border-bottom:1px solid var(--line);margin-top:14px;
}
.tier-head span:not(:first-child){text-align:right;}
.tier-label{font-size:13.5px;font-weight:600;min-width:0;}
.tier-label small{display:block;font-weight:400;font-size:11px;color:var(--ink-soft);}
.tier-row .num{
  text-align:right;
  font-family:'Space Mono',ui-monospace,monospace;
  font-size:14px;font-variant-numeric:tabular-nums;
}
.tier-row .num.cum{font-weight:700;}
.tier-row .num.over{color:var(--danger);}
.tier-dot{
  display:inline-block;width:8px;height:8px;border-radius:50%;
  margin-right:7px;vertical-align:1px;
}
.dot-A{background:var(--sage);}
.dot-B{background:var(--gold);}
.dot-C{background:var(--rose);}
.dot-unrated{background:var(--line);border:1px solid var(--ink-soft);}
.capacity-note{
  font-size:12.5px;line-height:1.5;
  margin-top:12px;padding-top:12px;border-top:1px solid var(--line);
}
.capacity-note b{font-family:'Space Mono',ui-monospace,monospace;}
.capacity-note.over{color:var(--danger);}
.capacity-note.under{color:var(--sage-deep);}

/* ---------- Budget ---------- */
/* minmax(0,1fr) rather than 1fr so a long category name shrinks instead of
   forcing the grid wider than the card. */
.cat-row,.cat-head{
  display:grid;
  grid-template-columns:minmax(0,1fr) 74px 74px;
  gap:6px;
  align-items:center;
}
.cat-row{padding:7px 0;border-bottom:1px dotted var(--line);}
.cat-row:last-child{border-bottom:none;}
.cat-row input[type=text]{
  background:transparent;border:none;padding:4px 2px;font-weight:600;font-size:14px;
}
.cat-row input[type=number]{
  padding:6px;font-size:14px;text-align:right;
  font-family:'Space Mono',ui-monospace,monospace;
}
.cat-head{
  font-size:10.5px;color:var(--ink-soft);text-transform:uppercase;letter-spacing:0.6px;
  padding-bottom:6px;border-bottom:1px solid var(--line);
}
.cat-head span:not(:first-child){text-align:right;}
.cat-row .icon-btn{min-width:32px;}

/* ---------- Tasks ---------- */
details.tf-group{
  background:var(--white);border:1px solid var(--line);border-radius:var(--radius);
  margin-bottom:10px;overflow:hidden;
}
details.tf-group summary{
  padding:13px 16px;cursor:pointer;list-style:none;
  min-height:var(--tap);
  display:flex;align-items:center;gap:8px;
  font-weight:600;font-size:14px;
}
details.tf-group summary::-webkit-details-marker{display:none;}
summary .sum-row{display:flex;align-items:center;justify-content:space-between;width:100%;gap:8px;}
summary .sum-count{font-family:'Space Mono',ui-monospace,monospace;font-size:11.5px;color:var(--ink-soft);font-weight:400;flex:none;}
.task-list{padding:0 16px 12px;}
.task-row{
  display:flex;align-items:center;gap:10px;
  min-height:var(--tap);
  padding:4px 0;border-top:1px dotted var(--line);
}
.task-row:first-child{border-top:none;}
.task-row input[type=checkbox]{
  width:24px;height:24px;flex:none;accent-color:var(--sage);margin:0;
}
.task-row label{flex:1;display:flex;align-items:center;min-height:var(--tap);cursor:pointer;}
.task-title{font-size:13.5px;overflow-wrap:anywhere;}
.task-title.done{text-decoration:line-through;color:var(--ink-soft);}

/* ---------- Ideas ---------- */
.idea-card{
  background:var(--white);border:1px solid var(--line);border-radius:var(--radius);
  padding:14px;margin-bottom:10px;
}
.idea-card.is-out{opacity:.55;}
.idea-card.is-chosen{border-color:var(--sage);border-width:1.5px;}
.idea-top{display:flex;justify-content:space-between;align-items:flex-start;gap:8px;}
.idea-name{font-weight:700;font-size:15.5px;font-family:'Fraunces',Georgia,serif;overflow-wrap:anywhere;}
.idea-sub{font-size:11px;color:var(--sage-deep);text-transform:uppercase;letter-spacing:.6px;margin-top:2px;}
.idea-detail{font-size:12.5px;color:var(--ink-soft);margin-top:8px;line-height:1.5;overflow-wrap:anywhere;}

.status-idea{background:var(--ivory-2);color:var(--ink-soft);}
.status-enquired{background:var(--rose-light);color:var(--rose);}
.status-viewing{background:var(--gold-soft);color:var(--gold);}
.status-visited{background:var(--sage-light);color:var(--sage-deep);}
.status-ruled-out{background:var(--ivory-2);color:var(--danger);}
.status-chosen{background:var(--sage);color:var(--white);}

/* The fit flag is the point of the card: does this place hold your guest list? */
.fit{
  display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;
  margin-top:10px;padding-top:10px;border-top:1px dotted var(--line);
  font-size:13px;
}
.fit .verdict{font-weight:700;}
.fit.ok .verdict{color:var(--sage-deep);}
.fit.tight .verdict{color:var(--gold);}
.fit.no .verdict{color:var(--danger);}
.fit .sub{font-size:11.5px;color:var(--ink-soft);}
.per-head{
  font-family:'Space Mono',ui-monospace,monospace;
  font-size:12.5px;color:var(--ink);font-variant-numeric:tabular-nums;
}
.per-head-list{margin-top:8px;display:flex;flex-direction:column;gap:4px;}
.per-head-row{display:flex;justify-content:space-between;gap:8px;font-size:12.5px;color:var(--ink-soft);}

.score-row{display:flex;gap:8px;margin-top:10px;}
.score-row > div{flex:1;min-width:0;}
.score-row label{
  display:block;font-size:10.5px;text-transform:uppercase;letter-spacing:.6px;
  color:var(--ink-soft);margin-bottom:3px;font-weight:600;
}
.disagree{
  margin-top:8px;font-size:12px;color:var(--gold);
  display:flex;align-items:center;gap:6px;
}
.disagree b{font-family:'Space Mono',ui-monospace,monospace;}

/* ---------- Vendors ---------- */
.vendor-card{
  background:var(--white);border:1px solid var(--line);border-radius:var(--radius);
  padding:14px;margin-bottom:10px;
}
.vendor-top{display:flex;justify-content:space-between;align-items:flex-start;gap:8px;}
.vendor-name{font-weight:700;font-size:15px;font-family:'Fraunces',Georgia,serif;overflow-wrap:anywhere;}
.vendor-cat{font-size:11px;color:var(--sage-deep);text-transform:uppercase;letter-spacing:.6px;margin-top:2px;}
.status-badge{
  font-size:10.5px;font-weight:700;padding:4px 9px;border-radius:20px;
  text-transform:uppercase;letter-spacing:.4px;white-space:nowrap;flex:none;
}
.status-booked{background:var(--sage-light);color:var(--sage-deep);}
.status-contacted{background:var(--rose-light);color:var(--rose);}
.status-researching{background:var(--ivory-2);color:var(--ink-soft);}
.vendor-detail{font-size:12.5px;color:var(--ink-soft);margin-top:8px;line-height:1.5;overflow-wrap:anywhere;}
.vendor-detail a{color:var(--sage-deep);}
.inline-select{width:auto;min-width:132px;flex:none;font-size:13px;}

/* ---------- Empty state ---------- */
.empty{
  text-align:center;padding:34px 14px;color:var(--ink-soft);
}
.empty .em-mark{font-family:'Fraunces',Georgia,serif;font-style:italic;font-size:22px;color:var(--gold);display:block;margin-bottom:6px;}
.empty p{font-size:13px;margin:4px 0 0;}

/* ---------- Bottom nav ---------- */
nav.bottom{
  position:sticky;bottom:0;left:0;right:0;
  background:rgba(250,247,241,0.94);
  -webkit-backdrop-filter:blur(6px);
  backdrop-filter:blur(6px);
  border-top:1px solid var(--line);
  display:flex;
  padding:4px 2px calc(4px + var(--safe-bottom));
  /* width:100% is load-bearing: .app is a flex column, and an auto cross-axis
     margin suppresses stretch, which would otherwise shrink the nav to its
     content width and squeeze every button below 44pt. */
  width:100%;
  max-width:520px;margin:0 auto;
  z-index:20;
}
/* With the on-screen keyboard up the nav would otherwise sit on top of whatever
   input has focus. app.js toggles this via the visualViewport API. */
body.keyboard-open nav.bottom{display:none;}
body.keyboard-open main{padding-bottom:24px;}
nav.bottom button{
  flex:1;background:none;border:none;cursor:pointer;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  min-height:var(--tap);
  padding:5px 2px;color:var(--ink-soft);
  font-family:'Inter',sans-serif;
  -webkit-tap-highlight-color:transparent;
}
nav.bottom button svg{width:20px;height:20px;stroke:var(--ink-soft);fill:none;stroke-width:1.6;}
nav.bottom button span{font-size:9.5px;font-weight:600;letter-spacing:0.2px;}
nav.bottom button.active{color:var(--sage-deep);}
nav.bottom button.active svg{stroke:var(--sage-deep);}

/* ---------- Conflict / toast ---------- */
.banner{
  position:fixed;left:50%;transform:translateX(-50%);
  bottom:calc(76px + var(--safe-bottom));
  width:min(480px, calc(100vw - 32px));
  background:var(--ink);color:var(--ivory);
  border-radius:12px;padding:12px 14px;
  font-size:13px;line-height:1.45;
  box-shadow:0 6px 24px rgba(0,0,0,.18);
  z-index:60;
}
.banner .btn-row{margin-top:10px;}
.banner.danger{background:var(--danger);color:#fff;}
.banner.danger .btn{background:#fff;border-color:#fff;color:var(--danger);}
.banner.danger .btn.ghost{background:transparent;border-color:rgba(255,255,255,.5);color:#fff;}
.banner .btn{background:var(--sage);border-color:var(--sage);}
.banner .btn.ghost{background:transparent;border-color:rgba(250,247,241,.4);color:var(--ivory);}

/* ---------- Login ---------- */
body.login-page .app{justify-content:center;padding:0 24px calc(40px + var(--safe-bottom));}
.login-box{width:100%;max-width:360px;margin:0 auto;text-align:center;}
.login-box h1{font-size:28px;margin-bottom:6px;}
.login-box p.sub{font-size:13px;color:var(--ink-soft);margin:0 0 22px;}
.login-box form{text-align:left;}
.login-box .btn{width:100%;margin-top:14px;}
.login-error{
  color:var(--danger);font-size:12.5px;margin-top:10px;min-height:18px;text-align:center;
}

::placeholder{color:#a8a496;}
.hidden{display:none !important;}
.sr-only{
  position:absolute;width:1px;height:1px;padding:0;margin:-1px;
  overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;
}
