/* Client Results Portal v2: neutral light (plain white) and neutral dark (graphite) themes */
:root,
[data-theme="light"] {
  --font-display: "Nunito", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --bg: #FFFFFF;
  --bg-alt: #F5F5F6;
  --surface: #FFFFFF;
  --surface-2: #F5F5F6;
  --ink: #17181A;
  --ink-2: #4B4E53;
  --ink-3: #6B6F76;
  --line: #E6E7E9;
  --line-strong: #D2D4D8;

  /* Subtle accent (muted sage) */
  --primary: #4E7A5F;
  --primary-hover: #3F6650;
  --primary-soft: #EEF2EF;
  --primary-ink: #3F6650;
  --on-primary: #FFFFFF;
  --focus: #4F5FA8;
  --bar-before: #C4C7CC;
  --live: #3D9A57;

  --st-booked-bg: #EAF3EC;
  --st-booked-ink: #2D5E3C;
  --st-booked-border: #CFE3D4;

  --st-answered-bg: #EEF0F6;
  --st-answered-ink: #3E4A78;
  --st-answered-border: #D9DDEC;

  --st-owner-bg: #F9EEE6;
  --st-owner-ink: #86482A;
  --st-owner-border: #EED8C8;

  --danger: #B93B30;
  --danger-hover: #9E2F26;
  --danger-bg: #FCEEEC;
  --danger-ink: #8E2A21;
  --danger-border: #F0C6C1;
  --on-danger: #FFFFFF;

  --strip-bg: #17181A;
  --on-strip: #F5F5F6;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 18px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 12px 28px rgba(0, 0, 0, 0.06);
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 24px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0E0E10;
  --bg-alt: #151517;
  --surface: #18181B;
  --surface-2: #212125;
  --ink: #F1F1F3;
  --ink-2: #BDBFC5;
  --ink-3: #8F929A;
  --line: #2A2A2F;
  --line-strong: #3A3A41;

  --primary: #7FAE90;
  --primary-hover: #93BEA3;
  --primary-soft: #232826;
  --primary-ink: #9CC5AB;
  --on-primary: #0E0E10;
  --focus: #9AA6E8;
  --bar-before: #4A4C53;
  --live: #4CC26B;

  --st-booked-bg: rgba(127, 174, 144, 0.16);
  --st-booked-ink: #A9D4B7;
  --st-booked-border: rgba(169, 212, 183, 0.28);

  --st-answered-bg: rgba(154, 166, 232, 0.14);
  --st-answered-ink: #C5CCF3;
  --st-answered-border: rgba(197, 204, 243, 0.26);

  --st-owner-bg: rgba(235, 149, 96, 0.14);
  --st-owner-ink: #F2C3A3;
  --st-owner-border: rgba(242, 195, 163, 0.26);

  --danger: #E4695D;
  --danger-hover: #EE8379;
  --danger-bg: rgba(228, 105, 93, 0.13);
  --danger-ink: #F5B8B1;
  --danger-border: rgba(245, 184, 177, 0.3);
  --on-danger: #1A0B0A;

  --strip-bg: #09090A;
  --on-strip: #DDDDE0;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: break-word;
  transition: background-color 0.18s ease, color 0.18s ease;
}

h1, h2, h3, p, ul, ol {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 8px;
}

.wrap {
  width: 100%;
  max-width: 58rem;
  margin-inline: auto;
  padding-left: max(14px, env(safe-area-inset-left, 0px));
  padding-right: max(14px, env(safe-area-inset-right, 0px));
}

@media (min-width: 480px) {
  .wrap {
    padding-left: max(18px, env(safe-area-inset-left, 0px));
    padding-right: max(18px, env(safe-area-inset-right, 0px));
  }
}

@media (min-width: 42rem) {
  .wrap {
    padding-left: max(28px, env(safe-area-inset-left, 0px));
    padding-right: max(28px, env(safe-area-inset-right, 0px));
  }
}

/* Top Utility Bar (Shortened for narrow viewports) */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(10px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-block: 0.55rem;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  color: var(--ink);
  min-width: 0;
  flex-shrink: 1;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--primary);
  color: var(--on-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: -0.03em;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-tag {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.14rem 0.48rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  white-space: nowrap;
}

@media (max-width: 479.98px) {
  .brand-tag {
    display: none;
  }
}

[data-theme="dark"] .brand-tag {
  color: var(--primary-ink);
}

.controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.seg-group {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
}

.seg-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font: 700 0.74rem/1 var(--font-body);
  padding: 0.36rem 0.52rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.seg-btn[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.theme-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  min-height: 30px;
  padding: 0 0.55rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font: 600 0.74rem/1 var(--font-body);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.theme-btn:hover {
  border-color: var(--line-strong);
}

/* Main container */
main {
  flex: 1;
  padding-block: 1.1rem 2.2rem;
  min-width: 0;
}

.stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  min-width: 0;
}

/* Header Card: Client Name + Period */
.client-header {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem 1.05rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

@media (min-width: 40rem) {
  .client-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 1.35rem 1.5rem;
  }
}

.client-title-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.28rem;
  min-width: 0;
}

