:root {
  --bg: #f4f7fa;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #17202a;
  --muted: #667281;
  --line: #dfe6ed;
  --brand: #17324d;
  --brand-2: #244f73;
  --antecedent: #eef6ff;
  --response: #f6f2ff;
  --consequence: #eff8f2;
  --danger: #8f2f2f;
  --shadow: 0 10px 30px rgba(26, 48, 68, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
textarea { resize: vertical; }
.hidden { display: none !important; }
.screen { min-height: 100vh; }

.auth-screen {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 10%, rgba(36,79,115,.11), transparent 32%),
    radial-gradient(circle at 90% 90%, rgba(23,50,77,.08), transparent 30%),
    var(--bg);
}
.auth-card {
  width: min(100%, 430px);
  padding: 34px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  letter-spacing: .04em;
  margin-bottom: 20px;
}
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.7rem, 4vw, 2.2rem); line-height: 1.08; margin-bottom: 12px; }
h2 { margin-bottom: 0; font-size: 1.2rem; }
h3 { font-size: clamp(1.45rem, 3vw, 1.85rem); margin-bottom: 8px; }
.eyebrow { margin-bottom: 6px; text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; font-weight: 800; color: var(--brand-2); }
.muted { color: var(--muted); }
.tiny { font-size: .82rem; }
.prewrap { white-space: pre-wrap; }

.stack { display: grid; gap: 16px; }
label { display: grid; gap: 8px; font-weight: 650; }
label > span { font-size: .92rem; }
input, textarea {
  width: 100%;
  border: 1px solid #cfd8e2;
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 13px 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(36,79,115,.12); }

