:root {
  --bg: #f8f4ee;
  --card: #fffdf9;
  --ink: #2d2724;
  --muted: #7b6f67;
  --faint: #a99d93;
  --line: #e9e0d5;
  --accent: #a3596a;
  --accent-ink: #fff;
  --accent-soft: #f5e4e6;
  --sage: #557158;
  --sage-soft: #e3ece1;
  --gold: #9a7428;
  --gold-soft: #f6ecd6;
  --blue: #4d6a8a;
  --blue-soft: #e3eaf2;
  --warn: #b04a33;
  --warn-soft: #f9e2db;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(70, 45, 30, .06), 0 6px 18px rgba(70, 45, 30, .05);
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.3rem; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 20px 16px 110px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hint { color: var(--muted); font-size: .85rem; margin: .25rem 0 0; }
.hidden { display: none !important; }

/* ---------- header + tabs ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(248, 244, 238, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1120px; margin: 0 auto; padding: 12px 16px 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand .names { font-family: var(--serif); font-size: 1.55rem; font-weight: 700; line-height: 1.1; }
.brand .sub { color: var(--muted); font-size: .85rem; }
.top-right { display: flex; align-items: center; gap: 8px; }
.icon-btn { border: 0; background: transparent; width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; cursor: pointer; color: var(--muted); font-size: 1.5rem; line-height: 1; }
.icon-btn:hover { background: var(--line); color: var(--ink); }
.sync { font-size: .75rem; padding: 3px 10px; border-radius: 99px; background: var(--line); color: var(--muted); white-space: nowrap; }
.sync.server { background: var(--sage-soft); color: var(--sage); }
.sync.saving { background: var(--gold-soft); color: var(--gold); }
.sync.offline, .sync.locked, .sync.setup { background: var(--warn-soft); color: var(--warn); }
.tabs { max-width: 1120px; margin: 0 auto; padding: 0 12px; display: flex; gap: 4px; }
.tabs button { border: 0; background: none; padding: 8px 12px 10px; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; display: flex; align-items: center; gap: 6px; }
.tabs button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
@media (max-width: 720px) {
  /* backdrop-filter would turn the header into the containing block of the fixed tab bar */
  .top { backdrop-filter: none; background: var(--bg); }
  .chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin-left: -16px; margin-right: -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .chips.scroll::-webkit-scrollbar { display: none; }
  .chips.scroll .chip { flex: none; }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); justify-content: space-around; max-width: none; z-index: 30; }
  .tabs button { flex-direction: column; gap: 2px; font-size: .7rem; padding: 6px 4px; border-bottom: 0; flex: 1; }
  .tabs button svg { width: 22px; height: 22px; }
  .brand .names { font-size: 1.35rem; }
}

