:root {
  --bg: #f4f1ec;
  --card: #ffffff;
  --ink: #3a3a40;
  --soft: #6b6b72;
  --muted: #9a9aa1;
  --sage: #8ba888;
  --sage-soft: #e6ede4;
  --rose: #c8a6a6;
  --rose-soft: #f5ebe5;
  --amber: #d4a373;
  --amber-soft: #f7ecd9;
  --line: #e6e1d8;
  --shadow-sm: 0 2px 8px rgba(58, 58, 64, 0.04);
  --shadow: 0 6px 24px rgba(58, 58, 64, 0.06);
  --shadow-lg: 0 12px 40px rgba(58, 58, 64, 0.1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Georgia', 'Cambria', serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 880px; margin: 0 auto; padding: 48px 24px 100px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: inherit; font-size: 0.9rem;
  cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--sage); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; }

.btn-primary { background: var(--sage); color: #fff; border-color: var(--sage); }
.btn-primary:hover { background: #7a9777; border-color: #7a9777; }

.btn-ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--soft); }
.btn-ghost:hover { background: var(--card); color: var(--ink); }

.btn-sm { padding: 6px 12px; font-size: 0.82rem; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px; cursor: pointer;
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--sage-soft); border-color: var(--sage); }
.icon-btn.recording { background: var(--rose-soft); border-color: var(--rose); color: #a77878; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn-primary { background: var(--sage); color: #fff; border-color: var(--sage); }
.icon-btn-primary:hover { background: #7a9777; border-color: #7a9777; color: #fff; }

.pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; padding: 0 6px; height: 20px;
  background: var(--sage-soft); color: var(--sage);
  border-radius: 10px; font-size: 0.72rem; font-weight: 600;
  margin-left: 4px;
}

/* ---------- Sticky action bar ---------- */
.actions-bar {
  position: sticky; top: 16px; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: -12px;
}
.actions-bar .spacer { flex: 1; }

/* ---------- Home ---------- */
.home-header { text-align: center; margin: 40px 0 36px; }
.home-header .leaf {
  width: 56px; height: 56px; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--sage-soft); color: var(--sage);
  border-radius: 18px;
}
.home-header .leaf svg { width: 28px; height: 28px; }
.home-header h1 { font-weight: 400; font-size: 2.4rem; margin: 0 0 10px; }
.home-header p { color: var(--soft); max-width: 500px; margin: 0 auto; font-style: italic; }

.home-actions { text-align: center; margin-bottom: 36px; }

.cases-list {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.case-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 22px 24px;
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}
.case-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--sage); }
.case-card h3 { margin: 0; font-weight: 500; font-size: 1.2rem; }
.case-card .subtitle { color: var(--soft); font-size: 0.9rem; font-style: italic; margin: 0; }
.case-card .stats { display: flex; gap: 14px; color: var(--muted); font-size: 0.82rem; }
.case-card .stats span { display: inline-flex; align-items: center; gap: 4px; }
.case-card .stats svg { width: 14px; height: 14px; }

.empty-state {
  text-align: center; padding: 48px 24px;
  background: var(--card); border: 1px dashed var(--line);
  border-radius: 16px; color: var(--soft);
}

/* ---------- Case header ---------- */
header#caseHeader { text-align: center; margin: 40px 0 56px; }
#caseName { font-weight: 400; font-size: clamp(2rem, 5vw, 2.8rem); margin: 0 0 12px; }
#caseIntro { color: var(--soft); font-style: italic; margin: 0; max-width: 520px; margin: 0 auto; }

/* ---------- Section titles ---------- */
.section-title { text-align: center; margin: 72px 0 32px; }
.section-title .eyebrow {
  display: inline-block; font-size: 0.75rem; letter-spacing: 2px;
  text-transform: uppercase; color: var(--sage); font-weight: 600; margin-bottom: 8px;
}
.section-title h2 { font-weight: 400; font-size: 1.6rem; margin: 0; }