.eyebrow {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.38rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  min-width: 0;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--live);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--live) 22%, transparent);
  flex-shrink: 0;
}

.client-name {
  font-size: clamp(1.35rem, 1.1rem + 1.5vw, 2rem);
  color: var(--ink);
  min-width: 0;
}

.client-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.6rem;
  font-size: 0.84rem;
  color: var(--ink-2);
  min-width: 0;
}

.period-pill {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  align-self: flex-start;
  max-width: 100%;
  padding: 0.38rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-2);
}

@media (min-width: 40rem) {
  .period-pill {
    align-self: center;
  }
}

/* Trial Bar Card */
.trial-card {
  padding: 0.95rem 1.05rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.5rem;
  min-width: 0;
}

.trial-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.18rem;
  min-width: 0;
}

@media (min-width: 480px) {
  .trial-top {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.3rem 0.75rem;
  }
}

.trial-label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.96rem;
  color: var(--ink);
  min-width: 0;
  max-width: 100%;
}

.trial-sub {
  font-size: 0.8rem;
  color: var(--ink-3);
  min-width: 0;
  max-width: 100%;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-hover) 100%);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.trial-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--ink-3);
}

/* 5 KPI Tiles: 1 column under 480px, 2 columns 480-767px, 5 columns 768px+ */
.kpi-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.65rem;
  min-width: 0;
}

@media (min-width: 480px) and (max-width: 767.98px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .kpi-tile:nth-child(5) {
    grid-column: span 2;
  }
}

@media (min-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
  }
}

.kpi-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.9rem 1.05rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.35rem;
  min-width: 0;
}

.kpi-tile--highlight {
  border-color: var(--st-booked-border);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}

.kpi-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
}

.kpi-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink-2);
  line-height: 1.3;
  min-width: 0;
}

.kpi-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

[data-theme="dark"] .kpi-icon {
  color: var(--primary-ink);
}

.kpi-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.55rem, 1.35rem + 1vw, 2.05rem);
  line-height: 1.05;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.kpi-note {
  font-size: 0.78rem;
  color: var(--ink-3);
  line-height: 1.35;
}

/* Recent Conversations Section */
.section-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-width: 0;
}

.section-head {
  padding: 1rem 1.05rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-width: 0;
}

@media (min-width: 42rem) {
  .section-head {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 1.15rem 1.25rem;
  }
}

.section-title-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.2rem;
  min-width: 0;
}

.section-title {
  font-size: 1.12rem;
}

.section-subtitle {
  font-size: 0.82rem;
  color: var(--ink-3);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
}

@media (min-width: 42rem) {
  .filter-row {
    width: auto;
  }
}

.filter-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  font: 600 0.74rem/1.15 var(--font-body);
  padding: 0.38rem 0.62rem;
  border-radius: 999px;
  cursor: pointer;
  max-width: 100%;
  white-space: normal;
  text-align: center;
  transition: all 0.15s ease;
}

.filter-chip[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.conv-list {
  min-width: 0;
}

.conv-item {
  padding: 0.95rem 1.05rem;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.42rem;
  min-width: 0;
}

.conv-item:last-child {
  border-bottom: 0;
}

.conv-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.5rem;
  min-width: 0;
  width: 100%;
}

.conv-who {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 0;
  max-width: 100%;
}

.conv-name {
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.channel-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-2);
  max-width: 100%;
}

.after-hours-tag {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-3);
  padding: 0.14rem 0.45rem;
  border-radius: 999px;
  border: 1px dashed var(--line-strong);
  max-width: 100%;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  max-width: 100%;
  white-space: normal;
}

.status-badge--booked {
  background: var(--st-booked-bg);
  color: var(--st-booked-ink);
  border: 1px solid var(--st-booked-border);
}

.status-badge--answered {
  background: var(--st-answered-bg);
  color: var(--st-answered-ink);
  border: 1px solid var(--st-answered-border);
}

.status-badge--handed_to_owner {
  background: var(--st-owner-bg);
  color: var(--st-owner-ink);
  border: 1px solid var(--st-owner-border);
}

.conv-summary {
  font-size: 0.9rem;
  color: var(--ink-2);
  min-width: 0;
}

.conv-time {
  font-size: 0.78rem;
  color: var(--ink-3);
}

.empty-state {
  padding: 1.75rem 1.05rem;
  text-align: center;
  color: var(--ink-3);
  font-size: 0.9rem;
}

/* Clinic Profile Reference Bar (Services & Hours from exemplo-clinica.json) */
.clinic-details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.9rem 1.05rem;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.clinic-details summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  list-style: none;
}

.clinic-details summary::-webkit-details-marker {
  display: none;
}

.clinic-details-grid {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.95rem;
  min-width: 0;
}

@media (min-width: 40rem) {
  .clinic-details-grid {
    grid-template-columns: 1.3fr 1fr;
  }
}

.mini-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.38rem;
  font-size: 0.83rem;
  color: var(--ink-2);
  min-width: 0;
}

.mini-list-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 0.65rem;
  padding: 0.32rem 0;
  border-bottom: 1px dashed var(--line);
  min-width: 0;
}

