:root {
  --bg: #f7f4ef;
  --panel: #ffffff;
  --ink: #26221f;
  --muted: #7a716a;
  --line: #e7e1d8;
  --accent: #8a4f35;
  --accent-ink: #fff;
  --good: #3f6b3a;
  --warn: #a86b12;
  --bad: #a2352b;
  --radius: 12px;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 999px; padding: .35rem .9rem; cursor: pointer;
}
button:disabled { opacity: .45; cursor: default; }
button.primary, .primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.linkish { border: 0; background: none; color: var(--accent); padding: 0; text-decoration: underline; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted, .hint { color: var(--muted); }

/* onboarding */
.onboard { max-width: 32rem; margin: 10vh auto; padding: 0 1.25rem; }
.onboard.wide { max-width: 60rem; }
.onboard h1 { font: 400 2.2rem/1.15 Georgia, serif; }
.lede { color: var(--muted); font-size: 1.05rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
form.card { display: grid; gap: 1rem; }
form.card label { display: grid; gap: .3rem; font-weight: 600; }
form.card input { border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; font-weight: 400; }
.error { color: var(--bad); }
.wedding-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1rem; }
.wedding-card { display: grid; gap: .2rem; color: inherit; text-decoration: none; }
.wedding-card span { color: var(--muted); font-size: .9rem; }

/* workspace */
.workspace { display: grid; grid-template-columns: minmax(20rem, 26rem) 1fr; height: 100vh; }
.chat { display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--panel); min-height: 0; }

/* the composer: one rounded box, with the tools and Send along its bottom edge */
.composer { padding: .5rem .85rem .85rem; background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--panel) 30%); }
.composer-box {
  display: grid; min-width: 0; gap: .15rem; padding: .7rem .7rem .55rem .95rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 1px 2px rgba(40, 25, 15, .04), 0 6px 20px -8px rgba(40, 25, 15, .12);
  transition: border-color .15s, box-shadow .15s;
}
.composer-box:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent), 0 6px 20px -8px rgba(40, 25, 15, .16); }
.composer-box.dragging { border-style: dashed; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 4%, var(--panel)); }
.composer textarea {
  width: 100%; min-height: 1.5em; max-height: 12rem; padding: .15rem 0; border: 0; outline: 0; resize: none;
  background: transparent; color: var(--ink); font-size: .95rem; line-height: 1.5; overflow-y: auto;
}
.composer textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.composer-bar { display: flex; align-items: center; gap: .25rem; min-width: 0; min-height: 2.25rem; }
.composer-tool {
  display: inline-flex; align-items: center; gap: .35rem; height: 2rem; padding: 0 .6rem; margin-left: -.35rem;
  border: 0; border-radius: 999px; background: none; color: var(--muted); font-size: .82rem; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
}
.composer-tool + .composer-tool { margin-left: 0; }
.composer-tool:hover, .composer-tool:focus-visible { background: var(--bg); color: var(--ink); }
.composer-tool svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.composer-tool:has(input:focus-visible) { outline: 2px solid var(--accent); }
.send {
  flex: none; margin-left: auto; display: grid; place-items: center; width: 2.25rem; height: 2.25rem; padding: 0;
  border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 2px 6px -1px color-mix(in srgb, var(--accent) 45%, transparent);
  transition: transform .12s, background .15s, box-shadow .15s, opacity .15s;
}
.send:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, black); transform: translateY(-1px); }
.send:active:not(:disabled) { transform: none; }
.send:disabled { cursor: default; box-shadow: none; }
.send svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.send .spinner { display: none; width: .95rem; height: .95rem; }
.composer.is-empty .send:not(.working) { background: var(--line); color: var(--muted); box-shadow: none; }
.send.working { opacity: .85; }
.send.working .send-icon { display: none; }
.send.working .spinner { display: block; }
.chip { font-size: .78rem; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: .1rem .55rem; }