/* ---------- Gatilhos ---------- */
.gatilhos {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.gatilho {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 22px 20px;
  cursor: pointer; text-align: left;
  font-family: inherit; font-size: inherit; color: inherit; text-decoration: none;
  display: flex; flex-direction: column; gap: 14px;
  transition: all 0.25s ease; box-shadow: var(--shadow-sm);
}
.gatilho:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--sage); }
.gatilho .icon-wrap {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--sage-soft); color: var(--sage);
}
.gatilho .icon-wrap svg { width: 22px; height: 22px; }
.gatilho h3 { margin: 0; font-size: 1.05rem; font-weight: 600; line-height: 1.35; }
.gatilho .arrow { margin-top: auto; color: var(--muted); font-size: 0.85rem; display: flex; align-items: center; gap: 4px; }
.gatilho .arrow svg { width: 14px; height: 14px; }
.gatilho[data-tone="rose"] .icon-wrap { background: var(--rose-soft); color: #a77878; }
.gatilho[data-tone="amber"] .icon-wrap { background: var(--amber-soft); color: #a87846; }

/* ---------- Detail cards ---------- */
.detail {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 40px;
  margin-bottom: 24px; box-shadow: var(--shadow-sm);
  display: grid; grid-template-columns: 1fr 120px; gap: 28px;
  align-items: center; scroll-margin-top: 40px;
}
.detail.flash { animation: flash 1.2s ease; }
@keyframes flash {
  0%, 100% { box-shadow: 0 0 0 0 var(--sage-soft), var(--shadow-sm); }
  50% { box-shadow: 0 0 0 6px var(--sage-soft), var(--shadow); }
}
@media (max-width: 640px) {
  .detail { grid-template-columns: 1fr; padding: 28px; }
  .detail .illustration { order: -1; width: 80px; height: 80px; }
}
.detail h2 { font-size: 1.5rem; font-weight: 500; margin: 0 0 10px; line-height: 1.25; }
.detail .kicker {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.72rem; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--sage); font-weight: 600; margin-bottom: 10px;
}
.detail .kicker svg { width: 14px; height: 14px; }
.detail p { margin: 0 0 12px; color: var(--soft); font-size: 1.02rem; }
.detail .inline-quote {
  margin-top: 16px; padding: 14px 18px;
  background: var(--bg); border-left: 3px solid var(--rose);
  border-radius: 0 8px 8px 0; font-style: italic; color: var(--ink); font-size: 0.95rem;
}
.detail .illustration { width: 120px; height: 120px; display: flex; align-items: center; justify-content: center; }

/* ---------- Voice ---------- */
.voice {
  background: linear-gradient(135deg, var(--sage-soft) 0%, var(--rose-soft) 100%);
  border-radius: 18px; padding: 48px 40px;
}
.voice .quotes {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.voice blockquote {
  margin: 0; padding: 24px;
  background: var(--card); border-radius: 12px;
  position: relative; box-shadow: var(--shadow-sm);
}
.voice blockquote::before {
  content: ""; display: block;
  width: 28px; height: 3px; background: var(--sage);
  margin-bottom: 12px; border-radius: 3px;
}
.voice blockquote p { margin: 0; font-style: italic; font-size: 1rem; line-height: 1.55; }
.voice cite {
  display: block; margin-top: 10px; font-style: normal;
  font-size: 0.78rem; color: var(--muted); letter-spacing: 1px; text-transform: uppercase;
}

/* ---------- Timeline ---------- */
.timeline-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 40px; margin-bottom: 24px; box-shadow: var(--shadow-sm);
}
.timeline-card h3 { font-size: 1.2rem; font-weight: 500; margin: 0 0 4px; }
.timeline-card .subtitle { color: var(--muted); font-size: 0.9rem; margin: 0 0 28px; font-style: italic; }

.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 14px; top: 10px; bottom: 10px;
  width: 2px; background: linear-gradient(to bottom, var(--sage) 0%, var(--rose) 100%); opacity: 0.4;
}
.timeline li { position: relative; padding-left: 48px; padding-bottom: 22px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: 8px; top: 8px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--card); border: 2px solid var(--sage); z-index: 1;
}
.timeline li[data-type="dark"]::before { border-color: var(--rose); }
.timeline li[data-type="alert"]::before { border-color: var(--amber); }
.timeline .when {
  display: block; font-size: 0.78rem; font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--sage); margin-bottom: 2px;
}
.timeline li[data-type="dark"] .when { color: #a77878; }
.timeline li[data-type="alert"] .when { color: #a87846; }
.timeline .what { display: block; font-size: 0.98rem; }
.timeline .what .note { display: block; color: var(--soft); font-size: 0.9rem; font-style: italic; margin-top: 4px; }

/* ---------- Dialogs ---------- */
dialog {
  max-width: 720px; width: calc(100% - 32px);
  max-height: 85vh; border: none; border-radius: 18px; padding: 0;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  background: var(--card); color: var(--ink);
}
dialog::backdrop { background: rgba(58, 58, 64, 0.45); backdrop-filter: blur(4px); }
dialog form { margin: 0; }

.dlg-header {
  padding: 20px 24px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--card); z-index: 2;
  border-radius: 18px 18px 0 0;
}
.dlg-header h2 { margin: 0; font-size: 1.15rem; font-weight: 500; }
.dlg-header-actions { display: flex; gap: 8px; align-items: center; }

.dlg-body { padding: 20px 24px 28px; overflow-y: auto; max-height: calc(85vh - 70px); }
.dlg-body .intro { color: var(--soft); font-style: italic; margin: 0 0 18px; padding-bottom: 14px; border-bottom: 1px dashed var(--line); }

.dlg-footer {
  padding: 16px 24px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 10px;
  background: var(--bg); border-radius: 0 0 18px 18px;
}

.close-btn {
  background: transparent; border: none; color: var(--muted);
  cursor: pointer; padding: 6px; border-radius: 8px;
  display: inline-flex; transition: all 0.15s;
}
.close-btn:hover { background: var(--bg); color: var(--ink); }
.close-btn svg { width: 20px; height: 20px; }

/* ---------- Forms ---------- */
label {
  display: block; margin-bottom: 14px;
  font-size: 0.85rem; color: var(--soft); font-weight: 600;
}
input, textarea, select {
  display: block; width: 100%; margin-top: 4px;
  padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; font-family: inherit; font-size: 0.95rem;
  color: var(--ink); font-weight: normal;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--sage); background: var(--card);
}
textarea { resize: vertical; font-family: inherit; line-height: 1.6; }
.form-hint { font-size: 0.8rem; color: var(--muted); font-style: italic; margin-top: -6px; }

