/* =========================================================
   AMPARO — Painel de gestão de casos (demonstração)
   Identidade: dourado #B09565 · grafite #1B1818 · papel #F4F1EA
   ========================================================= */

:root {
  --gold: #B09565;
  --gold-deep: #77602F;
  --gold-soft: #E8DCC4;
  --gold-wash: #F3EBDC;
  --ink: #1B1818;
  --ink-2: #4A4441;
  --muted: #7A716B;
  --bg: #F4F1EA;
  --surface: #FFFFFF;
  --surface-2: #FAF8F3;
  --line: #E4DED2;
  --line-strong: #D2CABB;
  --side: #191616;
  --high: #A33A2E;
  --high-bg: #F6E2DE;
  --mid: #94651A;
  --mid-bg: #F7EBD2;
  --low: #33604A;
  --low-bg: #E1ECE4;
  --info: #3C5568;
  --info-bg: #E3EBF1;
  --danger: #A33A2E;
  --shadow: 0 1px 2px rgba(27, 24, 24, 0.04), 0 8px 24px rgba(27, 24, 24, 0.05);
  --r: 6px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  margin: 0;
  font-family: "Sora", "Montserrat", system-ui, sans-serif;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-weight: 600;
}
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; }
svg { display: block; }
img { display: block; max-width: 100%; }

:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; border-radius: 3px; }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 0 0 4px 0;
}
.skip-link:focus { left: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Estrutura ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--side);
  color: rgba(255, 255, 255, 0.62);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  overflow-y: auto;
  z-index: 60;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; text-decoration: none; }
.brand img { width: 108px; height: auto; filter: brightness(0) invert(1); opacity: 0.94; }
.brand-sub {
  display: block; margin: -12px 0 18px 8px;
  font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.32);
}
.workspace {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  padding: 9px 10px;
  margin-bottom: 6px;
}
.ws-mark {
  width: 26px; height: 26px; border-radius: 4px;
  background: rgba(176, 149, 101, 0.22);
  color: var(--gold-soft);
  display: grid; place-items: center;
  font-family: "Sora", sans-serif; font-size: 10px; font-weight: 600;
  flex: 0 0 auto;
}
.ws-txt { min-width: 0; }
.ws-txt strong { display: block; color: rgba(255, 255, 255, 0.9); font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-txt span { display: block; font-size: 9.5px; color: rgba(255, 255, 255, 0.4); }
.ws-chev { margin-left: auto; color: rgba(255, 255, 255, 0.35); font-size: 10px; }

.nav-label {
  margin: 20px 10px 7px;
  font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
}
.snav { display: grid; gap: 2px; }
.snav a {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.62);
  text-decoration: none;
  font-size: 12.5px;
  transition: background-color 0.18s, color 0.18s;
}
.snav a:hover { background: rgba(255, 255, 255, 0.06); color: rgba(255, 255, 255, 0.9); }
.snav a.active { background: rgba(176, 149, 101, 0.15); color: #fff; }
.snav a.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 2px; border-radius: 2px; background: var(--gold);
}
.snav svg { width: 16px; height: 16px; flex: 0 0 auto; opacity: 0.8; }
.snav .count {
  margin-left: auto;
  font-size: 9.5px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 1px 6px;
}
.snav a.active .count { background: rgba(176, 149, 101, 0.3); color: var(--gold-soft); }

.side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.side-note {
  margin: 0 8px 12px;
  font-size: 9.5px; line-height: 1.5;
  color: rgba(255, 255, 255, 0.32);
}
.user { display: flex; align-items: center; gap: 9px; padding: 4px 8px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--gold); color: #1B1818;
  display: grid; place-items: center;
  font-family: "Sora", sans-serif; font-size: 10px; font-weight: 700;
  flex: 0 0 auto;
}
.user-txt { min-width: 0; }
.user-txt strong { display: block; color: rgba(255, 255, 255, 0.86); font-size: 11px; font-weight: 600; }
.user-txt span { display: block; font-size: 9.5px; color: rgba(255, 255, 255, 0.4); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: 62px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 30px;
  background: rgba(244, 241, 234, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); min-width: 0; }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs span.sep { color: var(--line-strong); }
