/* ============ The Little Wedding Book, editorial stationery look ============ */
:root{
  --paper:#f5f1e8;
  --card:#fffdf7;
  --ink:#2e2c26;
  --ink-soft:#6b6658;
  --line:#e2dac6;
  --line-soft:#ece6d6;
  /* the accent trio is replaced at runtime by the chosen colour */
  --accent:#51624a;
  --accent-deep:#3b4936;
  --accent-tint:#eef0e8;
  --sand:#a98c4f;
  --sand-tint:#f4ecd9;
  --done:#3e7d4f;
  --done-bg:#e4f0e3;
  --warn:#8f6d17;
  --warn-bg:#f8efd8;
  --late:#9c4433;
  --late-bg:#f5e5df;
  --serif:'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans:'Karla', 'Segoe UI', system-ui, sans-serif;
}
*{box-sizing:border-box; margin:0; padding:0}
[hidden]{display:none !important}
/* instant scroll on tab change (no animated glide) and no scroll-anchoring
   shifts when panels of different heights swap in and out */
html{scroll-behavior:auto; overflow-anchor:none}
body{
  font-family:var(--sans);
  color:var(--ink);
  background:var(--paper);
  min-height:100vh;
  font-size:14.5px;
  line-height:1.5;
  display:flex; flex-direction:column;
}
body.welcoming{overflow:hidden}
button{font-family:inherit; cursor:pointer; color:inherit}
button:disabled{cursor:default; opacity:.35}
input,select,textarea{font-family:inherit; font-size:13.5px; color:var(--ink); background:#fff; border:1px solid var(--line); border-radius:6px; padding:6px 9px; outline:none}
input:focus,select:focus,textarea:focus{border-color:var(--accent)}
:focus-visible{outline:2px solid var(--accent); outline-offset:2px}
input:focus-visible,select:focus-visible,textarea:focus-visible{outline:none; border-color:var(--accent); box-shadow:0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent)}
h2{font-family:var(--serif); font-weight:500; font-size:30px; letter-spacing:.01em}
h3{font-family:var(--serif); font-weight:600; font-size:20px; margin-bottom:10px}

/* ============ The page behind everything ============
   The website's landing page look: soft sage and gold glows on the paper, and one canvas of
   drifting stars and hearts (js/sparkles.js). Fixed, under every card, panel and dialog. */
.app-bg{
  position:fixed; inset:0; z-index:-1; pointer-events:none;
  background:
    radial-gradient(38% 52% at 16% 34%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%),
    radial-gradient(42% 60% at 86% 26%, rgba(201,162,84,.17), transparent 70%),
    radial-gradient(46% 44% at 62% 96%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%),
    radial-gradient(34% 36% at 50% 4%, rgba(255,253,247,.85), transparent 70%);
}
.app-stars{position:absolute; inset:0; width:100%; height:100%; display:block}

/* ============ Sample banner ============ */
.sample-banner{
  display:flex; align-items:center; justify-content:center; gap:14px; flex-wrap:wrap;
  padding:9px 16px; background:var(--sand-tint); color:var(--ink); font-size:13px; text-align:center;
  border-bottom:1px solid rgba(169,140,79,.4);
}

/* ============ Masthead: the green band, as on the website ============
   Follows the colour theme: the band is the theme's deep colour (dark sage by default). */