/* ---------- References list ---------- */
.ref-item {
  background: var(--bg); border-radius: 12px; padding: 16px 18px;
  margin-bottom: 10px; cursor: pointer;
  border: 1px solid transparent; transition: all 0.15s;
  display: flex; gap: 14px; align-items: flex-start;
}
.ref-item:hover { border-color: var(--sage); background: var(--card); }
.ref-item .ref-icon {
  flex-shrink: 0; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--sage-soft); color: var(--sage); border-radius: 10px;
}
.ref-item .ref-icon svg { width: 18px; height: 18px; }
.ref-item h4 { margin: 0 0 4px; font-size: 0.98rem; font-weight: 600; }
.ref-item .ref-desc { color: var(--soft); font-size: 0.85rem; margin: 0; }
.ref-item .ref-badge {
  display: inline-block; margin-top: 6px; padding: 2px 8px;
  background: var(--sage-soft); color: var(--sage);
  font-size: 0.7rem; font-weight: 600; border-radius: 10px;
  letter-spacing: 0.5px; text-transform: uppercase;
}

.ref-meta {
  display: flex; gap: 14px; flex-wrap: wrap;
  color: var(--muted); font-size: 0.82rem; margin-bottom: 16px;
  padding-bottom: 14px; border-bottom: 1px dashed var(--line);
}
.ref-meta span { display: inline-flex; align-items: center; gap: 4px; }
.ref-meta svg { width: 13px; height: 13px; }

.transcript { line-height: 1.75; font-size: 0.96rem; white-space: pre-wrap; }

.analysis-card {
  background: var(--sage-soft); border-radius: 12px; padding: 18px; margin-top: 16px;
}
.analysis-card h4 { margin: 0 0 10px; font-size: 0.95rem; color: var(--sage); }
.analysis-card .summary { color: var(--ink); margin: 0 0 14px; font-style: italic; }
.analysis-card h5 { margin: 14px 0 6px; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 1px; color: var(--soft); }
.analysis-card ul { margin: 0; padding-left: 18px; font-size: 0.9rem; }
.analysis-card li { margin-bottom: 4px; }

/* ---------- IA Chat ---------- */
#aiDialog { max-width: 920px; }
.ai-body { display: flex; padding: 0; max-height: calc(85vh - 70px); overflow: hidden; }
.ai-sidebar {
  width: 220px; flex-shrink: 0; border-right: 1px solid var(--line);
  background: var(--bg); padding: 16px 12px; overflow-y: auto;
}
.ai-sidebar-header {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--muted); font-weight: 600; margin-bottom: 8px; padding: 0 8px;
}
.conv-item {
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  font-size: 0.88rem; color: var(--ink); margin-bottom: 4px;
  transition: background 0.15s;
}
.conv-item:hover { background: var(--card); }
.conv-item.active { background: var(--card); border-left: 3px solid var(--sage); padding-left: 9px; }
.conv-item .conv-title { font-weight: 500; }
.conv-item .conv-date { font-size: 0.72rem; color: var(--muted); }

.ai-chat { flex: 1; display: flex; flex-direction: column; }
.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px 24px;
  display: flex; flex-direction: column; gap: 14px;
}
.chat-empty {
  color: var(--muted); font-style: italic; text-align: center;
  padding: 40px 20px; font-size: 0.95rem;
}
.msg { max-width: 85%; padding: 12px 16px; border-radius: 14px; font-size: 0.95rem; line-height: 1.55; white-space: pre-wrap; }
.msg-user { align-self: flex-end; background: var(--sage); color: #fff; border-bottom-right-radius: 4px; }
.msg-assistant { align-self: flex-start; background: var(--bg); border-bottom-left-radius: 4px; }
.msg-suggestions {
  align-self: flex-start; max-width: 85%;
  background: var(--amber-soft); border-radius: 12px; padding: 12px 16px;
  font-size: 0.88rem;
}
.msg-suggestions h5 { margin: 0 0 8px; font-size: 0.78rem; color: #a87846; text-transform: uppercase; letter-spacing: 1px; }
.msg-suggestions .sugg-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px dashed #e8d4b5; }
.msg-suggestions .sugg-item:first-of-type { border-top: none; }
.msg-suggestions .sugg-text { flex: 1; color: var(--ink); font-style: italic; }
.msg-suggestions button { font-size: 0.78rem; padding: 4px 10px; flex-shrink: 0; }

.chat-form {
  display: flex; gap: 8px; padding: 14px 18px;
  border-top: 1px solid var(--line); background: var(--card);
}
.chat-form textarea {
  flex: 1; min-height: 42px; max-height: 140px;
  margin: 0; border-radius: 12px; resize: none;
  padding: 10px 14px;
}
.record-status {
  padding: 8px 18px; background: var(--rose-soft); color: #a77878;
  font-size: 0.85rem; font-style: italic;
}

/* ---------- Footer ---------- */
footer {
  text-align: center; margin-top: 48px;
  padding-top: 28px; border-top: 1px solid var(--line);
}
footer p { color: var(--soft); font-size: 0.9rem; margin: 0 0 6px; }
footer strong { color: var(--ink); }

/* ---------- Plan modal (floating button + tabs) ---------- */
.plan-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 50;
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--sage); color: #fff; border: none;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(139, 168, 136, 0.4);
  cursor: pointer; transition: all 0.2s;
}
.plan-fab:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 12px 32px rgba(139, 168, 136, 0.5); }
.plan-fab svg { width: 24px; height: 24px; }

#planModal {
  max-width: 1100px; width: calc(100% - 32px);
  height: 85vh; max-height: 85vh;
  padding: 0;
}
.plan-modal-inner { display: flex; height: 100%; min-height: 0; }