.crumbs strong { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.demo-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--gold-deep);
  background: var(--gold-wash);
  border: 1px solid rgba(176, 149, 101, 0.4);
  border-radius: 999px;
  padding: 4px 9px;
  white-space: nowrap;
}
.demo-chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }
.icon-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 4px;
  display: grid; place-items: center;
  color: var(--ink-2);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--line-strong); background: var(--surface-2); }
.menu-btn { display: none; }

.view {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 26px 30px 56px;
  flex: 1;
}

/* ---------- Cabeçalho de página ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h1 { font-size: 22px; letter-spacing: -0.03em; }
.page-head .sub { margin-top: 5px; font-size: 11.5px; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 14px;
  border-radius: 4px;
  border: 1px solid transparent;
  font-family: "Sora", sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.18s, border-color 0.18s, color 0.18s;
  white-space: nowrap;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #322C2A; }
.btn-gold { background: var(--gold); color: #1B1818; }
.btn-gold:hover { background: #BFA574; }
.btn-ghost { background: var(--surface); color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--line-strong); background: var(--surface-2); }
.btn-sm { padding: 6px 10px; font-size: 10.5px; }

/* ---------- Cartões ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 13px; }
.card-head .hint { font-size: 10px; color: var(--muted); }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 15px 16px 13px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.kpi .k-label { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.kpi .k-value { font-family: "Sora", sans-serif; font-size: 26px; font-weight: 600; color: var(--ink); letter-spacing: -0.04em; margin-top: 6px; line-height: 1; }
.kpi .k-value small { font-size: 12px; font-weight: 400; letter-spacing: 0; color: var(--muted); margin-left: 2px; }
.kpi .k-foot { display: flex; align-items: center; gap: 6px; margin-top: 9px; font-size: 10px; color: var(--muted); }
.delta { font-weight: 600; font-size: 10px; }
.delta.up { color: var(--high); }
.delta.down { color: var(--low); }
.delta.neutral { color: var(--muted); }
.kpi svg { position: absolute; right: 12px; bottom: 12px; opacity: 0.9; }

/* ---------- Grades ---------- */
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 12px; margin-bottom: 12px; }
.split-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 12px; align-items: start; }
.overview-grid > *, .split-grid > *, .detail-grid > *, .settings-grid > *, .report-grid > * { min-width: 0; }

/* ---------- Gráfico ---------- */
.chart-wrap { padding: 8px 6px 0; }
.chart-wrap svg { width: 100%; height: auto; }
.chart-legend { display: flex; gap: 16px; padding: 4px 18px 14px; font-size: 10px; color: var(--muted); }
.chart-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

/* ---------- Donut ---------- */
.donut-wrap { display: flex; align-items: center; gap: 20px; padding: 4px 18px 16px; }
.donut {
  position: relative;
  width: 118px; height: 118px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: conic-gradient(var(--high) 0 18.4%, var(--mid) 18.4% 55.2%, var(--low) 55.2% 100%);
}
.donut::after {
  content: "";
  position: absolute; inset: 26px;
  background: var(--surface);
  border-radius: 50%;
}
.donut-center {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  z-index: 1;
  text-align: center;
}
.donut-center b { display: block; font-family: "Sora", sans-serif; font-size: 21px; color: var(--ink); line-height: 1; }
.donut-center span { display: block; font-size: 9px; color: var(--muted); margin-top: 3px; }
.donut-legend { display: grid; gap: 9px; font-size: 11px; }
.donut-legend div { display: flex; align-items: center; gap: 7px; }
.donut-legend i { width: 7px; height: 7px; border-radius: 50%; }
.donut-legend b { margin-left: auto; color: var(--ink); font-weight: 600; }
.donut-legend span { color: var(--muted); }