.mini-list-item:last-child {
  border-bottom: 0;
}

/* Access / Token Gate Screen */
.gate-card {
  max-width: 30rem;
  margin: 2rem auto;
  padding: 1.5rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.95rem;
  text-align: center;
  min-width: 0;
}

.gate-icon {
  width: 48px;
  height: 48px;
  margin-inline: auto;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gate-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem;
  text-align: left;
  margin-top: 0.2rem;
  min-width: 0;
}

.gate-input {
  width: 100%;
  max-width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  font: 500 0.88rem/1.3 var(--font-body);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0 1.1rem;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font: 700 0.9rem/1.2 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

.btn-secondary:hover {
  background: var(--line);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding-block: 1.15rem;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

@media (min-width: 40rem) {
  .footer-inner {
    flex-direction: row;
    align-items: center;
  }
}

.wa-btn {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font: 700 0.86rem/1.2 var(--font-body);
  text-decoration: none;
  border: 0;
  cursor: pointer;
  max-width: 100%;
}

.wa-btn:hover {
  background: var(--primary-hover);
}

.wa-placeholder-note {
  font-size: 0.78rem;
  color: var(--ink-3);
  padding: 0.45rem 0.75rem;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  margin-top: 0.4rem;
}

.footer-meta {
  font-size: 0.78rem;
  color: var(--ink-3);
}

[hidden] {
  display: none !important;
}

/* ===== v2 additions ===== */

/* Gate helpers (previously inline styles) */
.gate-title { font-size: 1.45rem; }
.gate-body { color: var(--ink-2); font-size: 0.94rem; }
.gate-label { font-size: 0.82rem; font-weight: 700; color: var(--ink-2); }
.gate-demo { border-top: 1px solid var(--line); padding-top: 0.9rem; margin-top: 0.25rem; }
.gate-demo .btn { width: 100%; }
.mini-heading { font-size: 0.88rem; margin-bottom: 0.45rem; color: var(--ink); }

/* Tabs */
.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  min-width: 0;
}
.tab-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font: 700 0.88rem/1.1 var(--font-body);
  padding: 0.62rem 0.4rem;
  border-radius: 999px;
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
[data-theme="dark"] .tab-btn[aria-selected="true"] { background: var(--line); }
@media (min-width: 40rem) {
  .tabs { max-width: 28rem; }
}
.tab-panel { min-width: 0; }

/* Conversation chat bubbles */
.chat { display: grid; gap: 0.4rem; margin-top: 0.1rem; min-width: 0; }
.bubble {
  display: grid;
  gap: 0.12rem;
  max-width: 92%;
  padding: 0.5rem 0.75rem;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.4;
  min-width: 0;
}
.bubble-who { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); }
.bubble-text { color: var(--ink); overflow-wrap: anywhere; }
.bubble--client { background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; justify-self: start; }
.bubble--assistant { background: var(--primary-soft); border: 1px solid var(--line); border-bottom-right-radius: 4px; justify-self: end; }
.conv-summary { font-size: 0.82rem; color: var(--ink-3); }

/* Compare tab */
.compare-intro { padding: 1rem 1.05rem; display: grid; gap: 0.5rem; }
.cmp-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; font-size: 0.8rem; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 0.4rem; min-width: 0; }
.swatch { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }
.swatch--before { background: var(--bar-before); }
.swatch--during { background: var(--primary); }

.cmp-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.75rem; min-width: 0; }
@media (min-width: 480px) { .cmp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 768px) { .cmp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cmp-card {
  display: grid;
  gap: 0.7rem;
  padding: 0.95rem 1.05rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  min-width: 0;
  align-content: start;
}
.cmp-card-title { font-size: 0.84rem; font-weight: 700; color: var(--ink-2); line-height: 1.3; }
.cmp-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.cmp-col { display: grid; gap: 0.15rem; min-width: 0; }
.cmp-col-label { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
.cmp-val { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.3rem, 1.1rem + 1vw, 1.7rem); line-height: 1.1; overflow-wrap: anywhere; }
.cmp-val--before { color: var(--ink-3); }
.cmp-val--during { color: var(--ink); }
.delta-pill {
  justify-self: start;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--st-booked-bg);
  color: var(--st-booked-ink);
  border: 1px solid var(--st-booked-border);
}

.chart-card { padding: 1rem 1.05rem; display: grid; gap: 0.7rem; }
.hbars { display: grid; gap: 1rem; min-width: 0; }
.hbar-group { display: grid; gap: 0.4rem; min-width: 0; }
.hbar-label { font-size: 0.84rem; font-weight: 700; color: var(--ink-2); }
.hbar-row { display: grid; grid-template-columns: 5.6rem minmax(0, 1fr) 2.8rem; align-items: center; gap: 0.5rem; font-size: 0.78rem; color: var(--ink-3); }
.hbar-name { min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }
.hbar-track { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 999px; }
.hbar-fill--before { background: var(--bar-before); }
.hbar-fill--during { background: var(--primary); }
.hbar-val { font-weight: 700; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }

.line-chart { width: 100%; min-width: 0; }
.trend-svg { display: block; width: 100%; height: auto; overflow: visible; }
.trend-svg .grid-line { stroke: var(--line); stroke-width: 1; }
.trend-svg .axis-text { fill: var(--ink-3); font: 500 9.5px var(--font-body); }
.trend-svg .axis-text--strong { fill: var(--ink); font-weight: 700; }
.trend-svg .line-before { stroke: var(--ink-3); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend-svg .dot-before { fill: var(--surface); stroke: var(--ink-3); stroke-width: 1.6; }
.trend-svg .line-drop { stroke: var(--primary); stroke-width: 2; stroke-dasharray: 4 3; }
.trend-svg .dot-during { fill: var(--primary); stroke: var(--surface); stroke-width: 2; }
.trend-svg .note-text { font: 700 11px var(--font-body); }
.trend-svg .note-text--before { fill: var(--ink-2); }
.trend-svg .note-text--during { fill: var(--primary-ink); }
.cmp-footnote { font-size: 0.78rem; color: var(--ink-3); padding-inline: 0.2rem; }

/* Setup tab */
.setup-intro { padding: 1.15rem 1.05rem; display: grid; gap: 0.4rem; }
.setup-title { font-size: clamp(1.3rem, 1.1rem + 1.2vw, 1.75rem); }
.steps { display: grid; gap: 0.85rem; min-width: 0; }
.step-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.85rem;
  padding: 1rem 1.05rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.step-num {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 800 0.9rem/1 var(--font-display);
}
.step-body { display: grid; gap: 0.6rem; min-width: 0; align-content: start; }
.step-title { font-size: 1.05rem; padding-top: 0.2rem; }
.step-items { display: grid; gap: 0.4rem; padding-left: 1.2rem; list-style: decimal; color: var(--ink); font-size: 0.93rem; }
.step-items li { padding-left: 0.2rem; min-width: 0; }
.step-items li::marker { color: var(--ink-3); font-weight: 700; }
.step-note { font-size: 0.84rem; color: var(--ink-3); padding: 0.55rem 0.75rem; background: var(--surface-2); border-radius: var(--r-sm); }
.timeline { display: grid; gap: 0.6rem; }
.timeline-item { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr); gap: 0.5rem; font-size: 0.93rem; align-items: start; }
.timeline-when { font-weight: 700; color: var(--primary-ink); font-size: 0.84rem; padding-top: 0.08rem; }
.timeline-text { min-width: 0; }
.step-media { border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.step-media img, .step-media video { display: block; width: 100%; height: auto; }
.step-media--empty { padding: 1.6rem 1rem; text-align: center; font-size: 0.82rem; color: var(--ink-3); border-style: dashed; }
.cmp-val { white-space: nowrap; font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem); }
.line-chart { max-width: 640px; margin-inline: auto; }

/* ===== v3: trial states ===== */
.live-dot--off { background: var(--ink-3) !important; box-shadow: none !important; animation: none !important; }
.trial-card[hidden], .period-pill[hidden] { display: none; }
.trial-card[data-state="setup"] { border-color: var(--line-strong); }
.trial-card[data-state="setup"] .progress-fill { transition: width 0.4s ease; }
.trial-card[data-state="pending"] { background: var(--primary-soft); border-color: var(--line-strong); }
.trial-card[data-state="pending"] .trial-label::before { content: "⏳ "; }
.trial-card[data-state="ended"] { background: var(--danger-bg); border-color: var(--danger-border); }
.trial-card[data-state="ended"] .trial-label { color: var(--danger-ink); }
.trial-card[data-state="ended"] .trial-sub { color: var(--ink-2); font-size: 0.88rem; }
.trial-top { align-items: flex-start; }
.trial-card[data-state="pending"] .trial-top,
.trial-card[data-state="ended"] .trial-top { flex-direction: column; align-items: flex-start; gap: 0.3rem; }
.trial-action { display: grid; gap: 0.5rem; justify-items: start; margin-top: 0.1rem; }
.trial-action[hidden] { display: none; }
.trial-cta-note { font-size: 0.82rem; color: var(--ink-2); max-width: 36rem; }
.btn-danger { background: var(--danger); color: var(--on-danger); }
.btn-danger:hover { background: var(--danger-hover); }
.progress-track[hidden], .trial-ticks[hidden] { display: none; }

.empty-state { padding: 2rem 1.2rem; text-align: center; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-md); display: grid; gap: 0.6rem; justify-items: center; }
.empty-state[hidden] { display: none; }
.empty-title { font-size: 1.15rem; }
.empty-body { color: var(--ink-2); font-size: 0.92rem; max-width: 30rem; }
.empty-go[hidden] { display: none; }
.is-empty > :not(.empty-state) { display: none !important; }