.preview { position: relative; display: flex; flex-direction: column; min-width: 0; }
.frame-wrap { flex: 1; display: grid; place-items: stretch; padding: 1rem; min-height: 0; }
.frame-wrap iframe { width: 100%; height: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.frame-wrap.phone { place-items: center; }
.frame-wrap.phone iframe { width: 390px; height: min(844px, 100%); border-radius: 28px; border-width: 8px; border-color: var(--ink); }
.empty { align-self: center; justify-self: center; color: var(--muted); max-width: 22rem; text-align: center; }

.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(24rem, 100%); background: var(--panel); border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgb(0 0 0 / 6%); overflow-y: auto; }
.drawer header { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.drawer h2 { margin: 0; font-size: 1.1rem; }
.drawer ol { list-style: none; margin: 0; padding: 0; }
.drawer li { display: flex; justify-content: space-between; gap: .75rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.drawer li > div:last-child { display: flex; flex-direction: column; gap: .3rem; }
.badge { background: var(--good); color: #fff; font-size: .72rem; border-radius: 999px; padding: .05rem .45rem; }

.ship-panel { position: absolute; top: 3.6rem; right: 1rem; width: min(24rem, calc(100% - 2rem)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: 0 12px 32px rgb(0 0 0 / 12%); }
.ship-panel h2 { margin: 0 0 .5rem; font-size: 1.15rem; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.checks li span { display: inline-block; width: 1.2rem; font-weight: 700; }
.checks li.pass span { color: var(--good); }
.checks li.warn span { color: var(--warn); }
.checks li.fail span { color: var(--bad); }
.checks small { display: block; margin-left: 1.2rem; color: var(--muted); }
.row { display: flex; justify-content: flex-end; gap: .5rem; }

.toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--panel); padding: .55rem 1rem; border-radius: 999px; box-shadow: 0 6px 20px rgb(0 0 0 / 20%); }

@media (max-width: 800px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: 55vh 1fr; height: auto; min-height: 100vh; }
  .chat { border-right: 0; border-bottom: 1px solid var(--line); }
  .preview { min-height: 80vh; }
}

/* settings */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: 1.4rem; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--panel); cursor: pointer; text-align: center; }
.dropzone.over, .dropzone:hover { border-color: var(--accent); }
.upload-tools { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 1.2rem 0 .6rem; }
.upload-tools input { max-width: 14rem; }
.upload-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .9rem; }
.upload { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.upload strong { font-size: .85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload .thumb { aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); display: grid; place-items: center; }
.upload .thumb img { width: 100%; height: 100%; object-fit: cover; }
.upload .filetype { font-size: .8rem; font-weight: 600; color: var(--muted); letter-spacing: .05em; }
.upload button { align-self: flex-start; }
.upload button.confirm { color: #a33; }
.small { font-size: .8rem; }
.settings-pane input { border: 1px solid var(--line); border-radius: 8px; padding: .45rem .6rem; background: var(--panel); }
.inline { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .5rem 0; }
.stack { display: grid; gap: .6rem; margin-top: .75rem; }
.stack label { display: grid; gap: .2rem; }
.stack label:has(input[type="radio"]) { display: flex; gap: .5rem; align-items: center; }
.results { list-style: none; padding: 0; margin: .75rem 0; }
.results li { display: grid; grid-template-columns: 1fr auto auto; gap: .75rem; align-items: center; padding: .4rem 0; border-bottom: 1px solid var(--line); }
#buy { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: .5rem; }
.ledger { width: 100%; border-collapse: collapse; font-size: .9rem; }
.ledger th, .ledger td { text-align: left; padding: .4rem .3rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.ledger .num { text-align: right; white-space: nowrap; }
.ledger code { overflow-wrap: anywhere; }
.notice-banner { background: #fff7e6; border: 1px solid #f0d9a8; border-radius: var(--radius); padding: .7rem 1rem; margin: 0; }
a.button { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: .35rem .9rem; text-decoration: none; color: var(--ink); background: var(--panel); }
a.button.primary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
button.quiet { border-color: transparent; color: var(--muted); }
details summary { cursor: pointer; color: var(--accent); margin-top: .75rem; }

.settings-pane a:not(.button), .uploads a:not(.button):not(.thumb) { color: var(--accent); }
.dropzone { background: var(--bg); }


/* Admin */
body.admin { background: var(--bg); }
.admin-head { display: flex; align-items: center; gap: 1.5rem; padding: .8rem 1.5rem; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.admin-head nav { display: flex; gap: .3rem; flex-wrap: wrap; }
.admin-head nav a { padding: .35rem .75rem; border-radius: 999px; color: var(--ink); text-decoration: none; font-size: .9rem; }
.admin-head nav a:hover { background: var(--bg); }
.admin-head nav a[aria-current="page"] { background: var(--ink); color: var(--panel); }
.admin-main { max-width: 1200px; margin: 0 auto; padding: 1.5rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
@media (max-width: 600px) { .admin-main { padding: 1rem; } .admin-head { padding: .6rem 1rem; gap: .5rem; } }
.admin-main h1 { margin: 0; }
.admin-main h2 { margin-top: 0; font-size: 1.15rem; }
.admin-main a:not(.button) { color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; }
.stats > div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; color: var(--muted); font-size: .85rem; }
.stats span { display: block; font-size: 1.5rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.admin-table { min-width: 640px; }
.admin-table td, .admin-table th { vertical-align: top; }
.admin-table tfoot th { border-top: 2px solid var(--line); }
.pill { display: inline-block; font-size: .72rem; font-weight: 600; border-radius: 999px; padding: .05rem .5rem; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.pill.live { background: #e7f3e7; color: #2f6b2f; border-color: #cfe3cf; }
.pill.ended { background: #f3e9e9; color: #8a3a3a; border-color: #e6d0d0; }
.pill.test { background: #fff3d6; color: #7a5a00; border-color: #f0dca8; }
td.gain { color: #2f6b2f; }
td.loss { color: #a33; }
.month-pick { float: right; }
button.danger { background: #a33; border-color: #a33; color: #fff; }
.confirm-delete input { width: 11rem; }
.admin-wedding-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.admin-wedding-head p { margin: .3rem 0 0; }
.admin-wedding-head .actions { display: flex; gap: .5rem; }
.admin-split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.25rem; align-items: start; }
@media (max-width: 860px) { .admin-split { grid-template-columns: 1fr; } .month-pick { float: none; } }
.transcript { list-style: none; margin: 0 0 1rem; padding: 0; max-height: 60vh; overflow-y: auto; display: grid; gap: .5rem; border-bottom: 1px solid var(--line); padding-bottom: 1rem; }
.transcript li { display: grid; grid-template-columns: auto 1fr; gap: .1rem .6rem; font-size: .9rem; }
.transcript .who { font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.transcript .when { font-size: .75rem; color: var(--muted); justify-self: end; }
.transcript .text { grid-column: 1 / -1; white-space: pre-wrap; overflow-wrap: anywhere; }
.transcript .t-activity { opacity: .65; font-size: .8rem; }
.transcript .t-activity .text { display: inline; }
.transcript .t-couple .who { color: var(--accent); }
.transcript .t-team .who { color: #3d6b3d; }
.team-message { display: grid; gap: .5rem; }
.team-message label { font-weight: 600; }
.team-message textarea { border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; resize: vertical; }
.team-message button { justify-self: start; }
.admin-main input:not([type=hidden]), .admin-main select { border: 1px solid var(--line); border-radius: 8px; padding: .4rem .6rem; background: var(--panel); font: inherit; }
.admin-main h2.spaced { margin-top: 1.5rem; }

/* Uploads modal */
.uploads-dialog { width: min(880px, calc(100vw - 2rem)); max-height: min(86vh, 900px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); box-shadow: 0 20px 60px rgba(40, 25, 15, .25); }
.uploads-dialog::backdrop { background: rgba(30, 22, 16, .45); }
.uploads-dialog .dialog-body { padding: 1.1rem 1.4rem 1.3rem; }
.uploads-dialog header { display: flex; justify-content: space-between; align-items: center; }
.uploads-dialog h2 { margin: 0; font-size: 1.25rem; }
.uploads-dialog > .dialog-body > p:first-of-type { margin: .3rem 0 1rem; }
@media (max-width: 600px) { .uploads-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; } }

/* starting a new wedding: a modal over an empty workspace */
.start-dialog { width: min(30rem, calc(100vw - 2rem)); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); box-shadow: 0 20px 60px rgba(40, 25, 15, .25); }
.start-dialog::backdrop { background: rgba(30, 22, 16, .45); }
.start-dialog form { display: grid; gap: .9rem; padding: 1.4rem 1.5rem 1.5rem; }
.start-dialog h1 { margin: 0; font: 400 1.7rem/1.2 Georgia, serif; }
.start-dialog p { margin: 0; }
.start-dialog label { display: grid; gap: .3rem; font-weight: 600; }
.start-dialog .hint { font-weight: 400; }
.start-dialog input { border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; font: inherit; font-weight: 400; }
.start-dialog button[type=submit] { justify-self: start; display: inline-flex; align-items: center; gap: .5rem; }
.start-status { display: flex; align-items: center; gap: .6rem; color: var(--muted); }
.start-status[hidden] { display: none; }
.spinner { flex: none; width: 1rem; height: 1rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.workspace.placeholder .messages, .workspace.placeholder .preview-empty { filter: saturate(.6); opacity: .7; }
.preview-empty { display: grid; place-items: center; height: 100%; color: var(--muted); padding: 2rem; text-align: center; }
@media (max-width: 600px) { .start-dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--radius) var(--radius) 0 0; } }
.composer-tool .spinner { width: .8rem; height: .8rem; }
/* 16px on touch screens, so iOS doesn't zoom into the box. */
@media (pointer: coarse) { .composer textarea { font-size: max(16px, 1rem); } }

/* --- workspace toolbars: the chat header and the preview's controls --- */
.chat-head { display: flex; align-items: center; gap: .7rem; min-height: 3.6rem; padding: .6rem .85rem .6rem 1rem; border-bottom: 1px solid var(--line); }
.monogram {
  flex: none; display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 12%, var(--panel)); color: var(--accent);
  font: 600 .78rem/1 Georgia, serif; letter-spacing: .02em; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}
.chat-title { min-width: 0; flex: 1; display: grid; gap: .1rem; }
.chat-title strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 400 1.08rem/1.2 Georgia, serif; }
.agent-kind { justify-self: start; padding: .05rem .45rem; border-radius: 999px; background: var(--bg); color: var(--muted); font-size: .7rem; letter-spacing: .02em; white-space: nowrap; }
.agent-kind[hidden] { display: none; }
.head-links { flex: none; display: flex; gap: .1rem; }

/* Round, borderless icon buttons; links styled the same way. */
.icon-btn {
  display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover, .icon-btn:focus-visible { background: var(--bg); color: var(--ink); }
a.icon-btn:not([href]) { opacity: .4; pointer-events: none; }
.icon-btn svg, .segmented svg, .ghost svg, .ship svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* The credit chip: a ring that empties as the agent spends, and what's left. */
.meter {
  flex: none; display: inline-flex; align-items: center; gap: .45rem; height: 2.1rem; padding: 0 .75rem 0 .5rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  color: var(--muted); font-size: .8rem; text-decoration: none; white-space: nowrap; transition: border-color .15s, background .15s;
}
.meter:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--bg); }
.meter strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.meter-ring {
  --pct: 0; --ring: var(--good);
  width: 1.05rem; height: 1.05rem; border-radius: 50%;
  background: conic-gradient(var(--ring) calc(var(--pct) * 1%), var(--line) 0);
  -webkit-mask: radial-gradient(circle, transparent 52%, #000 54%); mask: radial-gradient(circle, transparent 52%, #000 54%);
}
.meter.warn .meter-ring { --ring: var(--warn); }
.meter.warn strong { color: var(--warn); }

.preview-head { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; min-height: 3.6rem; padding: .6rem 1rem; border-bottom: 1px solid var(--line); background: var(--panel); }
/* Segmented controls: one track, the chosen option a raised pill. */
.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
.segmented button {
  display: inline-flex; align-items: center; gap: .4rem; height: 1.9rem; padding: 0 .85rem;
  border: 0; border-radius: 999px; background: none; color: var(--muted); font-size: .85rem; transition: background .15s, color .15s, box-shadow .15s;
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-selected="true"], .segmented button[aria-pressed="true"] {
  background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(40, 25, 15, .08), 0 1px 6px -2px rgba(40, 25, 15, .12);
}
.segmented svg { width: 1rem; height: 1rem; }
.actions { display: flex; align-items: center; gap: .3rem; }
.toolbar-sep { width: 1px; height: 1.4rem; margin: 0 .25rem; background: var(--line); }
.ghost {
  display: inline-flex; align-items: center; gap: .4rem; height: 2.1rem; padding: 0 .8rem;
  border: 1px solid transparent; border-radius: 999px; background: none; color: var(--ink); font-size: .88rem; transition: background .15s, border-color .15s;
}
.ghost:hover:not(:disabled) { background: var(--bg); }
.ghost svg { width: 1rem; height: 1rem; color: var(--muted); }
.ship {
  display: inline-flex; align-items: center; gap: .4rem; height: 2.25rem; padding: 0 1.05rem 0 .85rem; margin-left: .2rem;
  border: 0; font-weight: 600; font-size: .9rem;
  box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--accent) 55%, transparent); transition: transform .12s, background .15s, box-shadow .15s;
}
.ship:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, black); transform: translateY(-1px); }
.ship:disabled { opacity: 1; background: var(--line); color: var(--muted); box-shadow: none; }
.ship svg { stroke-width: 2.4; width: 1rem; height: 1rem; }
/* The version on screen. Draft and Live are the usual pair; an older version opened from History
   or the chat gets its own pill while it's showing, so neither of the others looks chosen. */
#tab-older[aria-selected="true"] { color: var(--warn); }
#tab-older[hidden] { display: none; }

/* The line under the toolbar that says which version is on screen and who can see it. */
.version-bar {
  --tone: var(--accent);
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; padding: .55rem 1rem;
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--tone) 6%, var(--panel)); font-size: .88rem;
}
.version-bar[hidden] { display: none; }
.version-bar[data-tone="live"] { --tone: var(--good); }
.version-bar[data-tone="older"] { --tone: var(--warn); background: color-mix(in srgb, var(--warn) 13%, var(--panel)); border-bottom-color: color-mix(in srgb, var(--warn) 30%, var(--line)); }
.version-bar p { flex: 1 1 18rem; margin: 0; color: var(--muted); }
.version-bar strong { color: var(--ink); font-weight: 600; }
.version-dot { flex: none; width: .55rem; height: .55rem; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone) 20%, transparent); }
.version-bar[data-tone="older"] .version-dot { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; background: color-mix(in srgb, var(--warn) 18%, var(--panel)); box-shadow: none; color: var(--warn); }
.version-dot svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.version-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-left: auto; }
.version-actions button { height: 2rem; padding: 0 .9rem; font-size: .85rem; white-space: nowrap; }
.version-actions .ghost { border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); background: var(--panel); }
.version-actions .primary { font-weight: 600; }
/* An older version also gets a warm frame, so it can't pass for the draft at a glance. */
.frame-wrap[data-view="version"] iframe, .frame-wrap[data-view="old-draft"] iframe { border-color: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 18%, transparent); }
.frame-wrap.phone[data-view="version"] iframe, .frame-wrap.phone[data-view="old-draft"] iframe { border-color: color-mix(in srgb, var(--warn) 70%, var(--ink)); }