/* ---------- Tabelas ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 12px; }
table.data th {
  text-align: left;
  font-family: "Sora", sans-serif;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 9px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background-color 0.15s; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover { background: var(--surface-2); }
table.data .proto { font-family: "Sora", sans-serif; font-size: 11px; font-weight: 600; color: var(--ink); white-space: nowrap; }
table.data .cat { color: var(--ink); font-weight: 500; }
table.data .muted { color: var(--muted); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
.row-sub { display: block; font-size: 9.5px; color: var(--muted); margin-top: 2px; }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); font-size: 12px; }
.show-sm { display: none; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.high { background: var(--high-bg); color: var(--high); }
.badge.mid { background: var(--mid-bg); color: var(--mid); }
.badge.low { background: var(--low-bg); color: var(--low); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.neutral { background: #EDE9E1; color: #6A625C; }
.badge.gold { background: var(--gold-wash); color: var(--gold-deep); }
.badge.no-dot::before { display: none; }

/* ---------- Filtros ---------- */
.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.search {
  position: relative;
  flex: 1 1 240px;
  max-width: 360px;
}
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 14px; height: 14px; }
.search input {
  width: 100%;
  padding: 9px 12px 9px 33px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  font-family: inherit;
  font-size: 12px;
  color: var(--ink);
}
.search input:focus { outline: none; border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(176, 149, 101, 0.18); }
select.control {
  padding: 9px 28px 9px 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237A716B' fill='none' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 10px center;
  appearance: none;
  font-family: inherit;
  font-size: 11.5px;
  color: var(--ink-2);
  cursor: pointer;
}
select.control:focus { outline: none; border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(176, 149, 101, 0.18); }
.result-line { font-size: 10.5px; color: var(--muted); margin-left: auto; white-space: nowrap; }

/* ---------- Detalhe ---------- */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--muted); text-decoration: none;
  margin-bottom: 12px;
}
.back-link:hover { color: var(--ink); }
.detail-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.detail-id { font-family: "Sora", sans-serif; font-size: 10.5px; letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; }
.detail-head h1 { font-size: 21px; margin: 4px 0 8px; }
.detail-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.detail-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.85fr); gap: 12px; align-items: start; }

.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--line);
  padding: 0 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  padding: 11px 12px;
  border: 0;
  background: none;
  font-family: "Sora", sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px;
  height: 2px; background: var(--gold); border-radius: 2px;
}
.tabpanel { padding: 18px; }
.tabpanel h3 { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.tabpanel p + p { margin-top: 10px; }
.tabpanel .prose { font-size: 12.5px; line-height: 1.65; color: var(--ink-2); }
.tabpanel .prose strong { color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 3px 9px;
}
.attach { display: grid; gap: 7px; }
.attach a {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 9px 11px;
  text-decoration: none;
  font-size: 11px;
  color: var(--ink-2);
  background: var(--surface-2);
}
.attach a:hover { border-color: var(--line-strong); }
.attach .fname { font-weight: 600; color: var(--ink); }
.attach .fsize { margin-left: auto; color: var(--muted); font-size: 10px; }

.kv { display: grid; gap: 0; margin: 0; }
.kv div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 11.5px; }
.kv div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); flex: 0 0 auto; }
.kv dd { margin: 0; text-align: right; color: var(--ink); font-weight: 500; }

.people { display: grid; gap: 10px; }
.person { display: flex; align-items: center; gap: 9px; }
.p-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-family: "Sora", sans-serif; font-size: 9px; font-weight: 600; color: var(--ink-2);
  flex: 0 0 auto;
}
.person .p-txt strong { display: block; font-size: 11px; color: var(--ink); font-weight: 600; }
.person .p-txt span { display: block; font-size: 9.5px; color: var(--muted); }
.person .badge { margin-left: auto; }

.msg-list { display: grid; gap: 12px; }
.msg { max-width: 88%; }
.msg-meta { font-size: 9.5px; color: var(--muted); margin-bottom: 4px; }
.msg-bubble {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 2px 8px 8px 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.55;
}
.msg.team { margin-left: auto; }
.msg.team .msg-meta { text-align: right; }
.msg.team .msg-bubble { background: var(--gold-wash); border-color: rgba(176, 149, 101, 0.35); border-radius: 8px 2px 8px 8px; }
.composer { display: flex; gap: 8px; margin-top: 14px; }
.composer input {
  flex: 1;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: inherit;
  font-size: 12px;
}
.composer input:focus { outline: none; border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(176, 149, 101, 0.18); }