/* ---------- generic pieces ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.section { margin-top: 26px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); background: var(--card); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.sm { padding: 5px 10px; font-size: .82rem; border-radius: 8px; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--warn); }
.btn.danger.confirm { background: var(--warn); color: #fff; border-color: var(--warn); }
.btn.ok { color: var(--sage); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.empty { text-align: center; padding: 34px 18px; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.pill { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--line); color: var(--muted); white-space: nowrap; }
.pill.researching { background: #eee9e3; color: #6f655d; }
.pill.contacted { background: var(--blue-soft); color: var(--blue); }
.pill.quoted { background: var(--gold-soft); color: var(--gold); }
.pill.shortlisted { background: var(--accent-soft); color: var(--accent); }
.pill.booked { background: var(--sage-soft); color: var(--sage); }
.pill.rejected { background: #efebe7; color: var(--faint); text-decoration: line-through; }
.pill.empty { background: transparent; border: 1px dashed var(--faint); color: var(--faint); }
.pill.pick { background: var(--gold-soft); color: var(--gold); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar.sage > i { background: var(--sage); }
.overdue { color: var(--warn); font-weight: 600; }

/* ---------- overview ---------- */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; background: linear-gradient(135deg, #fffaf4, #f8eceb); }
.ring { width: 118px; height: 118px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring .bg { stroke: #efe4dc; }
.ring .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .5s; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.6rem; font-weight: 600; }
.ring b small { display: block; font-family: var(--sans); font-size: .65rem; color: var(--muted); font-weight: 500; text-align: center; margin-top: -6px; }
.hero h1 { font-size: 2.1rem; }
.hero .count { font-size: 1.05rem; margin-top: 4px; }
.hero .count strong { font-size: 1.3rem; color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.stat { padding: 14px 16px; }
.stat .label { font-size: .78rem; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.45rem; font-weight: 600; line-height: 1.25; margin: 4px 0 8px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .value small { font-family: var(--sans); font-size: .85rem; color: var(--muted); font-weight: 400; }
.catgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.catcard { text-align: left; cursor: pointer; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; gap: 6px; }
.catcard:hover { border-color: var(--faint); }
.catcard .name { font-weight: 600; }
.catcard .detail { font-size: .83rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catcard.is-booked { background: #f5f9f3; border-color: #cfdfcc; }
.catcard.is-empty { background: transparent; border-style: dashed; }
.two { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.datechip { min-width: 54px; text-align: center; border-radius: 10px; background: var(--bg); padding: 4px 6px; line-height: 1.1; }
.datechip b { display: block; font-size: 1.1rem; font-weight: 600; }
.datechip span { font-size: .7rem; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.datechip.late { background: var(--warn-soft); color: var(--warn); }
.datechip.late span { color: var(--warn); }
.linkish { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; font-weight: 500; }
.linkish:hover { color: var(--accent); }
.pipeline { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--line); }
.pipeline i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: .83rem; color: var(--muted); }
.legend span::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--c); }

/* ---------- suppliers ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input[type=search], .toolbar select { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 12px; min-width: 0; }
.toolbar input[type=search] { flex: 1 1 200px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 4px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 4px 12px; font-size: .83rem; cursor: pointer; color: var(--muted); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip b { font-weight: 600; margin-left: 3px; }
.vgroup h3 { margin: 22px 0 10px; display: flex; align-items: baseline; gap: 8px; }
.vgroup h3 .muted { font-family: var(--sans); font-size: .85rem; font-weight: 400; }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.vcard { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.vcard.is-rejected { opacity: .6; }
.vcard .head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.vcard .vname { font-weight: 600; font-size: 1.02rem; text-align: left; }
.vcard .meta { font-size: .83rem; color: var(--muted); }
.vcard .facts { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: .88rem; }
.vcard .price { font-weight: 600; }
.status-sel { border: 0; border-radius: 99px; padding: 3px 8px; font-size: .78rem; font-weight: 600; cursor: pointer; max-width: 140px; }
.status-sel.researching { background: #eee9e3; color: #6f655d; }
.status-sel.contacted { background: var(--blue-soft); color: var(--blue); }
.status-sel.quoted { background: var(--gold-soft); color: var(--gold); }
.status-sel.shortlisted { background: var(--accent-soft); color: var(--accent); }
.status-sel.booked { background: var(--sage-soft); color: var(--sage); }
.status-sel.rejected { background: #efebe7; color: var(--faint); }
.checkmini { display: flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.checkmini .bar { width: 60px; height: 6px; }
.stars-ro { color: var(--gold); letter-spacing: 1px; white-space: nowrap; }
.stars-ro .off { color: #ddd2c6; }
.contact { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- compare ---------- */
.cmp-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
table.cmp { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 520px; font-size: .9rem; }
.cmp th, .cmp td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; min-width: 190px; }
.cmp th:first-child, .cmp td:first-child { position: sticky; left: 0; background: #faf6f0; min-width: 110px; width: 110px; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; z-index: 1; }
.cmp thead th { font-family: var(--serif); font-size: 1.2rem; text-transform: none; letter-spacing: 0; color: var(--ink); }
.cmp tr:last-child td { border-bottom: 0; }
.cmp thead .pill { font-family: var(--sans); margin-bottom: 4px; }
.cmp .best { color: var(--sage); font-weight: 600; }
.cmp .is-booked { background: #f5f9f3; }
.cmp ul { margin: 0; padding-left: 0; list-style: none; }
.cmp .pre { white-space: pre-wrap; }
.cmp .yes { color: var(--sage); }
.cmp .no { color: var(--faint); }
.cmp .acts { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- checklist ---------- */
.phase h3 { margin: 22px 0 6px; }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task input[type=checkbox] { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--sage); flex: none; cursor: pointer; }
.task .t { flex: 1; min-width: 0; }
.task .t .linkish { font-weight: 500; }
.task.done .t .linkish { text-decoration: line-through; color: var(--faint); }
.task .due { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.task .note { font-size: .82rem; color: var(--muted); white-space: pre-wrap; }
.card.flush { padding: 0; }

/* ---------- payments ---------- */
table.plain { width: 100%; border-collapse: collapse; font-size: .9rem; }
.plain th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.plain td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.plain tr:last-child td { border-bottom: 0; }
.plain .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }

/* ---------- settings ---------- */
.form-grid, .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.full { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; font-weight: 500; color: var(--muted); }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=number], input[type=password], input:not([type]), select, textarea {
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 11px; font-size: .95rem; color: var(--ink); width: 100%; min-width: 0;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.catrow { display: grid; grid-template-columns: 1fr 140px auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.catrow:last-child { border-bottom: 0; }
.catrow .needed { flex-direction: row; align-items: center; gap: 6px; white-space: nowrap; color: var(--ink); }
.catrow .needed input { width: 18px; height: 18px; accent-color: var(--sage); }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(40, 28, 22, .38); display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { background: var(--card); border-radius: 18px; width: min(680px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(40, 28, 22, .25); }
.modal-card form { display: flex; flex-direction: column; min-height: 0; max-height: inherit; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 8px; }
.modal-body { padding: 6px 18px 16px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.modal-foot .grow { flex: 1; }
fieldset { border: 0; padding: 0; margin: 16px 0 0; }
legend { font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; padding: 0; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-weight: 400; font-size: .9rem; cursor: pointer; }
label.check input { width: 18px; height: 18px; accent-color: var(--sage); flex: none; }
.stars { display: flex; gap: 2px; }
.stars button { border: 0; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: #ddd2c6; padding: 0 2px; }
.stars button.on { color: var(--gold); }
.mini-pay { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
@media (max-width: 720px) {
  .modal { padding: 0; align-items: end; }
  .modal-card { border-radius: 18px 18px 0 0; max-height: 92vh; }
  .modal-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}

/* ---------- lock ---------- */
.lock { max-width: 380px; margin: 60px auto; text-align: center; }
.lock h2 { margin-bottom: 6px; }
.lock form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.lock .err { color: var(--warn); font-size: .88rem; }

#toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 99px; font-size: .88rem; opacity: 0; pointer-events: none; transition: .25s; z-index: 60; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .two { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .hero h1 { font-size: 1.75rem; }
  .ring { width: 104px; height: 104px; }
  .form-grid, .grid2, .checks { grid-template-columns: 1fr; }
  .catrow { grid-template-columns: 1fr 110px; }
  .stat .value { font-size: 1.45rem; }
  .vgrid { grid-template-columns: 1fr; }
  .catgrid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .catcard { padding: 10px 11px; }
  .catcard .name { font-size: .9rem; line-height: 1.25; }
}