.primary, .ghost, .text-button, .icon-button {
  border: 0;
  border-radius: 12px;
  min-height: 44px;
  padding: 0 16px;
}
.primary { background: var(--brand); color: #fff; font-weight: 760; box-shadow: 0 5px 14px rgba(23,50,77,.17); }
.primary:hover { background: #10293f; }
.ghost { background: #edf2f6; color: var(--brand); font-weight: 700; }
.ghost:hover { background: #e2e9ef; }
.small { min-height: 36px; padding: 0 12px; }
.wide { width: 100%; }
.text-button { min-height: auto; padding: 0; background: transparent; color: var(--brand-2); font-weight: 700; margin-bottom: 14px; }
.icon-button { width: 40px; min-height: 40px; padding: 0; background: #eef2f5; font-size: 1.5rem; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  padding: 12px max(18px, env(safe-area-inset-left)) 12px max(18px, env(safe-area-inset-right));
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-chip { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 8px 10px; background: #f1f4f7; border-radius: 999px; font-size: .86rem; font-weight: 700; }

.app-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 26px 0 80px; }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 24px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; min-height: 40px; padding: 0 15px; font-weight: 720; }
.tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-heading { margin-bottom: 22px; }
.page-heading.split { display: flex; justify-content: space-between; align-items: end; gap: 18px; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.header-actions input { width: auto; min-width: 160px; }

.entry-form { display: grid; gap: 18px; }
.section-card {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.section-card.antecedent { background: var(--antecedent); }
.section-card.response { background: var(--response); }
.section-card.consequence { background: var(--consequence); }
.section-number { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: rgba(255,255,255,.86); font-weight: 850; color: var(--brand); }
.section-content { display: grid; gap: 16px; }
.section-kicker { margin-bottom: 0; font-weight: 850; color: var(--brand); }
.sticky-submit { position: sticky; bottom: 12px; padding: 10px; border-radius: 16px; background: rgba(244,247,250,.92); backdrop-filter: blur(10px); }

.surface { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.narrow { max-width: 560px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.stat-card span { display: block; color: var(--muted); font-size: .82rem; margin-bottom: 7px; }
.stat-card strong { font-size: 1.5rem; color: var(--brand); }
.stats-grid.compact .stat-card strong { font-size: 1.12rem; }

.table-toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.table-toolbar input { flex: 1; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 650px; }
th, td { text-align: left; padding: 14px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
td strong { display: block; }
td small { color: var(--muted); }

.records-list { display: grid; gap: 14px; }
.record-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.record-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); background: #fbfcfd; }
.record-head time { font-weight: 800; }
.record-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; }
.record-group { padding: 18px; border-right: 1px solid var(--line); }
.record-group:last-child { border-right: 0; }
.record-group.antecedent { background: linear-gradient(180deg, var(--antecedent), #fff 58%); }
.record-group.response { background: linear-gradient(180deg, var(--response), #fff 58%); }
.record-group.consequence { background: linear-gradient(180deg, var(--consequence), #fff 58%); }
.field-block + .field-block { margin-top: 14px; }
.field-block .label { display: block; margin-bottom: 5px; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 850; color: var(--muted); }
.field-block p { margin: 0; white-space: pre-wrap; line-height: 1.48; }
.empty { padding: 28px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed #cbd6e1; border-radius: 16px; }

.observations-readonly { margin-bottom: 18px; }
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(12,24,36,.55); }
.modal-card { width: min(100%, 500px); max-height: 90vh; overflow: auto; background: #fff; border-radius: 22px; padding: 24px; box-shadow: 0 24px 80px rgba(12,24,36,.28); }
.modal-header { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 100; max-width: 420px; padding: 13px 16px; border-radius: 12px; background: #17202a; color: #fff; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(10px); transition: .2s; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--danger); }

@media (max-width: 780px) {
  .topbar { align-items: flex-start; }
  .user-chip { display: none; }
  .app-shell { width: min(100% - 24px, 1180px); padding-top: 18px; }
  .page-heading.split { align-items: stretch; flex-direction: column; }
  .page-heading.split > .primary { width: 100%; }
  .stats-grid { grid-template-columns: 1fr; }
  .record-grid { grid-template-columns: 1fr; }
  .record-group { border-right: 0; border-bottom: 1px solid var(--line); }
  .record-group:last-child { border-bottom: 0; }
  .section-card { grid-template-columns: 1fr; padding: 18px; }
  .section-number { width: 34px; height: 34px; }
  .auth-card { padding: 26px 22px; }
  .table-toolbar { flex-direction: column; }
  .header-actions { width: 100%; }
  .header-actions > * { flex: 1 1 140px; }
}

/* V2: preenchimento emocional, acompanhamento e análise */
.field-group { display: grid; gap: 9px; }
.field-title { font-size: .92rem; font-weight: 700; }
.field-help { margin: -2px 0 2px; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.emotion-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.emotion-chip {
  border: 1px solid #cbd6e1;
  background: rgba(255,255,255,.86);
  color: var(--text);
  border-radius: 999px;
  min-height: 38px;
  padding: 0 13px;
  font-weight: 700;
}
.emotion-chip:hover { border-color: var(--brand-2); }
.emotion-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.rating-scale {
  display: grid;
  grid-template-columns: repeat(11, minmax(32px, 1fr));
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.rating-button {
  min-width: 34px;
  min-height: 40px;
  border: 1px solid #cbd6e1;
  border-radius: 10px;
  background: rgba(255,255,255,.9);
  color: var(--text);
  font-weight: 800;
}
.rating-button:hover { border-color: var(--brand-2); }
.rating-button.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.record-head { min-height: 56px; }
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 800;
  white-space: nowrap;
}
.status-badge.pending { background: #f2f4f6; color: #697481; }
.status-badge.reviewed { background: #eaf6ee; color: #315f41; }
.emotion-label {
  display: inline-flex;
  margin: 0 0 7px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(23,50,77,.08);
  color: var(--brand);
  font-size: .76rem;
  font-weight: 800;
}
.intensity-value { font-size: 1.08rem; font-weight: 850; color: var(--brand); }

.professional-feedback {
  margin: 0;
  padding: 16px 18px 18px;
  background: #f7fafc;
  border-top: 1px solid var(--line);
}
.professional-feedback p { margin-bottom: 6px; white-space: pre-wrap; line-height: 1.5; }
.professional-feedback .feedback-title { color: var(--brand); font-size: .82rem; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.review-tools { padding: 14px 18px 18px; background: #fbfcfd; border-top: 1px solid var(--line); }
.review-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.feedback-editor { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.feedback-editor summary { cursor: pointer; color: var(--brand); font-weight: 800; font-size: .88rem; }
.feedback-form { display: grid; gap: 10px; margin-top: 12px; }
.feedback-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.analysis-surface { margin-bottom: 18px; }
.analysis-head { display: flex; justify-content: space-between; align-items: start; gap: 20px; margin-bottom: 16px; }
.analysis-head h4 { margin: 4px 0 0; font-size: 1.05rem; }
.analysis-head > .tiny { max-width: 360px; text-align: right; }
.analysis-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mini-stat { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.mini-stat span { display: block; color: var(--muted); font-size: .76rem; margin-bottom: 6px; }
.mini-stat strong { color: var(--brand); font-size: 1.05rem; }
.emotion-distribution { margin-top: 18px; display: grid; gap: 9px; }
.distribution-title { margin-bottom: 2px; color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.emotion-bar-row { display: grid; grid-template-columns: minmax(90px, 140px) 1fr 28px; gap: 10px; align-items: center; font-size: .84rem; }
.emotion-bar-track { height: 9px; border-radius: 999px; overflow: hidden; background: #e9eef3; }
.emotion-bar-fill { height: 100%; border-radius: inherit; background: var(--brand-2); }
.emotion-bar-row strong { text-align: right; color: var(--brand); }

@media (max-width: 780px) {
  .rating-scale { grid-template-columns: repeat(11, 38px); padding-bottom: 6px; }
  .emotion-chips { gap: 7px; }
  .emotion-chip { min-height: 36px; padding: 0 11px; font-size: .88rem; }
  .record-head { align-items: flex-start; flex-direction: column; }
  .analysis-head { flex-direction: column; gap: 8px; }
  .analysis-head > .tiny { text-align: left; }
  .analysis-grid { grid-template-columns: 1fr 1fr; }
  .feedback-actions { align-items: stretch; flex-direction: column; }
  .feedback-actions .primary { width: 100%; }
  .emotion-bar-row { grid-template-columns: 90px 1fr 24px; }
}

@media (max-width: 430px) {
  .analysis-grid { grid-template-columns: 1fr; }
  .status-badge { white-space: normal; }
}

.stats-grid.dashboard-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pending-count { display:inline-grid; place-items:center; min-width:28px; min-height:28px; padding:0 8px; border-radius:999px; background:#fff1dc; color:#7b5012; font-weight:850; }
tr.has-pending td:first-child strong::after { content:' novo'; display:inline-block; margin-left:7px; padding:2px 6px; border-radius:999px; background:#fff1dc; color:#7b5012; font-size:.66rem; text-transform:uppercase; letter-spacing:.04em; vertical-align:middle; }
@media (max-width: 900px) { .stats-grid.dashboard-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .stats-grid.dashboard-grid { grid-template-columns: 1fr; } }

/* V3: estatísticas longitudinais, marcadores e notificações */
.therapist-client-tabs { margin-bottom: 18px; }
.stats-intro { margin-bottom: 18px; display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.stats-intro h4 { margin: 4px 0 0; font-size: 1.08rem; }
.stats-intro > .tiny { max-width: 520px; text-align: right; }
.stats-grid.stats-five { grid-template-columns: repeat(5, minmax(0,1fr)); }
.stats-direction-grid { margin-top: -2px; }
.analytics-layout { display: grid; grid-template-columns: 1.25fr .75fr; gap: 18px; align-items: start; }
.chart-card { min-width: 0; }
.line-chart { min-height: 240px; overflow-x: auto; }
.line-chart svg { width: 100%; min-width: 540px; height: auto; display: block; }
.chart-grid-line { stroke: #e3e9ef; stroke-width: 1; }
.chart-axis-text { fill: #718090; font-size: 11px; font-family: Inter, system-ui, sans-serif; }
.chart-line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-line.start { stroke: #17324d; }
.chart-line.after { stroke: #5e8c87; }
.chart-dot.start { fill: #17324d; }
.chart-dot.after { fill: #5e8c87; }
.chart-legend { display: flex; gap: 16px; align-items: center; margin-bottom: 8px; color: var(--muted); font-size: .8rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend-line { display: inline-block; width: 24px; height: 3px; border-radius: 999px; }
.legend-line.start { background: #17324d; }
.legend-line.after { background: #5e8c87; }
.feedback-form label { display: grid; gap: 7px; }
.feedback-form label > span { font-size: .85rem; font-weight: 750; color: var(--text); }
.feedback-form input { width: 100%; }

@media (max-width: 1060px) {
  .stats-grid.stats-five { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .analytics-layout { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .stats-intro { flex-direction: column; gap: 8px; }
  .stats-intro > .tiny { text-align: left; }
  .stats-grid.stats-five { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .stats-grid.stats-five { grid-template-columns: 1fr; }
}

/* Ajuda contextual dos campos */
.guided-field { gap: 6px; }
.guided-field > label { margin-bottom: 0; }
.field-example { margin-top: 2px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.7); overflow: hidden; }
.field-example summary { cursor: pointer; list-style: none; padding: 9px 11px; color: var(--brand-2); font-size: .82rem; font-weight: 700; }
.field-example summary::-webkit-details-marker { display: none; }
.field-example summary::before { content: '+ '; font-weight: 800; }
.field-example[open] summary::before { content: '− '; }
.field-example p { margin: 0; padding: 0 11px 11px; color: var(--muted); font-size: .84rem; line-height: 1.45; }

/* V6: experiência guiada, múltiplas emoções e identidade visual */
:root {
  --brand-deep: #102a43;
  --brand-gold: #b78a42;
  --green-soft: #eaf6ee;
  --gold-soft: #fbf5e9;
}

.auth-card { width: min(100%, 460px); padding-top: 28px; }
.auth-logo { display: block; width: 150px; max-height: 170px; object-fit: contain; margin: 0 auto 14px; }
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar-logo { width: 46px; height: 46px; object-fit: contain; border-radius: 12px; background: #fff; padding: 3px; border: 1px solid var(--line); }

.client-tabs { position: sticky; top: 82px; z-index: 20; background: rgba(244,247,250,.92); backdrop-filter: blur(10px); padding: 9px 0; margin-bottom: 18px; }
.client-home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(190px, .65fr);
  gap: 28px;
  align-items: center;
  padding: 30px;
  border: 1px solid rgba(23,50,77,.12);
  border-radius: 24px;
  background: linear-gradient(135deg, #fff 0%, #f7fafc 62%, #eef4f8 100%);
  box-shadow: 0 18px 50px rgba(17,42,67,.09);
  overflow: hidden;
}
.client-home-copy h3 { font-size: clamp(1.75rem, 4vw, 2.4rem); margin-bottom: 10px; }
.client-home-copy .muted { max-width: 650px; line-height: 1.6; }
.client-home-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.client-home-logo { width: min(100%, 250px); max-height: 260px; object-fit: contain; justify-self: end; filter: drop-shadow(0 14px 25px rgba(16,42,67,.09)); }
.client-home-stats { margin-top: 18px; grid-template-columns: repeat(4, minmax(0,1fr)); }
.client-home-latest { margin-top: 18px; }
.home-latest-row { display: grid; grid-template-columns: 1fr minmax(130px, 220px) auto; gap: 16px; align-items: center; }
.home-latest-row strong { display: block; margin-bottom: 7px; }

.wizard-progress { max-width: 820px; margin: 0 auto 16px; }
.wizard-progress-track { height: 7px; background: #dde6ee; border-radius: 999px; overflow: hidden; }
.wizard-progress-track span { display: block; height: 100%; width: 16.66%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: inherit; transition: width .25s ease; }
.wizard-progress-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; font-size: .8rem; color: var(--muted); }
.wizard-progress-meta strong { color: var(--brand); }
.entry-wizard { max-width: 820px; margin: 0 auto; }
.wizard-step { scroll-margin-top: 160px; }
.wizard-card {
  min-height: 460px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 15px;
  padding: 30px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 18px 50px rgba(20,45,70,.08);
}
.wizard-card.antecedent { background: linear-gradient(180deg, #f6fbff, #fff 46%); }
.wizard-card.response { background: linear-gradient(180deg, #faf8ff, #fff 46%); }
.wizard-card.consequence { background: linear-gradient(180deg, #f6fbf7, #fff 46%); }
.wizard-card h4 { margin: 0; font-size: clamp(1.35rem, 3vw, 1.75rem); color: var(--brand-deep); }
.wizard-card textarea { min-height: 150px; }
.wizard-card label > span, .compact-date > span { font-weight: 760; }
.compact-date { width: min(100%, 220px); }
.compact-date input { width: 100%; }
.wizard-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; padding-bottom: 30px; }
.wizard-actions .primary, .wizard-actions .ghost { min-width: 140px; }
.wizard-actions #wizard-next { margin-left: auto; }

.emotion-chips-large { gap: 9px; }
.emotion-chips-large .emotion-chip { min-height: 44px; padding: 0 15px; gap: 7px; display: inline-flex; align-items: center; }
.emotion-chip span { font-size: 1.08rem; line-height: 1; }
.emotion-chip.active { box-shadow: 0 4px 14px rgba(23,50,77,.16); transform: translateY(-1px); }

.intensity-field { margin-top: 4px; padding-top: 4px; }
.intensity-preview { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; margin-top: 3px; }
.intensity-preview::before { content: ''; grid-column: 1; grid-row: 1; width: 100%; height: 8px; border-radius: 999px; background: #e4e9ee; }
.intensity-preview span { grid-column: 1; grid-row: 1; display: block; height: 8px; width: 0; border-radius: 999px; z-index: 1; transition: width .2s ease, background .2s ease; }
.intensity-preview strong { grid-column: 2; grid-row: 1; font-size: .78rem; color: var(--muted); }
.intensity-inline { width: min(100%, 190px); }
.intensity-inline-head { display: flex; justify-content: flex-end; margin-bottom: 4px; font-size: .8rem; }
.intensity-track { width: 100%; height: 7px; border-radius: 999px; overflow: hidden; background: #e7edf2; }
.intensity-track span { display: block; height: 100%; border-radius: inherit; }

.emotion-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 7px; }
.emotion-label { gap: 5px; align-items: center; }
.emotion-label b { font-size: .92rem; }

.entry-review-summary { display: grid; gap: 10px; }
.review-summary-block { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfd; }
.review-summary-block > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.review-summary-block p { margin: 0; white-space: pre-wrap; line-height: 1.5; }
.review-summary-block .intensity-inline { margin-top: 8px; }

.records-accordion-list { gap: 10px; }
.record-accordion { overflow: hidden; }
.record-accordion-summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 18px; cursor: pointer; background: #fff; }
.record-accordion-summary::-webkit-details-marker { display: none; }
.record-accordion-summary time { display: block; font-weight: 850; margin-bottom: 7px; color: var(--brand-deep); }
.record-summary-emotions { display: flex; gap: 6px; flex-wrap: wrap; }
.record-summary-emotions span { padding: 3px 7px; border-radius: 999px; background: #f2f5f7; color: #52606d; font-size: .72rem; font-weight: 760; }
.record-summary-side { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-width: 320px; }
.record-summary-side .intensity-inline { width: 130px; }
.accordion-chevron { font-size: 1.4rem; color: var(--muted); transition: transform .2s ease; }
.record-accordion[open] .accordion-chevron { transform: rotate(180deg); }
.record-accordion[open] .record-accordion-summary { border-bottom: 1px solid var(--line); background: #fbfcfd; }
.record-accordion-body { animation: accordionIn .18s ease; }
@keyframes accordionIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.saved-observation-card { margin-bottom: 14px; border-left: 4px solid var(--brand-2); }
.saved-observation-card > p:last-child { margin-bottom: 0; line-height: 1.55; }

.professional-heading { align-items: center; }
.professional-brand { display: flex; align-items: center; gap: 18px; }
.professional-brand img { width: 90px; height: 100px; object-fit: contain; border-radius: 18px; background: #fff; padding: 4px; border: 1px solid var(--line); box-shadow: 0 10px 26px rgba(17,42,67,.08); }
.professional-name { margin: 1px 0 7px; color: var(--brand); font-weight: 800; }
.professional-name span { font-weight: 600; color: var(--muted); margin-left: 8px; font-size: .84rem; }

.analytics-layout { grid-template-columns: repeat(2, minmax(0,1fr)); }
.comparison-bars { display: grid; gap: 15px; margin-top: 12px; }
.comparison-row { display: grid; gap: 7px; }
.comparison-label { display: flex; justify-content: space-between; gap: 12px; font-size: .84rem; }
.comparison-label strong { color: var(--brand); }
.comparison-track { height: 11px; border-radius: 999px; overflow: hidden; background: #e9eef3; }
.comparison-track span { display: block; height: 100%; border-radius: inherit; }
.emotion-bar-fill.start { background: #244f73; }
.emotion-bar-fill.after { background: #5e8c87; }
.emotion-bar-fill.direction { background: #8a6f9c; }
.emotion-bar-fill.behavior { background: #6f6f98; }
.emotion-bar-fill.weekday { background: #8a7650; }

@media (max-width: 900px) {
  .client-home-hero { grid-template-columns: 1fr; }
  .client-home-logo { justify-self: center; width: 190px; max-height: 205px; }
  .client-home-stats { grid-template-columns: 1fr 1fr; }
  .analytics-layout { grid-template-columns: 1fr; }
  .record-summary-side { min-width: auto; flex-wrap: wrap; }
  .professional-brand img { width: 74px; height: 84px; }
}

@media (max-width: 780px) {
  .client-tabs { top: 72px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .client-tabs::-webkit-scrollbar { display: none; }
  .client-tabs .tab { flex: 0 0 auto; }
  .wizard-card { min-height: 0; padding: 22px 18px; }
  .wizard-actions { position: sticky; bottom: 0; z-index: 15; margin-inline: -12px; padding: 12px; background: rgba(244,247,250,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
  .wizard-actions .primary, .wizard-actions .ghost { flex: 1; min-width: 0; }
  .record-accordion-summary { align-items: flex-start; flex-direction: column; }
  .record-summary-side { width: 100%; justify-content: space-between; }
  .record-summary-side .intensity-inline { width: min(42vw, 150px); }
  .home-latest-row { grid-template-columns: 1fr; }
  .professional-brand { align-items: flex-start; }
  .professional-brand img { display: none; }
}

@media (max-width: 520px) {
  .auth-logo { width: 125px; max-height: 145px; }
  .topbar-logo { width: 40px; height: 40px; }
  .client-home-hero { padding: 22px 18px; }
  .client-home-logo { width: 160px; max-height: 180px; }
  .client-home-stats { grid-template-columns: 1fr 1fr; gap: 9px; }
  .client-home-stats .stat-card { padding: 14px; }
  .emotion-chips-large .emotion-chip { min-height: 42px; padding: 0 12px; font-size: .86rem; }
  .wizard-progress-meta { font-size: .76rem; }
  .professional-name span { display: block; margin: 3px 0 0; }
}


/* V7: títulos automáticos, sanfonas e síntese profissional */
.record-summary-main{min-width:0;display:grid;gap:8px}
.record-summary-date-title{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap}
.record-summary-date-title time{font-weight:800;color:#17324d;white-space:nowrap}
.record-auto-title{font-size:.97rem;color:#1f2e3d;line-height:1.35;min-width:0;overflow-wrap:anywhere}
.therapist-record-accordion{background:#fff}
.therapist-record-accordion .record-accordion-summary{cursor:pointer}
.professional-summary-surface{margin-top:18px}
.professional-summary-form{display:grid;gap:14px}
.professional-summary-form label{display:grid;gap:8px;font-weight:700}
.professional-summary-form textarea{min-height:180px;resize:vertical}
.professional-summary-footer{display:flex;justify-content:space-between;gap:18px;align-items:flex-end;flex-wrap:wrap}
.professional-summary-footer>div{display:grid;gap:3px}
@media(max-width:700px){.record-summary-date-title{display:grid;gap:4px}.professional-summary-footer .primary{width:100%}}

/* V8: menu, edição e exclusão */
.menu-toggle{display:inline-flex;align-items:center;gap:.4rem}
.menu-backdrop{position:fixed;inset:0;background:rgba(12,28,45,.35);backdrop-filter:blur(2px);z-index:89}
.app-menu-drawer{position:fixed;top:0;right:0;width:min(360px,92vw);height:100dvh;background:#fff;z-index:90;box-shadow:-20px 0 60px rgba(18,42,67,.18);transform:translateX(105%);transition:transform .22s ease;padding:24px;display:flex;flex-direction:column;gap:20px}
.app-menu-drawer.open{transform:translateX(0)}
.menu-drawer-head{display:flex;align-items:center;justify-content:space-between;padding-bottom:16px;border-bottom:1px solid var(--line,#dfe7ee)}
.menu-drawer-head strong{font-size:1.35rem}
.icon-button{border:0;background:#eef3f7;border-radius:12px;width:38px;height:38px;font-size:1.5rem;cursor:pointer}
.menu-section{display:grid;gap:8px}
.menu-section button,.menu-drawer-footer button{width:100%;text-align:left;border:0;background:transparent;border-radius:13px;padding:13px 14px;font:inherit;font-weight:700;color:#17354f;cursor:pointer}
.menu-section button:hover{background:#eef4f8}
.menu-drawer-footer{margin-top:auto;border-top:1px solid var(--line,#dfe7ee);padding-top:16px}
.menu-drawer-footer .danger-menu{color:#a92d2d;background:#fff4f4}
.edit-banner{display:flex;align-items:center;justify-content:space-between;gap:16px;background:#f5f8fb;border:1px solid #d7e2eb;border-radius:16px;padding:14px 16px;margin-bottom:14px}
.edit-banner>div{display:grid;gap:4px}
.client-record-actions{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap;margin-top:16px;padding-top:16px;border-top:1px solid #e4ebf0}
.danger-button{border:1px solid #e7b8b8;background:#fff5f5;color:#9f2e2e;border-radius:12px;padding:10px 14px;font-weight:700;cursor:pointer}
.danger-button:hover{background:#ffeaea}
.danger-button:disabled{opacity:.6;cursor:wait}
.saved-observation-head{display:flex;justify-content:space-between;gap:18px;align-items:flex-start}
.saved-observation-actions{display:flex;gap:8px;flex-wrap:wrap}
@media (max-width:760px){
  .topbar-actions .user-chip{display:none}
  .topbar-actions>#logout-btn{display:none}
  .client-tabs{overflow-x:auto;white-space:nowrap;padding-bottom:4px}
  .saved-observation-head,.edit-banner{align-items:stretch;flex-direction:column}
  .saved-observation-actions,.client-record-actions{justify-content:flex-start}
}


/* V9: robustez mobile e prevenção de cache visual antigo */
html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
img { max-width: 100%; height: auto; }
.auth-logo {
  width: min(150px, 38vw) !important;
  height: auto !important;
  max-height: 160px !important;
  object-fit: contain;
}
.topbar-logo {
  width: 46px !important;
  height: 46px !important;
  min-width: 46px;
  max-width: 46px !important;
  max-height: 46px !important;
  flex: 0 0 46px;
  object-fit: contain;
}
.client-home-logo {
  width: min(250px, 40vw) !important;
  height: auto !important;
  max-height: 260px !important;
  object-fit: contain;
}
.professional-brand img {
  width: 90px !important;
  height: 100px !important;
  min-width: 90px;
  max-width: 90px !important;
  max-height: 100px !important;
  object-fit: contain;
  flex: 0 0 90px;
}
.topbar-brand, .professional-brand, .client-home-hero, .auth-card { min-width: 0; max-width: 100%; }
.topbar-brand > div, .professional-brand > div, .client-home-copy { min-width: 0; }

@media (max-width: 760px) {
  .auth-screen { padding: 14px; }
  .auth-card { width: 100%; max-width: 420px; padding: 22px 18px; border-radius: 20px; }
  .auth-logo { width: min(118px, 34vw) !important; max-height: 128px !important; margin-bottom: 10px; }
  .topbar { min-height: 64px; padding: 9px 12px; align-items: center; }
  .topbar-logo { width: 36px !important; height: 36px !important; min-width: 36px; max-width: 36px !important; max-height: 36px !important; flex-basis: 36px; border-radius: 10px; }
  .topbar .eyebrow { font-size: .61rem; margin-bottom: 2px; }
  .topbar h2 { font-size: 1rem; line-height: 1.15; }
  .menu-toggle { min-height: 38px; padding: 0 10px; }
  .app-shell { width: calc(100% - 20px); padding-top: 14px; }
  .client-tabs { top: 64px; }
  .client-home-hero { grid-template-columns: 1fr; gap: 16px; padding: 20px 18px; }
  .client-home-logo { width: 108px !important; max-height: 118px !important; justify-self: center; order: -1; }
  .professional-brand img { display: none !important; }
  .professional-brand { gap: 0; }
  .record-summary-side { min-width: 0; width: 100%; justify-content: space-between; }
  .record-accordion-summary { align-items: flex-start; flex-direction: column; gap: 10px; }
  .record-summary-side .intensity-inline { width: min(100%, 150px); }
  .wizard-card { min-height: auto; padding: 22px 18px; }
}

@media (max-width: 390px) {
  .auth-logo { width: 102px !important; max-height: 112px !important; }
  .topbar-brand { gap: 8px; }
  .topbar-logo { width: 32px !important; height: 32px !important; min-width: 32px; max-width: 32px !important; max-height: 32px !important; flex-basis: 32px; }
  .menu-toggle { font-size: .82rem; }
  .client-home-logo { width: 96px !important; max-height: 106px !important; }
}


/* V10: rascunho automático, calendário mensal, sinalização opcional e backup */
.draft-banner{display:flex;align-items:center;justify-content:space-between;gap:16px;max-width:820px;margin:0 auto 14px;padding:14px 16px;border:1px solid #cfe0d6;border-radius:16px;background:#f4fbf6}
.draft-banner>div{display:grid;gap:3px}.draft-banner strong{color:#244b35}.draft-banner small{font-size:.78rem}
.discuss-option{display:flex!important;grid-template-columns:none!important;align-items:flex-start;gap:10px;padding:14px;border:1px solid #dce5ec;border-radius:14px;background:#fbfcfd;font-weight:600!important}
.discuss-option input{width:20px;height:20px;margin-top:2px;flex:0 0 20px}.discuss-option>span{display:grid;gap:3px}.discuss-option small{color:var(--muted);font-weight:500;line-height:1.4}
.status-badge.discuss{background:#eef1ff;color:#4b4d88;border-color:#d6daf7}.status-badge.discuss.compact{font-size:.7rem;white-space:nowrap}
.client-record-actions .is-marked{background:#edf1ff;color:#414b8a}
.client-calendar-card{margin-top:18px}.calendar-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:16px}.calendar-head h4{margin:3px 0 0}.calendar-nav{display:flex;align-items:center;gap:10px}.calendar-nav strong{text-transform:capitalize;min-width:145px;text-align:center;color:var(--brand)}
.calendar-weekdays,.client-calendar{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:7px}.calendar-weekdays{margin-bottom:7px;color:var(--muted);font-size:.72rem;font-weight:800;text-align:center}.calendar-day{position:relative;min-height:66px;border:1px solid var(--line);border-radius:12px;background:#fff;color:var(--text);display:flex;align-items:flex-start;justify-content:flex-start;padding:9px;cursor:default}.calendar-day:disabled{opacity:1}.calendar-day.has-entry{cursor:pointer;background:#fbfcfd;border-color:#cbd8e3}.calendar-day.has-entry:hover{transform:translateY(-1px);box-shadow:0 6px 16px rgba(20,45,70,.08)}.calendar-day b{position:absolute;right:7px;top:7px;min-width:20px;height:20px;border-radius:999px;background:#eef3f7;color:var(--brand);display:grid;place-items:center;font-size:.68rem}.calendar-day i{position:absolute;left:8px;right:8px;bottom:7px;height:4px;border-radius:999px;background:var(--day-color,#9bb0c3)}.calendar-day.empty-day{border:0;background:transparent}.calendar-help{margin:11px 0 0}
.backup-note{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:-4px 0 18px;padding:13px 16px;border:1px solid var(--line);border-radius:14px;background:#fbfcfd}.backup-note>div{display:grid;gap:3px}.backup-note span{font-size:.8rem}
@media(max-width:760px){.draft-banner,.calendar-head,.backup-note{align-items:stretch;flex-direction:column}.calendar-nav{justify-content:space-between}.calendar-nav strong{min-width:0}.calendar-weekdays,.client-calendar{gap:4px}.calendar-day{min-height:52px;padding:7px;font-size:.82rem}.calendar-day b{right:4px;top:4px;min-width:17px;height:17px;font-size:.62rem}.calendar-day i{left:6px;right:6px;bottom:5px}.backup-note button{width:100%}}


/* V12: horário opcional do acontecimento */
.entry-when-grid{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,.75fr);gap:12px;align-items:end;width:min(100%,390px)}
.entry-when-grid label{min-width:0;margin:0}
.compact-date,.compact-time{width:100%;min-width:0}
.compact-date input,.compact-time input{width:100%;min-width:0}
.compact-time>span{font-weight:760}
.compact-time>span small{font-weight:600;color:var(--muted)}
@media(max-width:390px){.entry-when-grid{grid-template-columns:minmax(0,1.2fr) minmax(0,.8fr);gap:8px}.entry-when-grid input{padding-left:10px;padding-right:8px}}


/* V14: acesso simplificado e senha amigável no celular */
.password-input-wrap { position: relative; width: 100%; }
.password-input-wrap input { padding-right: 78px; }
.password-toggle {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  border: 0; background: #edf2f6; color: var(--brand); border-radius: 9px;
  min-height: 34px; padding: 0 10px; font-size: .78rem; font-weight: 760; cursor: pointer;
}
.password-toggle:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.password-help { margin: 0; padding: 10px 12px; border: 1px solid #d8e1e9; border-radius: 11px; background: #f7f9fb; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.field-example { margin-top: 0; margin-bottom: 2px; }
@media (max-width: 480px) {
  .password-input-wrap input { font-size: 16px; }
  .password-toggle { right: 6px; padding: 0 9px; }
}

/* V15: cadastro próprio, recuperação de senha e acesso sem senha temporária */
.auth-links { display:flex; align-items:center; justify-content:center; gap:10px; margin-top:16px; color:var(--muted); font-size:.9rem; }
.auth-text-button { border:0; background:transparent; padding:4px 2px; color:var(--brand-2); font-weight:780; cursor:pointer; }
.auth-text-button:hover { text-decoration:underline; }
.auth-access-note { margin:12px 0 0; text-align:center; line-height:1.45; }
.auth-flow-modal { width:min(100%, 480px); }
.auth-flow-secondary { width:100%; margin-top:12px; }
.honeypot-field { position:absolute !important; left:-10000px !important; width:1px !important; height:1px !important; opacity:0 !important; pointer-events:none !important; }
.share-access-box { display:grid; gap:10px; padding:16px; border:1px solid var(--line); border-radius:14px; background:var(--surface-soft); }
.share-access-box span { font-size:.78rem; font-weight:800; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; }
.share-access-box strong { display:block; overflow-wrap:anywhere; font-size:.92rem; color:var(--brand); }
@media (max-width:480px) {
  .auth-links { gap:8px; font-size:.86rem; }
  .auth-flow-modal { padding:20px 17px; }
  .auth-access-note { font-size:.78rem; }
}

/* V16: acesso, exclusão e ajustes da tela de login */
.auth-title-block { text-align: center; }
.auth-title-block .muted { margin-left: auto; margin-right: auto; }
.table-row-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.access-info-card { display: grid; gap: 7px; padding: 15px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.access-info-card > span { font-size: .76rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.access-info-card > strong { color: var(--brand); overflow-wrap: anywhere; }
.access-info-card p { margin: 2px 0 0; line-height: 1.45; }
.access-reset-form { padding-bottom: 20px; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 18px; border-top: 1px solid #ead2d2; }
.danger-zone p { margin: 5px 0 0; max-width: 310px; line-height: 1.45; }
@media (max-width: 640px) {
  .danger-zone { align-items: stretch; flex-direction: column; }
  .danger-zone .danger-button { width: 100%; }
  .table-row-actions { justify-content: flex-start; }
}

/* V17: status do acompanhamento e controle de acesso */
.status-badge.client-active { background:#eaf6ee; color:#315f41; }
.status-badge.client-inactive { background:#f1f2f4; color:#626a73; }
.status-badge.access-enabled { background:#eaf4fb; color:#285b78; }
.status-badge.access-blocked { background:#fff0ef; color:#9a4039; }
.inactive-client-row { opacity:.82; }
.client-status-badges { display:flex; gap:8px; flex-wrap:wrap; margin-top:8px; }
.client-status-form { padding: 2px 0 20px; margin-bottom: 18px; border-bottom:1px solid var(--line); }
.status-management-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.table-toolbar select { min-width:170px; }
@media (max-width:640px) {
  .status-management-grid { grid-template-columns:1fr; }
  .table-toolbar select { width:100%; min-width:0; }
}