.notes { display: grid; gap: 10px; }
.note {
  border-left: 2px solid var(--gold);
  background: var(--surface-2);
  padding: 9px 12px;
  font-size: 11.5px;
}
.note .note-meta { font-size: 9.5px; color: var(--muted); margin-bottom: 3px; }

.timeline { display: grid; gap: 0; }
.tl-item { position: relative; padding: 0 0 16px 20px; border-left: 1px solid var(--line); margin-left: 4px; }
.tl-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -3.5px; top: 3px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
}
.tl-item strong { display: block; font-size: 11.5px; color: var(--ink); font-weight: 600; }
.tl-item span { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }

.checklist { display: grid; gap: 8px; }
.check-item {
  display: flex; align-items: flex-start; gap: 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 9px 11px;
  font-size: 11.5px;
}
.check-item input { margin-top: 2px; accent-color: var(--gold-deep); }
.check-item.done span { text-decoration: line-through; color: var(--muted); }
.check-item .due { margin-left: auto; font-size: 9.5px; color: var(--muted); white-space: nowrap; }

.confid {
  background: var(--surface-2);
  border: 1px dashed rgba(176, 149, 101, 0.7);
  border-radius: 4px;
  padding: 12px;
  font-size: 10.5px;
  color: var(--ink-2);
  line-height: 1.55;
}
.confid strong { display: block; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-deep); margin-bottom: 5px; }