.plan-tabs {
  width: 220px; flex-shrink: 0;
  background: var(--bg); border-right: 1px solid var(--line);
  padding: 20px 10px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.plan-tab {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: transparent; border: none;
  border-radius: 10px; cursor: pointer; text-align: left;
  font-family: inherit; font-size: 0.9rem; color: var(--ink);
  transition: background 0.15s;
}
.plan-tab:hover { background: var(--card); }
.plan-tab.active { background: var(--card); border-left: 3px solid var(--sage); padding-left: 11px; font-weight: 600; }
.plan-tab svg { width: 16px; height: 16px; color: var(--sage); flex-shrink: 0; }

.plan-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.plan-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--line);
}
.plan-header h2 { margin: 0; font-size: 1.2rem; font-weight: 500; }

.plan-body { flex: 1; overflow-y: auto; padding: 24px 28px; line-height: 1.7; }
.plan-body h1 { font-size: 1.6rem; font-weight: 500; margin: 0 0 16px; }
.plan-body h2 { font-size: 1.2rem; font-weight: 500; margin: 28px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.plan-body h2:first-child, .plan-body h1 + h2 { border-top: none; padding-top: 0; margin-top: 20px; }
.plan-body h3 { font-size: 1rem; font-weight: 600; margin: 20px 0 8px; }
.plan-body p { margin: 0 0 12px; color: var(--soft); }
.plan-body strong { color: var(--ink); }
.plan-body hr { border: none; border-top: 1px solid var(--line); margin: 28px 0; }
.plan-body blockquote {
  border-left: 3px solid var(--sage); padding: 10px 16px;
  background: var(--sage-soft); border-radius: 0 8px 8px 0;
  margin: 14px 0; color: var(--ink); font-style: italic;
}
.plan-body code {
  background: var(--bg); padding: 2px 6px; border-radius: 4px;
  font-size: 0.85em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.plan-body pre {
  background: var(--bg); padding: 16px; border-radius: 10px;
  overflow-x: auto; font-size: 0.85rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.55;
}
.plan-body pre code { background: transparent; padding: 0; font-size: inherit; }

.plan-body table {
  width: 100%; border-collapse: collapse; margin: 14px 0;
  font-size: 0.9rem; background: var(--card);
}
.plan-body table th, .plan-body table td {
  text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top;
}
.plan-body table th { background: var(--bg); font-weight: 600; color: var(--ink); }
.plan-body table td { color: var(--soft); }

.plan-body ul.md-list { padding-left: 22px; margin: 8px 0 14px; }
.plan-body li { margin-bottom: 4px; color: var(--soft); }
.plan-body .task-item {
  list-style: none; margin-left: -22px;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 3px 0;
}
.plan-body .task-item input { margin-top: 5px; flex-shrink: 0; width: auto; }
.plan-body .task-item span { color: var(--ink); }
.plan-body .task-item input:checked + span { color: var(--muted); text-decoration: line-through; }

.plan-body .migration-prompt {
  background: var(--amber-soft); border-radius: 12px; padding: 0;
  margin: 16px 0; border: 1px solid var(--amber);
}
.plan-body .migration-prompt .mp-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--amber);
}
.plan-body .migration-prompt .mp-header span {
  font-size: 0.78rem; letter-spacing: 1px; text-transform: uppercase;
  color: #a87846; font-weight: 600;
}
.plan-body .migration-prompt pre {
  background: transparent; border-radius: 0 0 12px 12px; margin: 0;
}

/* ---------- Hardware advisor ---------- */
.hw-advisor {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 20px; margin: 12px 0;
}
.hw-form .hw-grid {
  display: grid; gap: 10px; grid-template-columns: 1fr 1fr;
  margin-bottom: 14px;
}
.hw-form label { margin-bottom: 10px; }
.hw-form .hw-checks {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  margin-bottom: 14px;
}
.hw-form .hw-checks label {
  display: flex; align-items: center; gap: 8px;
  font-weight: normal; color: var(--ink); margin: 0;
  font-size: 0.9rem;
}
.hw-form .hw-checks input {
  width: auto; margin: 0;
}

.hw-current {
  background: var(--sage-soft); border-radius: 12px;
  padding: 16px 18px; margin: 18px 0;
  display: flex; flex-direction: column; gap: 4px;
}
.hw-badge {
  display: inline-block; font-size: 0.7rem; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--sage); font-weight: 600;
}
.hw-current strong { color: var(--ink); font-size: 1.05rem; }
.hw-current-desc { color: var(--soft); font-size: 0.9rem; font-style: italic; }

.hw-phases { display: grid; gap: 10px; }
.hw-phase {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 18px;
  transition: all 0.2s;
}
.hw-phase.ok { border-left: 3px solid var(--sage); padding-left: 15px; }
.hw-phase.blocked { opacity: 0.6; border-left: 3px solid var(--line); padding-left: 15px; }
.hw-phase.current { background: var(--sage-soft); border-color: var(--sage); }

.hw-phase-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.95rem; margin-bottom: 4px;
}
.hw-phase-name { color: var(--soft); }
.hw-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted);
}
.hw-phase.ok .hw-dot { background: var(--sage); }
.hw-phase.current .hw-dot { background: var(--sage); box-shadow: 0 0 0 4px rgba(139, 168, 136, 0.3); }

.hw-status {
  margin-left: auto; font-size: 0.68rem; letter-spacing: 1px;
  text-transform: uppercase; color: var(--muted); font-weight: 600;
}
.hw-phase.ok .hw-status { color: var(--sage); }
.hw-phase.current .hw-status { color: var(--sage); font-weight: 700; }