/* ===== v3: Setup tab ===== */
.btn-sm { min-height: 2.25rem; padding: 0 0.9rem; font-size: 0.84rem; }
.btn-ghost { background: transparent; color: var(--ink-3); border: 1px dashed var(--line-strong); font-weight: 600; }
.btn-ghost:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn:focus-visible, .input:focus-visible, .icon-btn:focus-visible, .link-btn:focus-visible, .info-sec summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: center; min-width: 0; }
.step-lead { font-size: 0.93rem; color: var(--ink-2); }
.step-lead--strong { color: var(--ink); font-weight: 700; }
.step-num--done { background: var(--st-booked-ink); }
[data-theme="dark"] .step-num--done { background: var(--primary); }
.step-num--soft { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line-strong); }

.step-card--compact { padding: 0.65rem 1.05rem; align-items: center; background: var(--surface); }
.step-card--compact .step-body { align-content: center; }
.step-card--compact .step-num { width: 26px; height: 26px; font-size: 0.8rem; }
.step-card--done.step-card--compact { background: var(--st-booked-bg); border-color: var(--st-booked-border); box-shadow: none; }
.step-card--warn { background: var(--st-owner-bg); border-color: var(--st-owner-border); box-shadow: none; }
.step-card--warn .step-num { background: var(--st-owner-ink); }
.status-row { display: flex; flex-wrap: wrap; gap: 0.5rem 0.9rem; align-items: center; justify-content: space-between; min-width: 0; }
.status-row-col { display: grid; gap: 0.1rem; min-width: 0; }
.status-row-text { font-weight: 700; font-size: 0.93rem; color: var(--ink); }
.status-row-sub { font-size: 0.8rem; color: var(--ink-2); }

.field { display: grid; gap: 0.3rem; min-width: 0; }
.field-label { font-size: 0.82rem; font-weight: 700; color: var(--ink-2); }
.field-hint { font-size: 0.78rem; color: var(--ink-3); }
.field-error { font-size: 0.84rem; color: var(--danger-ink); font-weight: 600; }
.input { width: 100%; max-width: 100%; min-width: 0; padding: 0.65rem 0.8rem; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: 500 0.95rem/1.3 var(--font-body); }
.input::placeholder { color: var(--ink-3); opacity: 0.8; }
.input--area { resize: vertical; min-height: 3.2rem; }
.phone-form { display: grid; gap: 0.7rem; min-width: 0; max-width: 26rem; }

.pair-code { display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.95rem 0.8rem; background: var(--primary-soft); border: 1px solid var(--line-strong); border-radius: var(--r-md); font: 800 clamp(1.7rem, 7vw, 2.4rem)/1 var(--font-display); letter-spacing: 0.14em; color: var(--ink); max-width: 22rem; font-variant-numeric: tabular-nums; }
.pair-code-dash { color: var(--ink-3); letter-spacing: 0; }
.pair-code--expired { opacity: 0.45; text-decoration: line-through; }
.pair-countdown { font-weight: 700; font-size: 0.88rem; color: var(--primary-ink); font-variant-numeric: tabular-nums; }
.pair-expired { font-weight: 700; color: var(--danger-ink); font-size: 0.92rem; }
.pair-wait { display: flex; gap: 0.6rem; align-items: center; font-size: 0.86rem; color: var(--ink-2); }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--primary); animation: misa-spin 0.9s linear infinite; flex-shrink: 0; }
@keyframes misa-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.callout { font-size: 0.88rem; color: var(--ink); padding: 0.65rem 0.8rem; background: var(--primary-soft); border-left: 3px solid var(--primary); border-radius: var(--r-sm); }
.info-sec { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); min-width: 0; }
.info-sec summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.5rem; padding: 0.7rem 0.85rem; font-weight: 700; font-size: 0.9rem; color: var(--ink); min-height: 2.75rem; }
.info-sec summary::-webkit-details-marker { display: none; }
.info-sec-title { flex: 1; min-width: 0; }
.info-sec-count { font-size: 0.78rem; font-weight: 700; color: var(--ink-3); background: var(--surface-2); border-radius: 999px; padding: 0.05rem 0.5rem; }
.info-sec-chev { color: var(--ink-3); transition: transform 0.15s ease; }
.info-sec[open] .info-sec-chev { transform: rotate(180deg); }
.info-sec[open] > summary { border-bottom: 1px solid var(--line); }
.info-sec-body { padding: 0.8rem 0.85rem; display: grid; gap: 0.7rem; min-width: 0; }