/* ---------- Riscos ---------- */
.factor-list { display: grid; gap: 13px; }
.factor { display: grid; gap: 5px; }
.factor-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11.5px; }
.factor-top b { color: var(--ink); font-weight: 600; }
.factor-top span { color: var(--muted); font-size: 10px; }
.bar { height: 7px; border-radius: 3px; background: #EDE8DD; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); border-radius: 3px; }
.bar i.high { background: var(--high); }
.bar i.mid { background: var(--gold); }
.bar i.low { background: var(--low); }

.matrix-wrap { overflow-x: auto; }
.matrix {
  display: grid;
  grid-template-columns: 74px repeat(5, minmax(36px, 1fr));
  gap: 3px;
  min-width: 300px;
}
.matrix .m-label { font-size: 9px; color: var(--muted); display: flex; align-items: center; }
.matrix .m-axis { font-size: 8.5px; color: var(--muted); text-align: center; padding: 2px 0; }
.cell { aspect-ratio: 1.5; border-radius: 3px; position: relative; }
.cell.c1 { background: #E4EDE5; }
.cell.c2 { background: #F1E9CE; }
.cell.c3 { background: #F4DDD0; }
.cell.c4 { background: #EFC9C0; }
.cell .dot {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 13px; height: 13px; border-radius: 50%;
  background: rgba(27, 24, 24, 0.72);
  color: #fff; font-size: 7.5px; font-weight: 700;
  display: grid; place-items: center;
}
.matrix-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 9px; color: var(--muted); margin-top: 10px; }
.matrix-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }

/* ---------- Tarefas / relatórios ---------- */
.seg { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 3px; }
.seg button {
  border: 0; background: none; border-radius: 3px;
  padding: 5px 10px; font-size: 10.5px; color: var(--muted); cursor: pointer;
}
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(27,24,24,.08); }
.report-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 12px; }
.report-card { padding: 18px; display: flex; flex-direction: column; }
.report-card .r-icon {
  width: 32px; height: 32px; border-radius: 4px;
  background: var(--gold-wash); color: var(--gold-deep);
  display: grid; place-items: center; margin-bottom: 12px;
}
.report-card h3 { font-size: 12.5px; margin-bottom: 5px; }
.report-card p { font-size: 11px; color: var(--muted); line-height: 1.55; }
.report-card .r-foot { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.report-card .r-foot span { font-size: 9.5px; color: var(--muted); }

.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.setting-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row strong { display: block; font-size: 11.5px; color: var(--ink); font-weight: 600; }
.setting-row p { font-size: 10px; color: var(--muted); margin-top: 3px; max-width: 38ch; }
.switch { position: relative; width: 34px; height: 19px; flex: 0 0 auto; margin-top: 2px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; background: #DAD3C7; border-radius: 999px; transition: background-color 0.2s; }
.switch .track::after { content: ""; position: absolute; width: 13px; height: 13px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: transform 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,.18); }
.switch input:checked + .track { background: var(--gold-deep); }
.switch input:checked + .track::after { transform: translateX(15px); }
.switch input:focus-visible + .track { outline: 2px solid var(--gold-deep); outline-offset: 2px; }

table.data.perm-table td, table.data.perm-table th { font-size: 10.5px; padding: 9px 10px; }
table.data.perm-table th:not(:first-child), table.data.perm-table td:not(:first-child) { text-align: center; }
.yes { color: var(--low); font-weight: 700; }
.no { color: #BDB5A9; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: 120;
  display: flex; align-items: center; gap: 9px;
  background: var(--ink);
  color: rgba(255, 255, 255, 0.92);
  border-radius: 5px;
  padding: 11px 15px;
  font-size: 11.5px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  max-width: min(360px, calc(100vw - 40px));
}
.toast.show { opacity: 1; transform: none; }
.toast::before { content: "✓"; color: var(--gold-soft); font-weight: 700; }

/* ---------- Scrim / mobile ---------- */
.scrim {
  display: none;
  position: fixed; inset: 0;
  background: rgba(20, 17, 17, 0.45);
  z-index: 55;
  opacity: 0;
  transition: opacity 0.25s;
}
.scrim.show { display: block; opacity: 1; }

/* ---------- Responsivo ---------- */
@media (max-width: 1120px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .overview-grid, .split-grid, .detail-grid { grid-template-columns: 1fr; }
  .report-grid, .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .hide-md { display: none; }
  .view { padding: 20px 18px 48px; }
  .topbar { padding: 0 18px; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: 264px;
    transform: translateX(-100%);
    transition: transform 0.28s var(--ease);
    height: 100dvh;
  }
  .sidebar.open { transform: none; }
  .menu-btn { display: grid; }
  .topbar .crumbs { font-size: 10.5px; }
  .demo-chip { display: none; }
}

@media (max-width: 560px) {
  .hide-sm { display: none; }
  .show-sm { display: block; }
  .chart-wrap svg text { display: none; }
  .page-head h1 { font-size: 19px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 12px; }
  .kpi .k-value { font-size: 22px; }
  .kpi svg { display: none; }
  .detail-actions { width: 100%; }
  .detail-actions .btn { flex: 1; }
  .toolbar .search { max-width: none; }
  .toolbar select.control { flex: 1 1 42%; }
  .result-line { margin-left: 0; }
  .donut-wrap { flex-direction: column; align-items: flex-start; }
  .toast { right: 12px; left: 12px; bottom: 12px; max-width: none; }
  .report-card .r-foot { flex-direction: column; align-items: flex-start; }

  table.data.stack-sm { display: block; }
  table.data.stack-sm thead { display: none; }
  table.data.stack-sm tbody { display: block; }
  table.data.stack-sm tr { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; row-gap: 8px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
  table.data.stack-sm tr:last-child { border-bottom: 0; }
  table.data.stack-sm td { display: block; padding: 0; border: 0; }
  table.data.stack-sm td::before {
    content: attr(data-label); display: block;
    font-size: 9px; font-weight: 700; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--muted); margin-bottom: 2px;
  }
  table.data.stack-sm td:first-child { grid-column: 1 / -1; font-weight: 600; color: var(--ink); }
  table.data.stack-sm td:first-child::before { display: none; }
  table.data td.empty { padding: 18px 14px; text-align: center; }
  table.data td.empty::before { display: none; }

  table.data.perm-table th, table.data.perm-table td { padding: 8px 5px; font-size: 9.5px; }
  table.data.perm-table th { letter-spacing: 0.04em; }
  table.data.perm-table th:first-child, table.data.perm-table td:first-child { padding-left: 12px; }
  table.data.perm-table th:last-child, table.data.perm-table td:last-child { padding-right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* =========================================================
   Painel conectado — login, formulários, modais, utilitários
   ========================================================= */

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.02fr 0.98fr; }
.login-aside {
  position: relative;
  overflow: hidden;
  background: var(--side);
  color: rgba(255, 255, 255, 0.68);
  padding: 44px 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
}
.login-aside::before {
  content: "";
  position: absolute;
  right: -160px; bottom: -180px;
  width: 520px; height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(176, 149, 101, 0.22), transparent 68%);
}
.login-aside > * { position: relative; }
.login-brand img { width: 124px; height: auto; filter: brightness(0) invert(1); opacity: 0.95; }
.login-aside h1 { color: #fff; font-size: 32px; line-height: 1.15; margin: 0 0 14px; max-width: 15ch; }
.login-aside p { font-size: 13px; line-height: 1.7; max-width: 40ch; color: rgba(255, 255, 255, 0.58); }
.login-points { display: grid; gap: 12px; margin-top: 26px; }
.login-points li { display: flex; gap: 10px; font-size: 11.5px; line-height: 1.55; color: rgba(255, 255, 255, 0.62); }
.login-points li::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold); margin-top: 6px; flex: 0 0 auto;
}
.login-foot { font-size: 10px; color: rgba(255, 255, 255, 0.32); }
.login-main { display: grid; place-items: center; padding: 36px 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 352px; }
.login-card .eyebrow {
  font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--gold-deep); font-weight: 700; margin-bottom: 8px;
}
.login-card h2 { font-size: 21px; margin-bottom: 6px; }
.login-card .sub { font-size: 11.5px; color: var(--muted); margin-bottom: 22px; }
.login-card .login-hint {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 10px; color: var(--muted); line-height: 1.6;
}