.hw-phase-body p { margin: 0 0 4px; font-size: 0.9rem; color: var(--soft); }
.hw-needs small { color: var(--muted); }
.hw-upgrade { margin-top: 10px; }

/* ---------- Case tabs ---------- */
.case-tabs {
  display: flex; gap: 4px; justify-content: center;
  margin: 0 0 32px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  max-width: max-content;
  margin-left: auto; margin-right: auto;
}
.case-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px;
  background: transparent; border: none;
  font-family: inherit; font-size: 0.92rem;
  color: var(--soft); cursor: pointer;
  border-radius: 999px;
  transition: all 0.15s;
}
.case-tab:hover { color: var(--ink); background: var(--bg); }
.case-tab.active {
  background: var(--sage);
  color: #fff;
  font-weight: 500;
}
.case-tab svg { width: 16px; height: 16px; }
@media (max-width: 580px) {
  .case-tabs { width: 100%; max-width: none; border-radius: 16px; }
  .case-tab { flex: 1; padding: 10px 8px; font-size: 0.85rem; }
  .case-tab span { display: none; }
  .case-tab svg { width: 18px; height: 18px; }
  .case-tab.active span { display: inline; }
}

.tab-panel { animation: fadeIn 0.3s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .tab-panel { animation: none; }
}

/* ---------- People tab ---------- */
.people-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.person-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden;
  transition: all 0.2s ease;
}
.person-card:hover { border-color: var(--sage); box-shadow: var(--shadow-sm); }
.person-card.expanded { box-shadow: var(--shadow); border-color: var(--sage); }
.person-card[data-tone="rose"]:hover,
.person-card[data-tone="rose"].expanded { border-color: var(--rose); }
.person-card[data-tone="amber"]:hover,
.person-card[data-tone="amber"].expanded { border-color: var(--amber); }

.person-card-head {
  display: flex; align-items: center; gap: 16px;
  width: 100%; padding: 18px 22px;
  background: transparent; border: none; text-align: left;
  font-family: inherit; cursor: pointer; color: inherit;
  transition: background 0.15s;
}
.person-card-head:hover { background: var(--bg); }
.person-card-head:focus-visible { outline: 2px solid var(--sage); outline-offset: -2px; }

.person-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--sage-soft); color: var(--sage);
  flex-shrink: 0;
}
.person-card[data-tone="rose"] .person-icon { background: var(--rose-soft); color: #a77878; }
.person-card[data-tone="amber"] .person-icon { background: var(--amber-soft); color: #a87846; }
.person-icon svg { width: 22px; height: 22px; }

.person-head-text { flex: 1; min-width: 0; }
.person-head-text h3 { margin: 0 0 2px; font-size: 1.05rem; font-weight: 600; }
.person-role {
  font-size: 0.78rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1.2px;
}

.person-chevron-wrap {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--bg);
  color: var(--soft);
  transition: all 0.2s ease;
}
.person-card-head:hover .person-chevron-wrap { background: var(--sage-soft); color: var(--sage); }
.person-chevron-wrap svg {
  width: 18px; height: 18px;
  transition: transform 0.2s ease;
}
.person-card.expanded .person-chevron-wrap { background: var(--sage-soft); color: var(--sage); }
.person-card.expanded .person-chevron-wrap svg { transform: rotate(180deg); }

.person-card-body { padding: 8px 22px 24px; }
.person-summary {
  font-style: italic; color: var(--soft);
  border-left: 2px solid var(--line);
  padding-left: 14px; margin: 0 0 18px;
}
.person-block { margin-bottom: 18px; }
.person-block:last-child { margin-bottom: 0; }
.person-block h4 {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--soft); margin: 0 0 8px; font-weight: 600;
}
.person-block ul { padding-left: 18px; margin: 0; color: var(--soft); }
.person-block li { margin-bottom: 4px; }

.person-disclaimer {
  font-size: 0.82rem; color: var(--muted); font-style: italic;
  background: var(--bg); padding: 8px 12px; border-radius: 8px;
  margin: 0 0 12px;
}

.person-issue {
  margin-bottom: 8px; padding: 12px 14px;
  background: var(--bg); border-radius: 10px;
}
.person-issue summary {
  cursor: pointer; color: var(--ink);
  list-style: none; display: flex; align-items: center;
}
.person-issue summary::-webkit-details-marker { display: none; }
.person-issue summary::before {
  content: "+"; margin-right: 10px; color: var(--sage);
  font-weight: 600; transition: transform 0.2s;
}
.person-issue[open] summary::before { content: "−"; }
.person-issue p { margin: 8px 0; color: var(--soft); font-size: 0.92rem; }
.person-issue .issue-refs { margin-top: 12px; font-size: 0.88rem; }
.person-issue .issue-refs strong {
  display: block; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--soft); margin-bottom: 6px;
}
.person-issue .issue-refs ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.person-issue .issue-refs a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--sage); text-decoration: none;
  padding: 4px 0;
}
.person-issue .issue-refs a:hover { text-decoration: underline; }
.person-issue .issue-refs a svg {
  width: 12px; height: 12px;
  opacity: 0.6;
}

/* References footer (legais) */
ul.ref-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
ul.ref-links li {
  background: var(--card); border-radius: 8px;
}
ul.ref-links a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  color: var(--ink); text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s;
}
ul.ref-links a:hover { background: var(--sage-soft); color: var(--sage); }
ul.ref-links a > svg { width: 16px; height: 16px; color: var(--sage); flex-shrink: 0; }
ul.ref-links a > span { flex: 1; }
ul.ref-links a .ext-icon { width: 14px; height: 14px; opacity: 0.5; }