.row-edit { display: grid; gap: 0.4rem; align-items: center; min-width: 0; }
.row-edit--prices { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; padding-bottom: 0.7rem; border-bottom: 1px dashed var(--line); }
.row-edit--prices .c-name { grid-column: 1 / -1; }
.row-edit--prices .icon-btn { grid-column: 3; grid-row: 2; }
.row-edit--hours { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
.row-edit--faq { padding: 0.6rem; background: var(--surface-2); border-radius: var(--r-sm); }
.faq-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.4rem; align-items: center; }
@media (min-width: 40rem) {
  .row-edit--prices { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, 1fr) auto; padding-bottom: 0; border-bottom: 0; }
  .row-edit--prices .c-name { grid-column: auto; }
  .row-edit--prices .icon-btn { grid-column: auto; grid-row: auto; }
}
.icon-btn { width: 2.25rem; height: 2.25rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font-size: 1.15rem; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon-btn:hover { background: var(--danger-bg); color: var(--danger-ink); border-color: var(--danger-border); }
.link-btn { justify-self: start; background: none; border: 0; padding: 0.35rem 0; color: var(--primary-ink); font: 700 0.86rem/1.2 var(--font-body); cursor: pointer; min-height: 2.25rem; }
.link-btn:hover { text-decoration: underline; }

.save-bar { display: grid; gap: 0.55rem; padding-top: 0.3rem; }
.save-reviewed { font-size: 0.82rem; color: var(--ink-3); font-weight: 600; }
.save-msg { font-size: 0.84rem; font-weight: 600; min-height: 1.1em; color: var(--ink-2); }
.save-msg--ok { color: var(--st-booked-ink); }
.save-msg--warn { color: var(--st-owner-ink); }
.save-msg--err { color: var(--danger-ink); }
.save-note { font-size: 0.78rem; color: var(--ink-3); }
.step-card--next { background: var(--surface-2); box-shadow: none; }
.row-edit--hours > input:first-child { grid-column: 1 / -1; }
@media (min-width: 40rem) { .row-edit--hours > input:first-child { grid-column: auto; } }
.row-edit--hours { grid-template-columns: minmax(0, 1fr) auto; }
@media (min-width: 40rem) { .row-edit--hours { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; } }

/* Light/dark switch: sliding knob, sun on the left, moon on the right */
.theme-btn{position:relative;width:58px;min-width:58px;height:30px;min-height:30px;padding:0;gap:0;border-radius:999px;background:var(--surface-2);border:1px solid var(--line)}
.theme-btn .ts-icon{position:absolute;top:50%;transform:translateY(-50%);display:flex;color:var(--ink-3);z-index:1;transition:color .2s ease}
.theme-btn .ts-sun{left:7px}
.theme-btn .ts-moon{right:7px}
.theme-btn .ts-knob{position:absolute;top:3px;left:3px;width:22px;height:22px;border-radius:50%;background:var(--primary);box-shadow:0 1px 3px rgba(0,0,0,.25);transition:transform .22s ease}
.theme-btn[aria-checked="true"] .ts-knob{transform:translateX(28px)}
.theme-btn[aria-checked="false"] .ts-sun,.theme-btn[aria-checked="true"] .ts-moon{color:var(--on-primary)}
@media (prefers-reduced-motion:reduce){.theme-btn .ts-knob{transition:none}}

/* ===== p07: structured setup, results range/drill/ROI, desktop grid, 16px inputs, 44px targets ===== */
button, input, select, textarea { font-family: var(--font-body); }
.input, .gate-input { font-size: 1rem; min-height: 2.75rem; }
select.input { appearance: auto; }
.input[aria-invalid="true"], .gate-input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.input:focus-visible, .gate-input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.btn-sm { min-height: 2.75rem; }
.icon-btn { width: 2.75rem; height: 2.75rem; }
.link-btn { min-height: 2.75rem; padding-inline: 0.2rem; }
.seg-btn { min-height: 2.75rem; padding: 0.36rem 0.8rem; font-size: 0.82rem; }
.filter-chip { min-height: 2.75rem; padding: 0.4rem 0.9rem; font-size: 0.82rem; }
.tab-btn { min-height: 2.75rem; }
.theme-btn { position: relative; }
.theme-btn::after { content: ""; position: absolute; inset: -8px -4px; }
.check-row { display: flex; align-items: center; gap: 0.55rem; min-height: 2.75rem; font-size: 0.9rem; color: var(--ink-2); cursor: pointer; }
.check-row input { width: 1.4rem; height: 1.4rem; accent-color: var(--primary); flex: none; }
.toast[hidden], .field-error[hidden], .gate-demo[hidden], .support-link[hidden], .wa-btn[hidden], .demo-badge[hidden], .kpi-hint[hidden], .drill-card[hidden], .roi-card[hidden], .range-card[hidden], .range-custom[hidden], #daily-card[hidden] { display: none !important; }

.support-link { display: inline-flex; align-items: center; min-height: 2.75rem; color: var(--primary-ink); font-weight: 700; font-size: 0.88rem; text-decoration: underline; text-underline-offset: 3px; justify-self: start; }
.step-tag { font-size: 0.78rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.plain-bullets { display: grid; gap: 0.4rem; padding-left: 1.2rem; list-style: disc; font-size: 0.93rem; color: var(--ink-2); }
.phone-grp { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: 0.5rem; }
.phone-echo { font-size: 0.88rem; font-weight: 700; color: var(--st-booked-ink); min-height: 1.2em; }
[data-theme="dark"] .phone-echo { color: var(--primary); }
.pair-code { font-size: clamp(2.2rem, 9vw, 3.2rem); padding: 1.2rem 1rem; max-width: 26rem; }
.pair-code-grp { letter-spacing: 0.16em; }

.demo-badge { display: inline-flex; width: fit-content; padding: 0.15rem 0.65rem; border-radius: 999px; background: var(--st-owner-bg); color: var(--st-owner-ink); border: 1px solid var(--st-owner-border); font-size: 0.78rem; font-weight: 700; }

/* Business info */
.callout--warn { background: var(--st-owner-bg); border-left-color: var(--st-owner-ink); }
.info-sec-state { font-size: 0.78rem; font-weight: 700; color: var(--st-owner-ink); background: var(--st-owner-bg); border-radius: 999px; padding: 0.1rem 0.55rem; white-space: nowrap; }
.info-sec-state.is-seen { color: var(--st-booked-ink); background: var(--st-booked-bg); }
[data-theme="dark"] .info-sec-state.is-seen { color: var(--primary); }
.sub-heading { font-size: 0.95rem; margin-top: 0.4rem; }
.svc-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.6rem; padding: 0.8rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); min-width: 0; }
.svc-row > :first-child { grid-column: 1 / -1; }
.svc-remove { grid-column: 1 / -1; justify-self: end; }
.input-prefix { display: flex; align-items: stretch; min-width: 0; }
.input-prefix .prefix { display: inline-flex; align-items: center; padding: 0 0.7rem; background: var(--surface-2); border: 1px solid var(--line-strong); border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); color: var(--ink-2); font-weight: 700; }
.input-prefix .input { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.input--time { width: auto; min-width: 7.2rem; }
.week-grid { display: grid; gap: 0.4rem; min-width: 0; }
.week-row { display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: 0.2rem 0.6rem; align-items: center; padding: 0.4rem 0.6rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); min-width: 0; }
.week-row.is-closed { background: var(--surface-2); }
.week-day { font-weight: 800; font-size: 0.9rem; }
.week-times { grid-column: 1 / -1; display: grid; gap: 0.3rem; min-width: 0; }
.time-pair { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.time-to { color: var(--ink-3); font-size: 0.86rem; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 0.55rem; min-height: 2.75rem; cursor: pointer; font-size: 0.9rem; font-weight: 600; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch-track { width: 44px; height: 26px; border-radius: 999px; background: var(--line-strong); position: relative; flex: none; transition: background-color 0.15s ease; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.15s ease; }
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--focus); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; list-style: none; padding: 0; }
.chip { display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.1rem 0.2rem 0.1rem 0.8rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-strong); font-size: 0.88rem; font-weight: 600; }
.chip .icon-btn { border: 0; background: transparent; }
.closure-add { display: grid; gap: 0.6rem; align-items: end; grid-template-columns: minmax(0, 1fr); }
.link-test { display: grid; gap: 0.5rem; align-items: end; grid-template-columns: minmax(0, 1fr); }
.preview-box { padding: 0.8rem 0.9rem; background: var(--primary-soft); border: 1px solid var(--line); border-radius: var(--r-sm); display: grid; gap: 0.4rem; }
.preview-list { display: grid; gap: 0.35rem; font-size: 0.9rem; color: var(--ink); list-style: none; padding: 0; }
.save-bar { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); margin-inline: -0.2rem; padding: 0.7rem 0.2rem 0.6rem; z-index: 5; }
.save-progress { font-size: 0.82rem; color: var(--ink-3); font-weight: 600; }