/* ---------- Formulários ---------- */
.field { margin-bottom: 14px; }
.field > label, .field-label {
  display: block;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
}
.field select { padding-right: 30px; }
.field textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--gold-deep);
  box-shadow: 0 0 0 3px rgba(176, 149, 101, 0.18);
}
.field .hint { font-size: 10px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline-check { display: flex; align-items: flex-start; gap: 8px; font-size: 11px; color: var(--ink-2); margin: 4px 0 12px; }
.inline-check input { margin-top: 2px; accent-color: var(--gold-deep); }
.form-error {
  background: var(--high-bg); color: var(--high);
  border: 1px solid rgba(163, 58, 46, 0.25);
  border-radius: 4px; padding: 9px 11px;
  font-size: 11.5px; margin-bottom: 12px; line-height: 1.5;
}
.form-ok {
  background: var(--low-bg); color: var(--low);
  border: 1px solid rgba(51, 96, 74, 0.25);
  border-radius: 4px; padding: 9px 11px;
  font-size: 11.5px; margin-bottom: 12px;
}
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #8C2F25; }
.btn-danger-ghost { background: var(--surface); color: var(--danger); border-color: rgba(163, 58, 46, 0.35); }
.btn-danger-ghost:hover { background: var(--high-bg); }

/* ---------- Faixa de alerta ---------- */
.alert-strip {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px;
  background: var(--mid-bg); color: var(--mid);
  border: 1px solid rgba(148, 101, 26, 0.28);
  border-radius: var(--r);
  padding: 11px 14px;
  font-size: 11.5px;
  margin-bottom: 12px;
}
.alert-strip strong { font-weight: 700; }
.alert-strip a { color: var(--mid); white-space: nowrap; }
.alert-strip.calm { background: var(--low-bg); color: var(--low); border-color: rgba(51, 96, 74, 0.25); }

/* ---------- Paginação ---------- */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 11px 16px;
  border-top: 1px solid var(--line);
  font-size: 10.5px; color: var(--muted);
}
.pager .pg-actions { display: flex; gap: 6px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(20, 17, 17, 0.52);
  display: grid; place-items: center;
  padding: 20px;
}
.modal {
  width: min(500px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 15px; }
.modal-body { padding: 18px; }
.modal-body p { font-size: 12px; line-height: 1.6; color: var(--ink-2); }
.modal-body p + p { margin-top: 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 18px; border-top: 1px solid var(--line); }
.modal .btn { font-size: 11px; }

/* ---------- Código e integração ---------- */
.code {
  position: relative;
  background: #201C1B;
  color: #ECE6D9;
  border-radius: 4px;
  padding: 14px 15px;
  font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 10.5px;
  line-height: 1.6;
  overflow: auto;
  white-space: pre;
  margin: 0;
}
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 0 6px; }
.code-head span { font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.copy-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 4px; padding: 4px 9px; font-size: 9.5px; cursor: pointer;
}
.copy-btn:hover { border-color: var(--line-strong); }
.step-list { display: grid; gap: 12px; counter-reset: passo; }
.step-list li { position: relative; padding-left: 30px; font-size: 11.5px; line-height: 1.6; color: var(--ink-2); }
.step-list li::before {
  counter-increment: passo; content: counter(passo);
  position: absolute; left: 0; top: 0;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--gold-wash); color: var(--gold-deep);
  font-family: "Sora", sans-serif; font-size: 9.5px; font-weight: 700;
  display: grid; place-items: center;
}
.step-list code, .inline-code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 10.5px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 3px; padding: 1px 4px;
  color: var(--ink);
}

