:root {
  --bg: #f6f5f2; --surface: #ffffff; --surface-2: #f0eee9; --border: #e3e0d8;
  --text: #1f1d1a; --muted: #6d685f; --accent: #5b4bdb; --accent-2: #ece9ff; --accent-text: #ffffff;
  --ok: #1f8a5b; --ok-bg: #e3f4ec; --warn: #a86400; --warn-bg: #fff2dc; --bad: #b42318; --bad-bg: #fde8e6;
  --stage-pending: #8a6d00; --stage-confirmed: #1f6feb; --stage-planning: #5b4bdb; --stage-completed: #1f8a5b; --stage-cancelled: #8c8c8c;
  --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141311; --surface: #1d1c19; --surface-2: #262420; --border: #34312b;
    --text: #f1eee8; --muted: #a39d92; --accent: #8f83ff; --accent-2: #2a2650; --accent-text: #14121f;
    --ok: #4cc38a; --ok-bg: #16302a; --warn: #f0b252; --warn-bg: #352712; --bad: #ff7a6b; --bad-bg: #3a1b18;
    --stage-pending: #e0b93a; --stage-confirmed: #6aa8ff; --stage-planning: #8f83ff; --stage-completed: #4cc38a; --stage-cancelled: #8c8c8c;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141311; --surface: #1d1c19; --surface-2: #262420; --border: #34312b;
  --text: #f1eee8; --muted: #a39d92; --accent: #8f83ff; --accent-2: #2a2650; --accent-text: #14121f;
  --ok: #4cc38a; --ok-bg: #16302a; --warn: #f0b252; --warn-bg: #352712; --bad: #ff7a6b; --bad-bg: #3a1b18;
  --stage-pending: #e0b93a; --stage-confirmed: #6aa8ff; --stage-planning: #8f83ff; --stage-completed: #4cc38a; --stage-cancelled: #8c8c8c;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.05rem; font-family: var(--sans); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .nowrap { white-space: nowrap; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.stack > * + * { margin-top: .75rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.hidden { display: none !important; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.card h3 { text-transform: uppercase; font-size: .75rem; letter-spacing: .08em; color: var(--muted); margin-bottom: .75rem; }
.stat .num { font-size: 1.8rem; font-weight: 650; font-family: var(--serif); }
.stat .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

.btn { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: .5rem .9rem; border-radius: 8px; font: inherit; font-weight: 550; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.small { padding: .3rem .6rem; font-size: .85rem; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: .3rem; border-radius: 6px; font-size: 1rem; line-height: 1; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .5rem .65rem; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { min-height: 70px; resize: vertical; }
label { display: block; font-size: .85rem; font-weight: 550; margin-bottom: .25rem; color: var(--muted); }
.field { margin-bottom: .85rem; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 .9rem; }

.chip { display: inline-block; font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; padding: .15rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.chip.stage-pending { color: var(--stage-pending); background: color-mix(in srgb, var(--stage-pending) 14%, transparent); }
.chip.stage-confirmed { color: var(--stage-confirmed); background: color-mix(in srgb, var(--stage-confirmed) 14%, transparent); }
.chip.stage-planning { color: var(--stage-planning); background: color-mix(in srgb, var(--stage-planning) 14%, transparent); }
.chip.stage-completed { color: var(--stage-completed); background: color-mix(in srgb, var(--stage-completed) 14%, transparent); }
.chip.stage-cancelled { color: var(--stage-cancelled); background: color-mix(in srgb, var(--stage-cancelled) 14%, transparent); }
.chip.ok { color: var(--ok); background: var(--ok-bg); } .chip.warn { color: var(--warn); background: var(--warn-bg); } .chip.bad { color: var(--bad); background: var(--bad-bg); }

.banner { border-radius: 10px; padding: .7rem .9rem; font-size: .9rem; }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner.ok { background: var(--ok-bg); color: var(--ok); }

.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.ring { --p: 0; width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0); }
.ring > div { width: 96px; height: 96px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; }
.ring b { font-size: 1.6rem; font-family: var(--serif); display: block; line-height: 1; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; }

/* Layout: admin */
.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 1rem .75rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font-family: var(--serif); font-size: 1.35rem; font-weight: 700; padding: .25rem .6rem 1rem; display: flex; align-items: center; gap: .5rem; }
.brand .dot { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: var(--accent-text); font-size: .9rem; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: .5rem .7rem; border-radius: 8px; color: var(--text); font-weight: 500; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--accent-2); color: var(--accent); }
.nav .badge { background: var(--accent); color: var(--accent-text); border-radius: 99px; font-size: .72rem; padding: 0 .45rem; font-weight: 700; }
.nav .group { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 1rem .7rem .3rem; }
main.content { padding: 1.5rem 2rem 4rem; max-width: 1200px; width: 100%; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs a, .tabs button { padding: .6rem .9rem; border: 0; background: none; font: inherit; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; font-weight: 550; }
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs .active { color: var(--accent); border-bottom-color: var(--accent); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: .4rem .9rem; border-radius: 8px; font: inherit; font-weight: 550; color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.mobile-top { display: none; }

/* Event list */
.event-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 1rem; align-items: center; padding: .9rem 1rem; border-bottom: 1px solid var(--border); color: var(--text); }
.event-row:hover { background: var(--surface-2); text-decoration: none; }
.event-row:last-child { border-bottom: 0; }
.datebox { text-align: center; border: 1px solid var(--border); border-radius: 10px; padding: .3rem 0; background: var(--surface); }
.datebox .m { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 700; }
.datebox .d { font-size: 1.35rem; font-weight: 700; font-family: var(--serif); line-height: 1.1; }
.month-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 650; padding: 1rem 1rem .4rem; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal .dow { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .5rem; text-align: center; background: var(--surface-2); font-weight: 650; }
.cal .day { min-height: 104px; border-top: 1px solid var(--border); border-left: 1px solid var(--border); padding: .35rem; cursor: pointer; position: relative; }
.cal .day:nth-child(7n+1) { border-left: 0; }
.cal .day.other { background: var(--surface-2); color: var(--muted); }
.cal .day.today .n { background: var(--accent); color: var(--accent-text); border-radius: 99px; padding: 0 .45rem; }
.cal .day.selected { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal .day.off { background: repeating-linear-gradient(-45deg, transparent 0 6px, color-mix(in srgb, var(--warn) 10%, transparent) 6px 12px); }
.cal .n { font-size: .82rem; font-weight: 600; display: inline-block; }
.cal .pill { display: block; font-size: .74rem; padding: .1rem .35rem; border-radius: 5px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.cal .pill.off { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
@media (max-width: 1150px) { .cal-layout { grid-template-columns: minmax(0, 1fr); } }

/* Planning */
.section-head { background: var(--accent); color: var(--accent-text); border-radius: var(--radius); padding: .9rem 1.1rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: .8rem; margin-top: 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.item-card { display: grid; grid-template-columns: 78px 1fr auto; gap: .9rem; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; margin-top: .6rem; cursor: pointer; box-shadow: var(--shadow); }
.item-card:hover { border-color: var(--accent); }
.item-card.removed { opacity: .55; }
.item-card .time { font-weight: 650; font-size: .9rem; color: var(--muted); }
.item-card .title { font-weight: 650; font-size: 1.02rem; }
.item-card .meta { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; font-size: .8rem; color: transparent; }
.check.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.song { display: grid; grid-template-columns: 44px 1fr auto; gap: .7rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--border); }
.song:last-child { border-bottom: 0; }
.song img, .song .art { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.song .t { font-weight: 600; line-height: 1.25; }
.song .a { font-size: .85rem; color: var(--muted); }
.song .actions { display: flex; gap: .1rem; }
.search-box { position: relative; }
.results { border: 1px solid var(--border); border-radius: 10px; margin-top: .4rem; max-height: 340px; overflow-y: auto; background: var(--surface); }
.results .song { padding: .45rem .6rem; }
.results .song:hover { background: var(--surface-2); }
.genre-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .5rem; }
.genre { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .4rem .6rem; border: 1px solid var(--border); border-radius: 10px; }
.genre .opts { display: flex; gap: 2px; }
.genre .opts button { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; font-size: .75rem; padding: .2rem .45rem; cursor: pointer; color: var(--muted); }
.genre .opts button.on-love { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.genre .opts button.on-ok { background: var(--accent-2); color: var(--accent); border-color: var(--accent); }
.genre .opts button.on-no { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.q { padding: .75rem 0; border-bottom: 1px solid var(--border); }
.q:last-child { border-bottom: 0; }
.q.skipped textarea { opacity: .5; }

/* Drawer / modal */
.overlay { position: fixed; inset: 0; background: rgba(20, 18, 15, .45); z-index: 50; display: flex; justify-content: flex-end; }
.drawer { background: var(--bg); width: min(720px, 100%); height: 100%; display: flex; flex-direction: column; box-shadow: -8px 0 30px rgba(0,0,0,.2); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1.1rem; border-bottom: 1px solid var(--border); background: var(--surface); }
.drawer-body { overflow-y: auto; padding: 1.1rem; flex: 1; }
.drawer-foot { display: flex; justify-content: space-between; align-items: center; padding: .7rem 1.1rem; border-top: 1px solid var(--border); background: var(--surface); }
.modal-wrap { position: fixed; inset: 0; background: rgba(20, 18, 15, .45); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 14px; width: min(560px, 100%); max-height: 90vh; overflow-y: auto; padding: 1.3rem; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: .6rem 1rem; border-radius: 10px; z-index: 70; font-weight: 550; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: calc(100% - 32px); }
.toast.error { background: var(--bad); color: #fff; }
.saved { font-size: .8rem; color: var(--muted); }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }

/* Portal */
.portal-top { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.portal-top .inner { max-width: 900px; margin: 0 auto; padding: .7rem 16px; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.portal-main { max-width: 900px; margin: 0 auto; padding: 1.25rem 16px 4rem; }
.hero { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #f0a)); color: #fff; border-radius: 18px; padding: 1.8rem 1.6rem; }
.hero h1 { font-size: 2.1rem; margin: .2rem 0; }
.hero .eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; opacity: .85; font-weight: 650; }
.countdown { font-size: .95rem; opacity: .95; margin-top: .4rem; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 30% 0 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; height: 100%; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .mobile-top { display: flex; justify-content: space-between; align-items: center; padding: .6rem 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
  main.content { padding: 1rem 16px 4rem; }
  .cal-layout { grid-template-columns: 1fr; }
  .cal .day { min-height: 64px; padding: .2rem; }
  .cal .pill { font-size: 0; height: 6px; padding: 0; }
  .item-card { grid-template-columns: 1fr auto; }
  .item-card .time { grid-column: 1 / -1; }
  .event-row { grid-template-columns: 52px 1fr; }
  .event-row > :last-child { grid-column: 2; }
  .hero h1 { font-size: 1.6rem; }
}

/* Event rows adapt to the width of the card they sit in. */
.card { container-type: inline-size; }
@container (max-width: 560px) {
  .event-row { grid-template-columns: 52px 1fr; }
  .event-row > :last-child { grid-column: 2; justify-content: flex-start; }
}
@media (max-width: 520px) { .portal-top .brand span:last-child { display: none; } }

/* Documents */
.doc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem 2.2rem; line-height: 1.6; }
.doc h2 { font-size: 1.5rem; margin-top: 0; } .doc h3 { font-size: 1.1rem; text-transform: none; letter-spacing: 0; color: var(--text); margin: 1.4rem 0 .4rem; font-family: var(--serif); }
.doc h4 { margin: 1rem 0 .3rem; } .doc p { margin: .5rem 0; } .doc ul, .doc ol { margin: .4rem 0; padding-left: 1.3rem; }
.sig { border-top: 1px solid var(--border); margin-top: 1.5rem; padding-top: 1rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.sig .name { font-family: "Brush Script MT", "Segoe Script", cursive; font-size: 1.8rem; color: var(--accent); line-height: 1.2; }
.editor { font: 14px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; min-height: 460px; }
.inv-items td input { padding: .35rem .45rem; }
.task { display: grid; grid-template-columns: 28px 1fr auto; gap: .6rem; align-items: start; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.task:last-child { border-bottom: 0; }
.task.done .t { text-decoration: line-through; color: var(--muted); }
.task input[type=checkbox] { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--accent); }
.hbar { height: 10px; border-radius: 99px; background: var(--accent); min-width: 2px; }
.field-chip { display: inline-block; font: 12px ui-monospace, Menlo, monospace; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: .1rem .4rem; margin: .15rem; cursor: pointer; }
.field-chip:hover { border-color: var(--accent); }
@media print {
  body { background: #fff; color: #000; }
  .sidebar, .mobile-top, .no-print, .portal-top, .toast { display: none !important; }
  .app { display: block; } main.content, .portal-main { padding: 0; max-width: none; }
  .doc, .card { border: 0; box-shadow: none; padding: 0; }
}
.inv-items td:first-child input { min-width: 220px; }
[data-sched] td:first-child input { min-width: 140px; }

/* ---------- CRM additions: search, kanban, inbox, forms, media, charts ---------- */
.search { position: relative; margin: 0 .2rem .8rem; }
.search input { padding: .45rem .6rem; font-size: .9rem; }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.15); z-index: 45; max-height: 360px; overflow-y: auto; }
.search-results a { display: flex; flex-direction: column; padding: .45rem .7rem; color: var(--text); border-bottom: 1px solid var(--border); font-size: .9rem; }
.search-results a:hover { background: var(--surface-2); text-decoration: none; }
h3.sec { text-transform: uppercase; font-size: .75rem; letter-spacing: .08em; color: var(--muted); margin: 0 0 .6rem; }
.click { cursor: pointer; } .click:hover td { background: var(--surface-2); }
.tag { display: inline-block; font-size: .72rem; background: var(--accent-2); color: var(--accent); border-radius: 6px; padding: .05rem .4rem; margin: .1rem .2rem .1rem 0; font-weight: 600; }
.tags { margin-top: .3rem; }

main.content:has(.kanban) { max-width: none; }
.kanban { display: flex; gap: .8rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; }
.kcol { flex: 0 0 250px; background: var(--surface-2); border-radius: var(--radius); padding: .5rem; min-height: 200px; transition: background .15s; }
.kcol.over { background: var(--accent-2); outline: 2px dashed var(--accent); outline-offset: -2px; }
.khead { display: flex; justify-content: space-between; align-items: baseline; font-weight: 650; font-size: .88rem; padding: .3rem .4rem .6rem; gap: .4rem; }
.kbody { display: flex; flex-direction: column; gap: .5rem; min-height: 120px; }
.kcard { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .6rem .7rem; color: var(--text); box-shadow: var(--shadow); cursor: grab; }
.kcard:hover { border-color: var(--accent); text-decoration: none; }
.kcard.dragging { opacity: .45; }
.kname { font-size: .92rem; line-height: 1.3; }
.kempty { color: var(--muted); font-size: .8rem; text-align: center; padding: 1.2rem .4rem; border: 1px dashed var(--border); border-radius: 10px; }

.inbox { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 1rem; align-items: start; }
.convs { max-height: calc(100vh - 140px); overflow-y: auto; }
.conv { display: block; position: relative; padding: .7rem .9rem; border-top: 1px solid var(--border); color: var(--text); }
.conv:hover { background: var(--surface-2); text-decoration: none; }
.conv.active { background: var(--accent-2); }
.conv.unread b { color: var(--accent); }
.dot-badge { position: absolute; right: .8rem; bottom: .7rem; background: var(--accent); color: var(--accent-text); border-radius: 99px; font-size: .7rem; font-weight: 700; padding: 0 .4rem; }
.thread { display: flex; flex-direction: column; gap: .6rem; max-height: 52vh; overflow-y: auto; padding: .3rem .2rem 1rem; }
.bubble { max-width: 78%; padding: .55rem .8rem; border-radius: 14px; }
.bubble .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .who { opacity: .75; margin-bottom: .15rem; }
.bubble.me { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; }
.bubble.them { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.composer { border-top: 1px solid var(--border); padding-top: .8rem; }
.composer textarea { margin-bottom: .5rem; }
@media (max-width: 900px) { .inbox { grid-template-columns: 1fr; } .inbox.has-thread .convs, .inbox:not(.has-thread) [data-thread] { display: none; } .bubble { max-width: 92%; } }

.tpl { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem; border: 1px solid var(--border); border-radius: 10px; margin-bottom: .4rem; cursor: pointer; color: var(--text); font-weight: 500; }
.tpl input { width: auto; margin-top: .25rem; }
.tpl:has(input:checked) { border-color: var(--accent); background: var(--accent-2); }
.qedit { padding: .6rem 0; border-bottom: 1px solid var(--border); }
.checks { display: grid; gap: .2rem; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; margin: 0; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 99px; cursor: pointer; transition: .2s; }
.switch span::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::before { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.flow-arrow { text-align: center; color: var(--muted); padding: .2rem 0; }
.step { border-left: 3px solid var(--accent); }

.timerbar { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.timerbar .clock { font: 600 1.8rem var(--serif); font-variant-numeric: tabular-nums; margin-left: auto; }
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 1.2rem; text-align: center; color: var(--muted); margin-bottom: 1rem; }
.dropzone.over { border-color: var(--accent); background: var(--accent-2); color: var(--accent); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; }
.media { padding: .6rem; }
.media .thumb { display: grid; place-items: center; height: 120px; background: var(--surface-2); border-radius: 8px; overflow: hidden; margin-bottom: .45rem; color: var(--muted); font-weight: 700; }
.media .thumb img { width: 100%; height: 100%; object-fit: cover; }
.note { border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: .6rem .7rem; margin-top: .6rem; }

.vbars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .3rem; align-items: end; height: 190px; }
.vbar { display: flex; flex-direction: column; align-items: center; gap: .25rem; height: 100%; justify-content: flex-end; }
.vbar .pair { display: flex; gap: 2px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.vbar .pair span { width: 40%; border-radius: 4px 4px 0 0; min-height: 2px; }
.in, .sw.in { background: var(--accent); } .out, .sw.out { background: color-mix(in srgb, var(--warn) 65%, transparent); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.cal .pill.meet, .sw.meet { background: color-mix(in srgb, var(--stage-confirmed) 18%, var(--surface)); color: var(--stage-confirmed); }
.cal .pill.pay, .sw.pay { background: var(--ok-bg); color: var(--ok); }
.sw.meet { border: 1px solid var(--stage-confirmed); } .sw.pay { border: 1px solid var(--ok); }

/* Public pages (forms, scheduler, proposals) */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .4rem; }
.slots button, .days button { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: .5rem; font: inherit; font-weight: 600; cursor: pointer; color: var(--text); }
.slots button:hover, .days button:hover { border-color: var(--accent); }
.slots button.on, .days button.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.days { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .4rem; }
.days button { flex: 0 0 74px; display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.days button small { font-weight: 500; opacity: .75; }
.pkg { display: block; border: 2px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; cursor: pointer; background: var(--surface); color: var(--text); font-weight: 400; }
.pkg:has(input:checked) { border-color: var(--accent); background: var(--accent-2); }
.pkg input { width: auto; }
.portal-logo { height: 30px; width: auto; border-radius: 6px; }
.chat-portal .thread { max-height: none; }
@media (max-width: 860px) {
  /* Two-column page layouts set inline stack on phones. */
  main.content .grid[style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
  .step select, .step input:not([type=number]) { max-width: 100%; }
  [data-preview] { position: static !important; }
}