/* ---------- Actions tab ---------- */
.actions-intro {
  background: var(--sage-soft); padding: 16px 20px;
  border-radius: 12px; color: var(--ink);
  font-style: italic; margin: 0 0 24px;
}

.actions-pros-cons {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px; margin-bottom: 24px;
}
@media (max-width: 640px) {
  .actions-pros-cons { grid-template-columns: 1fr; }
}
.prox-cons-col {
  padding: 20px 22px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line);
}
.prox-cons-col.col-cons { border-left: 3px solid var(--rose); }
.prox-cons-col.col-pros { border-left: 3px solid var(--sage); }
.prox-cons-col h3 {
  margin: 0 0 12px; font-size: 1rem; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.prox-cons-col.col-cons h3 { color: #a77878; }
.prox-cons-col.col-pros h3 { color: var(--sage); }
.prox-cons-col h3 svg { width: 18px; height: 18px; }
.prox-cons-col ul { padding-left: 18px; margin: 0; color: var(--soft); font-size: 0.93rem; }
.prox-cons-col li { margin-bottom: 6px; }

.actions-rights {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 24px; margin-bottom: 24px;
}
.actions-rights h3 {
  margin: 0 0 16px; font-size: 1.1rem; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.actions-rights h3 svg { width: 20px; height: 20px; color: var(--sage); }
.rights-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
}
@media (max-width: 700px) {
  .rights-grid { grid-template-columns: 1fr; }
}
.rights-col h4 {
  margin: 0 0 8px; font-size: 0.82rem;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--sage); font-weight: 600;
}
.rights-col.rights-loses h4 { color: #a87846; }
.rights-col ul { padding-left: 18px; margin: 0; color: var(--soft); font-size: 0.9rem; }
.rights-col li { margin-bottom: 5px; }

.actions-plans {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 24px; margin-bottom: 24px;
}
.actions-plans > h3 {
  margin: 0 0 16px; font-size: 1.1rem; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.actions-plans > h3 svg { width: 20px; height: 20px; color: var(--sage); }
.action-plan { padding: 16px 0; border-top: 1px dashed var(--line); }
.action-plan:first-of-type { border-top: none; padding-top: 0; }
.action-plan h4 {
  margin: 0 0 10px; font-size: 0.92rem;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--sage); font-weight: 600;
}
.action-plan-days h4 { color: #a77878; }
.action-plan-weeks h4 { color: #a87846; }
.action-plan-months h4 { color: var(--sage); }
.action-plan ol { padding-left: 22px; margin: 0; }
.action-plan li { margin-bottom: 12px; color: var(--ink); }
.action-plan li strong { color: var(--ink); display: block; margin-bottom: 2px; }
.action-plan li p { margin: 4px 0 0; color: var(--soft); font-size: 0.92rem; line-height: 1.6; }

/* ---------- Extremes ---------- */
.extremes {
  background: #faf3ec; border: 1px solid #e6d4b5;
  border-radius: 14px; overflow: hidden; margin-top: 24px;
}
.extremes summary {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 24px; cursor: pointer;
  list-style: none; user-select: none;
  transition: background 0.15s;
}
.extremes summary:hover { background: rgba(212, 163, 115, 0.08); }
.extremes summary::-webkit-details-marker { display: none; }
.extremes .ext-icon-wrap {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--amber-soft); color: #a87846; flex-shrink: 0;
}
.extremes .ext-icon-wrap svg { width: 22px; height: 22px; }
.extremes .ext-title-wrap { flex: 1; min-width: 0; }
.extremes .ext-title {
  display: block; font-weight: 600; color: #a87846; font-size: 1.02rem;
}
.extremes .ext-warning {
  display: block; font-size: 0.85rem; color: var(--soft);
  font-style: italic; margin-top: 2px;
}
.extremes .ext-chev {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--card); color: #a87846; flex-shrink: 0;
}
.extremes .ext-chev svg {
  width: 18px; height: 18px;
  transition: transform 0.2s ease;
}
.extremes[open] .ext-chev svg { transform: rotate(180deg); }
.extremes[open] summary { border-bottom: 1px solid #e6d4b5; }
.extremes-body { padding: 24px; }
.ext-section { margin-bottom: 24px; }
.ext-section:last-child { margin-bottom: 0; }
.ext-section h4 {
  margin: 0 0 10px; font-size: 1rem; font-weight: 600; color: var(--ink);
}
.ext-disclaimer {
  font-size: 0.85rem; color: var(--soft); font-style: italic;
  background: var(--card); padding: 10px 14px; border-radius: 8px;
  margin: 0 0 14px;
}

.crimes-list { display: grid; gap: 10px; }
.crime-item {
  background: var(--card); border-radius: 10px;
  padding: 14px 16px; border-left: 3px solid var(--amber);
}
.crime-item.severity-alta { border-left-color: var(--rose); }
.crime-item.severity-media { border-left-color: var(--amber); }
.crime-item h5 { margin: 0 0 4px; font-size: 0.95rem; font-weight: 600; }
.crime-law {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); margin: 0 0 8px;
}
.crime-evidence { margin: 0; color: var(--soft); font-size: 0.9rem; }

.report-section { padding-top: 8px; }
.report-section > p {
  color: var(--soft); margin-bottom: 14px;
}
.report-toggle {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; margin: 16px 0;
  padding: 16px 24px;
  font-size: 1rem; font-weight: 600;
  background: linear-gradient(135deg, #d4a373 0%, #c8a06f 100%);
  color: #fff; border: none;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(212, 163, 115, 0.3);
  cursor: pointer;
  transition: all 0.2s ease;
}
.report-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(212, 163, 115, 0.4);
}
.report-toggle svg { width: 20px; height: 20px; }
.report-toggle.active {
  background: var(--card); color: #a87846;
  border: 2px solid #a87846; box-shadow: none;
}
.report-toggle.active:hover { transform: none; box-shadow: var(--shadow-sm); }

.report-guide {
  margin-top: 18px;
  background: var(--card); border-radius: 12px;
  padding: 22px; border: 1px solid var(--line);
}
.report-block { margin-bottom: 22px; }
.report-block:last-child { margin-bottom: 0; }
.report-block h4 {
  margin: 0 0 12px; font-size: 0.95rem; font-weight: 600;
  color: var(--ink);
}
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 14px;
  color: var(--ink); font-size: 0.93rem;
  background: var(--bg);
  border-radius: 10px;
  margin-bottom: 6px;
  transition: background 0.15s;
}
.checklist li:hover { background: var(--sage-soft); }
.checklist li.checked { color: var(--muted); text-decoration: line-through; }
.checklist .check-circle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--card);
  flex-shrink: 0; margin-top: 1px;
  transition: all 0.15s;
}
.checklist li:hover .check-circle { border-color: var(--sage); }
.checklist li.checked .check-circle { background: var(--sage); border-color: var(--sage); }
.checklist .check-circle svg {
  width: 14px; height: 14px; color: #fff;
  opacity: 0; transition: opacity 0.15s;
}
.checklist li.checked .check-circle svg { opacity: 1; }
.checklist li > span:last-child { flex: 1; line-height: 1.5; }