/* ---------- Utilidades ---------- */
.warn-box {
  border: 1px dashed rgba(176, 149, 101, 0.75);
  background: var(--surface-2);
  border-radius: 4px;
  padding: 12px 13px;
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--ink-2);
}
.warn-box strong { display: block; color: var(--gold-deep); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-0 { margin-bottom: 0; }
.muted { color: var(--muted); }
.small { font-size: 10.5px; }
.strong { color: var(--ink); font-weight: 600; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.empty-state { padding: 40px 24px; text-align: center; }
.empty-state h3 { font-size: 14px; margin-bottom: 6px; }
.empty-state p { font-size: 11.5px; color: var(--muted); max-width: 46ch; margin: 0 auto 16px; line-height: 1.6; }
.loading { padding: 40px; text-align: center; color: var(--muted); font-size: 11.5px; }
.pill-tab { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; color: var(--muted); }
.kpi .k-note { font-size: 9.5px; color: var(--muted); margin-top: 7px; }
.data-table td .proto-btn { border: 0; background: none; padding: 0; cursor: pointer; text-align: left; }
.data-table td .proto-btn:hover { text-decoration: underline; text-underline-offset: 2px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }
.user-cell { display: flex; align-items: center; gap: 8px; }
.user-cell .avatar { width: 24px; height: 24px; font-size: 8.5px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 11.5px; }
.stat-line:last-child { border-bottom: 0; }
.stat-line b { font-family: "Sora", sans-serif; color: var(--ink); font-size: 14px; }
.tab-body { padding: 18px; }
.tab-body > h3 { font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 9px; }
.tab-body > h3 + p { margin-bottom: 16px; }
.message-composer { margin-top: 16px; }
.message-composer textarea { min-height: 74px; }

/* ---------- Tabela de permissões / usuários ---------- */
.table-note { padding: 10px 16px; font-size: 10px; color: var(--muted); border-top: 1px solid var(--line); }
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 5px; }

/* ---------- Login responsivo ---------- */
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-aside { padding: 30px 24px 32px; gap: 24px; }
  .login-aside h1 { font-size: 25px; max-width: none; }
  .login-points, .login-foot { display: none; }
  .login-main { padding: 28px 20px 40px; align-items: start; }
}

@media (max-width: 700px) {
  .two-col, .three-col { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}

/* ---------- Impressão ---------- */
@media print {
  .sidebar, .topbar, .page-actions, .no-print, .toast, .pager { display: none !important; }
  .shell { display: block; }
  .view { max-width: none; padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}