/* History: the row on screen stands out. */
.drawer header p { margin: .15rem 0 0; color: var(--muted); font-size: .82rem; }
.drawer li.showing { background: color-mix(in srgb, var(--accent) 5%, var(--panel)); box-shadow: inset 3px 0 0 var(--accent); }
.showing-badge { background: var(--accent); }
.drawer li button { white-space: nowrap; }

@media (max-width: 1100px) { .segmented button span { display: none; } .segmented button { padding: 0 .6rem; } #tab-older span { display: inline; } }
@media (max-width: 600px) { .version-actions { margin-left: 0; width: 100%; } .version-actions button { flex: 1; } }
@media (max-width: 800px) { .toolbar-sep { display: none; } .ghost span { display: none; } .ghost { padding: 0 .55rem; } .actions { flex: 1; } .ship { margin-left: auto; } }

/* --- settings: a modal over the workspace, sections on the left --- */
.settings-dialog { width: min(920px, calc(100vw - 2rem)); height: min(680px, calc(100vh - 3rem)); padding: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); color: var(--ink); box-shadow: 0 24px 70px rgba(40, 25, 15, .28); overflow: hidden; }
.settings-dialog::backdrop { background: rgba(30, 22, 16, .45); }
.settings-shell { display: grid; grid-template-columns: 13.5rem minmax(0, 1fr); height: 100%; }
.settings-nav { padding: 1.3rem .8rem; background: var(--bg); border-right: 1px solid var(--line); }
.settings-nav h2 { margin: 0 .55rem 1rem; font: 400 1.45rem/1.2 Georgia, serif; }
.settings-nav nav { display: grid; gap: 2px; }
.settings-nav [role="tab"] {
  display: flex; align-items: center; gap: .6rem; width: 100%; height: 2.4rem; padding: 0 .75rem;
  border: 0; border-radius: 10px; background: none; color: var(--muted); font-size: .92rem; text-align: left; transition: background .15s, color .15s;
}
.settings-nav [role="tab"]:hover { color: var(--ink); background: color-mix(in srgb, var(--panel) 60%, transparent); }
.settings-nav [role="tab"][aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(40, 25, 15, .08), 0 1px 6px -2px rgba(40, 25, 15, .12); }
.settings-nav [role="tab"] svg { width: 1.05rem; height: 1.05rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.settings-nav [role="tab"][aria-selected="true"] svg { color: var(--accent); }
.settings-main { display: flex; flex-direction: column; min-height: 0; }
.settings-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1rem .6rem 1.6rem; }
.settings-head h3 { margin: 0; font-size: 1.15rem; font-weight: 600; }
.settings-head .icon-btn svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.settings-body { flex: 1; overflow-y: auto; padding: .2rem 1.6rem 1.8rem; }
.settings-body > .notice-banner { margin-bottom: 1rem; }
.settings-pane { display: grid; gap: 1rem; align-content: start; }
.settings-pane[hidden] { display: none; }
.settings-pane > p, .settings-pane .inline, .settings-pane .stack { margin: 0; }
.settings-pane h4 { margin: .6rem 0 0; font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.settings-pane label { font-size: .92rem; }
.settings-pane button:not(.primary):not(.quiet), .settings-pane a.button:not(.primary) { background: var(--panel); }
.settings-pane .button svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.15em; margin-right: .35rem; }
.lead-line { font-size: 1.02rem; }
.field-card { display: grid; gap: .55rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--bg) 45%, var(--panel)); }
.field-card[hidden] { display: none; }
.field-card .inline { margin: 0; }
.credit-hero { display: flex; align-items: center; gap: .9rem; }
.credit-hero strong { display: block; font: 400 2.2rem/1.1 Georgia, serif; font-variant-numeric: tabular-nums; }
.credit-hero span:not(.meter-ring) { color: var(--muted); font-size: .9rem; }
.meter-ring.big { width: 2.6rem; height: 2.6rem; -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%); mask: radial-gradient(circle, transparent 58%, #000 60%); }
.credit-hero.warn .meter-ring { --ring: var(--warn); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .6rem; margin: 0; }
.stat-row div { padding: .75rem .9rem; border: 1px solid var(--line); border-radius: 12px; }
.stat-row dt { font-size: .78rem; color: var(--muted); }
.stat-row dd { margin: .15rem 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-row small { font-weight: 400; color: var(--muted); }
.settings-pane .ledger { font-size: .86rem; }
.settings-pane .ledger th { font-weight: 600; color: var(--muted); font-size: .78rem; }
.settings-pane .results li { border-bottom-color: var(--line); }
@media (max-width: 700px) {
  .settings-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  .settings-shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .settings-nav { padding: .8rem .8rem .6rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .settings-nav h2 { font-size: 1.2rem; margin: 0 .3rem .6rem; }
  .settings-nav nav { display: flex; overflow-x: auto; gap: .25rem; }
  .settings-nav [role="tab"] { width: auto; flex: none; height: 2.1rem; white-space: nowrap; }
  .settings-head { padding: .8rem .8rem .4rem 1.1rem; }
  .settings-shell { position: relative; }
  #settings-close { position: absolute; top: .55rem; right: .55rem; }
  .settings-body { padding: .2rem 1.1rem 1.5rem; }
}
.settings-pane #domain-body { display: grid; gap: .8rem; }
.settings-pane .address { font-size: 1.05rem; font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.search-row input { flex: 1; min-width: 12rem; }
.settings-head h3:focus { outline: none; }
.settings-nav, .settings-main { min-width: 0; }
.field-card p { margin: 0; }
.settings-pane .results:empty { display: none; }
.settings-pane .results { margin: 0; }
.settings-pane details summary { margin-top: 0; }
.settings-pane a.button { display: inline-flex; align-items: center; gap: .1rem; height: 2.3rem; padding: 0 1rem; font-weight: 600; }

/* accounts: who's on a wedding, signed-in line */
.people { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.people li { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.people li button { margin-left: auto; }
form.signed-in { display: flex; align-items: center; gap: .4rem; margin-top: 1rem; }
form.signed-in button { padding: .2rem .4rem; }

.role-pick { border: 0; padding: 0; margin: 0; display: grid; gap: .35rem; }
.role-pick legend { font-weight: 600; margin-bottom: .3rem; }
.role-pick label { font-weight: 400; display: flex; gap: .4rem; align-items: baseline; }
.read-only { opacity: .65; }
.badge.role-badge { background: var(--line); color: var(--ink); }
.preview-bar button[hidden], #ship-btn[hidden], #undo-btn[hidden], #invite-card[hidden] { display: none; }
/* --- the domain page: a page of its own, so buying isn't one click from closing --- */
.domain-page { min-height: 100vh; background: var(--bg); }
.page-bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 1rem; min-height: 3.6rem; padding: .6rem 1.25rem;
  background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.back-link {
  display: inline-flex; align-items: center; gap: .45rem; height: 2.1rem; padding: 0 .85rem 0 .6rem; border-radius: 999px;
  color: var(--ink); text-decoration: none; font-size: .9rem; transition: background .15s, opacity .15s;
}
.back-link:hover { background: var(--bg); }
.back-link svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.back-link[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.page-bar-who { display: flex; align-items: center; gap: .6rem; min-width: 0; margin: 0 auto; }
.page-bar-who strong { font: 400 1.05rem/1.2 Georgia, serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-bar .meter { flex: none; }
.page-bar .meter[hidden] { display: none; }
.domain-main { max-width: 64rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; display: grid; gap: 1.4rem; }
.page-title h1 { margin: 0 0 .3rem; font: 400 2.1rem/1.15 Georgia, serif; }
.page-title p { margin: 0; }
.domain-main > .notice-banner[hidden] { display: none; }
.notice-banner[data-tone="good"] { background: #eef6ec; border-color: #cfe3cf; }
.notice-banner[data-tone="bad"] { background: #fbeeec; border-color: #ecc9c4; color: var(--bad); }
.eyebrow { display: inline-flex; align-items: center; gap: .45rem; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.address-card { display: grid; gap: .5rem; justify-items: start; padding: 1.2rem 1.4rem; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 1px 2px rgba(40, 25, 15, .04); }
.address-card.live { box-shadow: inset 3px 0 0 var(--good), 0 1px 2px rgba(40, 25, 15, .04); }
.address-card.working { box-shadow: inset 3px 0 0 var(--accent), 0 1px 2px rgba(40, 25, 15, .04); }
.address-card p { margin: 0; }
.address-card .inline { margin: .3rem 0 0; }
.address-card .address { font: 400 1.6rem/1.2 Georgia, serif; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.address-card a.address:hover { color: var(--accent); }
.address-card p .address { font: inherit; color: var(--accent); }
.address-card .table-scroll { width: 100%; }
.earlier { margin-top: .8rem; padding: .8rem 1.1rem; border: 1px dashed var(--line); border-radius: 14px; font-size: .9rem; }
.earlier h3 { margin: 0 0 .3rem; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.earlier ul { margin: 0; padding-left: 1.1rem; }

.finder { display: grid; gap: .9rem; }
.finder[hidden] { display: none; }
.finder h2, .checkout h2 { margin: 0; font: 400 1.5rem/1.2 Georgia, serif; }
.finder > p { margin: -.4rem 0 0; max-width: 46rem; }
.search-hero {
  display: flex; align-items: center; gap: .5rem; padding: .4rem .4rem .4rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  box-shadow: 0 1px 2px rgba(40, 25, 15, .04), 0 6px 20px -10px rgba(40, 25, 15, .16); transition: border-color .15s, box-shadow .15s;
}
.search-hero:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.search-icon svg { display: block; width: 1.15rem; height: 1.15rem; fill: none; stroke: var(--muted); stroke-width: 1.9; stroke-linecap: round; }
.search-hero input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 1.05rem; padding: .4rem 0; }
.search-hero button { height: 2.5rem; padding: 0 1.3rem; font-weight: 600; }
.finder-grid { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.filters { position: sticky; top: 4.6rem; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.filters summary { display: flex; align-items: center; gap: .45rem; padding: .8rem 1rem; margin: 0; color: var(--ink); font-weight: 600; list-style: none; }
.filters summary::-webkit-details-marker { display: none; }
.filters summary svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.filter-count:not(:empty) { margin-left: auto; min-width: 1.3rem; padding: 0 .35rem; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .72rem; text-align: center; line-height: 1.3rem; }
.filters-body { display: grid; gap: 1rem; padding: 0 1rem 1rem; }
.filters fieldset { margin: 0; padding: 0; border: 0; display: grid; gap: .4rem; }
.filters legend { padding: 0; margin-bottom: .35rem; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.filters output { font-size: .88rem; font-weight: 600; }
.filters p { margin: 0; }
.filters input[type="range"] { width: 100%; accent-color: var(--accent); }
.filters .toggles label { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.filters input[type="checkbox"] { accent-color: var(--accent); width: 1rem; height: 1rem; }
.filters #f-reset { justify-self: start; padding-left: 0; }
.filters #f-reset[hidden] { display: none; }
.ext-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.ext-chip input { position: absolute; opacity: 0; pointer-events: none; }
.ext-chip span {
  display: inline-block; padding: .2rem .65rem; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; color: var(--muted);
  background: var(--panel); cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.ext-chip input:checked + span { background: color-mix(in srgb, var(--accent) 10%, var(--panel)); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); color: var(--accent); font-weight: 600; }
.ext-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.results-col { min-width: 0; display: grid; gap: .6rem; }
.results-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: .88rem; }
.sort { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); }
.sort select { font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: .25rem .7rem; background: var(--panel); }
.domain-results { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.dr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 1rem; padding: .8rem 1rem .8rem 1.2rem; border-bottom: 1px solid var(--line); transition: background .15s; }
.dr:last-child { border-bottom: 0; }
.dr:hover:not(.taken) { background: color-mix(in srgb, var(--bg) 55%, var(--panel)); }
.dr-name { min-width: 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.dr-stem { font-weight: 600; }
.dr-ext { color: var(--accent); font-weight: 600; }
.dr.taken .dr-name, .dr.taken .dr-ext { color: var(--muted); font-weight: 400; }
.dr.taken .dr-stem { font-weight: 400; text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }
.dr-meta { display: flex; gap: .35rem; }
.tag { font-size: .72rem; padding: .05rem .5rem; border-radius: 999px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.tag.idea { background: color-mix(in srgb, var(--accent) 9%, var(--panel)); color: var(--accent); }
.dr-price { display: grid; justify-items: end; line-height: 1.25; min-width: 7.5rem; }
.dr-price strong { font-variant-numeric: tabular-nums; }
.dr-price small { font-size: .74rem; color: var(--muted); }
.dr-price small.warn, .warn { color: var(--warn); }
.dr .choose { font-weight: 600; }
.dr .choose:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.dr.taken { grid-template-columns: minmax(0, 1fr) auto auto; }
.results-loading, .results-empty { display: flex; align-items: center; gap: .6rem; padding: 1.4rem 1.2rem; color: var(--muted); }
.domain-results .error { padding: 1rem 1.2rem; }
.own-domain { padding: .2rem 0; }
.own-domain .stack { max-width: 32rem; }
.own-domain input:not([type=radio]) { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .7rem; background: var(--panel); }

/* checkout */
.checkout { display: grid; gap: .8rem; }
.checkout[hidden] { display: none; }
.back-inline { justify-self: start; border: 0; background: none; padding: 0; color: var(--accent); font-size: .92rem; }
.back-inline:disabled { color: var(--muted); }
.checkout-grid { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 1.25rem; align-items: start; }
.checkout-card, .summary-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 1.3rem 1.4rem; }
.checkout-card { display: grid; gap: 1rem; }
.checkout-card .notice-banner { margin: 0; }
.checkout-card fieldset { margin: 0; padding: 0; border: 0; display: grid; gap: .7rem; min-width: 0; transition: opacity .2s; }
.checkout-card fieldset:disabled { opacity: .55; }
.checkout-card legend { padding: 0; margin-bottom: .2rem; font-weight: 600; }
.checkout-card fieldset > p { margin: -.4rem 0 0; }
.checkout-card label { display: grid; gap: .25rem; font-size: .9rem; min-width: 0; }
.checkout-card input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .65rem; background: var(--panel); }
.checkout-card input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
.checkout-card .two { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.checkout-card .three { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: .7rem; }
.checkout-card .narrow { max-width: 8rem; }
.checkout-card .error { margin: 0; }
.checkout-card .error[hidden] { display: none; }
.nowrap { overflow-wrap: anywhere; }
.summary-card { position: sticky; top: 4.6rem; display: grid; gap: .5rem; }
.summary-name { font: 400 1.35rem/1.2 Georgia, serif; overflow-wrap: anywhere; }
.summary-card dl { margin: .3rem 0; display: grid; gap: .45rem; }
.summary-card dl div { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: .45rem; border-bottom: 1px solid var(--line); font-size: .9rem; }
.summary-card dt { color: var(--muted); }
.summary-card dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.summary-card p { margin: 0; }
.summary-card a { color: var(--accent); }

/* The Buy button: a spinner and a moving sheen while it works, so it never just looks greyed out. */
.buy-btn {
  position: relative; overflow: hidden; justify-self: stretch; display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  height: 3rem; font-size: 1rem; font-weight: 600; box-shadow: 0 2px 10px -2px color-mix(in srgb, var(--accent) 55%, transparent);
  transition: background .15s, transform .12s;
}
.buy-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, black); transform: translateY(-1px); }
.buy-btn .spinner { display: none; }
.buy-btn.working { opacity: 1; cursor: progress; }
.buy-btn.working .spinner { display: block; }
.buy-btn.working::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .28) 50%, transparent 80%);
  transform: translateX(-100%); animation: sheen 1.4s ease-in-out infinite;
}
@keyframes sheen { to { transform: translateX(100%); } }
.buy-progress { display: grid; gap: .7rem; }
.buy-progress[hidden] { display: none; }
.buy-progress p { margin: 0; }
.progress-track { height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-track span { display: block; width: 35%; height: 100%; border-radius: inherit; background: var(--accent); animation: indeterminate 1.3s ease-in-out infinite; }
.buy-progress.finished .progress-track span { width: 100%; animation: none; background: var(--good); }
.buy-progress.finished p { display: none; }
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.buy-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.buy-steps li { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .92rem; transition: color .2s; }
.buy-steps .step-mark { flex: none; display: grid; place-items: center; width: 1.25rem; height: 1.25rem; border-radius: 50%; border: 2px solid var(--line); }
.buy-steps li.active { color: var(--ink); font-weight: 600; }
.buy-steps li.active .step-mark { border-color: var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; }
.buy-steps li.done { color: var(--ink); }
.buy-steps li.done .step-mark { border-color: var(--good); background: var(--good); }
.buy-steps li.done .step-mark::after { content: ""; width: .32rem; height: .58rem; margin-top: -.12rem; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.buy-steps li.failed { color: var(--bad); font-weight: 600; }
.buy-steps li.failed .step-mark { border-color: var(--bad); background: var(--bad); }
.address-card .buy-steps { margin: .3rem 0; }
@media (prefers-reduced-motion: reduce) {
  .buy-btn.working::after, .progress-track span { animation-duration: 3s; }
  .buy-steps li.active .step-mark { animation-duration: 2.4s; }
}

@media (max-width: 760px) {
  .page-bar { padding: .5rem 1rem; gap: .5rem; }
  .page-bar-who { display: none; }
  .page-bar .meter { margin-left: auto; }
  .domain-main { padding: 1.3rem 1rem 3rem; gap: 1.1rem; }
  .page-title h1 { font-size: 1.7rem; }
  .finder-grid, .checkout-grid { grid-template-columns: 1fr; }
  .filters, .summary-card { position: static; }
  .summary-card { order: -1; }
  .search-hero input { font-size: max(16px, 1rem); }
  .search-hero button { padding: 0 1rem; }
  .dr { grid-template-columns: minmax(0, 1fr) auto; gap: .35rem .75rem; padding: .75rem 1rem; }
  .dr-meta { grid-row: 2; }
  .dr-price { grid-row: 1 / 3; grid-column: 2; }
  .dr .choose { grid-column: 1 / -1; justify-self: stretch; }
  .dr.taken { grid-template-columns: minmax(0, 1fr) auto; }
  .checkout-card { padding: 1.1rem; }
  .checkout-card .two, .checkout-card .three { grid-template-columns: 1fr; }
  .checkout-card input { font-size: max(16px, 1rem); }
  .address-card { padding: 1rem 1.1rem; }
  .address-card .address { font-size: 1.35rem; }
}
.results-more { display: flex; justify-content: center; padding: .8rem; }
.results-more button { font-weight: 600; }
.domain-main { grid-template-columns: minmax(0, 1fr); }
.domain-main > *, .finder > *, .checkout > * { min-width: 0; }
@media (max-width: 760px) {
  .checkout-card .three { grid-template-columns: 1fr 1fr; }
  .checkout-card .three label:first-child { grid-column: 1 / -1; }
}
.buy-btn.done, .buy-btn.done:disabled { opacity: 1; background: var(--good); border-color: var(--good); box-shadow: none; }

/* --- the chat's scrollback --------------------------------------------------
   The couple's messages are filled bubbles on the right. The builder writes on
   the page itself, under a small "Your builder" line, so long replies read like
   a letter rather than a cramped speech bubble. Messages from the same side a
   few minutes apart group together; a quiet line marks each new day or pause. */
.scrollback { position: relative; flex: 1; min-height: 0; display: flex; }
.scroll { flex: 1; min-width: 0; overflow-y: auto; overscroll-behavior: contain; padding: .5rem 1.1rem 1rem; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.messages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }

.msg { position: relative; display: flex; flex-direction: column; min-width: 0; margin-top: 1.1rem; overflow-wrap: anywhere; }
.msg.cont { margin-top: .3rem; }
.msg.couple { align-items: flex-end; padding-left: 2.5rem; }
.msg.builder { align-items: stretch; }
.msg.notice, .msg.team { align-items: center; margin-top: 1.25rem; }

/* the couple: warm filled bubbles, the corner nearest the edge tucked on the last of a run */
.couple .bubble {
  max-width: 100%; padding: .6rem .9rem; border-radius: 18px 18px 18px 18px;
  background: var(--accent); color: var(--accent-ink); white-space: pre-wrap; line-height: 1.45;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 30%, transparent);
}
.msg.couple:not(:has(+ .msg.couple.cont)) .bubble { border-bottom-right-radius: 6px; }
.msg.couple.cont .bubble { border-top-right-radius: 8px; }

/* the builder: a small label, then text on the page */
.who { display: flex; align-items: center; gap: .45rem; margin-bottom: .35rem; color: var(--muted); font-size: .78rem; font-weight: 600; letter-spacing: .01em; }
.who .avatar {
  display: grid; place-items: center; width: 1.45rem; height: 1.45rem; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 12%, var(--panel)); color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}
.who .avatar svg { width: .85rem; height: .85rem; fill: currentColor; stroke: none; }
.builder .bubble { font-size: .95rem; line-height: 1.6; color: var(--ink); }
.md p { margin: 0 0 .65em; }
.md p:last-child, .md ul:last-child, .md ol:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: .1em 0 .7em; padding-left: 1.25em; }
.md li { margin: .25em 0; padding-left: .15em; }
.md li::marker { color: color-mix(in srgb, var(--accent) 70%, var(--muted)); }
.md .md-heading { margin-top: .9em; font-weight: 600; }
.md .md-heading:first-child { margin-top: 0; }
.md strong { font-weight: 600; }
.md code { font-size: .88em; background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: .05em .3em; }
.md a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.couple .md a, .couple .bubble a { color: inherit; }

/* a quiet time under the last message of each run */
.msg .stamp { display: block; margin-top: .3rem; font-size: .7rem; color: color-mix(in srgb, var(--muted) 80%, transparent); font-variant-numeric: tabular-nums; }
.msg:has(+ .msg.cont) > .stamp, .msg.notice > .stamp, .msg.team > .stamp, .msg.steps:not(.done) > .stamp { display: none; }
.msg.steps > .stamp { display: none; }

/* a new day, or a pause in the chat */
.time-divider { display: flex; align-items: center; gap: .75rem; margin: 1.6rem 0 .2rem; color: var(--muted); font-size: .72rem; letter-spacing: .02em; }
.time-divider::before, .time-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.time-divider strong { font-weight: 600; color: var(--ink); opacity: .75; }
.messages > .time-divider:first-child { margin-top: .6rem; }

/* the builder's steps: one line that spins while it works and opens to show every step */
.msg.steps { align-items: flex-start; }
.msg.steps details { max-width: 100%; }
.msg.steps summary {
  display: inline-flex; align-items: center; gap: .5rem; max-width: 100%; padding: .3rem .7rem .3rem .45rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--muted);
  font-size: .8rem; cursor: pointer; list-style: none; transition: border-color .15s, background .15s;
}
.msg.steps summary::-webkit-details-marker { display: none; }
.msg.steps summary:hover { background: var(--bg); color: var(--ink); }
.steps-status { display: grid; place-items: center; width: 1.15rem; height: 1.15rem; border-radius: 50%; background: var(--bg); color: var(--accent); }
.steps-status .spinner { width: .7rem; height: .7rem; border-width: 1.5px; }
.steps-done { display: none; }
.msg.steps.done .steps-status { background: color-mix(in srgb, var(--good) 12%, var(--panel)); color: var(--good); }
.msg.steps.done .steps-status .spinner { display: none; }
.msg.steps.done .steps-done { display: grid; }
.steps-done svg { width: .75rem; height: .75rem; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.steps-label { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.msg.steps:not(.done) .steps-label { color: var(--ink); }
.steps-count:empty { display: none; }
.steps-count { flex: none; padding: 0 .4rem; border-radius: 999px; background: var(--bg); font-size: .72rem; font-variant-numeric: tabular-nums; }
.steps-chevron { display: grid; color: var(--muted); transition: transform .15s; }
.steps-chevron svg { width: .8rem; height: .8rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.msg.steps details[open] .steps-chevron { transform: rotate(90deg); }
.msg.steps ol { position: relative; margin: .5rem 0 .2rem .95rem; padding: 0 0 0 1rem; list-style: none; border-left: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.msg.steps ol li { position: relative; padding: .12rem 0; }
.msg.steps ol li::before { content: ""; position: absolute; left: calc(-1rem - 3.5px); top: .6em; width: 6px; height: 6px; border-radius: 50%; background: var(--panel); box-shadow: inset 0 0 0 1.5px var(--line); }
.msg.steps:not(.done) ol li:last-child { color: var(--ink); }
.msg.steps:not(.done) ol li:last-child::before { box-shadow: inset 0 0 0 1.5px var(--accent); background: var(--accent); }

/* "Draft 3 is ready": a card with a way to look at it */
.draft { display: flex; align-items: center; gap: .7rem; padding: .6rem .6rem .6rem .7rem; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: 0 1px 3px rgba(40, 25, 15, .05); }
.draft-icon { flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 10px; background: var(--bg); color: var(--accent); }
.draft-icon svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.draft-words { flex: 1; min-width: 0; display: grid; gap: .05rem; font-size: .85rem; line-height: 1.35; }
.draft-words span { color: var(--muted); font-size: .8rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.draft-view { flex: none; height: 2rem; padding: 0 .85rem; font-size: .82rem; font-weight: 600; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.draft-view:hover { background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }

/* files the couple added: thumbnails in a tidy grid */
.msg.files { padding-left: 2.5rem; }
.file-grid { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 7.5rem)); gap: .35rem; justify-content: end; }
.file-grid[data-count="1"] { --cols: 1; }
.file-grid[data-count="1"] .file { width: 11rem; aspect-ratio: 4 / 3; }
.file-grid[data-count="3"], .file-grid[data-count="4"] { --cols: 3; }
.file { position: relative; display: grid; place-items: center; aspect-ratio: 1; overflow: hidden; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); text-decoration: none; transition: transform .15s, box-shadow .15s; }
.file:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -8px rgba(40, 25, 15, .3); }
.file img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file.doc { grid-template-rows: 1fr auto; gap: .2rem; padding: .7rem .55rem .55rem; }
.file .ext { align-self: end; padding: .15rem .4rem; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); font-size: .68rem; font-weight: 700; letter-spacing: .06em; color: var(--accent); }
.file .name { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .72rem; }
.file.gone { opacity: .55; cursor: default; }
.file.gone:hover { transform: none; box-shadow: none; }

/* notes from the portal itself: centred and quiet */
.notice-line { display: inline-flex; align-items: flex-start; gap: .4rem; max-width: 92%; padding: .35rem .8rem; border-radius: 999px; background: var(--bg); color: var(--muted); font-size: .8rem; line-height: 1.45; text-align: center; }
.notice-line .i { display: grid; margin-top: .1rem; color: var(--good); }
.notice-line .i svg { width: .9rem; height: .9rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notice-line .md p { margin: 0; }
.team-card, .offer-card { width: 100%; padding: .75rem .95rem; border-radius: 14px; font-size: .9rem; line-height: 1.5; }
.team-card { background: color-mix(in srgb, var(--good) 7%, var(--panel)); border: 1px solid color-mix(in srgb, var(--good) 20%, var(--line)); }
.team-card .from { display: flex; align-items: center; gap: .35rem; margin-bottom: .25rem; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--good); }
.offer-card { background: var(--panel); border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(40, 25, 15, .05); }
.offer-actions { margin-top: .6rem; }
.offer-card a.button.primary { color: var(--accent-ink); text-decoration: none; font-weight: 600; font-size: .85rem; }

/* the builder is working: three soft dots */
.typing { display: flex; align-items: center; gap: .55rem; margin-top: 1rem; color: var(--muted); font-size: .8rem; }
.messages:has(> .msg.steps:not(.done):last-child) + .chat-empty + .typing { display: none; }
.dots { display: inline-flex; gap: 3px; padding: .5rem .65rem; border-radius: 999px; background: var(--bg); }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); animation: dot 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-2px); } }

/* the top of the scrollback: earlier messages, or where the chat began */
.history-edge { display: flex; justify-content: center; align-items: center; gap: .5rem; min-height: 1px; color: var(--muted); font-size: .78rem; }
.history-edge.loading, .history-edge:has(button) { padding: .75rem 0 .25rem; }
.history-edge .spinner { width: .8rem; height: .8rem; border-width: 1.5px; }
.history-edge.start { flex-direction: column; gap: .35rem; padding: 1.4rem 0 .4rem; text-align: center; }
.history-edge.start p { margin: 0; display: grid; gap: .05rem; }
.history-edge.start strong { font: 400 .95rem/1.3 Georgia, serif; color: var(--ink); }
.start-mark { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: color-mix(in srgb, var(--accent) 10%, var(--panel)); color: var(--accent); }
.start-mark svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.ghost-pill { height: 1.9rem; padding: 0 .9rem; font-size: .8rem; color: var(--muted); background: var(--panel); }
.ghost-pill:hover { color: var(--ink); background: var(--bg); }

/* back to the newest message */
.jump {
  position: absolute; left: 50%; bottom: .6rem; transform: translateX(-50%); z-index: 2;
  display: inline-flex; align-items: center; gap: .35rem; height: 2.1rem; padding: 0 .9rem 0 .7rem;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink); font-size: .8rem; font-weight: 500;
  box-shadow: 0 6px 20px -6px rgba(40, 25, 15, .25); animation: rise .18s ease-out;
}
.jump svg { width: .95rem; height: .95rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.jump:hover { background: var(--bg); }
.jump.has-new { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.jump.has-new:hover { background: color-mix(in srgb, var(--accent) 88%, black); }
.jump[hidden] { display: none; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 6px); } }

/* before the chat has loaded: soft placeholder lines */
.skeleton { display: grid; gap: .45rem; margin-top: 1.25rem; }
.skeleton span { display: block; height: .8rem; border-radius: 999px; background: linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--line) 70%, var(--bg)) 50%, var(--bg) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton.builder span { width: 88%; }
.skeleton.builder span.short { width: 55%; }
.skeleton.couple { justify-items: end; }
.skeleton.couple span { width: 60%; height: 2.4rem; border-radius: 18px 18px 6px 18px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* a chat with nothing in it yet */
.chat-empty { display: grid; justify-items: center; gap: .5rem; padding: 3rem .5rem 1rem; text-align: center; }
.chat-empty[hidden] { display: none; }
.chat-empty-mark { display: grid; place-items: center; width: 3.2rem; height: 3.2rem; border-radius: 50%; background: color-mix(in srgb, var(--accent) 10%, var(--panel)); color: var(--accent); font: 600 1rem/1 Georgia, serif; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent); }
.chat-empty h2 { margin: .4rem 0 0; font: 400 1.3rem/1.25 Georgia, serif; }
.chat-empty p { margin: 0; max-width: 20rem; color: var(--muted); font-size: .9rem; }
.suggestions { display: grid; gap: .4rem; width: 100%; max-width: 19rem; margin-top: .8rem; }
.suggestions button { padding: .55rem .9rem; border-radius: 12px; text-align: left; font-size: .85rem; transition: border-color .15s, background .15s; }
.suggestions button:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: color-mix(in srgb, var(--accent) 4%, var(--panel)); }

@media (prefers-reduced-motion: reduce) {
  .dots i, .skeleton span, .jump { animation: none; }
  .file:hover { transform: none; }
}
.typing[hidden], .history-edge:empty { display: none; }
.composer-tool[hidden] { display: none; }

/* admin: invites */
.invite-result { margin-top: 1rem; background: var(--bg); }
.invite-result p { margin: .3rem 0; }
.admin-main input.copy-link { width: 100%; font-family: ui-monospace, monospace; font-size: .85rem; }
td.actions form { display: inline; }

/* --- adding files by dropping them anywhere on the workspace --- */
.drop-overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1.25rem;
  background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(3px) saturate(.9); -webkit-backdrop-filter: blur(3px) saturate(.9);
  animation: drop-in .14s ease-out;
}
.drop-overlay::before {
  content: ""; position: absolute; inset: .75rem; border: 2px dashed color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 22px; pointer-events: none;
}
.drop-overlay[hidden] { display: none; }
.drop-card {
  position: relative; display: grid; justify-items: center; gap: .45rem; max-width: 25rem; padding: 2rem 2.25rem 1.8rem; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 24px 60px -18px rgba(40, 25, 15, .35);
  pointer-events: none; animation: drop-card-in .2s cubic-bezier(.2, .9, .3, 1.2);
}
.drop-icon { display: grid; place-items: center; width: 3.4rem; height: 3.4rem; margin-bottom: .35rem; border-radius: 50%; background: color-mix(in srgb, var(--accent) 12%, var(--panel)); color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent); }
.drop-icon svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; animation: drop-bob 1.2s ease-in-out infinite; }
.drop-card strong { font: 400 1.4rem/1.2 Georgia, serif; }
.drop-card span:last-child { color: var(--muted); font-size: .88rem; line-height: 1.5; }
@keyframes drop-in { from { opacity: 0; } }
@keyframes drop-card-in { from { opacity: 0; transform: scale(.96) translateY(6px); } }
@keyframes drop-bob { 50% { transform: translateY(-3px); } }
/* While dragging, the preview can't swallow the drop. */
.dropping iframe { pointer-events: none; }