.where-list { display: grid; gap: 10px; }
.where-item {
  display: flex; gap: 14px;
  background: var(--bg); border-radius: 12px; padding: 16px 18px;
  transition: all 0.15s;
}
.where-item:hover { background: var(--sage-soft); }
.where-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--card); color: var(--sage);
  flex-shrink: 0;
}
.where-icon svg { width: 18px; height: 18px; }
.where-content { flex: 1; min-width: 0; }
.where-item h5 { margin: 0 0 4px; font-size: 0.97rem; font-weight: 600; line-height: 1.3; }
.where-type {
  display: inline-block; font-size: 0.7rem;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--sage); font-weight: 600; margin-bottom: 6px;
}
.where-item p { margin: 0; color: var(--soft); font-size: 0.88rem; line-height: 1.5; }
.where-item p a {
  color: var(--sage); text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
.where-item p a:hover { border-bottom-color: var(--sage); }

.phones-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.phone-card {
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  background: var(--sage-soft);
  padding: 16px 12px;
  border-radius: 12px; text-decoration: none;
  color: var(--sage);
  transition: all 0.15s;
  min-height: 110px;
}
.phone-card:hover {
  transform: translateY(-2px);
  background: var(--sage); color: #fff;
  box-shadow: var(--shadow-sm);
}
.phone-card:hover .phone-label { color: rgba(255,255,255,0.92); }
.phone-number {
  font-size: 1.7rem; font-weight: 700; line-height: 1;
  margin-bottom: 8px;
}
.phone-label {
  font-size: 0.74rem; color: var(--soft);
  text-align: center; line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.protective-block {
  background: var(--card);
  border: 1px solid var(--sage);
  padding: 22px; border-radius: 14px;
}
.protective-block > h4 { display: none; } /* substituído pelo protective-header */
.protective-header {
  display: flex; gap: 14px; align-items: flex-start;
  margin-bottom: 14px;
}
.protective-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: var(--sage-soft); color: var(--sage);
  border-radius: 12px; flex-shrink: 0;
}
.protective-icon svg { width: 22px; height: 22px; }
.protective-header h4 { margin: 0 0 2px; font-size: 1rem; }
.protective-law {
  margin: 0; font-size: 0.82rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px;
}
.protective-desc { color: var(--soft); margin: 0 0 16px; }

.protective-includes h5 {
  margin: 0 0 10px; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--soft); font-weight: 600;
}
.protective-includes ul {
  list-style: none; padding: 0; margin: 0 0 16px;
  display: grid; gap: 6px;
}
.protective-includes li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 12px;
  background: var(--bg); border-radius: 8px;
  color: var(--ink); font-size: 0.92rem;
}
.protective-includes li svg {
  width: 16px; height: 16px; color: var(--sage);
  flex-shrink: 0; margin-top: 2px;
}

.protective-block .emphasis {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--sage-soft);
  color: var(--sage);
  padding: 12px 16px; border-radius: 10px;
  font-size: 0.92rem; font-weight: 500;
  margin-bottom: 10px;
}
.protective-block .emphasis svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.protective-block .emphasis span { color: var(--ink); font-weight: 500; }