.toast { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 0.8rem; max-width: min(92vw, 28rem); padding: 0.55rem 0.7rem 0.55rem 1rem; border-radius: 999px; background: var(--strip-bg); color: var(--on-strip); box-shadow: var(--shadow-md); font-size: 0.9rem; }
.toast-text { min-width: 0; }
.toast-btn { min-height: 2.75rem; padding: 0 1rem; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.16); color: inherit; font: 700 0.9rem/1 var(--font-body); cursor: pointer; }
.toast-btn:focus-visible { outline: 3px solid var(--focus); }

/* Results: range, tiles as buttons, drill-down, ROI, daily bars */
.range-card { display: grid; gap: 0.7rem; padding: 1rem 1.05rem; }
.range-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.3rem 1rem; }
.range-label { font-size: 0.9rem; font-weight: 700; color: var(--ink-2); }
.range-custom { display: grid; gap: 0.6rem; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 28rem; }
.range-actions { display: flex; justify-content: flex-end; }
button.kpi-tile { font: inherit; color: inherit; text-align: left; width: 100%; cursor: pointer; align-items: stretch; justify-content: flex-start; }
button.kpi-tile:hover { border-color: var(--line-strong); }
button.kpi-tile.is-open { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft), var(--shadow-sm); }
button.kpi-tile:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.kpi-more { font-size: 0.78rem; font-weight: 700; color: var(--primary-ink); margin-top: auto; }
.kpi-hint { font-size: 0.84rem; color: var(--ink-3); padding-inline: 0.2rem; margin-top: -0.4rem; }
.drill-card { padding: 1rem 1.05rem; display: grid; gap: 0.6rem; }
.drill-list { display: grid; gap: 0.5rem; list-style: none; padding: 0; max-height: 26rem; overflow: auto; }
.drill-item { display: grid; gap: 0.1rem; padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.drill-mid { font-size: 0.9rem; color: var(--ink); }
.drill-sub { font-size: 0.8rem; color: var(--ink-3); }
.drill-empty { font-size: 0.9rem; color: var(--ink-3); padding: 0.4rem 0; }
.roi-card { padding: 1rem 1.05rem; display: grid; gap: 0.6rem; }
.roi-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.roi-tag { font-size: 0.78rem; font-weight: 700; padding: 0.1rem 0.6rem; border-radius: 999px; background: var(--st-owner-bg); color: var(--st-owner-ink); border: 1px solid var(--st-owner-border); }
.roi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.roi-cell { display: grid; gap: 0.15rem; padding: 0.7rem 0.8rem; background: var(--surface-2); border-radius: var(--r-sm); }
.roi-label { font-size: 0.8rem; color: var(--ink-3); font-weight: 700; }
.roi-value { font: 800 1.6rem/1.1 var(--font-display); color: var(--ink); }
.roi-note { font-size: 0.8rem; color: var(--ink-3); }
.roi-line { font-size: 0.92rem; color: var(--ink-2); }
.roi-line--strong { color: var(--ink); font-weight: 700; }
.roi-source summary { cursor: pointer; font-size: 0.84rem; font-weight: 700; color: var(--primary-ink); min-height: 2.75rem; display: flex; align-items: center; }
.roi-source p { font-size: 0.82rem; color: var(--ink-3); }
.daily-cols { display: flex; align-items: flex-end; gap: 0.5rem; height: 11rem; padding-top: 0.3rem; }
.daily-col { flex: 1 1 0; min-width: 0; display: grid; grid-template-rows: auto 1fr auto; gap: 0.2rem; height: 100%; justify-items: center; }
.daily-bars { display: flex; align-items: flex-end; gap: 3px; width: 100%; max-width: 3rem; height: 100%; }
.daily-bar { flex: 1; border-radius: 4px 4px 0 0; min-height: 3px; }
.daily-bar--msg { background: var(--primary); }
.daily-bar--bk { background: var(--ink-3); }
.daily-val, .daily-day { font-size: 0.78rem; color: var(--ink-3); font-weight: 700; }
.swatch--bk { background: var(--ink-3); }
.cmp-count { font-size: 0.86rem; font-weight: 700; color: var(--ink-2); }
.cmp-source { font-size: 0.78rem; color: var(--ink-3); }
.gate-card .support-link { margin-top: 0.8rem; }

@media (min-width: 40rem) {
  .phone-grp { grid-template-columns: 12rem minmax(0, 18rem); }
  .closure-add { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; }
  .link-test { grid-template-columns: minmax(0, 1fr) auto; }
  .week-row { grid-template-columns: 3rem 8.5rem minmax(0, 1fr); }
  .week-times { grid-column: auto; }
  .svc-row { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.3fr) auto; align-items: start; }
  .svc-row > :first-child { grid-column: auto; }
  .svc-remove { grid-column: auto; margin-top: 1.6rem; }
}