/* the tray above the message box: each file, its progress, and anything that couldn't be added */
.upload-tray {
  margin-bottom: .5rem; padding: .6rem .7rem .5rem; border: 1px solid var(--line); border-radius: 16px; background: var(--panel);
  box-shadow: 0 8px 24px -14px rgba(40, 25, 15, .3); animation: rise-in .18s ease-out;
}
.upload-tray[hidden] { display: none; }
@keyframes rise-in { from { opacity: 0; transform: translateY(6px); } }
.tray-head { display: flex; align-items: center; gap: .5rem; min-height: 1.6rem; font-size: .85rem; }
.tray-head strong { flex: 1; font-weight: 600; }
.tray-note { color: var(--bad); font-size: .75rem; }
.tray-close { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); }
.tray-close:hover { background: var(--bg); color: var(--ink); }
.tray-close svg, .tray-mark svg { width: .9rem; height: .9rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tray-bar { --p: 0; height: 3px; margin: .35rem 0 .45rem; border-radius: 999px; background: var(--bg); overflow: hidden; }
.tray-bar::after { content: ""; display: block; height: 100%; width: calc(var(--p) * 100%); border-radius: inherit; background: var(--accent); transition: width .2s ease-out; }
.tray-bar[hidden] { display: none; }
.tray-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .15rem; max-height: 11.5rem; overflow-y: auto; scrollbar-width: thin; }
.tray-item { display: flex; align-items: center; gap: .6rem; padding: .3rem .1rem; }
.tray-thumb {
  flex: none; display: grid; place-items: center; width: 2.3rem; height: 2.3rem; overflow: hidden; border-radius: 9px;
  background: var(--bg); border: 1px solid var(--line); color: var(--accent); font-size: .6rem; font-weight: 700; letter-spacing: .05em;
}
.tray-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tray-words { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.tray-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .83rem; }
.tray-status { color: var(--muted); font-size: .74rem; font-variant-numeric: tabular-nums; }
.tray-mark { flex: none; display: grid; place-items: center; width: 1.4rem; height: 1.4rem; color: var(--muted); }
.tray-mark .spinner { width: .8rem; height: .8rem; border-width: 1.5px; color: var(--accent); }
.tray-item.queued { opacity: .6; }
.tray-item.done .tray-mark { color: var(--good); }
.tray-item.done .tray-status { color: var(--good); }
.tray-item.rejected .tray-thumb, .tray-item.failed .tray-thumb { opacity: .5; filter: grayscale(1); }
.tray-item.rejected .tray-name, .tray-item.failed .tray-name { color: var(--muted); }
.tray-item.rejected .tray-status, .tray-item.failed .tray-status, .tray-item.rejected .tray-mark, .tray-item.failed .tray-mark { color: var(--bad); }
.tray-item.rejected .tray-status, .tray-item.failed .tray-status { white-space: normal; }

@media (prefers-reduced-motion: reduce) {
  .drop-overlay, .drop-card, .drop-icon svg, .upload-tray { animation: none; }
}
