:root {
  --paper: #f5f2eb;
  --surface: #fffdf8;
  --ink: #25211d;
  --muted: #716b63;
  --line: #ded8ce;
  --brass: #9b7b43;
  --rose: #a85f73;
  --green: #45715c;
  --amber: #a06a2f;
  --red: #9b493f;
  --sidebar: #211f1b;
  --sidebar-muted: #aaa49b;
  --radius: 6px;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0;
}
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; flex: 0 0 auto; }
[data-lucide] {
  width: 18px;
  height: 18px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  font-style: normal;
  font-size: 16px;
  line-height: 1;
}
[data-lucide]::before { content: "·"; }
[data-lucide="house"]::before { content: "⌂"; }
[data-lucide="users"]::before, [data-lucide="user-plus"]::before { content: "♙"; }
[data-lucide="clipboard-check"]::before { content: "✓"; }
[data-lucide="mail"]::before, [data-lucide="mail-plus"]::before,
[data-lucide="mail-check"]::before { content: "✉"; }
[data-lucide="refresh-cw"]::before { content: "↻"; }
[data-lucide="list-checks"]::before { content: "☷"; }
[data-lucide="feather"]::before { content: "❧"; }
[data-lucide="database-backup"]::before { content: "◫"; }
[data-lucide="log-out"]::before { content: "↪"; }
[data-lucide="search"]::before, [data-lucide="scan-search"]::before { content: "⌕"; }
[data-lucide="chevron-right"]::before { content: "›"; }
[data-lucide="x"]::before { content: "×"; }
[data-lucide="plus"]::before { content: "+"; }
[data-lucide="send"]::before { content: "➤"; }
[data-lucide="save"]::before { content: "↓"; }
[data-lucide="pencil"]::before { content: "✎"; }
[data-lucide="trash-2"]::before { content: "⌫"; }
[data-lucide="eye"]::before { content: "◉"; }
[data-lucide="eye-off"]::before { content: "○"; }
[data-lucide="qr-code"]::before { content: "▦"; }
[data-lucide="badge-check"]::before { content: "✓"; }
[data-lucide="circle-alert"]::before { content: "!"; }
[data-lucide="briefcase-business"]::before { content: "▣"; }
[data-lucide="gift"]::before { content: "◇"; }
[data-lucide="clock-3"]::before { content: "◷"; }
[data-lucide="glass-water"]::before { content: "♢"; }
[data-lucide="heart-off"]::before { content: "♡"; }