.masthead{
  position:relative; overflow:hidden; isolation:isolate;
  display:grid; grid-template-columns:minmax(0, 1fr) minmax(0, max-content) minmax(0, 1fr); align-items:center; gap:18px;
  padding:15px 36px 14px;
  background:var(--accent-deep); color:#fdfcf7;
  border-bottom:1px solid rgba(201,162,84,.35);
}
.masthead-stars{position:absolute; inset:0; width:100%; height:100%; pointer-events:none; z-index:0; display:block}
.masthead > :not(.masthead-stars), .masthead-actions > *{position:relative; z-index:1}
.masthead-brand{justify-self:start; display:flex; align-items:center; gap:12px; min-width:0}
.brand-icon{flex:none; display:block; width:36px; height:36px; border-radius:22%; box-shadow:0 0 0 1px rgba(201,162,84,.55), 0 6px 14px -8px rgba(0,0,0,.45)}
.brand-name{font:500 21px/1.45 var(--serif); letter-spacing:.005em; white-space:nowrap; color:#fdfcf7; padding:.08em 0 .14em; overflow:hidden; text-overflow:ellipsis}
.brand-name .little{font-family:'Allura', var(--serif); font-weight:400; color:#c9a254; font-size:1.28em; line-height:0; margin:0 .02em; position:relative; top:.04em}
.masthead-title{text-align:center}
.masthead-title h1{color:#fdfcf7}
.masthead .masthead-sub{color:rgba(253,252,247,.74)}
.masthead .masthead-sub .dot{color:#c9a254}
.masthead #countdown{color:#e9d6a6}
.masthead .link-btn{color:#e9d6a6}
.masthead .link-btn:hover{color:#fdfcf7}
.masthead-actions{justify-self:end}
.masthead .save-state{color:rgba(253,252,247,.7)}
.masthead .save-state.saving{color:#e9d6a6}
.masthead .save-state.saved{color:rgba(253,252,247,.78)}
.masthead .save-state.error{color:#f4bfb2}
.masthead .btn.ghost{background:transparent; color:#fdfcf7; border-color:rgba(253,252,247,.5); white-space:nowrap}
.masthead .btn.ghost:hover{background:rgba(253,252,247,.1); border-color:#fdfcf7}
.masthead .btn.nudge::after{border-color:var(--accent-deep)}
.masthead :focus-visible{outline-color:#e9d6a6}
@media (max-width:1000px){ .brand-name{display:none} }
.masthead-sub .sub-short{display:none}
@media (max-width:760px){ .masthead-sub .sub-long{display:none} .masthead-sub .sub-short{display:inline} }

/* the ring of initials, used on the welcome card */
.monogram{
  width:56px; height:56px; min-width:56px; border-radius:50%;
  border:1.5px solid var(--sand);
  display:flex; align-items:center; justify-content:center;
  font-family:var(--serif); font-style:italic; font-size:17px; letter-spacing:.03em; color:var(--accent-deep);
  background:var(--card);
  box-shadow:0 0 0 4px var(--paper), 0 0 0 5px var(--line);
  white-space:nowrap; overflow:hidden;
}
.masthead-title{min-width:0}
.masthead-title h1{font-family:var(--serif); font-weight:500; font-size:34px; line-height:1.05; overflow-wrap:anywhere}
.masthead-sub{color:var(--ink-soft); letter-spacing:.06em; font-size:13px; margin-top:3px}
.masthead-sub .dot{color:var(--sand); margin:0 4px}
#countdown{color:var(--accent-deep); font-weight:600}
.masthead-actions{display:flex; gap:10px; align-items:center}

.link-btn{
  background:none; border:none; padding:0; font:inherit; color:var(--accent-deep);
  text-decoration:underline; text-underline-offset:3px; cursor:pointer;
}
.link-btn:hover{color:var(--accent)}

/* ============ Tabs ============ */
.tabs{
  display:flex; gap:4px; padding:0 36px;
  border-bottom:1px solid var(--line);
  background:rgba(255,253,247,.86);
  position:sticky; top:0; z-index:40; backdrop-filter:blur(6px);
}
.tab{
  background:none; border:none; padding:14px 18px 12px;
  font-size:12px; letter-spacing:.16em; text-transform:uppercase; font-weight:600;
  color:var(--ink-soft); border-bottom:2px solid transparent;
}
.tab:hover{color:var(--ink)}
.tab.active{color:var(--accent-deep); border-bottom-color:var(--accent)}

main{padding:26px 36px 60px; max-width:1500px; margin:0 auto; width:100%; flex:1}
.panel{display:none}
.panel.active{display:block}
.panel-head{display:flex; align-items:flex-end; justify-content:space-between; gap:20px; margin-bottom:16px}
.panel-head-right{display:flex; gap:10px; align-items:center; white-space:nowrap}
.hint{color:var(--ink-soft); font-size:13px; margin-top:4px; max-width:780px; text-wrap:pretty}
.hint.small{font-size:12px}
.switch-label{font-size:13px; color:var(--ink-soft); display:flex; gap:6px; align-items:center; cursor:pointer}

.site-foot{
  text-align:center; color:var(--ink-soft); font-size:12px; letter-spacing:.03em;
  padding:18px 20px 26px; border-top:1px solid var(--line-soft);
}

/* ============ Buttons ============ */
.btn{
  background:var(--accent-deep); color:#fdfcf7; border:1px solid var(--accent-deep);
  border-radius:7px; padding:8px 16px; font-size:13px; font-weight:600; letter-spacing:.02em;
  display:inline-flex; align-items:center; justify-content:center; gap:6px; cursor:pointer;
  text-decoration:none; position:relative;
}
.btn:hover{background:var(--accent); border-color:var(--accent)}
.btn.ghost{background:transparent; color:var(--accent-deep); border-color:var(--line)}
.btn.ghost:hover{border-color:var(--accent); background:var(--accent-tint)}
.btn.small{padding:5px 11px; font-size:12px}
.btn.danger-btn{background:transparent; color:var(--late); border-color:#dcb9b0}
.btn.danger-btn:hover{background:var(--late); color:#fff; border-color:var(--late)}
/* a quiet dot when a backup is overdue */
.btn.nudge::after{
  content:''; position:absolute; top:-4px; right:-4px; width:10px; height:10px; border-radius:50%;
  background:var(--warn); border:2px solid var(--paper);
}
.icon-btn{background:none; border:none; color:var(--ink-soft); font-size:15px; padding:4px 6px; border-radius:5px; line-height:1}
.icon-btn:hover:not(:disabled){background:var(--accent-tint); color:var(--ink)}
.icon-btn.danger:hover{background:var(--late-bg); color:var(--late)}

/* ============ Check circles ============ */
.check{
  width:22px; height:22px; min-width:22px; border-radius:50%;
  border:1.6px solid #b9b19c; background:#fff; color:transparent;
  font-size:12px; display:flex; align-items:center; justify-content:center;
  transition:all .18s ease; padding:0;
}
.check:hover{border-color:var(--done)}
.check.on{background:var(--done); border-color:var(--done); color:#fff}

/* ============ Calendar timeline ============ */
.tl-legend{display:flex; flex-wrap:wrap; gap:6px 18px; margin-bottom:10px; font-size:12px; color:var(--ink-soft)}
.lg{display:flex; align-items:center; gap:6px}
.sw{width:11px; height:11px; border-radius:3px; display:inline-block}
.sw-due{background:var(--warn-bg); border:1.5px solid var(--warn)}
.sw-late{background:var(--late-bg); border:1.5px solid var(--late)}
.sw-done{background:var(--done-bg); border:1.5px solid var(--done)}
.sw-pay{background:#fff; border:1.5px solid var(--line); border-left:4px solid var(--sand)}
.sw-wed{background:var(--accent); border:1.5px solid var(--accent-deep); width:4px; border-radius:2px}

.tl-frame{position:relative}
.tl-scroll{
  overflow-x:auto; overflow-y:auto; max-height:min(84vh, 900px);
  border:1px solid var(--line); border-radius:12px;
  background:var(--card);
  box-shadow:0 8px 24px -18px rgba(46,44,38,.4);
}
.tl-canvas{position:relative; user-select:none}
.tl-empty{
  position:absolute; left:0; right:0; top:50%; transform:translateY(-30%); margin:0 auto;
  width:max-content; max-width:90%; background:var(--card); border-radius:8px; z-index:7;
  text-align:center; color:var(--ink-soft); font-size:13px; padding:8px 16px; pointer-events:none;
}
.tl-month{
  position:absolute; top:0; bottom:0;
  border-left:1px dashed var(--line);
}
.tl-month.alt{background:rgba(226,218,198,.14)}
.tl-month-label{
  position:sticky; top:0;
  padding:14px 0 6px 14px;
  font-family:var(--serif); font-style:italic; font-size:20px; color:var(--accent-deep);
  white-space:nowrap;
}
.tl-month-year{font-size:12px; font-family:var(--sans); font-style:normal; color:var(--ink-soft); letter-spacing:.1em; margin-left:6px}
.tl-today{
  position:absolute; top:0; bottom:0; width:2px;
  background:var(--sand); z-index:5;
}
.tl-today::after{
  content:'Today'; position:absolute; top:42px; left:8px;
  font-size:10px; letter-spacing:.14em; text-transform:uppercase; color:#7d6534;
  font-weight:700; white-space:nowrap;
}
.tl-wedding{
  position:absolute; top:0; bottom:0; width:3px;
  background:var(--accent); z-index:5; border-radius:2px;
}
.tl-wedding::after{
  content:'Wedding day'; position:absolute; top:42px; right:10px;
  font-size:10px; letter-spacing:.14em; text-transform:uppercase; color:var(--accent-deep);
  font-weight:700; white-space:nowrap;
}
.tl-chip{
  position:absolute; width:236px; min-height:56px;
  background:#fff; border:1.5px solid var(--line);
  border-radius:10px; padding:9px 12px 9px 10px;
  display:flex; gap:10px; align-items:center;
  cursor:grab; z-index:6;
  box-shadow:0 3px 10px -6px rgba(46,44,38,.35);
  transition:box-shadow .15s ease;
}
.tl-chip .check{width:21px; height:21px; min-width:21px; font-size:11px}
.tl-chip .tc-body{min-width:0}
.tl-chip:hover{box-shadow:0 6px 16px -6px rgba(46,44,38,.45); z-index:8}
.tl-chip.dragging{cursor:grabbing; z-index:50; box-shadow:0 12px 28px -8px rgba(46,44,38,.5); opacity:.92}
.tl-chip .tc-title{font-size:13.5px; font-weight:600; line-height:1.3; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.tc-date{font-size:11.5px; color:var(--ink-soft); letter-spacing:.04em; margin-top:3px}
.tl-chip.is-due{border-color:var(--warn); background:var(--warn-bg)}
.tl-chip.is-late{border-color:var(--late); background:var(--late-bg)}
.tl-chip.is-late .tc-date{color:var(--late); font-weight:700}
.tl-chip.is-done{border-color:var(--done); background:var(--done-bg)}
.tl-chip.is-done .tc-title{color:var(--ink-soft); text-decoration:line-through; text-decoration-thickness:1px}
/* a payment is marked by its gold edge, whatever its state colour */
.tl-chip.is-pay{border-left:4px solid var(--sand); padding-left:8px}
.tl-chip.is-pay:not(.is-done):not(.is-late):not(.is-due){background:var(--sand-tint)}

/* Coming up strip */
.upnext{margin-top:22px}
.upnext h3{margin-bottom:8px}
.upnext-list{display:flex; gap:10px; overflow-x:auto; padding-bottom:6px}
.upnext-card{
  min-width:210px; background:var(--card); border:1px solid var(--line);
  border-left:3px solid var(--warn); border-radius:9px; padding:10px 12px;
}
.upnext-card.late{border-left-color:var(--late)}
.upnext-card .un-when{font-size:11px; letter-spacing:.1em; text-transform:uppercase; color:var(--warn); font-weight:700}
.upnext-card.late .un-when{color:var(--late)}
.upnext-card .un-title{font-size:13px; font-weight:600; margin-top:3px}
.upnext-card .tc-date{font-size:11px}
.upnext-empty{color:var(--ink-soft); font-size:13px; padding:8px 2px}

/* ============ Checklists ============ */
.stage-pills{display:flex; flex-wrap:wrap; gap:8px; margin-bottom:14px}
.stage-pill{
  border:1px solid var(--line); background:var(--card); border-radius:999px;
  padding:7px 15px; font-size:12.5px; font-weight:600; color:var(--ink-soft);
}
.stage-pill:hover{border-color:var(--accent)}
.stage-pill.active{background:var(--accent-deep); border-color:var(--accent-deep); color:#fdfcf7}
.stage-pill .sp-count{font-weight:400; margin-left:5px; font-size:11px}
.stage-progress{margin-bottom:14px; max-width:520px}
.progress-track{height:6px; background:var(--line-soft); border-radius:99px; overflow:hidden}
.progress-fill{height:100%; background:linear-gradient(90deg, var(--accent), var(--done)); border-radius:99px; transition:width .3s ease}
.progress-text{font-size:12px; color:var(--ink-soft); margin-top:5px}

.task-list{display:flex; flex-direction:column; gap:7px; margin-bottom:16px}
.task-row{
  display:flex; align-items:center; gap:12px;
  background:var(--card); border:1px solid var(--line); border-radius:10px;
  padding:10px 14px;
  transition:background .2s ease, border-color .2s ease;
}
.task-row.done{background:var(--accent-tint); border-color:var(--line)}
.task-row.overdue:not(.done){border-left:3px solid var(--late)}
.task-main{flex:1; min-width:0}
.task-title-input{
  border:none; background:transparent; width:100%; font-size:14px; font-weight:600; padding:2px 0; border-radius:3px;
}
.task-row.done .task-title-input{text-decoration:line-through; color:var(--ink-soft)}
.task-due{border:none; background:transparent; color:var(--ink-soft); font-size:12.5px; width:128px; padding:4px 2px}
.task-due.overdue-txt{color:var(--late); font-weight:700}
.star-btn{background:none; border:none; font-size:16px; color:#948b6e; padding:2px 4px; line-height:1}
.star-btn.on{color:var(--sand)}
.star-btn:hover{color:var(--sand)}
.notes-input{width:240px; font-size:12px; color:var(--ink-soft); border-color:var(--line-soft); background:rgba(255,255,255,.6)}

.add-row{display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-top:10px}
.add-row input[type=text]{flex:1; min-width:200px}
.add-row input[type=number]{width:120px}

/* ============ Stat cards ============ */
.stat-row{display:grid; grid-template-columns:repeat(auto-fit, minmax(170px, 230px)); gap:14px; margin-bottom:20px}
.stat-card{
  background:var(--card); border:1px solid var(--line); border-radius:11px;
  padding:14px 20px; min-width:0;
}
.stat-card .st-label{font-size:11px; letter-spacing:.14em; text-transform:uppercase; color:var(--ink-soft); font-weight:700}
.stat-card .st-value{font-family:var(--serif); font-size:30px; font-weight:600; color:var(--accent-deep); margin-top:2px; line-height:1.15}
.stat-card.accent .st-value{color:var(--sand)}
.stat-card.over .st-value, .stat-card.over .progress-text{color:var(--late)}

/* ============ Tables ============ */
/* the two sheets sit one above the other: side by side they clipped their own columns */
.two-col{display:grid; grid-template-columns:1fr; gap:28px; align-items:start}
@media (min-width:1760px){.two-col{grid-template-columns:1.05fr 1fr}}
/* min-width:0 lets the column shrink below the table's natural width, so the
   wide sheet scrolls inside its own box instead of widening the whole page */
.two-col > .col{min-width:0}
.table-wrap{
  background:var(--card); border:1px solid var(--line); border-radius:11px;
  overflow-x:auto; max-width:100%;
}
.grid-table{width:100%; border-collapse:collapse; font-size:13.5px}
.grid-table th{
  text-align:left; font-size:10.5px; letter-spacing:.13em; text-transform:uppercase;
  color:var(--ink-soft); padding:11px 12px; border-bottom:1px solid var(--line);
  white-space:nowrap;
}
.grid-table td{padding:7px 12px; border-bottom:1px solid var(--line-soft); vertical-align:middle}
.grid-table tr:last-child td{border-bottom:none}
.grid-table .num{text-align:right}
.grid-table td.num{font-variant-numeric:tabular-nums}
.grid-table input[type=number]{width:92px; text-align:right; border-color:transparent; background:transparent; padding:4px 6px}
.grid-table input[type=number]:hover, .grid-table input[type=number]:focus{border-color:var(--line); background:#fff}
.grid-table input[type=text]{border-color:transparent; background:transparent; width:100%; min-width:110px; padding:4px 6px}
.grid-table input[type=text]:hover, .grid-table input[type=text]:focus{border-color:var(--line); background:#fff}
.grid-table input[type=date]{border-color:transparent; background:transparent; padding:4px 4px; font-size:12.5px; color:var(--ink-soft)}
.grid-table input[type=date]:hover, .grid-table input[type=date]:focus{border-color:var(--line); background:#fff}
.grid-table select{font-size:12.5px; padding:4px 6px; max-width:170px}
#budget-table input[data-b=category]{min-width:190px}
#budget-table input[data-b=notes]{min-width:150px}
#payments-table .pay-label input{min-width:170px}
.grid-table tfoot td{font-weight:700; border-top:2px solid var(--line); background:var(--accent-tint); font-family:var(--serif); font-size:15px}
.grid-table .empty-row td{padding:18px 16px; max-width:none}
.pay-row.paid td{background:var(--done-bg)}
.pay-row.paid .pay-label input{text-decoration:line-through; opacity:.7}
.pay-row.due-soon td{background:var(--warn-bg)}
.pay-row.late-pay td{background:var(--late-bg)}
.pay-row td{background-clip:padding-box}
.pay-cat{border-color:transparent; background:transparent; color:var(--ink-soft)}
.pay-cat:hover, .pay-cat:focus{border-color:var(--line); background:#fff}
.paid-cell{width:34px}
.cat-paid{color:var(--done); font-weight:600; white-space:nowrap}

/* ============ Guests ============ */
.bulk-box{margin:12px 0; display:flex; gap:10px; align-items:flex-start; flex-wrap:wrap}
.bulk-main{flex:1; min-width:240px; max-width:460px}
.bulk-box textarea{width:100%}
.filter-row{display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin:16px 0 10px}
.filter-row input[type=search]{flex:1; min-width:180px; max-width:320px}
.rsvp-select{font-size:12.5px; padding:4px 6px}
.rsvp-yes{color:var(--done); font-weight:700}
.rsvp-no{color:var(--late); font-weight:700}
#guests-table td{padding:5px 12px}
.grp-select{border-color:var(--line); font-weight:600}

/* group colour: any element carrying --g takes that group's colour */
.guest-chip.has-grp, .seat.occupied.has-grp, .grp-select.has-grp{
  border-color:var(--g);
  background:color-mix(in srgb, var(--g) 12%, #fff);
  color:var(--g);
}

/* ============ Seating ============ */
.seating-wrap{display:flex; gap:18px; height:calc(100dvh - 275px); min-height:460px}
.seat-side{
  width:268px; min-width:268px; background:var(--card);
  border:1px solid var(--line); border-radius:11px; padding:14px;
  display:flex; flex-direction:column; gap:8px;
}
.seat-side h3{margin-bottom:0}
.count-pill{
  background:var(--accent-tint); color:var(--accent-deep); border-radius:99px;
  font-size:11px; padding:2px 9px; font-family:var(--sans); font-weight:700; vertical-align:2px;
}
.unseated-list{flex:1; overflow-y:auto; display:flex; flex-direction:column; gap:6px; padding-right:2px}
.guest-chip{
  background:#fff; border:1.4px solid var(--line); border-radius:14px;
  padding:7px 13px; font-size:12.5px; font-weight:600; cursor:grab;
  user-select:none; white-space:normal; overflow-wrap:anywhere; line-height:1.3;
  transition:border-color .15s ease;
}
.guest-chip:hover{border-color:var(--accent)}
.grp-legend{display:flex; flex-wrap:wrap; gap:4px 12px; font-size:11px; color:var(--ink-soft)}
.grp-legend span{display:flex; align-items:center; gap:5px}
.gdot{width:9px; height:9px; border-radius:50%; display:inline-block}

.seat-canvas-wrap{
  flex:1; position:relative; overflow-y:auto; overflow-x:hidden; border:1px solid var(--line); border-radius:11px;
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--accent) 14%, transparent) 1px, transparent 0) 0 0/26px 26px,
    var(--card);
}
.seat-canvas{position:relative; width:1200px; height:1120px; transform-origin:0 0; user-select:none}
.seat-empty{
  position:absolute; left:0; right:0; top:40%; text-align:center; color:var(--ink-soft);
  font-size:13px; padding:0 20px; pointer-events:none;
}
.table-el{position:absolute; z-index:2}
.table-disc{
  position:absolute; left:50%; top:50%; transform:translate(-50%,-50%);
  width:118px; height:118px; border-radius:50%;
  background:#fff; border:1.6px solid var(--sand);
  box-shadow:0 6px 18px -10px rgba(46,44,38,.5), inset 0 0 0 5px var(--sand-tint);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  cursor:grab; text-align:center; padding:10px;
}
.table-disc:active{cursor:grabbing}
/* The table's name: drawn as text that wraps and shrinks to fit (sized in seating.js),
   and typed into in place. Presses on it go to the table until it is opened. */
.table-name{
  display:block; font-family:var(--serif); font-style:italic; font-size:16px; font-weight:600; line-height:1.05;
  color:var(--accent-deep); text-align:center; white-space:normal; overflow-wrap:anywhere;
  max-width:92px; min-width:1.2em; padding:1px 4px; border-radius:5px; outline:none; cursor:text;
  pointer-events:none; -webkit-user-select:none; user-select:none;
}
.table-name.clamped{display:-webkit-box; -webkit-box-orient:vertical; overflow:hidden}
@media (hover:hover) and (pointer:fine){
  .table-name{pointer-events:auto}
  .table-name:hover{text-decoration:underline dotted; text-decoration-color:color-mix(in srgb, var(--accent-deep) 55%, transparent); text-underline-offset:3px}
}
.table-name:focus{
  pointer-events:auto; display:block; overflow:visible; min-width:3em;
  background:#fff; text-decoration:none; cursor:text; -webkit-user-select:text; user-select:text;
  box-shadow:0 0 0 1.5px color-mix(in srgb, var(--accent-deep) 60%, transparent), 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent);
}
.table-count{font-size:10px; color:var(--ink-soft); letter-spacing:.08em; margin-top:1px}
.table-tools{
  position:absolute; left:50%; top:calc(50% + 40px); transform:translateX(-50%);
  display:none; gap:2px; background:#fff; border:1px solid var(--line); border-radius:99px;
  padding:1px 4px; z-index:4;
}
.table-rect{
  position:absolute; left:10px; right:10px; top:110px; height:78px;
  border-radius:14px; background:#fff; border:1.6px solid var(--sand);
  box-shadow:0 6px 18px -10px rgba(46,44,38,.5), inset 0 0 0 5px var(--sand-tint);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  cursor:grab; padding:6px;
}
.table-rect:active{cursor:grabbing}
.table-el.rect .table-tools{top:auto; bottom:0}
.table-el:hover .table-tools, .table-el:focus-within .table-tools{display:flex}
.table-tools button{background:none; border:none; font-size:12px; padding:2px 6px; color:var(--ink-soft); border-radius:99px}
.table-tools button:hover{background:var(--accent-tint); color:var(--ink)}
.seat{
  position:absolute; transform:translate(-50%,-50%);
  width:26px; height:26px; border-radius:50%;
  background:var(--paper); border:1.5px dashed #c9c0a6;
  z-index:3; transition:all .12s ease;
}
.seat.drop-hot{border-color:var(--accent); border-style:solid; background:var(--accent-tint); box-shadow:0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent)}
.seat.occupied{
  width:auto; height:auto; border-radius:999px; border:1.4px solid var(--accent);
  background:#fff; padding:4px 8px; font-size:11.5px; font-weight:600;
  max-width:112px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  cursor:grab; box-shadow:0 2px 8px -4px rgba(46,44,38,.4);
}
/* long tables: names stand upright above the table edge */
.table-el.rect .seat.occupied{
  writing-mode:vertical-rl;
  transform:translate(-50%, -100%);
  max-width:none; max-height:108px;
  padding:9px 4px;
}
.drag-ghost{
  position:fixed; z-index:999; pointer-events:none;
  background:var(--accent-deep); color:#fdfcf7; border-radius:999px;
  padding:6px 14px; font-size:12.5px; font-weight:600;
  box-shadow:0 10px 24px -8px rgba(46,44,38,.6);
  transform:translate(-50%,-120%);
}
.side-drop-hot{outline:2px solid var(--accent); outline-offset:-2px; border-radius:11px}

/* ============ Notes ============ */
.notes-grid{
  display:grid; grid-template-columns:repeat(auto-fill, minmax(300px, 1fr));
  gap:18px; align-items:start;
}
.note-card{
  position:relative; background:var(--card);
  border:1px solid var(--line); border-radius:4px;
  padding:18px 20px 20px;
  box-shadow:0 10px 26px -18px rgba(46,44,38,.5);
  background-image:linear-gradient(180deg, color-mix(in srgb, var(--sand) 6%, transparent), transparent 60px);
}
.note-card::before{
  content:''; position:absolute; left:14px; right:14px; top:0; height:3px;
  background:linear-gradient(90deg, var(--sand), transparent);
  border-radius:0 0 3px 3px;
}
.note-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:6px}
.note-date{
  border:none; background:transparent; color:#7d6534; font-weight:700;
  font-size:11px; letter-spacing:.12em; text-transform:uppercase; padding:2px 0;
}
.note-del{opacity:0; transition:opacity .15s ease}
.note-card:hover .note-del, .note-card:focus-within .note-del{opacity:1}
.note-title{
  font-family:var(--serif); font-size:23px; font-weight:600; color:var(--accent-deep);
  border:none; border-bottom:1px solid transparent; background:transparent; width:100%; padding:0 0 4px; line-height:1.15; border-radius:0;
  display:block; resize:none; overflow:hidden; field-sizing:content; min-height:32px;
}
.note-title:focus, .note-title:focus-visible{outline:none; box-shadow:none; border-bottom-color:var(--line)}
.note-with{display:flex; align-items:center; gap:8px; margin:2px 0 10px}
.nw-label{
  font-size:10px; letter-spacing:.14em; text-transform:uppercase; color:var(--ink-soft);
  font-weight:700; white-space:nowrap;
}
.note-with input{
  border:none; border-bottom:1px dotted var(--line); background:transparent;
  flex:1; min-width:0; font-style:italic; font-family:var(--serif); font-size:16px; color:var(--ink);
  padding:1px 2px; border-radius:0;
}
.note-with input:focus, .note-with input:focus-visible{border-bottom-color:var(--accent); box-shadow:none}
.note-body{
  width:100%; border:none; background:transparent; resize:vertical; field-sizing:content; max-height:420px; overflow-y:auto;
  font-family:var(--sans); font-size:13.5px; line-height:1.6; color:var(--ink);
  padding:0; min-height:80px;
}
.note-body:focus, .note-body:focus-visible{outline:none; box-shadow:none}
.notes-empty, .gallery-empty{
  grid-column:1/-1; text-align:center; color:var(--ink-soft);
  padding:60px 20px; line-height:1.7;
}
.ne-mark{font-family:var(--serif); font-size:44px; color:var(--sand); opacity:.6; margin-bottom:10px}

/* ============ Gallery ============ */
#gallery-upload-group{font-size:13px; padding:7px 10px}
.gallery-group{margin-bottom:30px}
.gallery-group-title{
  font-family:var(--serif); font-weight:600; font-size:22px; color:var(--accent-deep);
  border-bottom:1px solid var(--line); padding-bottom:8px; margin-bottom:16px;
  display:flex; align-items:center; gap:10px;
}
.gallery-grid{
  display:grid; grid-template-columns:repeat(auto-fill, minmax(210px, 1fr)); gap:18px;
}
.gal-tile{display:flex; flex-direction:column; gap:7px}
.gal-thumb{
  position:relative; aspect-ratio:4/3; border-radius:9px; overflow:hidden;
  background:var(--accent-tint); border:1px solid var(--line);
  box-shadow:0 8px 20px -14px rgba(46,44,38,.55);
}
.gal-thumb img{width:100%; height:100%; object-fit:cover; cursor:zoom-in; display:block; transition:transform .3s ease}
.gal-thumb:hover img{transform:scale(1.04)}
.gal-missing{display:flex; align-items:center; justify-content:center; height:100%; color:var(--ink-soft); font-size:12px; font-style:italic}
.gal-tools{position:absolute; top:8px; right:8px; display:flex; gap:5px; opacity:0; transition:opacity .15s ease}
.gal-thumb:hover .gal-tools, .gal-thumb:focus-within .gal-tools{opacity:1}
.gal-tool{
  width:28px; height:28px; border-radius:50%; border:none; cursor:pointer;
  background:rgba(255,253,247,.94); color:var(--ink); font-size:13px; line-height:1;
  box-shadow:0 2px 8px -2px rgba(46,44,38,.5);
}
.gal-tool:hover{background:#fff}
.gal-tool.danger:hover{background:var(--late); color:#fff}
.gal-caption{
  border:none; background:transparent; font-size:13px; font-weight:600; color:var(--ink);
  padding:2px 2px; border-bottom:1px solid transparent; width:100%; border-radius:0;
}
.gal-caption:hover{border-bottom-color:var(--line-soft)}
.gal-caption:focus, .gal-caption:focus-visible{outline:none; box-shadow:none; border-bottom-color:var(--accent)}
.gal-group{font-size:11.5px; color:var(--ink-soft); padding:3px 5px; border-color:var(--line-soft)}

/* Lightbox */
.lightbox{
  position:fixed; inset:0; z-index:200; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:14px; padding:40px;
  background:rgba(30,28,24,.82); backdrop-filter:blur(4px);
}
.lightbox img{max-width:92vw; max-height:82vh; border-radius:6px; box-shadow:0 30px 60px -20px rgba(0,0,0,.7)}
.lightbox-cap{color:#f5f1e8; font-family:var(--serif); font-style:italic; font-size:18px; text-align:center}
.lightbox-close{
  position:absolute; top:22px; right:26px; width:40px; height:40px; border-radius:50%;
  border:1px solid rgba(245,241,232,.4); background:rgba(0,0,0,.25); color:#f5f1e8; font-size:16px;
}
.lightbox-close:hover{background:rgba(0,0,0,.5)}

/* ============ Settings ============ */
.settings-body{display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:20px; align-items:start}
@media (min-width:1240px){.settings-body{grid-template-columns:repeat(3, minmax(0, 1fr))}}
.set-card{
  background:var(--card); border:1px solid var(--line); border-radius:12px; padding:22px 24px;
  scroll-margin-top:70px; transition:box-shadow .4s ease, border-color .4s ease;
}
.set-card.flash{border-color:var(--accent); box-shadow:0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent)}
.set-card h3{margin-bottom:2px}
.set-card > .hint{margin:0 0 16px}
#card-wedding, #card-data{grid-column:1 / -1}
.set-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(190px, 1fr)); gap:14px 16px; margin-bottom:18px}
.field{display:flex; flex-direction:column; gap:5px; min-width:0}
.field > span{font-size:10.5px; letter-spacing:.13em; text-transform:uppercase; color:var(--ink-soft); font-weight:700}
.field input, .field select{width:100%; height:38px; padding:6px 10px; font-size:14px}
.theme-row{display:flex; flex-wrap:wrap; gap:8px}
.theme-dot{
  display:flex; align-items:center; gap:8px; background:#fff; border:1px solid var(--line);
  border-radius:999px; padding:6px 14px 6px 8px; font-size:12.5px; font-weight:600; color:var(--ink-soft);
}
.theme-dot i{width:18px; height:18px; border-radius:50%; display:block}
.theme-dot:hover{border-color:var(--accent)}
.theme-dot.on{border-color:var(--accent-deep); color:var(--ink); box-shadow:0 0 0 1px var(--accent-deep)}

.le-list{display:flex; flex-direction:column; gap:6px}
.le-row{
  display:flex; align-items:center; gap:6px; background:#fff; border:1px solid var(--line-soft);
  border-radius:9px; padding:5px 8px;
}
.le-row input[type=text]{flex:1; min-width:0; border-color:transparent; background:transparent; font-weight:600; padding:5px 6px}
.le-row input[type=text]:hover, .le-row input[type=text]:focus{border-color:var(--line); background:#fff}
.le-count{font-size:11.5px; color:var(--ink-soft); white-space:nowrap; padding:0 4px}
.le-swatch{width:20px; height:20px; min-width:20px; border-radius:50%; border:2px solid #fff; box-shadow:0 0 0 1px var(--line); padding:0}
.le-swatch:hover{box-shadow:0 0 0 2px var(--accent)}
.le-add{margin-top:12px}
.le-add input[type=text]{min-width:140px}

.backup-status{font-weight:600; color:var(--accent-deep); margin:0 0 12px}
.set-actions{display:flex; gap:10px; flex-wrap:wrap; margin-bottom:12px}
.danger-zone{
  display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap;
  margin-top:20px; padding-top:18px; border-top:1px solid var(--line-soft);
}
.danger-zone .hint{margin-top:2px}
.about-line{grid-column:1 / -1; color:var(--ink-soft); font-size:12px; letter-spacing:.06em}

/* ============ First-run welcome ============ */
.welcome{
  position:fixed; inset:0; z-index:300; display:flex; padding:24px; overflow-y:auto;
  background:
    radial-gradient(1200px 500px at 80% -10%, color-mix(in srgb, var(--sand) 16%, transparent), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 55%),
    var(--paper);
}
.welcome-card{
  margin:auto; background:var(--card); border:1px solid var(--line); border-radius:16px;
  padding:34px 36px 28px; width:min(560px, 100%);
  box-shadow:0 30px 70px -30px rgba(46,44,38,.6);
  display:flex; flex-direction:column; gap:16px;
}
.welcome-mono{align-self:center; font-size:26px; font-style:italic}
.welcome-card h2{text-align:center; color:var(--accent-deep); font-size:32px; line-height:1.1}
.welcome-sub{text-align:center; color:var(--ink-soft); font-size:13.5px; margin-top:-8px; text-wrap:balance}
.welcome-names{display:grid; grid-template-columns:1fr auto 1fr; gap:12px; align-items:end}
.welcome-names .amp{font-family:var(--serif); font-style:italic; font-size:26px; color:var(--sand); padding-bottom:4px}
.welcome-grid{display:grid; grid-template-columns:1.3fr .8fr 1fr; gap:12px}
.check-line{display:flex; align-items:center; gap:8px; font-size:13px; color:var(--ink-soft); margin-top:-6px; cursor:pointer}
.welcome-start{border:none; display:flex; flex-direction:column; gap:8px}
.welcome-start legend{font-size:10.5px; letter-spacing:.13em; text-transform:uppercase; color:var(--ink-soft); font-weight:700; margin-bottom:6px}
.choice{
  display:flex; gap:10px; align-items:flex-start; border:1px solid var(--line); border-radius:10px;
  padding:11px 13px; cursor:pointer; background:#fff;
}
.choice:has(input:checked){border-color:var(--accent-deep); box-shadow:0 0 0 1px var(--accent-deep)}
.choice input{margin-top:3px; accent-color:var(--accent-deep)}
.choice strong{display:block; font-size:14px}
.choice em{display:block; font-style:normal; font-size:12.5px; color:var(--ink-soft)}
.welcome-error{color:var(--late); font-size:13px; min-height:18px; text-align:center; margin:-6px 0}
.welcome-go{padding:12px; font-size:15px}
.welcome-alt{display:flex; justify-content:center; gap:8px 22px; flex-wrap:wrap; font-size:13px}
.welcome-private{text-align:center; color:var(--ink-soft); font-size:12px}
input[type=checkbox], input[type=radio]{accent-color:var(--accent-deep); padding:0}

.save-state{font-size:12px; letter-spacing:.04em; color:var(--ink-soft); white-space:nowrap}
.save-state.saving{color:var(--warn)}
.save-state.saved{color:#356b44}
.save-state.error{color:var(--late); font-weight:700}

/* ============ Keeping the plan safe: install guidance ============ */
.install-banner{
  display:flex; align-items:center; justify-content:center; gap:10px 14px; flex-wrap:wrap;
  padding:9px 16px; background:var(--warn-bg); color:#4f3d06; border-bottom:1px solid #e6d5a3;
  font-size:13px; text-align:center;
}
.install-banner .btn{background:#4f3d06; border-color:#4f3d06}
.install-banner .icon-btn{color:#4f3d06}
.install-box{
  border:1px solid #e6d5a3; background:var(--warn-bg); border-radius:10px; padding:14px 16px;
  font-size:13.5px; color:#4a3a08; display:flex; flex-direction:column; gap:8px; margin:6px 0 10px;
}
.install-box strong{font-size:15px}
.install-box ol{padding-left:20px; display:flex; flex-direction:column; gap:3px}
.install-box em{font-style:normal; font-weight:700}
.install-box .link-btn{align-self:flex-start; color:#4a3a08; margin-top:2px}
.welcome-fields{display:flex; flex-direction:column; gap:16px}
.backup-status.due{color:var(--warn)}

/* ============ Seating: picked guest, picked table ============ */
.guest-chip.picked, .seat.occupied.picked{
  outline:2.5px solid var(--accent-deep); outline-offset:2px;
  box-shadow:0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent);
}
.table-el.selected .table-disc, .table-el.selected .table-rect{
  border-color:var(--accent-deep);
  box-shadow:0 0 0 4px color-mix(in srgb, var(--accent) 26%, transparent), inset 0 0 0 5px var(--sand-tint);
}
.table-bar{
  position:sticky; top:0; left:0; z-index:8;
  display:flex; align-items:center; gap:8px 10px; flex-wrap:wrap; padding:9px 12px;
  background:rgba(255,253,247,.97); border-bottom:1px solid var(--line);
}
.table-bar input{flex:1; min-width:120px; max-width:260px; font-weight:600}
.tb-seats{display:flex; align-items:center; gap:8px; font-size:13px; color:var(--ink-soft); white-space:nowrap}
.seat-pick{
  position:fixed; left:50%; bottom:18px; transform:translateX(-50%); z-index:60;
  display:flex; align-items:center; justify-content:center; gap:8px 10px; flex-wrap:wrap;
  background:var(--accent-deep); color:#fdfcf7; padding:10px 14px; border-radius:14px; font-size:13.5px;
  box-shadow:0 14px 30px -10px rgba(46,44,38,.6); width:max-content; max-width:calc(100vw - 24px);
}
.seat-pick .btn{background:#fdfcf7; color:var(--accent-deep); border-color:#fdfcf7}
.seat-pick .btn.ghost{background:transparent; color:#fdfcf7; border-color:rgba(253,252,247,.55)}
/* on touch the scaled-down hover buttons are too small to hit: the table bar replaces them */
@media (pointer: coarse){ .table-tools{display:none !important} }

/* phone tab strip: fade the edge where more tabs are waiting */
.tabs.more-right{-webkit-mask-image:linear-gradient(90deg, #000 calc(100% - 46px), transparent); mask-image:linear-gradient(90deg, #000 calc(100% - 46px), transparent)}
.tabs.more-left{-webkit-mask-image:linear-gradient(90deg, transparent, #000 46px); mask-image:linear-gradient(90deg, transparent, #000 46px)}
.tabs.more-left.more-right{-webkit-mask-image:linear-gradient(90deg, transparent, #000 46px, #000 calc(100% - 46px), transparent); mask-image:linear-gradient(90deg, transparent, #000 46px, #000 calc(100% - 46px), transparent)}

.upnext-card.more{min-width:160px; background:var(--late-bg)}

/* ============ Refinements from the design review ============ */
/* the serif face draws old-style figures by default, so 0 looked like the letter o */
h1, h2, h3, .st-value, .grid-table tfoot td, .table-name, .note-title, .tl-month-label, .ne-mark, .welcome-names .amp{font-variant-numeric:lining-nums}
input:disabled, select:disabled{opacity:.45; background:var(--line-soft); cursor:not-allowed}
.sr-only{position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap}
.grid-table th [data-cur]{letter-spacing:.04em}
/* no spinner arrows in the sheets: they shifted the figures out of line with their headers */
.grid-table input[type=number]{appearance:textfield; -moz-appearance:textfield}
.grid-table input[type=number]::-webkit-inner-spin-button, .grid-table input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none; margin:0}
.grid-table td.num input{margin-right:-6px}
#guests-table input[data-g=name]{min-width:230px}
#guests-table .empty-row td{padding:18px 16px}
@media (max-height:800px){
  .welcome{padding:14px}
  .welcome-card{padding:24px 36px 20px; gap:13px}
}
/* narrower windows: the guest list moves above the floor plan, which then gets the full width */
@media (max-width:1100px){
  .seating-wrap{flex-direction:column; height:auto; min-height:0; gap:12px}
  .seat-side{width:100%; min-width:0}
  .unseated-list{flex-direction:row; flex-wrap:wrap; align-content:flex-start; max-height:24dvh; min-height:64px; overflow-y:auto}
  .seat-canvas-wrap{height:72dvh; min-height:420px}
  #budget-stats{grid-template-columns:repeat(3, minmax(0, 1fr))}
}

/* in-app dialog */
.dlg{
  border:1px solid var(--line); border-radius:14px; padding:0; background:var(--card); color:var(--ink);
  width:min(440px, calc(100vw - 32px)); box-shadow:0 30px 70px -24px rgba(46,44,38,.6);
  margin:auto;
}
.dlg::backdrop{background:rgba(30,28,24,.45)}
.dlg form{padding:24px 24px 20px; display:flex; flex-direction:column; gap:20px}
.dlg p{font-size:15px; line-height:1.5; white-space:pre-line; overflow-wrap:anywhere}
.dlg-actions{display:flex; justify-content:flex-end; gap:10px; flex-wrap:wrap}
.dlg-actions .btn{min-width:92px; padding:9px 18px}
.btn.danger-solid{background:var(--late); border-color:var(--late); color:#fff}
.btn.danger-solid:hover{background:#863728; border-color:#863728}

/* scrollbars */
::-webkit-scrollbar{height:10px; width:10px}
::-webkit-scrollbar-thumb{background:#d6cdb4; border-radius:99px; border:2px solid var(--paper)}
::-webkit-scrollbar-track{background:transparent}

/* let drag gestures work on touch screens without the page scrolling underneath */
.tl-chip, .seat.occupied, .table-disc, .table-rect, .guest-chip{touch-action:none}

@media (prefers-reduced-motion: reduce){
  *{transition:none !important; scroll-behavior:auto !important}
}

/* ============ Narrow laptops and tablets ============ */
@media (max-width: 1000px){
  .settings-body{grid-template-columns:1fr}
  .notes-input{width:170px}
}

/* ============ Phones and small tablets ============ */
@media (max-width: 760px){
  body{font-size:15px}
  main{padding:16px 13px 48px}

  /* Masthead stacks; actions drop to their own row */
  .masthead{padding:10px 14px 9px; gap:3px 10px; grid-template-columns:minmax(max-content, 1fr) minmax(0, max-content) minmax(max-content, 1fr)}
  .brand-icon{width:30px; height:30px}
  .masthead-title h1{font-size:23px}
  .masthead-sub{font-size:11.5px; margin-top:1px}
  .masthead-actions .btn{padding:7px 12px; font-size:12px}

  /* Tabs become a single swipeable row */
  .tabs{padding:0 10px; overflow-x:auto; flex-wrap:nowrap; scrollbar-width:none}
  .tabs::-webkit-scrollbar{display:none}
  .tab{flex:0 0 auto; padding:13px 12px 11px; font-size:11px; letter-spacing:.1em; white-space:nowrap}

  /* Headings and section heads */
  h2{font-size:24px}
  .panel-head{flex-direction:column; align-items:stretch; gap:10px}
  .panel-head-right{width:100%; flex-wrap:wrap; white-space:normal}
  .hint{font-size:12.5px}

  /* Inputs at 16px stop iOS from zooming the page on focus */
  input, select, textarea{font-size:16px}
  .add-row{gap:8px}
  .add-row input[type=text]{min-width:0; flex:1 1 100%}
  .add-row input, .add-row select{flex:1 1 auto; min-width:0}
  .add-row input[type=number]{width:auto}
  .add-row .btn{flex:0 0 auto}

  /* Checklist rows: title on its own line, the rest underneath */
  .task-row{flex-wrap:wrap; gap:8px 10px; padding:10px 12px}
  .task-main{flex:1 1 calc(100% - 40px)}
  .task-title-input{font-size:15px}
  .notes-input{flex:1 1 100%; width:auto; order:5; font-size:14px; margin-left:32px}
  .notes-input:placeholder-shown:not(:focus){border-color:transparent; background:transparent; padding:0 2px; height:22px; font-size:13px}
  .task-due{flex:1 1 auto; width:auto; margin-left:32px; font-size:14px}

  /* Stat cards two-up */
  .stat-row{gap:10px; grid-template-columns:1fr 1fr}
  .stat-card{padding:12px 14px}
  .stat-card .st-value{font-size:24px}

  .two-col{gap:22px}
  /* Compact the sheets so more of them fits the phone width */
  .grid-table{font-size:13px}
  .grid-table th, .grid-table td{padding:6px 8px}
  .grid-table th{font-size:9.5px; letter-spacing:.08em}
  .grid-table input, .grid-table select{font-size:14px}
  .grid-table input[type=text]{min-width:120px}
  .grid-table input[type=number]{width:78px}
  .grid-table tfoot td{font-size:13px}
  #guests-table td{padding:5px 8px}

  .filter-row input[type=search]{max-width:none; flex:1 1 100%}
  .filter-row select{flex:1 1 0; min-width:0}

  /* Notes single column, gallery tighter */
  .notes-grid{grid-template-columns:1fr}
  .note-del{opacity:1}
  .gallery-grid{grid-template-columns:repeat(auto-fill, minmax(140px, 1fr)); gap:12px}
  .gal-tools{opacity:1}
  #gallery-upload-group{flex:1 1 auto}

  .upnext-card{min-width:180px}

  /* Seating: side list on top, floor plan below, both usable by touch */
  .seating-wrap{flex-direction:column; height:auto; min-height:0; gap:12px}
  .seat-side{width:100%; min-width:0}
  .unseated-list{flex-direction:row; flex-wrap:wrap; align-content:flex-start;
    max-height:34dvh; min-height:120px; overflow-y:auto}
  .seat-canvas-wrap{height:66vh; height:66dvh; overflow:auto}
  .table-tools{display:flex}

  /* Settings */
  .set-card{padding:18px 16px}
  .set-grid{grid-template-columns:1fr 1fr}
  .le-count{display:none}

  /* Welcome fills more of the screen */
  .welcome{padding:12px}
  .welcome-card{padding:26px 20px 22px}
  .welcome-card h2{font-size:27px}
  .welcome-grid{grid-template-columns:1fr 1fr}
  .welcome-grid .field:first-child{grid-column:1 / -1}
  .lightbox{padding:16px}
}

@media (max-width: 380px){
  .stat-row{grid-template-columns:1fr}
  .masthead-title h1{font-size:21px}
  .welcome-names{grid-template-columns:1fr}
  .welcome-names .amp{display:none}
  .set-grid{grid-template-columns:1fr}
}

/* six budget figures: one row on a wide screen, two rows of three below that */
@media (min-width:1401px){ #budget-stats{grid-template-columns:repeat(6, minmax(0, 1fr))} }
@media (max-width:1400px){ #budget-stats{grid-template-columns:repeat(3, minmax(0, 1fr))} }

/* ============ Phones: every sheet row becomes a card ============
   Nothing scrolls sideways. Each row is its own small card with the name on
   top and the figures labelled underneath. */
@media (max-width: 760px){
  #budget-stats{grid-template-columns:1fr 1fr}

  .table-wrap{overflow:visible; background:none; border:none; border-radius:0}
  .grid-table, .grid-table tbody, .grid-table tfoot{display:block; width:100%}
  .grid-table thead{position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0)}
  .grid-table tr{
    display:grid; gap:8px 10px; align-items:start; position:relative;
    background:var(--card); border:1px solid var(--line); border-radius:11px;
    padding:10px 12px 12px; margin-bottom:8px;
  }
  .grid-table td, .grid-table td.num, #guests-table td{display:block; padding:0; border:none; min-width:0; text-align:left; background:none}
  .grid-table td[data-label]::before{
    content:attr(data-label); display:block; margin-bottom:3px;
    font-size:10px; letter-spacing:.1em; text-transform:uppercase; font-weight:700; color:var(--ink-soft);
    font-family:var(--sans, inherit);
  }
  .grid-table input[type=text], .grid-table input[type=number], .grid-table input[type=date], .grid-table select{
    width:100%; min-width:0; max-width:none; font-size:16px; text-align:left;
    border-color:var(--line); background:#fff; padding:7px 8px; margin:0; color:var(--ink);
  }
  .grid-table td.num input{margin-right:0}
  #budget-table input[data-b=category], #budget-table input[data-b=notes],
  #payments-table .pay-label input, #guests-table input[data-g=name]{min-width:0}

  /* the name is the card's heading: plain text until it is tapped */
  .grid-table .c-name, .grid-table .pay-label{padding-right:40px}
  .grid-table .c-name input, .grid-table .pay-label input{
    border-color:transparent; background:transparent; padding:6px 4px; font-weight:700; font-size:16px;
  }
  .grid-table .c-name input:focus, .grid-table .pay-label input:focus{border-color:var(--line); background:#fff}
  .grid-table .c-del{position:absolute; top:6px; right:4px}
  .grid-table .c-del .icon-btn{width:40px; height:40px; font-size:16px}
  .grid-table .check{width:28px; height:28px; min-width:28px}

  /* cost sheet */
  #budget-table tr{grid-template-columns:1fr 1fr 1fr; grid-template-areas:"name name name" "budget actual paid" "notes notes notes"}
  #budget-table .c-name{grid-area:name}
  #budget-table .c-budget{grid-area:budget}
  #budget-table .c-actual{grid-area:actual}
  #budget-table .c-paid{grid-area:paid; font-size:16px}
  #budget-table .c-notes{grid-area:notes}
  /* the paid figure sits level with the two boxes beside it */
  #budget-table tbody .c-paid{line-height:38px; padding-left:4px}
  #budget-table tbody .c-paid::before{line-height:1.3; margin-left:-4px}
  #budget-table tbody .c-paid:empty::after{content:"-"; color:var(--ink-soft); font-weight:400}
  #budget-table tfoot tr{background:var(--accent-tint); grid-template-areas:"name name name" "budget actual paid"; align-items:start}
  #budget-table tfoot td{background:none; border:none; font-size:17px}
  #budget-table tfoot .c-name{padding:2px 4px; font-size:19px}
  #budget-table tfoot .c-blank{display:none}
  #budget-table tfoot td:empty::after{content:"-"; color:var(--ink-soft); font-weight:400}

  /* payment schedule */
  #payments-table tr{grid-template-columns:34px minmax(0, .8fr) minmax(0, 1fr); grid-template-areas:"check label label" ". for for" ". amount due"}
  #payments-table .paid-cell{grid-area:check; width:auto; align-self:center}
  #payments-table .pay-label{grid-area:label}
  #payments-table .c-for{grid-area:for}
  #payments-table .c-amount{grid-area:amount}
  #payments-table .c-due{grid-area:due}
  .pay-row td{background:none}
  tr.pay-row.paid{background:var(--done-bg)}
  tr.pay-row.due-soon{background:var(--warn-bg)}
  tr.pay-row.late-pay{background:var(--late-bg)}
  .pay-row.paid td, .pay-row.due-soon td, .pay-row.late-pay td{background:none}
  .pay-cat{color:var(--ink)}

  /* guest list */
  /* compact: the drop-downs say what they are, so only the invite tick keeps a label,
     and it sits on the name line next to the delete button */
  #guests-table tr{grid-template-columns:1fr 1fr; grid-template-areas:"name name" "reply group" "type diet"; padding-top:6px}
  #guests-table .c-name{grid-area:name; padding-right:142px}
  #guests-table td[data-label="Group"]{grid-area:group}
  #guests-table td[data-label="Attending"]{grid-area:type}
  #guests-table td[data-label="Reply"]{grid-area:reply}
  #guests-table td[data-label="Dietary"]{grid-area:diet}
  #guests-table td[data-label]::before{display:none}
  #guests-table td[data-label="Invite sent"]{
    position:absolute; top:6px; right:46px; height:40px; display:flex; align-items:center; gap:7px;
  }
  #guests-table td[data-label="Invite sent"]::before{display:block; content:"Invited"; margin:0}
  #guests-table .grp-select, #guests-table .rsvp-select{font-size:16px}

  /* empty states stay a single plain line */
  .grid-table tr.empty-row{display:block; padding:16px}
  .grid-table tr.empty-row td{padding:0; max-width:none}
}

/* ============ Touch and small-screen refinements (phone review) ============ */
/* A swipe that starts on a card, a name or a table scrolls the page. Dragging
   with a finger needs a short press-and-hold first (HOLD_MS in app.js). */
.tl-chip, .seat.occupied, .table-disc, .table-rect, .guest-chip{
  touch-action:manipulation; -webkit-touch-callout:none; -webkit-user-select:none; user-select:none;
}
.held{outline:2.5px solid var(--accent-deep); outline-offset:2px; box-shadow:0 10px 24px -8px rgba(46,44,38,.55)}

.toast{
  position:fixed; left:50%; bottom:calc(18px + env(safe-area-inset-bottom, 0px)); transform:translateX(-50%); z-index:70;
  display:flex; align-items:center; gap:12px; background:var(--ink); color:#fdfcf7;
  padding:9px 10px 9px 16px; border-radius:12px; font-size:13.5px;
  box-shadow:0 14px 30px -10px rgba(46,44,38,.6); width:max-content; max-width:calc(100vw - 24px);
}
.toast .btn{background:#fdfcf7; color:var(--ink); border-color:#fdfcf7; flex:0 0 auto}

/* the tab row never widens the page: it scrolls inside itself at any width */
.tabs{overflow-x:auto; flex-wrap:nowrap; scrollbar-width:none}
.tabs::-webkit-scrollbar{display:none}
.tab{flex:0 0 auto; white-space:nowrap}
.set-card{min-width:0}
.le-row input[type=text]{width:0}

/* sample banner: full sentence on a wide screen, short one on a phone */
.sb-short{display:none}
.due-wrap{display:contents}
.due-wrap span{display:none}
.w-anyway{width:100%; min-height:44px; margin-top:4px; background:#fff}
.install-box.compact{padding:8px 12px; font-size:12.5px; margin:0}
.seat:not(.occupied)::after{content:''; position:absolute; inset:-7px; border-radius:50%}

/* notch and home-indicator room (the page is allowed under them) */
.masthead, .tabs, main{
  padding-left:max(36px, env(safe-area-inset-left, 0px));
  padding-right:max(36px, env(safe-area-inset-right, 0px));
}
.seat-pick{bottom:calc(18px + env(safe-area-inset-bottom, 0px))}
.site-foot{padding-bottom:calc(26px + env(safe-area-inset-bottom, 0px))}

/* no hover on this device: tools that waited for a hover are always shown */
@media (hover:none){
  .note-del, .gal-tools{opacity:1}
}

/* stacked seating (tablets and phones): the table tools dock to the foot of the screen,
   so they are in reach wherever the table sits on the floor plan */
@media (max-width:1100px), (pointer:coarse){
  .table-bar{
    position:fixed; top:auto; left:12px; right:12px; bottom:calc(12px + env(safe-area-inset-bottom, 0px)); z-index:60;
    border:1px solid var(--line); border-radius:14px; box-shadow:0 14px 30px -10px rgba(46,44,38,.6);
    background:var(--card);
  }
  .table-bar input{max-width:none}
}

/* fingers: nothing under 16px in a field (stops iOS zooming in), and bigger targets */
@media (pointer:coarse){
  input, select, textarea,
  .field input, .field select, .grid-table input, .grid-table select,
  .task-title-input, .notes-input, .task-due, .note-date, .note-body,
  .gal-caption, .gal-group, #gallery-upload-group, .le-row input[type=text], .table-bar input{font-size:16px}
  .note-date{letter-spacing:.04em}
  .field input, .field select{height:44px}

  .icon-btn, .star-btn{min-width:40px; min-height:40px; display:inline-flex; align-items:center; justify-content:center}
  .check{width:28px; height:28px; min-width:28px; position:relative}
  .check::after{content:''; position:absolute; inset:-8px}
  .tl-chip .check{width:20px; height:20px; min-width:20px}
  .btn{min-height:44px}
  .btn.small, .stage-pill{min-height:38px}
  .tab{min-height:44px}
  .gal-tool{width:40px; height:40px}
  .le-swatch{width:28px; height:28px; min-width:28px}
  .guest-chip{padding:10px 14px; font-size:14px}
  .link-btn{padding:6px 0}

  .due-wrap{display:flex; align-items:center; gap:8px; flex:1 1 auto; min-width:0}
  .due-wrap span{display:inline; font-size:10.5px; letter-spacing:.13em; text-transform:uppercase; font-weight:700; color:var(--ink-soft)}
  .due-wrap input{flex:1 1 auto; min-width:0}
}

@media (max-width:760px){
  .masthead{padding-left:max(14px, env(safe-area-inset-left, 0px)); padding-right:max(14px, env(safe-area-inset-right, 0px)); gap:2px 12px}
  .tabs{padding-left:max(10px, env(safe-area-inset-left, 0px)); padding-right:max(10px, env(safe-area-inset-right, 0px))}
  main{padding-left:max(13px, env(safe-area-inset-left, 0px)); padding-right:max(13px, env(safe-area-inset-right, 0px))}

  /* shorter top: one-line banner, Back up beside the names, save state on a slim line */
  .sb-long{display:none}
  .sb-short{display:inline}
  .sample-banner{padding:6px 12px; gap:10px; flex-wrap:nowrap}
  .masthead-actions{display:contents}
  .masthead #btn-export{grid-column:3; grid-row:1; justify-self:end}
  .masthead .save-state{grid-column:1 / -1; grid-row:2; text-align:center; font-size:11px; min-height:0; line-height:1.3}
  .masthead .save-state:empty{display:none}

  .w-sample{width:100%}
  .welcome-alt{flex-direction:column; align-items:center}
  .seat-pick{bottom:calc(12px + env(safe-area-inset-bottom, 0px)); left:12px; right:12px; transform:none; width:auto; max-width:none}
  .toast{left:12px; right:12px; transform:none; width:auto; max-width:none; justify-content:space-between}
}

/* On touch the name lets every press through to the table (a hold or a drag moves it);
   seating.js opens the name for typing when a quick tap lands on it. */
@media (pointer:coarse){ .table-name:not(:focus){pointer-events:none} }
@media (max-width:760px){ .masthead-sub{letter-spacing:.02em} }

/* ============ Checklists: the All view, every stage as a group ============ */
.stage-pill-all{border-style:dashed}
.stage-pill-all.active{border-style:solid}
.stage-group{display:flex; flex-direction:column; gap:7px}
.stage-group + .stage-group{margin-top:22px}
.stage-group-head{
  display:flex; align-items:baseline; flex-wrap:wrap; gap:6px 14px;
  padding:0 2px 8px; border-bottom:1px solid var(--line); margin-bottom:3px;
  position:sticky; top:0; z-index:3; background:var(--paper);
}
.stage-group-head h3{margin:0; font-size:21px}
.stage-group-count{color:var(--ink-soft); font-size:12.5px; letter-spacing:.04em}
.stage-group-head .link-btn{margin-left:auto; font-size:12.5px}
@media (max-width:760px){
  .stage-group-head .link-btn{margin-left:0; flex-basis:100%}
}

/* ============ Fit the checklist to the couple's timeline ============ */
.fit-box{
  display:flex; align-items:center; flex-wrap:wrap; gap:10px 18px;
  background:var(--card); border:1px solid var(--line); border-left:3px solid var(--accent);
  border-radius:10px; padding:12px 16px; margin:-4px 0 16px; max-width:980px;
}
.fit-box p{flex:1 1 340px; font-size:13.5px; font-weight:600; line-height:1.45; min-width:0}
.fit-box .fit-sub{display:block; font-weight:400; color:var(--ink-soft); font-size:12.5px; margin-top:2px}
.fit-actions{display:flex; gap:8px; flex-wrap:wrap}

/* ============ Your own events on the calendar ============ */
:root{ --event:#3a7179; --event-bg:#e3eff0 }
.sw-ev{background:var(--event-bg); border:1.5px solid var(--line); border-left:4px solid var(--event)}
.tl-chip.is-event{border-left:4px solid var(--event); padding-left:8px; background:var(--event-bg)}
.tl-chip.is-event.is-done{background:var(--done-bg); border-color:var(--done); border-left-color:var(--event)}
.tl-chip.is-event.is-past:not(.is-done){opacity:.72}
.tl-chip .tc-edit{
  flex:1; min-width:0; display:block; text-align:left; background:none; border:none; padding:0;
  font:inherit; color:inherit; cursor:inherit; border-radius:4px;
}
.tl-chip .tc-edit .tc-title, .tl-chip .tc-edit .tc-date{display:block}
.tl-chip .tc-edit .tc-title{white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.tl-chip .tc-edit .tc-date{white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.tc-rep{color:var(--event); font-weight:600}
.upnext-card.ev{border-left-color:var(--event)}
.upnext-card.ev .un-when{color:var(--event)}

.ev-section{margin-top:26px}
.ev-head{display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:8px}
.ev-head h3{margin:0}
.ev-list{display:grid; grid-template-columns:repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap:8px}
.ev-row{
  display:flex; align-items:center; gap:8px; min-width:0;
  background:var(--card); border:1px solid var(--line); border-left:4px solid var(--event);
  border-radius:10px; padding:10px 6px 10px 12px;
}
.ev-main{flex:1; min-width:0}
.ev-title{font-weight:600; font-size:14px; overflow-wrap:anywhere}
.ev-rule{font-size:12px; color:var(--ink-soft); margin-top:1px}
.ev-next{font-size:12px; color:var(--event); font-weight:600; margin-top:1px}
.ev-empty{margin:0; grid-column:1 / -1}

/* the add / edit dialog */
.ev-dlg{width:min(520px, calc(100vw - 24px)); max-height:calc(100dvh - 24px); overflow:auto}
.ev-dlg form{gap:14px}
.ev-dlg h3{margin:0; font-size:25px; font-weight:500; color:var(--accent-deep)}
.ev-grid{display:grid; grid-template-columns:1fr 1fr; gap:12px}
.ev-custom{display:flex; align-items:center; gap:8px; font-size:13.5px; color:var(--ink-soft)}
.ev-custom input{width:76px; height:38px}
.ev-custom select{height:38px; flex:0 1 140px}
.ev-dlg .ev-occ-hint{font-size:12.5px; color:var(--ink-soft); margin:-6px 0 0; line-height:1.4}
.ev-dlg .ev-summary{font-size:13px; font-weight:600; color:var(--event); min-height:19px; margin:-2px 0 0}
.ev-dlg .ev-error{font-size:13px; color:var(--late); min-height:0; margin:-8px 0 0}
.ev-dlg .ev-error:empty{display:none}
.ev-actions{align-items:center}
.ev-actions .ev-spacer{flex:1}
@media (max-width:760px){
  .ev-dlg form{padding:20px 16px 16px}
  .ev-head{flex-wrap:wrap}
  .ev-actions .btn{min-width:0; flex:1 1 auto}
  .ev-actions .ev-spacer{display:none}
  .ev-actions #ev-delete{flex-basis:100%; order:3}
  #ev-end-row{grid-template-columns:1fr}
  .fit-box{padding:12px 13px}
  .fit-actions{width:100%}
  .fit-actions .btn{flex:1 1 auto}
}
@media (pointer:coarse){
  .ev-custom input, .ev-custom select{height:44px; font-size:16px}
}

/* ============ Printing: no stars, no glows, a plain band ============ */
@media print{
  .app-bg, .masthead-stars{display:none !important}
  .masthead{background:none !important; color:var(--ink); border-bottom:1px solid var(--line)}
  .masthead-title h1, .brand-name{color:var(--ink) !important}
  .masthead .masthead-sub{color:var(--ink-soft)}
}