/* Desktop: widen to 1200px and use a grid instead of a phone column */
@media (min-width: 64rem) {
  .wrap { max-width: 75rem; }
  #panel-results { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  #panel-results > * { grid-column: 1 / -1; }
  #panel-results > .roi-card, #panel-results > #daily-card { grid-column: auto; }
  #panel-results .conv-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; align-items: start; }
  #panel-compare .cmp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #panel-setup .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  #panel-setup #step-wa, #panel-setup #step-info, #panel-setup #step-next { grid-column: 1 / -1; }
  .kpi-tile { min-height: 8.5rem; }
}

/* What Misa answers (p09) */
.topic-groups { display: grid; gap: 0.5rem; min-width: 0; }
.topic-group { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); min-width: 0; }
.topic-head { display: flex; align-items: center; flex-wrap: wrap; gap: 0.2rem 0.8rem; padding: 0.2rem 0.7rem; }
.topic-head .switch { flex: 1 1 12rem; min-width: 0; }
.topic-count { font-size: 0.82rem; color: var(--ink-3); white-space: nowrap; }
.topic-toggle { min-height: 2.75rem; padding: 0 0.3rem; border: 0; background: transparent; color: var(--primary); font: inherit; font-size: 0.85rem; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.topic-toggle:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
.topic-list { display: grid; gap: 0; padding: 0.1rem 0.7rem 0.4rem 1.6rem; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-sm) var(--r-sm); }
.topic-list[hidden] { display: none; }
.topic-row { min-width: 0; }
.topic-row .switch-text { font-weight: 500; }
.topic-added { display: grid; gap: 0.4rem; min-width: 0; }
.topic-row--misa { padding: 0.3rem 0.7rem 0.5rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.topic-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.6rem; padding-left: calc(44px + 0.55rem); font-size: 0.8rem; color: var(--ink-3); }
.topic-group-name { font-weight: 600; }
.topic-badge { padding: 0.05rem 0.5rem; border-radius: 999px; background: var(--primary-soft); border: 1px solid var(--line-strong); color: var(--ink); font-size: 0.74rem; font-weight: 700; }
.switch input:indeterminate + .switch-track { background: var(--primary); opacity: 0.55; }
.switch input:indeterminate + .switch-track::after { transform: translateX(9px); }