[data-lucide="message-circle"] { position: relative; }
[data-lucide="message-circle"]::before { content: ''; width: 14px; height: 12px; border: 1.6px solid currentColor; border-radius: 50%; }
[data-lucide="message-circle"]::after { content: ''; position: absolute; right: 1px; bottom: 2px; width: 5px; height: 5px; border-left: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-24deg) skew(-14deg); background: transparent; }
[data-lucide="shield-check"]::before { content: "◆"; }
[data-lucide="check"]::before { content: "\2713"; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  background: var(--sidebar);
  color: #f4efe6;
}
.crm-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; border-bottom: 1px solid rgba(255,255,255,.11); }
.crm-monogram { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(228,194,135,.55); border-radius: 50%; color: #e4c287; font: 18px var(--serif); }
.crm-brand-copy { display: flex; flex-direction: column; gap: 2px; font-weight: 650; }
.crm-brand-copy small { color: var(--sidebar-muted); font-size: 11px; font-weight: 400; }
.primary-nav { display: grid; gap: 4px; margin-top: 22px; }
.nav-button {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--sidebar-muted);
  text-align: left;
}
.nav-button:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-button.active { background: rgba(168,95,115,.2); color: #fff; box-shadow: inset 2px 0 var(--rose); }
.sidebar-footer { margin-top: auto; display: grid; grid-template-columns: 9px 1fr; gap: 2px 8px; align-items: center; padding: 14px 10px 0; border-top: 1px solid rgba(255,255,255,.11); color: #ddd8cf; font-size: 12px; }
.sidebar-footer small { grid-column: 2; color: var(--sidebar-muted); overflow: hidden; text-overflow: ellipsis; }
.system-dot { width: 8px; height: 8px; border-radius: 50%; background: #63a27d; box-shadow: 0 0 0 3px rgba(99,162,125,.14); }

.workspace { min-width: 0; padding: 28px 32px 48px; overflow-x: hidden; }
.workspace-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.workspace-header h1, .drawer-header h2, dialog h2, .section-toolbar h2 { margin: 0; font-family: var(--serif); font-weight: 400; }
.workspace-header h1 { font-size: 34px; }
.eyebrow { margin: 0 0 4px; color: var(--brass); font-size: 10px; font-weight: 700; letter-spacing: .16em; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-button, .command-button, .text-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 4px;
}
.icon-button { width: 38px; padding: 0; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.icon-button:hover { border-color: var(--brass); color: var(--ink); }
.command-button { padding: 0 14px; border: 1px solid var(--ink); background: var(--ink); color: #fff; font-weight: 650; }
.command-button:hover { background: #403a33; }
.text-button { padding: 0 12px; border: 0; background: transparent; color: var(--muted); }

.workspace-view { display: none; }
.workspace-view.active { display: block; }

/* ——— shared invitation overview ——— */

.overview-hero {
  position: relative;
  min-height: 230px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 34px;
  overflow: hidden;
  padding: 34px 38px;
  border: 1px solid #51493f;
  border-radius: 10px;
  background:
    radial-gradient(circle at 82% 18%, rgba(183,145,79,.17), transparent 24%),
    linear-gradient(135deg, #24211c 0%, #302a23 100%);
  color: #f7f1e7;
  box-shadow: 0 18px 42px -34px rgba(31,26,20,.9);
}
.overview-hero::after {
  content: '';
  position: absolute;
  right: 16%;
  bottom: -1px;
  width: 1px;
  height: 72%;
  background: linear-gradient(transparent, rgba(224,190,127,.3));
}
.overview-hero-copy { position: relative; z-index: 2; max-width: 650px; }
.overview-hero-copy h2 { margin: 6px 0 9px; font: 400 clamp(32px, 4vw, 49px)/1.02 var(--serif); letter-spacing: -.02em; }
.overview-hero-copy > p:not(.eyebrow) { max-width: 610px; margin: 0; color: #c8c0b5; line-height: 1.55; }
.overview-hero-actions { display: flex; align-items: center; gap: 10px; margin-top: 24px; }
.overview-primary-action, .overview-secondary-action, .overview-link, .overview-more {
  border: 0;
  background: transparent;
}
.overview-primary-action {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 16px;
  border: 1px solid #ddbd82;
  border-radius: 4px;
  background: #ddbd82;
  color: #231f1a;
  font-weight: 700;
}
.overview-primary-action:hover { background: #efd39e; }
.overview-secondary-action { padding: 10px; color: #d8d0c5; }
.overview-secondary-action:hover { color: #fff; }
.overview-secondary-action span { margin-left: 4px; color: #ddbd82; }
.overview-countdown {
  position: relative;
  z-index: 2;
  width: 170px;
  aspect-ratio: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  border: 1px solid rgba(221,189,130,.55);
  border-radius: 50%;
  background: rgba(22,19,16,.25);
  box-shadow: inset 0 0 0 8px rgba(221,189,130,.035);
}
.overview-countdown strong { font: 400 46px/1 var(--serif); color: #efd39e; font-variant-numeric: tabular-nums; }
.overview-countdown span { margin-top: 3px; color: #e5ded3; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.overview-countdown small { margin-top: 13px; color: #aaa196; font-size: 9px; }
.overview-hero-rings { position: absolute; z-index: 1; inset: 0; pointer-events: none; opacity: .3; }
.overview-hero-rings span { position: absolute; width: 180px; aspect-ratio: 1; border: 1px solid #d9b974; border-radius: 50%; }
.overview-hero-rings span:first-child { right: 5%; top: -45%; }
.overview-hero-rings span:last-child { right: -3%; top: 5%; }

.overview-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 14px 0 18px; }
.overview-stat {
  min-width: 0;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.overview-stat:hover { transform: translateY(-2px); border-color: #cbbfae; box-shadow: 0 12px 28px -24px rgba(33,29,25,.75); }
.overview-stat > span:nth-child(2) { min-width: 0; display: grid; grid-template-columns: 1fr auto; align-items: baseline; column-gap: 8px; }
.overview-stat small { color: var(--muted); font-size: 11px; font-weight: 650; }
.overview-stat strong { grid-row: 1 / span 2; grid-column: 2; font: 400 31px var(--serif); font-variant-numeric: tabular-nums; }
.overview-stat-note { grid-column: 1; margin-top: 4px; color: #928b81; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overview-stat > svg:last-child { width: 15px; color: #aaa196; }
.overview-stat-icon { width: 40px; height: 40px; display: grid !important; place-items: center; border-radius: 50%; background: #eee9e0; color: var(--brass); }
.overview-stat.attending .overview-stat-icon { background: #e1ece5; color: var(--green); }
.overview-stat.declined .overview-stat-icon { background: #f2e1de; color: var(--red); }
.overview-stat.awaiting .overview-stat-icon { background: #efe6d7; color: var(--amber); }

.overview-grid { display: grid; grid-template-columns: minmax(280px, .86fr) minmax(390px, 1.14fr); gap: 14px; }
.overview-card { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.overview-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.overview-card h3 { margin: 2px 0 0; font: 400 25px var(--serif); }
.overview-card .eyebrow { font-size: 9px; }
.overview-link { padding: 5px 0; color: var(--brass); font-size: 11px; font-weight: 700; white-space: nowrap; }
.overview-link:hover, .overview-more:hover { color: var(--rose); }
.overview-freshness { padding: 4px 7px; border-radius: 999px; background: #e1ece5; color: var(--green); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.overview-progress-layout { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 24px; }
.overview-donut {
  width: 150px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0 0%, var(--red) 0 0%, var(--amber) 0 0%, #d9d2c7 0 100%);
  transform: rotate(-90deg);
}
.overview-donut::before { content: ''; grid-area: 1 / 1; width: 108px; aspect-ratio: 1; border-radius: 50%; background: var(--surface); }
.overview-donut > div { z-index: 1; grid-area: 1 / 1; display: grid; justify-items: center; text-align: center; transform: rotate(90deg); }
.overview-donut strong { font: 400 28px var(--serif); }
.overview-donut span { margin-top: 2px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.overview-legend { margin: 0; }
.overview-legend div { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px solid #eee9e1; }
.overview-legend div:last-child { border-bottom: 0; }
.overview-legend dt { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.overview-legend dd { margin: 0; font-weight: 750; font-variant-numeric: tabular-nums; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-dot.attending { background: var(--green); }
.legend-dot.declined { background: var(--red); }
.legend-dot.awaiting { background: var(--amber); }
.legend-dot.to-send { background: #d9d2c7; }
.overview-source { margin: 18px 0 0; padding-top: 13px; border-top: 1px solid #eee9e1; color: var(--muted); font-size: 10px; line-height: 1.5; }

.overview-person-list, .overview-reply-list { display: grid; }
.overview-person, .overview-reply {
  min-width: 0;
  display: grid;
  align-items: center;
  gap: 11px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid #eee9e1;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.overview-person { grid-template-columns: 34px minmax(0, 1fr) auto; }
.overview-reply { grid-template-columns: 9px minmax(0, 1fr) auto; }
.overview-person:last-child, .overview-reply:last-child { border-bottom: 0; }
.overview-person:hover strong, .overview-reply:hover strong { color: var(--rose); }
.overview-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #efe8db; color: var(--brass); font: 700 11px var(--serif); }
.overview-person strong, .overview-reply strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.overview-person small, .overview-reply small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.overview-person > span:last-child { color: var(--amber); font-size: 10px; font-weight: 700; white-space: nowrap; }
.reply-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px #e6efe9; }
.overview-reply time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.overview-list-empty { min-height: 150px; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.overview-card-intro { margin: -5px 0 15px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.overview-name-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.overview-name-chip { padding: 7px 9px; border: 1px solid #e1d9cc; border-radius: 999px; background: #faf7f1; color: #514b44; font-size: 10px; }
button.overview-name-chip:hover { border-color: var(--brass); color: var(--ink); }
.overview-more { margin-top: 15px; padding: 0; color: var(--brass); font-size: 10px; font-weight: 700; }
.metric-strip { display: grid; grid-template-columns: repeat(6, minmax(100px, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.metric { min-width: 0; padding: 15px 16px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.metric strong { font-family: var(--serif); font-size: 27px; font-weight: 400; font-variant-numeric: tabular-nums; }
.metric.warning strong { color: var(--amber); }
.metric.alert strong { color: var(--rose); }

.table-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 22px 0 12px; }
.search-control { width: min(420px, 48%); height: 40px; display: flex; align-items: center; gap: 9px; padding: 0 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--muted); }
.search-control input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.filter-group { display: flex; gap: 10px; }
.filter-group label { display: grid; gap: 4px; }
.filter-group label > span, dialog label > span, .drawer-section label > span { color: var(--muted); font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; }
select, input, textarea { border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); }
select { min-width: 140px; height: 40px; padding: 0 30px 0 10px; }
input, textarea { width: 100%; padding: 10px 11px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(155,123,67,.23); border-color: var(--brass); }

.table-shell { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 850px; }
th { padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--muted); background: #f0ece4; font-size: 10px; text-align: left; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid #ebe6dc; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #faf7f1; }
.household-name { display: block; font-weight: 680; }
.subtext { display: block; max-width: 280px; margin-top: 3px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-pill { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; background: #ece8e0; color: var(--muted); font-size: 11px; white-space: nowrap; }
.status-pill[data-status="attending"], .status-pill[data-status="sent"] { background: #e1ece5; color: var(--green); }
.status-pill[data-status="declined"] { background: #f2e1de; color: var(--red); }
.status-pill[data-status="maybe"], .status-pill[data-status="planned"] { background: #efe6d7; color: var(--amber); }
.status-pill[data-status="done"], .status-pill[data-status="booked"], .status-pill[data-status="paid"], .status-pill[data-status="purchased"] { background: #e1ece5; color: var(--green); }
.status-pill[data-status="critical"], .status-pill[data-status="overdue"] { background: #f2e1de; color: var(--red); }
.status-pill[data-status="high"], .status-pill[data-status="waiting"], .status-pill[data-status="quoted"], .status-pill[data-status="must_have"] { background: #efe6d7; color: var(--amber); }
.status-pill[data-status="in_progress"], .status-pill[data-status="contacted"], .status-pill[data-status="listed"] { background: #e2e8ee; color: #466379; }
.row-action { width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); }
.row-action:hover { color: var(--rose); }
.row-actions { display: inline-flex; align-items: center; }
.row-action.danger:hover { color: var(--red); }
.record-link { color: var(--brass); text-decoration: underline; text-underline-offset: 2px; }
.empty-state { min-height: 260px; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--muted); text-align: center; }
.empty-state[hidden] { display: none; }
.empty-state svg { width: 28px; height: 28px; color: var(--brass); }
.empty-state strong { color: var(--ink); }
.empty-state span { font-size: 12px; }

.section-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; }
.section-toolbar h2 { font-size: 27px; }
.section-toolbar p { margin: 4px 0 0; color: var(--muted); }
.response-overview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 14px 0 18px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.response-window, .response-quality { margin: 0; color: var(--muted); font-size: 12px; }
.response-quality { margin-top: 5px; color: var(--amber); }
.response-progress { width: min(330px, 42%); display: grid; gap: 7px; }
.response-progress > span { color: var(--muted); font-size: 11px; text-align: right; }
.response-progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: #e8e2d8; }
.response-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width 180ms ease; }
.whatsapp-handoff-note { display: flex; align-items: flex-start; gap: 10px; margin: -5px 0 16px; padding: 12px 14px; border: 1px solid #d8c8a9; border-radius: var(--radius); background: #fbf5e9; color: var(--muted); font-size: 12px; line-height: 1.45; }
.whatsapp-handoff-note svg { margin-top: 1px; color: var(--brass); }
.whatsapp-handoff-note strong { color: var(--ink); }
.response-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.response-toolbar .segmented-control { margin-right: auto; }
.response-search { width: min(300px, 34%); }
.response-table { min-width: 1080px; }
.response-days { font-variant-numeric: tabular-nums; white-space: nowrap; }
.response-days.chase-due { color: var(--amber); font-weight: 700; }
.whatsapp-action { color: var(--green); }
.whatsapp-action:hover { color: var(--rose); }
.whatsapp-sent-label { color: var(--green); font-size: 11px; white-space: nowrap; }
.duplicate-record { display: inline-flex; margin-top: 4px; color: var(--amber); font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.planning-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 22px 0 12px; }
.segmented-control { display: inline-grid; grid-auto-flow: column; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); overflow: hidden; }
.segmented-control button { min-height: 38px; padding: 0 14px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--muted); }
.segmented-control button:last-child { border-right: 0; }
.segmented-control button:hover { color: var(--ink); background: #f8f5ee; }
.segmented-control button.active { background: var(--ink); color: #fff; }
.planning-panel { display: none; }
.planning-panel.active { display: block; }
.planning-table { min-width: 960px; }
.status-list { margin: 0; border-top: 1px solid var(--line); background: var(--surface); }
.status-list div { display: grid; grid-template-columns: minmax(180px, 32%) 1fr; gap: 24px; padding: 17px 4px; border-bottom: 1px solid var(--line); }
.status-list dt { color: var(--muted); }
.status-list dd { margin: 0; font-weight: 650; }

.detail-drawer { position: fixed; z-index: 30; top: 0; right: 0; width: min(560px, 100vw); height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: var(--surface); box-shadow: -18px 0 46px rgba(33,29,25,.15); transform: translateX(105%); transition: transform .34s cubic-bezier(.16,1,.3,1); }
.detail-drawer.open { transform: none; }
.drawer-scrim { position: fixed; z-index: 29; inset: 0; background: rgba(33,29,25,.22); opacity: 0; visibility: hidden; transition: .25s; }
.drawer-scrim.open { opacity: 1; visibility: visible; }
.drawer-header { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.drawer-header h2 { font-size: 25px; }
.drawer-content { overflow-y: auto; padding: 0 22px 38px; }
.drawer-section { padding: 22px 0; border-bottom: 1px solid var(--line); }
.drawer-section:last-child { border-bottom: 0; }
.drawer-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.drawer-section h3 { margin: 0; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid label { display: grid; gap: 5px; }
.form-grid .full { grid-column: 1 / -1; }
.field-hint { color: var(--muted); font-size: 10px; line-height: 1.45; }
.section-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.guest-record { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 13px 0; border-bottom: 1px solid #ebe6dc; }
.guest-record:last-child { border-bottom: 0; }
.guest-record strong { display: block; }
.guest-meta { margin-top: 3px; color: var(--muted); font-size: 12px; }
.interaction { position: relative; padding: 0 0 18px 19px; border-left: 1px solid var(--line); }
.interaction::before { content: ''; position: absolute; left: -4px; top: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--brass); }
.interaction:last-child { padding-bottom: 0; }
.interaction strong { display: block; font-size: 12px; }
.interaction p { margin: 5px 0; color: var(--muted); line-height: 1.45; }
.interaction time { color: #999188; font-size: 10px; }
.copy-link { display: flex; gap: 7px; }
.copy-link input { min-width: 0; }
.invite-qr { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.invite-qr[hidden] { display: none; }
.invite-qr img { width: 132px; height: 132px; padding: 6px; border: 1px solid var(--line); background: #fff; }

dialog { width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: 0 24px 70px rgba(33,29,25,.24); }
#draft-dialog { width: min(1040px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: hidden; }
dialog::backdrop { background: rgba(33,29,25,.35); }
dialog form { display: grid; gap: 15px; padding: 20px; }
dialog header, dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
dialog h2 { font-size: 25px; }
dialog label { display: grid; gap: 5px; }
dialog footer { justify-content: flex-end; padding-top: 5px; }
.campaign-composer { min-width: 0; max-height: calc(100vh - 32px); grid-template-rows: auto minmax(0, 1fr) auto; }
.composer-layout { min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(260px, .8fr) minmax(340px, 1.2fr); gap: 22px; overflow-y: auto; }
.composer-fields { display: grid; align-content: start; gap: 15px; }
.recipient-summary, .delivery-notice { display: flex; align-items: flex-start; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 4px; background: #f8f5ee; }
.recipient-summary svg, .delivery-notice svg { margin-top: 1px; color: var(--brass); }
.recipient-summary span { display: grid; gap: 3px; }
.recipient-summary small, .delivery-notice { color: var(--muted); font-size: 12px; line-height: 1.45; }
.delivery-notice.configured { border-color: #c9ddcf; background: #f0f6f2; color: var(--green); }
.email-preview-shell { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 4px; background: #ddd7cc; }
.preview-label { display: block; margin: 1px 2px 9px; color: #615b54; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
#invitation-preview { display: block; width: 100%; height: clamp(400px, 58vh, 540px); border: 0; background: #eee9df; }
#whatsapp-dialog { width: min(620px, calc(100vw - 32px)); }
.whatsapp-composer { width: auto; }
.whatsapp-recipient { display: flex; align-items: center; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 4px; background: #f8f5ee; }
.whatsapp-recipient-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #e1ece5; color: var(--green); }
.whatsapp-recipient > span:last-child { display: grid; gap: 3px; }
.whatsapp-recipient small { color: var(--muted); font-size: 11px; }
.whatsapp-notice { display: flex; align-items: flex-start; gap: 9px; padding: 11px 12px; border: 1px solid #cbded0; border-radius: 4px; background: #f0f6f2; color: var(--green); font-size: 11px; line-height: 1.45; }
.whatsapp-notice svg { flex: 0 0 auto; margin-top: 1px; }
.whatsapp-message-choice { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.whatsapp-message-choice legend { padding: 0; color: var(--ink); font-size: 12px; font-weight: 650; }
.whatsapp-message-option { display: flex; align-items: flex-start; gap: 9px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); cursor: pointer; }
.whatsapp-message-option:hover { border-color: var(--brass); background: #fbf5e9; }
.whatsapp-message-option input { flex: 0 0 auto; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--rose); }
.whatsapp-message-option span { display: grid; gap: 2px; }
.whatsapp-message-option small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.whatsapp-link-row { margin-top: -3px; }
.whatsapp-hint { min-height: 17px; margin: -5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.whatsapp-composer footer { flex-wrap: wrap; }
.checkbox-control { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 9px; }
.checkbox-control input { width: 16px; height: 16px; accent-color: var(--rose); }
.message-select { width: 16px; height: 16px; accent-color: var(--rose); }
button:disabled { cursor: not-allowed; opacity: .48; }

.toast { position: fixed; z-index: 60; left: 50%; bottom: 24px; max-width: calc(100vw - 32px); padding: 11px 15px; border-radius: 4px; background: var(--ink); color: #fff; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: .24s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 1050px) {
  .metric-strip { grid-template-columns: repeat(3, 1fr); }
  .metric:nth-child(3) { border-right: 0; }
  .metric:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .overview-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  body { display: block; padding-bottom: 68px; }
  .sidebar { position: fixed; z-index: 20; top: auto; right: 0; bottom: 0; left: 0; width: 100%; height: 68px; padding: 7px 10px; border-top: 1px solid rgba(255,255,255,.16); }
  .crm-brand, .sidebar-footer { display: none; }
  .sidebar-signout {
    position: fixed;
    z-index: 30;
    top: 14px;
    right: 15px;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    background: var(--ink);
    font-size: 0;
  }
  .sidebar-signout[hidden] { display: none; }
  .primary-nav { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 1px; margin: 0; }
  .nav-button { min-width: 0; height: 54px; flex-direction: column; justify-content: center; gap: 3px; padding: 0 1px; font-size: 9px; }
  .nav-button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-button.active { box-shadow: inset 0 -2px var(--rose); }
  .workspace { padding: 20px 15px 34px; }
  .workspace-header { align-items: flex-start; padding-right: 48px; }
  .workspace-header h1 { font-size: 29px; }
  .overview-hero { min-height: 0; grid-template-columns: minmax(0, 1fr) 92px; gap: 14px; padding: 24px 20px; }
  .overview-hero-copy h2 { font-size: 30px; }
  .overview-hero-copy > p:not(.eyebrow) { font-size: 12px; }
  .overview-countdown { width: 92px; }
  .overview-countdown strong { font-size: 31px; }
  .overview-countdown small { display: none; }
  .overview-hero-rings { display: none; }
  .overview-primary-action { padding-inline: 12px; font-size: 11px; }
  .overview-secondary-action { display: none; }
  .overview-stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .overview-stat { grid-template-columns: 32px minmax(0, 1fr); gap: 9px; padding: 12px 10px; }
  .overview-stat-icon { width: 32px; height: 32px; }
  .overview-stat > svg:last-child, .overview-stat-note { display: none; }
  .overview-stat strong { font-size: 25px; }
  .overview-card { padding: 18px; }
  .overview-progress-layout { grid-template-columns: 118px minmax(0, 1fr); gap: 17px; }
  .overview-donut { width: 118px; }
  .overview-donut::before { width: 84px; }
  .overview-donut strong { font-size: 23px; }
  .command-button { padding-inline: 11px; }
  .header-actions .command-button { font-size: 0; gap: 0; width: 40px; padding: 0; }
  .header-actions .command-button svg { width: 18px; height: 18px; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .metric { border-bottom: 1px solid var(--line); }
  .metric:nth-child(2n) { border-right: 0; }
  .metric:nth-last-child(-n+2) { border-bottom: 0; }
  .table-toolbar { align-items: stretch; flex-direction: column; }
  .search-control { width: 100%; }
  .filter-group { display: grid; grid-template-columns: 1fr 1fr; }
  select { width: 100%; min-width: 0; }
  .status-list div { grid-template-columns: 1fr; gap: 6px; }
  .section-toolbar { align-items: flex-start; }
  .toolbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .planning-toolbar { align-items: stretch; flex-direction: column; }
  .response-overview { align-items: stretch; flex-direction: column; }
  .response-progress { width: 100%; }
  .response-progress > span { text-align: left; }
  .response-toolbar { align-items: stretch; flex-wrap: wrap; }
  .response-toolbar .segmented-control { width: 100%; grid-auto-flow: initial; grid-template-columns: repeat(2, 1fr); }
  .response-search { width: calc(100% - 50px); }
  .segmented-control { width: 100%; grid-auto-flow: initial; grid-template-columns: repeat(3, 1fr); }
  .segmented-control button { min-width: 0; padding-inline: 6px; font-size: 12px; }
  .planning-toolbar .command-button { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  #draft-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .composer-layout { grid-template-columns: 1fr; }
  #invitation-preview { height: 500px; }
  .campaign-composer footer { flex-wrap: wrap; }
  .campaign-composer footer .command-button { order: -1; width: 100%; }
}

/* ——— sign-in gate + sign-out ——— */

.sidebar-signout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  height: 38px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 4px;
  background: transparent;
  color: var(--sidebar-muted);
  font-size: 12px;
  font-weight: 600;
}
.sidebar-signout:hover { color: #f4efe6; border-color: rgba(255,255,255,.4); }
.sidebar-signout svg { width: 15px; height: 15px; }

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 0, #2a2620, #17140f);
}
.login-card {
  width: min(360px, 100%);
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
  padding: 38px 30px 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 24px 60px -30px rgba(0,0,0,.7);
}
.login-monogram { width: 52px; height: 52px; font-size: 22px; }
.login-card h2 { margin: 0; font: 650 22px var(--sans); }
.login-sub { margin: 0; color: var(--muted); font-size: 13px; }
.login-card label { width: 100%; }
.login-card input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
}
.login-card input:focus { outline: 2px solid var(--brass); outline-offset: 1px; border-color: var(--brass); }
.login-card .command-button { width: 100%; height: 46px; border-radius: 6px; }
.login-error { margin: 0; color: var(--red); font-size: 12px; font-weight: 600; }
.login-hint { margin: 2px 0 0; color: var(--muted); font-size: 11px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

.sync-conflict-shell { margin-top: 24px; }
.conflict-value { max-width: 260px; overflow-wrap: anywhere; }
.conflict-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.conflict-actions .text-button { white-space: nowrap; }