.protective-block .warning-box {
  display: flex; gap: 10px; align-items: flex-start;
  background: #fbeae0;
  padding: 12px 16px; border-radius: 10px;
  font-size: 0.92rem;
}
.protective-block .warning-box svg { width: 18px; height: 18px; color: #c47a7a; flex-shrink: 0; margin-top: 1px; }
.protective-block .warning-box span { color: #8a4747; }
.protective-block .warning-box strong { color: #6e3636; }

/* ---------- Status banner (chip flutuante topo) ---------- */
.status-banner {
  position: fixed; top: 16px; left: 16px; z-index: 55;
}
.status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 14px;
  font-family: inherit; font-size: 0.78rem; color: var(--soft);
  cursor: pointer; transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.status-pill:hover { border-color: var(--sage); color: var(--ink); }
.status-pill .status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted);
}
.status-pill[data-mode="local"] .status-dot,
.status-pill[data-mode="tunnel"] .status-dot,
.status-pill[data-mode="remote"] .status-dot {
  background: var(--sage); box-shadow: 0 0 0 3px rgba(139, 168, 136, 0.25);
}
.status-pill[data-mode="offline"] .status-dot { background: var(--amber); }

#backendSettingsDialog { max-width: 540px; }
.status-info { margin-bottom: 18px; }
.status-ok strong { color: var(--sage); display: block; }
.status-off strong { color: var(--amber); display: block; }
.status-info .muted { font-size: 0.85rem; color: var(--muted); display: block; margin-top: 4px; }
.status-info p { margin-top: 10px; color: var(--soft); font-size: 0.9rem; }

.llm-status {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; padding: 10px 14px;
  border-radius: 10px;
}
.llm-status.ok { background: var(--sage-soft); color: var(--sage); }
.llm-status.off { background: var(--amber-soft); color: #a87846; }
.llm-status svg { width: 16px; height: 16px; flex-shrink: 0; }
.llm-status strong { color: var(--ink); }
.llm-status span { font-size: 0.82rem; color: var(--soft); margin-left: 4px; }

.feature-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.feature {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.78rem; padding: 3px 10px; border-radius: 10px;
}
.feature.on { background: var(--sage-soft); color: var(--sage); }
.feature.off { background: var(--bg); color: var(--muted); text-decoration: line-through; }
.feature svg { width: 12px; height: 12px; }

.status-help {
  margin-top: 14px;
  background: var(--bg); border-radius: 10px; padding: 10px 14px;
  font-size: 0.88rem;
}
.status-help summary { cursor: pointer; color: var(--soft); }
.status-help ol { margin: 10px 0 0; padding-left: 20px; color: var(--soft); }
.status-help li { margin-bottom: 4px; }
.status-help code { font-size: 0.85em; }

/* Test status panel */
.test-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px; margin: 14px 0;
}
.test-stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 12px; text-align: center;
}
.test-stat strong { display: block; font-size: 1.6rem; font-weight: 500; }
.test-stat span { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.test-stat-pass strong { color: var(--sage); }
.test-stat-fail strong { color: #c47a7a; }
.test-stat-skip strong { color: var(--amber); }
.test-updated { grid-column: 1 / -1; color: var(--muted); font-size: 0.78rem; text-align: center; font-style: italic; }

.test-loading, .test-empty { padding: 20px; color: var(--muted); font-style: italic; }

.task-badge {
  display: inline-block; margin-left: 8px; padding: 1px 8px;
  font-size: 0.72rem; border-radius: 10px; font-weight: 600;
  vertical-align: middle; letter-spacing: 0.5px;
}
.task-badge-pass { background: var(--sage-soft); color: var(--sage); }
.task-badge-fail { background: #f5d8d8; color: #a55454; }
.task-badge-skip { background: var(--amber-soft); color: #a87846; }
.task-badge-pending { background: var(--bg); color: var(--muted); }

.task-error { margin: 6px 0 0 28px; font-size: 0.85rem; }
.task-error summary { cursor: pointer; color: #a55454; }
.task-error pre {
  background: #fdf0f0; padding: 10px; border-radius: 6px; margin-top: 6px;
  font-size: 0.8rem; white-space: pre-wrap;
}

.test-bonus {
  margin-top: 16px; padding: 14px 18px;
  background: var(--sage-soft); border-radius: 12px;
}
.test-bonus strong { font-size: 0.85rem; display: block; margin-bottom: 8px; }
.test-bonus ul { margin: 0; padding-left: 20px; }
.test-bonus li { font-size: 0.88rem; color: var(--ink); }

/* ---------- Accessibility: reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .gatilho:hover, .case-card:hover, .btn:hover, .plan-fab:hover { transform: none !important; }
  .detail.flash { animation: none !important; }
}

/* ---------- Dark mode via prefers-color-scheme ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1d22;
    --card: #2a282e;
    --ink: #e9e6df;
    --soft: #b0a99e;
    --muted: #7e7a72;
    --sage: #a6c2a3;
    --sage-soft: #333a33;
    --rose: #d8b8b8;
    --rose-soft: #3a3030;
    --amber: #e0b885;
    --amber-soft: #3a3228;
    --line: #3a383f;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
  }
  .voice { background: linear-gradient(135deg, var(--sage-soft) 0%, var(--rose-soft) 100%); }
  .detail .inline-quote { background: var(--bg); }
  dialog::backdrop { background: rgba(0, 0, 0, 0.7); }
  .task-error pre { background: #2e2224; }
  .task-badge-fail { background: #4a2a2a; color: #eaa8a8; }
}

/* ---------- Print mode ---------- */
@media print {
  :root { --bg: #ffffff; }
  body { background: #fff; }
  .wrap { padding: 24px; max-width: none; }
  .actions-bar, dialog, #aiDialog, .chat-form { display: none !important; }
  .detail, .timeline-card, .voice { break-inside: avoid; page-break-inside: avoid; box-shadow: none; }
  .gatilho { box-shadow: none; }
  a { color: inherit; text-decoration: none; }
}
body.print-mode .actions-bar { display: none !important; }
