:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --navy: #0f1f2e;
  --navy-2: #172838;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --surface-3: #eef3f6;
  --surface-4: #e7eef3;
  --ink: #102033;
  --ink-soft: #334b5f;
  --muted: #657789;
  --line: #d8e1e7;
  --line-strong: #b5c3cc;
  --blue: #235789;
  --teal: #126b64;
  --mint: #15a37f;
  --green: #087443;
  --amber: #b7791f;
  --red: #b42318;
  --coral: #d45b45;
  --violet: #5f5f7f;
  --shadow: 0 14px 32px rgba(16, 32, 51, 0.1);
  --shadow-soft: 0 5px 14px rgba(16, 32, 51, 0.04);
  --radius: 8px;
  --radius-sm: 6px;
  --detail-section-page-offset: 186px;

  /* --- Redesign tokens v2 --- */
  --accent: #1f5f8b;            /* Everblue brand accent (slightly richer than --blue) */
  --accent-strong: #134a6e;
  --accent-soft: #e8f1f8;       /* tinted surface for active/hover */
  --accent-ring: rgba(31, 95, 139, 0.18);
  --feature-bg: #0f2438;        /* inverted "hero" card background */
  --feature-ink: #eaf2f8;

  --pos: #0c7a4d;               /* positive delta */
  --pos-soft: #e4f4ec;
  --neg: #c0392b;               /* negative delta */
  --neg-soft: #fbeae7;

  /* chart palette (muted, on-brand; used only for data-viz) */
  --c-1: #1f5f8b; --c-2: #15a37f; --c-3: #b7791f; --c-4: #7a6cc0; --c-5: #4a90c2; --c-6: #5b8c7e;

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 2px rgba(16,32,51,.06), 0 1px 1px rgba(16,32,51,.04);
  --shadow-2: 0 6px 18px rgba(16,32,51,.07);
  --shadow-3: 0 18px 40px rgba(16,32,51,.10);

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-7: 32px; --space-8: 40px;
}

/* ===== Redesign components v2 ===== */
.eb-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: var(--space-6);
}
.eb-card--flush { padding: 0; overflow: hidden; }

.eb-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); }
.eb-section-head__title { font-size: 1.05rem; font-weight: 650; color: var(--ink); letter-spacing: -0.01em; }
.eb-section-head__eyebrow { font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.eb-section-head__action { font-size: .8rem; font-weight: 600; color: var(--accent); cursor: pointer; }

/* KPI grid + card */
.eb-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--space-4); }
.eb-kpi {
  display: flex; flex-direction: column; gap: var(--space-3);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-md); box-shadow: var(--shadow-1);
  padding: var(--space-5);
}
.eb-kpi__top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.eb-kpi__value { font-size: 1.9rem; font-weight: 700; line-height: 1.05; color: var(--ink); letter-spacing: -0.02em; }
.eb-kpi__label { font-size: .8rem; color: var(--muted); }
.eb-kpi--feature { background: var(--feature-bg); border-color: transparent; }
.eb-kpi--feature .eb-kpi__value { color: #fff; }
.eb-kpi--feature .eb-kpi__label { color: var(--feature-ink); opacity: .85; }

/* icon tile */
.eb-icon-tile { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.eb-icon-tile svg { width: 20px; height: 20px; }
.eb-icon-tile--pos { background: var(--pos-soft); color: var(--pos); }
.eb-icon-tile--neg { background: var(--neg-soft); color: var(--neg); }
.eb-icon-tile--amber { background: #fbf1de; color: var(--amber); }
.eb-kpi--feature .eb-icon-tile { background: rgba(255,255,255,.12); color: #fff; }

/* delta / status pill */
.eb-pill { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 650; padding: 3px 9px; border-radius: var(--radius-pill); background: var(--surface-3); color: var(--ink-soft); }
.eb-pill--pos { background: var(--pos-soft); color: var(--pos); }
.eb-pill--neg { background: var(--neg-soft); color: var(--neg); }
.eb-pill--amber { background: #fbf1de; color: var(--amber); }
.eb-pill--red { background: var(--neg-soft); color: var(--neg); }
.eb-pill--green { background: var(--pos-soft); color: var(--pos); }

/* chart card */
.eb-chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); }
.eb-chart-card__body { display: flex; align-items: center; gap: var(--space-5); flex-wrap: wrap; }
.eb-legend { display: flex; flex-direction: column; gap: var(--space-2); font-size: .8rem; color: var(--ink-soft); }
.eb-legend__row { display: flex; align-items: center; gap: var(--space-2); }
.eb-legend__dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* generic page grid for screens with a main + side rail */
.eb-screen-grid { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: var(--space-5); align-items: start; }
@media (max-width: 1180px) { .eb-screen-grid { grid-template-columns: 1fr; } }
.eb-stack { display: flex; flex-direction: column; gap: var(--space-5); }

/* Hoje screen layout */
.today-panel { display: flex; flex-direction: column; gap: var(--space-5); }
.today-charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
.today-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); align-items: start; }
@media (max-width: 980px) {
  .today-charts-row, .today-cols { grid-template-columns: 1fr; }
}
/* flatten inner items so they read as rows inside the eb-card (no card-in-card) */
.today-cols .eb-card .home-company-card,
.today-cols .eb-card .agenda-item--button {
  border: none; border-radius: 0; background: transparent; padding: 10px 0;
}
.today-cols .eb-card .agenda-list > * + *,
.today-cols .eb-card .quality-list > * + * { border-top: 1px solid var(--line); }
.today-cols .eb-card .home-company-card:hover,
.today-cols .eb-card .agenda-item--button:hover { background: var(--surface-2); border-radius: var(--radius-md); }

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
td,
th,
p,
span,
strong,
small {
  overflow-wrap: break-word;
  word-break: normal;
}

.os-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.os-sidebar {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
  min-height: 100vh;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: #eef2f5;
  position: sticky;
  top: 0;
  align-self: start;
}

.os-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 7px 14px;
  border-bottom: 1px solid var(--line);
}

.os-brand__mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-size: 18px;
  font-weight: 950;
}

.os-brand span,
.os-brand strong {
  display: block;
  line-height: 1.15;
}

.os-brand span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.os-brand strong {
  margin-top: 3px;
  color: var(--ink);
  font-size: 16px;
}

.os-nav {
  display: grid;
  align-content: start;
  gap: 5px;
}

.os-nav-button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 850;
  text-align: left;
  cursor: pointer;
}

.os-nav-button span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 7px;
  background: rgba(16, 32, 51, 0.06);
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
}

.os-nav-button:hover,
.os-nav-button.is-active {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.os-nav-button.is-active span {
  background: var(--navy);
  color: #fff;
}

/* Accent-based active state for sidebar nav (redesign task 4). */
.os-nav-button.is-active,
.os-nav-button[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: var(--radius-md);
}

.os-nav-button.is-active span,
.os-nav-button[aria-current="page"] span {
  background: var(--accent);
  color: #fff;
}

.os-sidebar-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.os-sidebar-card span {
  color: var(--teal);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.os-sidebar-card strong {
  color: var(--ink);
  font-size: 13px;
}

.os-sidebar-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.os-frame {
  min-width: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

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

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 10px 24px rgba(16, 42, 67, 0.06);
  backdrop-filter: blur(14px);
}

.brand-block {
  display: grid;
  gap: 4px;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.app-header .eyebrow {
  color: var(--teal);
}

h1 {
  color: inherit;
  font-size: 22px;
  line-height: 1.08;
}

h2 {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
}

.header-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.global-search-shell {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 8px;
  width: min(440px, 34vw);
  min-height: 42px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
}

.global-search-shell span {
  color: var(--ink-soft);
  font-size: 18px;
}

.global-search-shell strong {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.global-search-shell small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sync-status {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.health-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(18, 107, 100, 0.22);
  border-radius: 7px;
  background: rgba(18, 107, 100, 0.09);
  color: var(--teal);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.health-chip--warning {
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(183, 121, 31, 0.25);
  color: #fff4d5;
}

.health-chip--danger {
  border-color: rgba(248, 113, 113, 0.44);
  background: rgba(180, 35, 24, 0.32);
  color: #ffe0db;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--surface-2);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 14px;
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 14px 28px 32px;
}

.workspace > :not(.context-rail) {
  grid-column: 1;
  min-width: 0;
  max-width: 100%;
}

.context-rail {
  display: grid;
  grid-column: 2;
  grid-row: 1 / span 40;
  align-self: start;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  position: sticky;
  top: 88px;
}

.context-rail__header,
.context-rail__stats,
.context-rail__section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.context-rail__header,
.context-rail__section {
  display: grid;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  padding: 13px;
}

.context-rail__header span,
.context-rail__section span {
  color: var(--teal);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.context-rail__header strong,
.context-rail__section strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}

.context-rail__header p,
.context-rail__section p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.context-rail__stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  overflow: hidden;
}

.context-rail__fact {
  display: grid;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
}

.context-rail__fact:last-child {
  border-bottom: 0;
}

.context-rail__fact span,
.context-rail__fact small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  line-height: 1.2;
  text-transform: uppercase;
  overflow-wrap: normal;
  word-break: normal;
}

.context-rail__fact strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.context-rail__section button {
  width: fit-content;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid rgba(18, 107, 100, 0.22);
  border-radius: var(--radius-sm);
  background: #e9f5f2;
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.52fr) minmax(330px, 0.78fr);
  gap: 14px;
}

.executive-panel,
.distribution-panel,
.metric,
.toolbar,
.focus-panel,
.table-panel,
.board-kpi,
.crm-panel,
.company-row,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.executive-panel {
  display: grid;
  gap: 12px;
  min-height: 224px;
  padding: 18px;
  overflow: hidden;
  position: relative;
}

.executive-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--navy);
}

.distribution-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 224px;
  padding: 18px;
}

.section-heading {
  display: grid;
  gap: 6px;
}

.executive-copy {
  max-width: 940px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.45;
}

.executive-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.action-card {
  display: grid;
  gap: 7px;
  min-height: 84px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.action-card strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}

.action-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.action-card::before {
  content: attr(data-rank);
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.signal-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.signal {
  min-height: 70px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: inset 0 -3px 0 rgba(35, 87, 137, 0.14);
}

.signal strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.signal span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.signal--red {
  box-shadow: inset 0 -3px 0 rgba(180, 35, 24, 0.22);
}

.signal--yellow {
  box-shadow: inset 0 -3px 0 rgba(183, 121, 31, 0.22);
}

.signal--green {
  box-shadow: inset 0 -3px 0 rgba(8, 116, 67, 0.22);
}

.donut-wrap {
  display: grid;
  width: 138px;
  height: 138px;
  place-items: center;
  justify-self: center;
  position: relative;
}

.donut-chart {
  width: 138px;
  height: 138px;
  border-radius: 50%;
  background: conic-gradient(var(--line-strong) 0 100%);
  box-shadow: inset 0 0 0 1px rgba(16, 32, 51, 0.06), var(--shadow-soft);
}

.donut-center {
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  background: var(--surface);
  position: absolute;
  box-shadow: 0 8px 24px rgba(16, 32, 51, 0.12);
}

.donut-center strong {
  font-size: 24px;
  line-height: 1;
}

.donut-center span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.alert-bars {
  display: grid;
  gap: 12px;
}

.alert-bar {
  display: grid;
  gap: 7px;
}

.alert-bar__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 850;
}

.alert-bar__track {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.alert-bar__fill {
  height: 100%;
  min-width: 4px;
  border-radius: inherit;
  background: var(--line-strong);
}

.alert-bar__fill--Verde {
  background: var(--green);
}

.alert-bar__fill--Amarelo {
  background: var(--amber);
}

.alert-bar__fill--Vermelho {
  background: var(--red);
}

.alert-bar__fill--Sem-alerta {
  background: #7a8794;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.command-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(218px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.command-card {
  min-height: 118px;
  padding: 13px 13px 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
  text-align: left;
}

button.command-card {
  cursor: pointer;
}

button.command-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 10px 24px rgba(16, 32, 51, 0.075);
}

.command-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  width: 4px;
  height: auto;
  inset: 0 auto 0 0;
  background: var(--teal);
}

.command-card--risk::before {
  background: var(--red);
}

.command-card--decision::before {
  background: var(--amber);
}

.command-card--data::before {
  background: var(--violet);
}

.command-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.command-card strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
}

.command-card p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.38;
}

.command-card small {
  display: inline-flex;
  width: fit-content;
  margin-top: 14px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 850;
}

.command-card--home {
  display: grid;
  grid-template-rows: 24px 64px 48px minmax(64px, 1fr) auto;
  align-content: start;
  gap: 0;
  min-height: 138px;
  padding: 14px 15px;
}

.command-card--home .home-card__label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.command-card--home .home-card__value {
  align-self: end;
  margin-top: 0;
  color: var(--ink);
  font-size: 34px;
  line-height: 0.92;
}

.command-card--home .home-card__title {
  display: block;
  align-self: start;
  margin-top: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
}

.command-card--home p {
  margin-top: 0;
}

.command-card--home small {
  align-self: end;
  margin-top: 12px;
}

.metric {
  min-height: 108px;
  padding: 13px 13px 13px 15px;
  overflow: hidden;
  position: relative;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  width: 4px;
  height: auto;
  inset: 0 auto 0 0;
  background: var(--blue);
}

.metric--attention::before {
  background: var(--amber);
}

.metric--reporting::before {
  background: var(--red);
}

.metric--checkins::before {
  background: var(--teal);
}

.metric-icon {
  display: grid;
  width: 28px;
  height: 28px;
  margin-bottom: 9px;
  place-items: center;
  border-radius: 8px;
  background: rgba(27, 95, 214, 0.12);
  color: var(--blue);
  font-size: 12px;
  font-weight: 950;
}

.metric--attention .metric-icon {
  background: rgba(183, 121, 31, 0.14);
  color: var(--amber);
}

.metric--reporting .metric-icon {
  background: rgba(180, 35, 24, 0.12);
  color: var(--red);
}

.metric--checkins .metric-icon {
  background: rgba(15, 118, 110, 0.13);
  color: var(--teal);
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin: 7px 0 6px;
  color: var(--ink);
  font-size: 30px;
  line-height: 0.95;
}

.toolbar {
  display: grid;
  grid-template-columns:
    minmax(260px, 1.35fr)
    repeat(5, minmax(150px, 0.8fr))
    minmax(150px, 0.65fr)
    minmax(140px, 0.7fr);
  gap: 10px;
  margin-top: 14px;
  padding: 10px;
  align-items: end;
  position: sticky;
  top: 72px;
  z-index: 14;
  overflow-x: scroll;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(101, 119, 137, 0.55) rgba(216, 225, 231, 0.45);
  -webkit-overflow-scrolling: touch;
}

.toolbar::-webkit-scrollbar {
  height: 9px;
}

.toolbar::-webkit-scrollbar-track {
  background: rgba(216, 225, 231, 0.45);
  border-radius: 999px;
}

.toolbar::-webkit-scrollbar-thumb {
  background: rgba(101, 119, 137, 0.55);
  border-radius: 999px;
}

.mode-switch--primary {
  display: none !important;
}

body:not(.screen-hoje) .toolbar {
  margin-top: 0;
}

.toolbar-clear {
  min-height: 42px;
  width: 100%;
  padding-inline: 10px;
  line-height: 1.1;
  white-space: normal;
}

.mode-switch {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 42px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-4);
}

.toolbar > label,
.toolbar-clear,
.toolbar > .check-toggle {
  min-width: 0;
  max-width: 100%;
}

.mode-switch--primary {
  padding: 5px;
  background: #e8eef2;
  display: none !important;
}

.submode-switch {
  display: none;
  min-height: 38px;
  margin-top: -4px;
  border-color: transparent;
  background: transparent;
}

body.screen-operacao .submode-switch--operation,
body.screen-governanca .submode-switch--governance,
body.screen-sistema .submode-switch--system {
  display: flex;
}

.submode-switch .mode-button {
  min-height: 30px;
  border: 1px solid var(--line);
  background: #fff;
}

.submode-switch .mode-button.is-active {
  border-color: rgba(18, 107, 100, 0.24);
  background: #e9f5f2;
  color: var(--teal);
}

/* Operação cuts as a clean segmented control (mirrors the Investidas
   Lista/Heatmap toggle). Active tab uses the accent. */
.submode-switch--operation {
  display: none;
  gap: 4px;
  padding: 4px;
  border: none;
  border-radius: var(--radius-pill, 999px);
  background: var(--accent-soft, rgba(18, 107, 100, 0.08));
  width: fit-content;
  min-height: 0;
}
.submode-switch--operation .mode-button {
  min-height: 32px;
  min-width: 0;
  padding: 6px 18px;
  border: none;
  background: transparent;
  color: var(--muted, #657789);
  font-weight: 650;
  border-radius: var(--radius-pill, 999px);
  opacity: 0.85;
}
.submode-switch--operation .mode-button:hover {
  background: rgba(255, 255, 255, 0.55);
  opacity: 1;
}
.submode-switch--operation .mode-button.is-active {
  background: var(--accent, #126b64);
  color: #fff;
  opacity: 1;
  border: none;
  box-shadow: var(--shadow-1, 0 1px 2px rgba(15, 23, 42, 0.12));
}

.mode-button {
  min-width: 82px;
  min-height: 32px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.mode-button.is-active {
  background: var(--navy);
  color: #fff;
  box-shadow: none;
}

.view-context {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-soft);
  min-width: 0;
  overflow: hidden;
}

.view-context__copy {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
}

.view-context__copy span {
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.view-context__copy strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.1;
}

.view-context__copy p {
  max-width: 620px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.view-context__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.view-context__actions button {
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.view-context__actions button:hover,
.view-context__actions button.is-active {
  border-color: rgba(18, 107, 100, 0.28);
  background: #e9f5f2;
  color: var(--teal);
}

.view-context__side {
  display: grid;
  align-content: start;
  gap: 8px;
  width: min(620px, 100%);
  min-width: 0;
}

.view-context__stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.view-context__stat {
  display: grid;
  gap: 3px;
  min-height: 66px;
  min-width: 0;
  overflow: hidden;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.view-context__stat span,
.view-context__stat small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  line-height: 1.2;
  text-transform: uppercase;
  overflow-wrap: normal;
  word-break: normal;
}

.view-context__stat strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.view-context__filters {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.view-context__filters span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.clarity-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.clarity-card {
  display: grid;
  gap: 6px;
  min-height: 118px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.clarity-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--line-strong);
}

.clarity-card.is-active {
  border-color: rgba(18, 107, 100, 0.28);
  background: #f7fbfa;
}

.clarity-card.is-active::before {
  background: var(--teal);
}

.clarity-card:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.clarity-card span,
.clarity-card small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
  text-transform: uppercase;
}

.clarity-card strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.15;
}

.clarity-card p {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.35;
}

.clarity-card small {
  margin-top: auto;
  color: var(--teal);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

input,
select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.check-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink-soft);
  line-height: 1.1;
}

.check-toggle input {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  padding: 0;
}

.check-toggle span {
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
}

.today-panel,
.war-room-panel,
.risk-map-panel,
.audit-panel,
.automation-panel,
.automation-audit-panel,
.committee-panel,
.reporting-panel,
.collections-panel,
.history-panel {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(460px, 1.05fr);
  gap: 14px;
  margin-top: 14px;
}

.committee-panel,
.war-room-panel,
.risk-map-panel,
.audit-panel,
.automation-panel,
.automation-audit-panel,
.reporting-panel,
.collections-panel,
.history-panel {
  grid-template-columns: 1fr;
}

.heatmap-panel {
  margin-top: 14px;
}

.action-agenda,
.data-quality-panel,
.committee-brief,
.war-room-brief,
.risk-map-brief,
.audit-brief,
.automation-brief,
.automation-audit-brief,
.reporting-brief,
.collections-brief,
.history-brief,
.heatmap-brief {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 16px;
}

.agenda-list,
.quality-list,
.committee-grid,
.war-room-grid,
.risk-map-grid,
.audit-grid,
.automation-grid,
.automation-audit-grid,
.reporting-grid,
.collections-grid,
.history-grid {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.daily-brief {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.daily-brief div {
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.daily-brief span,
.daily-brief strong {
  display: block;
}

.daily-brief span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.daily-brief strong {
  margin-top: 7px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.15;
}

.home-company-card {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.home-company-card:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.home-company-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.home-company-card__top strong {
  font-size: 15px;
}

.home-company-card__meta,
.home-company-card__critical,
.home-company-card__next {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.home-company-card__critical {
  color: var(--ink-soft);
  font-weight: 750;
}

.home-radar-group {
  display: grid;
  gap: 7px;
}

.home-radar-group > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.home-mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.home-mini-row:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.home-mini-row span,
.home-mini-row strong,
.home-mini-row small {
  display: block;
}

.home-mini-row strong {
  font-size: 13px;
  line-height: 1.25;
}

.home-mini-row small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.committee-grid,
.risk-map-grid,
.audit-grid,
.automation-grid,
.reporting-grid,
.collections-grid,
.history-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.war-room-grid {
  grid-template-columns: minmax(250px, 0.68fr) repeat(2, minmax(270px, 1fr));
  align-items: stretch;
}

/* Sistema — lean: status line on top (full width), then ONE workflow list,
   then the failures/incidents card (rendered only when failures exist). */
body.screen-sistema .automation-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.automation-status-line {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.automation-status-line > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.automation-status-line > div span {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}
.automation-status-line > div small {
  font-size: 12px;
  color: rgba(15, 23, 42, 0.6);
}

/* Governança — consolidated blocks (decisões pendentes, pauta, atas). */
body.screen-governanca .committee-grid,
body.screen-governanca .history-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.governance-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.governance-block .section-heading h3 {
  margin: 2px 0 0;
  font-size: 16px;
}
.governance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.governance-table th,
.governance-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  vertical-align: top;
}
.governance-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(15, 23, 42, 0.55);
}
.governance-table tr:last-child td {
  border-bottom: none;
}
.governance-minutes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.governance-minute {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.04);
}
.governance-minute__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.governance-minute__top strong {
  font-size: 14px;
}
.governance-minute__top span {
  font-size: 12px;
  color: rgba(15, 23, 42, 0.6);
}
.governance-minute p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.agenda-item,
.quality-item,
.committee-card,
.war-room-card,
.reporting-card,
.audit-card,
.automation-card,
.collections-card,
.history-card {
  display: grid;
  gap: 7px;
  min-height: 84px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.module-card,
.committee-card--overview,
.reporting-card--overview,
.history-card--overview {
  position: relative;
  overflow: hidden;
  border-color: rgba(15, 23, 42, 0.1);
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.055);
}

.module-card::before,
.committee-card--overview::before,
.reporting-card--overview::before,
.history-card--overview::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--blue);
}

.committee-card--overview::before {
  background: var(--violet);
}

.reporting-card--overview::before {
  background: var(--teal);
}

.history-card--overview::before {
  background: var(--amber);
}

.module-card__eyebrow {
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.module-card p + p,
.committee-card--overview p + p,
.reporting-card--overview p + p,
.history-card--overview p + p {
  padding-top: 7px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.agenda-item {
  border-left: 5px solid var(--teal);
}

.agenda-item--button {
  grid-template-columns: auto minmax(0, 1fr);
  width: 100%;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.agenda-item--button:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.agenda-item__rank {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 7px;
  background: rgba(16, 32, 51, 0.07);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 950;
}

.agenda-item__body {
  display: grid;
  gap: 5px;
}

.agenda-item__body em {
  color: var(--teal);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.agenda-item--urgent {
  border-left-color: var(--red);
}

.agenda-item--warning {
  border-left-color: var(--amber);
}

.agenda-item strong,
.quality-item strong,
.committee-card strong,
.war-room-card strong,
.reporting-card strong,
.audit-card strong,
.automation-card strong,
.collections-card strong,
.history-card strong {
  font-size: 14px;
  line-height: 1.25;
}

.agenda-item p,
.quality-item p,
.committee-card p,
.war-room-card p,
.reporting-card p,
.audit-card p,
.automation-card p,
.collections-card p,
.history-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.history-card--overview {
  align-content: start;
}

.history-overview-score {
  color: var(--ink);
  font-size: 38px;
  font-weight: 900;
  line-height: 0.95;
}

.reporting-card--overview {
  align-content: start;
}

.audit-card--overview {
  align-content: start;
}

.automation-card--overview {
  align-content: start;
}

.collections-card--overview {
  align-content: start;
}

.committee-card--overview {
  align-content: start;
}

.reporting-overview-score {
  color: var(--ink);
  font-size: 38px;
  font-weight: 900;
  line-height: 0.95;
}

.audit-overview-score {
  color: var(--ink);
  font-size: 38px;
  font-weight: 900;
  line-height: 0.95;
}

.automation-overview-score {
  color: var(--ink);
  font-size: 38px;
  font-weight: 900;
  line-height: 0.95;
}

.collections-overview-score {
  color: var(--ink);
  font-size: 38px;
  font-weight: 900;
  line-height: 0.95;
}

.audit-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.audit-line,
.audit-evidence,
.automation-line {
  display: grid;
  gap: 6px;
  padding: 9px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
}

.audit-line,
.automation-line {
  grid-template-columns: minmax(0, 1fr) auto;
}

.audit-line--urgent {
  border-left-color: var(--red);
}

.audit-line--warning {
  border-left-color: var(--amber);
}

.audit-line--controlled {
  border-left-color: var(--green);
}

.automation-line--ok {
  border-left-color: var(--green);
}

.automation-line--warning {
  border-left-color: var(--amber);
}

.automation-line--danger {
  border-left-color: var(--red);
}

.audit-line span,
.audit-evidence span,
.automation-line span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}

.audit-line small,
.audit-line p,
.audit-evidence small,
.audit-evidence p,
.automation-line small,
.automation-line p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.audit-line p,
.audit-line > small,
.automation-line p,
.automation-line > small {
  grid-column: 1 / -1;
}

.audit-line em,
.automation-line em {
  color: var(--ink-soft);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  line-height: 1.2;
  text-align: right;
}

.automation-card--ok {
  border-top: 4px solid var(--green);
}

.automation-card--danger {
  border-top: 4px solid var(--red);
}

.automation-card--version {
  grid-column: span 2;
}

.runtime-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0;
}

.runtime-fact {
  min-height: 58px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.runtime-fact span,
.runtime-fact strong {
  display: block;
}

.runtime-fact span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.runtime-fact strong {
  margin-top: 5px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
  overflow-wrap: break-word;
}

.automation-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
  margin: 8px 0;
}

.automation-stats div {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.automation-stats span,
.automation-stats small {
  display: block;
}

.automation-stats span {
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.automation-stats small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  overflow-wrap: normal;
  word-break: normal;
}

.system-scoreboard,
.system-integrations {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
  margin: 8px 0;
}

.system-scoreboard div,
.system-integration {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.system-scoreboard span,
.system-scoreboard small,
.system-integration span,
.system-integration strong {
  display: block;
}

.system-scoreboard span {
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.system-scoreboard small,
.system-integration span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  line-height: 1.2;
  text-transform: uppercase;
  overflow-wrap: normal;
  word-break: normal;
}

.system-integration {
  border-left: 4px solid var(--line-strong);
}

.system-integration--ok {
  border-left-color: var(--green);
}

.system-integration--watch {
  border-left-color: var(--amber);
}

.system-integration--danger {
  border-left-color: var(--red);
}

.system-integration strong {
  margin-top: 5px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
}

.committee-overview-score {
  color: var(--ink);
  font-size: 38px;
  font-weight: 900;
  line-height: 0.95;
}

.history-metric-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
}

.history-metric-line--good {
  border-left-color: var(--green);
}

.history-metric-line--bad {
  border-left-color: var(--red);
}

.history-metric-line span,
.history-metric-line small,
.history-metric-line em {
  display: block;
}

.history-metric-line span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}

.history-metric-line small,
.history-metric-line em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.25;
}

.history-metric-line strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
  text-align: right;
}

.history-metric-line em {
  grid-column: 1 / -1;
}

.quality-meter {
  display: grid;
  gap: 6px;
}

.quality-meter__top {
  display: flex;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 900;
}

.quality-meter__track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.quality-meter__fill {
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.quality-meter__fill--low {
  background: var(--red);
}

.quality-meter__fill--mid {
  background: var(--amber);
}

.automation-audit-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.automation-audit-grid {
  display: grid;
  gap: 14px;
}

.automation-audit-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.automation-audit-kpi,
.automation-audit-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.automation-audit-kpi {
  display: grid;
  gap: 7px;
  min-height: 86px;
  padding: 12px;
  position: relative;
  overflow: hidden;
}

.automation-audit-kpi::before,
.automation-audit-card--focus::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--line-strong);
}

.automation-audit-kpi--done::before,
.automation-audit-status--done {
  background: rgba(18, 107, 100, 0.14);
  color: var(--teal);
}

.automation-audit-kpi--progress::before,
.automation-audit-status--progress {
  background: rgba(43, 91, 197, 0.14);
  color: var(--blue);
}

.automation-audit-kpi--validate::before,
.automation-audit-status--validate {
  background: rgba(183, 121, 31, 0.16);
  color: #8a5a10;
}

.automation-audit-kpi--backlog::before,
.automation-audit-status--backlog {
  background: rgba(100, 116, 139, 0.16);
  color: var(--muted);
}

.automation-audit-kpi--error::before,
.automation-audit-status--error {
  background: rgba(160, 52, 52, 0.14);
  color: var(--danger);
}

.automation-audit-kpi span,
.automation-audit-card > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
  text-transform: uppercase;
}

.automation-audit-kpi strong {
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
}

.automation-audit-card {
  padding: 14px;
}

.automation-audit-card--focus {
  display: grid;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.automation-audit-card--focus::before {
  background: var(--teal);
}

.automation-audit-card strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
}

.automation-audit-next {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.automation-audit-next div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.automation-audit-next b,
.automation-audit-next p {
  display: block;
}

.automation-audit-next b {
  color: var(--ink);
  font-size: 13px;
}

.automation-audit-next p {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.35;
}

.automation-audit-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.automation-audit-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
}

.automation-audit-table th,
.automation-audit-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  vertical-align: top;
}

.automation-audit-table th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.automation-audit-table td strong {
  color: var(--ink);
  font-size: 13px;
}

.automation-audit-table tr:last-child td {
  border-bottom: 0;
}

.automation-audit-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

/* ===== Screen-based panel visibility (5 canonical screens) ===== */

/* Hide every top-level panel by default; each screen re-shows its own. */
.today-panel,
.hero-grid,
.metrics-grid,
.command-grid,
.layout,
.heatmap-panel,
.board-panel,
.reporting-panel,
.action-inbox-panel,
.war-room-panel,
.collections-panel,
.risk-map-panel,
.committee-panel,
.audit-panel,
.history-panel,
.automation-panel,
.automation-audit-panel {
  display: none;
}

/* Hoje — read-only 30-second view: aggregate strip + Top da fila + Alertas.
   The hero/metrics/command grids and the clarity strip (the duplicated
   AGORA/OPERAÇÃO/ANÁLISE cards) are hidden here; the today-panel carries
   everything the Hoje screen shows. */
body.screen-hoje .today-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin-top: 14px;
}
.today-aggregate-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.today-aggregate-metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.today-aggregate-metric span {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(15, 23, 42, 0.55);
}
.today-aggregate-metric strong {
  font-size: 24px;
  line-height: 1.1;
}
.today-aggregate-metric small {
  font-size: 12px;
  color: rgba(15, 23, 42, 0.6);
}
body.screen-hoje .hero-grid,
body.screen-hoje .metrics-grid,
body.screen-hoje .command-grid,
body.screen-hoje .clarity-strip {
  display: none;
}

body.screen-hoje .toolbar {
  grid-template-columns: 1fr;
  margin-top: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  position: static;
}

body.screen-hoje .toolbar > label,
body.screen-hoje .toolbar-clear,
body.screen-hoje .submode-switch,
body.screen-hoje .view-context {
  display: none;
}

body:not(.screen-hoje) .clarity-strip {
  margin-top: 0;
}

/* Investidas */
body.screen-investidas .layout {
  display: grid;
}
body.screen-investidas .heatmap-panel {
  display: block;
}

/* Lista / Heatmap toggle (only on Investidas) */
.investidas-view-toggle {
  display: none;
}
body.screen-investidas .investidas-view-toggle {
  display: inline-flex;
  gap: 6px;
  margin: 0 0 16px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.06);
  width: fit-content;
}
.investidas-view-button {
  appearance: none;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 9px;
  cursor: pointer;
  opacity: 0.7;
}
.investidas-view-button.is-active {
  background: #ffffff;
  opacity: 1;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

/* inv-lista: show split-view, hide heatmap */
body.screen-investidas.inv-lista .heatmap-panel {
  display: none;
}
/* inv-heatmap: show heatmap, hide split-view */
body.screen-investidas.inv-heatmap .layout.portfolio-crm {
  display: none;
}
/* keep the filter toolbar above the heatmap (heatmap-panel precedes the
   toolbar in the DOM, so reorder it in the single-column workspace grid) */
body.screen-investidas.inv-heatmap #heatmapPanel {
  order: 1;
}

/* ===== Redesign screen isolation =====
   All screen panels live in the DOM and are toggled by body.screen-*. Two base
   rules (.layout @ ~4067, .board-panel @ ~2893) re-set display:grid and so leak
   onto every screen; pin the two big content panels to their own screen by id.
   The legacy .view-context (generic CRM/section header) and .clarity-strip
   (the "AGORA" command trio) are replaced by the per-screen KPI card rows, so
   they are hidden everywhere. */
.view-context,
.clarity-strip {
  display: none;
}
body:not(.screen-investidas) #portfolioLayout {
  display: none;
}
body:not(.screen-operacao) #boardPanel {
  display: none;
}

/* Operação */
/* Operação is now a single consolidated work surface: only the board-panel
   (consolidated queue) shows. The legacy operacao panels stay defined in the
   DOM but are hidden here regardless of any view-* sub-mode. The 4 cuts are
   driven by body.op-${operacaoCut} + state.operacaoCut, not by panel toggling. */
body.screen-operacao .board-panel {
  display: grid;
}
body.screen-operacao .reporting-panel,
body.screen-operacao .war-room-panel,
body.screen-operacao .collections-panel,
body.screen-operacao .risk-map-panel,
body.screen-operacao .action-inbox-panel {
  display: none;
}

/* Governança — consolidated portfolio view. Three blocks shown together:
   committee-panel (decisões/comitês pendentes) + history-panel (pauta dos
   próximos comitês + atas recentes). The legacy audit-panel and the governance
   sub-mode switch are hidden; no sub-switching on this screen. */
body.screen-governanca .committee-panel,
body.screen-governanca .history-panel {
  display: block;
}
body.screen-governanca .audit-panel,
body.screen-governanca .submode-switch--governance {
  display: none;
}

/* Sistema — lean: single workflow list. The parallel automation-audit table is
   hidden on this screen; status line + one list live in automation-panel. */
body.screen-sistema .automation-panel {
  display: block;
}
body.screen-sistema .automation-audit-panel,
body.screen-sistema .submode-switch--system {
  display: none;
}

/* ===== Sistema redesign (Task 9) — remove irrelevant inherited chrome =====
   A system-health screen has no use for the portfolio filter toolbar or the
   contextual rail (Cockpit / próxima melhor ação / registro em foco), so hide
   them and make the workspace single-column like Investidas does. */
body.screen-sistema .toolbar {
  display: none;
}
body.screen-sistema .context-rail {
  display: none;
}
body.screen-sistema .workspace {
  grid-template-columns: minmax(0, 1fr);
}

/* Workflows list as clean status-pill rows inside an .eb-card--flush. */
.automation-workflows .automation-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4);
}
.automation-workflows .automation-row + .automation-row {
  border-top: 1px solid var(--line);
}
.automation-row__main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.automation-row__main strong {
  font-size: 14px;
  line-height: 1.2;
}
.automation-row__main small {
  font-size: 12px;
  color: rgba(15, 23, 42, 0.6);
}
.automation-row__main p {
  font-size: 13px;
  line-height: 1.35;
  margin: 2px 0 0;
}
.automation-row .eb-pill {
  flex: 0 0 auto;
}
.automation-row--empty {
  padding: var(--space-4);
  color: rgba(15, 23, 42, 0.6);
}

input:focus,
select:focus,
button:focus {
  outline: 2px solid rgba(21, 94, 239, 0.24);
  outline-offset: 2px;
}

.priority-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.72fr) minmax(560px, 1.28fr);
  gap: 14px;
  margin-top: 14px;
}

.war-room-hero {
  display: grid;
  align-content: space-between;
  min-height: 100%;
  padding: 16px;
  border-radius: var(--radius);
  color: #fff;
  background: #17202b;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.risk-category {
  display: grid;
  gap: 10px;
  min-height: 246px;
  padding: 14px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--green);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.risk-category--watch {
  border-top-color: var(--amber);
}

.risk-category--critical {
  border-top-color: var(--red);
}

.risk-category__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.risk-category__top span,
.risk-category__top em {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.risk-category__top strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 30px;
  line-height: 0.95;
}

.risk-category__top strong::after {
  content: " pts";
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.risk-category__top em {
  height: max-content;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}

.risk-category__track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.risk-category__fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.risk-category--watch .risk-category__fill {
  background: var(--amber);
}

.risk-category--critical .risk-category__fill {
  background: var(--red);
}

.risk-category p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.risk-company-list {
  display: grid;
  gap: 8px;
}

.risk-company,
.risk-empty {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: left;
}

.risk-company {
  cursor: pointer;
}

.risk-company:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.risk-company strong {
  color: var(--ink);
  font-size: 13px;
}

.risk-company span,
.risk-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.war-room-company small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.war-room-hero span,
.war-room-hero p {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  line-height: 1.35;
}

.war-room-hero > span {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.war-room-hero > strong {
  margin-top: 10px;
  color: #fff;
  font-size: 34px;
  line-height: 0.95;
}

.war-room-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.war-room-stats div {
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.war-room-stats strong,
.war-room-stats span {
  display: block;
}

.war-room-stats strong {
  color: #fff;
  font-size: 22px;
}

.war-room-stats span {
  font-size: 11px;
}

.war-room-card {
  min-height: 198px;
  background: #fff;
}

.war-room-card h3 {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.2;
}

.war-room-card__body {
  display: grid;
  gap: 9px;
}

.war-room-company,
.war-room-item,
.war-room-agenda-item,
.war-room-empty {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: left;
}

.war-room-company {
  cursor: pointer;
}

.war-room-company:hover {
  border-color: var(--red);
  box-shadow: var(--shadow-soft);
}

.war-room-company span,
.war-room-item span,
.war-room-empty,
.war-room-agenda-item p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.war-room-item small {
  display: block;
  padding-top: 2px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.35;
}

.war-room-item--blocker {
  border-left: 5px solid var(--amber);
}

.war-room-agenda-item {
  grid-template-columns: 62px 1fr;
}

.war-room-agenda-item span {
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
}

.war-room-agenda-item p {
  grid-column: 2;
}

.focus-panel,
.table-panel {
  padding: 16px;
}

.board-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4, 16px);
  margin-top: 14px;
  align-items: start;
}

/* Operação: KPI strip + status chart + full-width queue, stacked. */
body.screen-operacao .board-panel {
  grid-template-columns: minmax(0, 1fr);
}

.board-chart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4, 16px);
  max-width: 460px;
}

.board-focus-panel,
.board-main-panel {
  min-width: 0;
  overflow: hidden;
}

#govKpis {
  margin-bottom: var(--space-4, 16px);
}

.gov-chart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4, 16px);
  max-width: 460px;
  margin-bottom: var(--space-4, 16px);
}

.gov-chart-empty {
  margin: var(--space-2, 8px) 0 0;
  font-size: 0.8125rem;
  color: var(--feature-ink, #657789);
}

/* The consolidated queue is the primary full-width work surface. */
.board-main-panel {
  padding: 0;
}
.board-main-panel .eb-section-head {
  padding: var(--space-4, 16px) var(--space-4, 16px) var(--space-3, 12px);
}
.board-main-panel .op-cut-subtitle {
  margin: 2px 0 0;
}

.board-panel__header {
  display: grid;
  gap: 12px;
}

.board-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.board-kpi {
  display: grid;
  gap: 4px;
  min-height: 66px;
  min-width: 0;
  overflow: hidden;
  padding: 10px;
  background: var(--surface-2);
}

.board-kpi span,
.board-kpi small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  line-height: 1.2;
  text-transform: uppercase;
  overflow-wrap: normal;
  word-break: normal;
}

.board-kpi strong {
  color: var(--ink);
  font-size: 21px;
  line-height: 1;
}

.focus-list {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.focus-item {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--amber);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: left;
  cursor: pointer;
}

.focus-item:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.focus-item strong {
  font-size: 13px;
}

.focus-item p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.operation-queue {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.operation-lane {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.operation-lane__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.operation-lane__head span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.operation-lane__head strong {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12px;
}

.operation-lane__items {
  display: grid;
  gap: 7px;
}

.operation-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-left: 4px solid var(--teal);
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
}

.operation-item--overdue {
  border-left-color: var(--red);
}

.operation-item strong {
  font-size: 12px;
}

.operation-item p {
  margin-top: 2px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
}

.operation-item small,
.operation-empty {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.operation-item button {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.operation-item button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.action-inbox-brief {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.action-inbox-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.action-inbox-header__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.action-inbox-kpis {
  display: grid;
  grid-template-columns: repeat(8, minmax(112px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.action-inbox-kpi {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.action-inbox-kpi--danger {
  border-color: rgba(185, 28, 28, 0.22);
  background: rgba(254, 242, 242, 0.86);
}

.action-inbox-kpi--watch {
  border-color: rgba(180, 83, 9, 0.22);
  background: rgba(255, 251, 235, 0.86);
}

.action-inbox-kpi--ok {
  border-color: rgba(4, 120, 87, 0.18);
  background: rgba(236, 253, 245, 0.72);
}

.action-inbox-kpi span,
.action-inbox-kpi small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  line-height: 1.25;
  text-transform: uppercase;
}

.action-inbox-kpi strong {
  display: block;
  margin: 7px 0 2px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.action-inbox-controls {
  display: grid;
  grid-template-columns: repeat(9, minmax(118px, 1fr));
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbfc;
}

.action-inbox-controls label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.action-inbox-controls span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.action-inbox-controls select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
}

.action-inbox-table-wrap {
  width: 100%;
  min-width: 0;
  max-height: 640px;
  margin-top: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.action-inbox-table {
  width: 100%;
  min-width: 1480px;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

.action-inbox-table th,
.action-inbox-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.3;
}

.action-inbox-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef6f7;
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.action-inbox-table th:nth-child(1),
.action-inbox-table td:nth-child(1) {
  width: 300px;
}

.action-inbox-table th:nth-child(2),
.action-inbox-table td:nth-child(2) {
  width: 150px;
}

.action-inbox-table th:nth-child(3),
.action-inbox-table td:nth-child(3),
.action-inbox-table th:nth-child(4),
.action-inbox-table td:nth-child(4),
.action-inbox-table th:nth-child(5),
.action-inbox-table td:nth-child(5),
.action-inbox-table th:nth-child(6),
.action-inbox-table td:nth-child(6) {
  width: 130px;
}

.action-inbox-table th:nth-child(7),
.action-inbox-table td:nth-child(7) {
  width: 140px;
}

.action-inbox-table th:nth-child(8),
.action-inbox-table td:nth-child(8) {
  width: 130px;
}

.action-inbox-table th:nth-child(9),
.action-inbox-table td:nth-child(9) {
  width: 150px;
}

.action-inbox-table th:nth-child(10),
.action-inbox-table td:nth-child(10) {
  width: 126px;
}

.action-inbox-row--danger td {
  background: rgba(254, 242, 242, 0.52);
}

.action-inbox-row--watch td {
  background: rgba(255, 251, 235, 0.5);
}

.action-inbox-row strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}

.action-inbox-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.action-inbox-group td {
  position: sticky;
  top: 39px;
  z-index: 1;
  padding: 9px 14px;
  background: #dfecee;
  color: var(--ink);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.action-inbox-group span {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  margin-left: 8px;
  place-items: center;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
}

.action-inbox-actions {
  display: grid;
  gap: 6px;
}

.action-inbox-actions button,
.action-inbox-actions a {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.action-inbox-actions button:hover,
.action-inbox-actions a:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.action-inbox-empty {
  display: grid;
  gap: 12px;
  padding: 22px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfc 100%);
}

.action-inbox-empty span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.action-inbox-empty strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
}

.action-inbox-empty p {
  max-width: 760px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.action-inbox-empty__facts,
.action-inbox-empty__companies,
.action-inbox-empty__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-inbox-empty__facts small,
.action-inbox-empty__companies span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
}

.action-inbox-empty__actions button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  background: #fff;
  color: var(--teal);
  font: inherit;
  font-size: 12px;
  font-weight: 950;
  cursor: pointer;
}

.action-inbox-empty__actions button:hover {
  background: rgba(20, 184, 166, 0.08);
}

.action-inbox-suggestions {
  margin-top: 14px;
}

.action-inbox-suggestion-card {
  padding: 14px;
  border: 1px solid rgba(180, 83, 9, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 251, 235, 0.72);
}

.action-inbox-suggestion-card__header span {
  display: block;
  color: #92400e;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.action-inbox-suggestion-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.action-inbox-suggestion-card__header button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(146, 64, 14, 0.2);
  border-radius: 8px;
  background: #fff;
  color: #92400e;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.action-inbox-suggestion-card__header button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.action-inbox-suggestion-card__tools {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.action-inbox-suggestion-card__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.action-inbox-suggestion-card__filters button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(146, 64, 14, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #92400e;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.action-inbox-suggestion-card__filters button.is-active {
  border-color: rgba(20, 184, 166, 0.45);
  background: rgba(20, 184, 166, 0.12);
  color: var(--teal-strong);
}

.action-inbox-suggestion-card__header strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}

.action-inbox-suggestion-card__header p {
  max-width: 780px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.action-inbox-suggestion-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.action-inbox-suggestion-list--ignored {
  padding-top: 10px;
  border-top: 1px dashed rgba(146, 64, 14, 0.22);
}

.action-inbox-suggestion-empty {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.action-inbox-suggestion {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(180, 83, 9, 0.16);
  border-radius: 8px;
  background: #fff;
}

.action-inbox-suggestion--urgent {
  border-color: rgba(185, 28, 28, 0.22);
  background: rgba(254, 242, 242, 0.58);
}

.action-inbox-suggestion--ignored {
  border-color: rgba(100, 116, 139, 0.2);
  background: rgba(248, 250, 252, 0.82);
  opacity: 0.84;
}

.action-inbox-suggestion--ignored span {
  color: #64748b;
}

.action-inbox-suggestion div {
  min-width: 0;
}

.action-inbox-suggestion span,
.action-inbox-suggestion strong,
.action-inbox-suggestion small {
  display: block;
}

.action-inbox-suggestion span {
  color: #92400e;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.action-inbox-suggestion strong {
  margin-top: 3px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}

.action-inbox-suggestion small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.35;
}

.action-inbox-suggestion__actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.action-inbox-suggestion__actions button {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.action-inbox-suggestion__actions button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.action-inbox-unlinked {
  margin-top: 14px;
}

.action-inbox-unlinked-card {
  padding: 14px;
  border: 1px solid rgba(185, 28, 28, 0.18);
  border-radius: var(--radius);
  background: rgba(254, 242, 242, 0.74);
}

.action-inbox-unlinked-card__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.action-inbox-unlinked-card__header span {
  display: block;
  color: #991b1b;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.action-inbox-unlinked-card__header strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}

.action-inbox-unlinked-card__header p {
  max-width: 760px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.action-inbox-unlinked-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.action-inbox-unlinked-item {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(185, 28, 28, 0.16);
  border-radius: 8px;
  background: #fff;
}

.action-inbox-unlinked-item div {
  min-width: 0;
}

.action-inbox-unlinked-item strong,
.action-inbox-unlinked-item small {
  display: block;
}

.action-inbox-unlinked-item strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}

.action-inbox-unlinked-item small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.35;
}

.action-inbox-unlinked-item a {
  flex: 0 0 auto;
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
}

.action-inbox-unlinked-item a:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.board-table-wrap {
  width: 100%;
  min-width: 0;
  max-height: 620px;
  margin-top: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.board-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}

.board-table th,
.board-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.25;
  overflow-wrap: normal;
  word-break: normal;
}

.board-table th {
  position: sticky;
  top: 0;
  background: #eef6f7;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  white-space: nowrap;
  z-index: 1;
}

.op-cut-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.operation-cut-row {
  cursor: pointer;
}

.operation-cut-row td {
  vertical-align: middle;
}

.operation-cut-row:hover td {
  background: var(--accent-soft, #e8f1f8);
}

.operation-cut-row--overdue td,
.operation-cut-row--overdue:hover td {
  background: rgba(220, 38, 38, 0.06);
}

.operation-cut-table .eb-pill {
  white-space: nowrap;
}

.op-cut-edit {
  width: 100%;
  min-width: 96px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  background: #fff;
  color: inherit;
}

.op-cut-edit:focus {
  outline: 2px solid rgba(21, 94, 239, 0.24);
  outline-offset: 1px;
}

.board-table th:nth-child(1),
.board-table td:nth-child(1) {
  min-width: 150px;
  width: 150px;
}

.board-table th:nth-child(2),
.board-table td:nth-child(2) {
  min-width: 110px;
  width: 110px;
  white-space: nowrap;
}

.board-table th:nth-child(3),
.board-table td:nth-child(3),
.board-table th:nth-child(4),
.board-table td:nth-child(4) {
  min-width: 116px;
  width: 116px;
  white-space: nowrap;
}

.board-table th:nth-child(5),
.board-table td:nth-child(5) {
  min-width: 150px;
  width: 150px;
}

.board-table th:nth-child(6),
.board-table td:nth-child(6) {
  min-width: 320px;
  width: auto;
  white-space: normal;
}

.board-table th:nth-child(7),
.board-table td:nth-child(7) {
  min-width: 132px;
  width: 132px;
}

.board-table tr {
  cursor: pointer;
}

.board-table tr:hover td {
  background: #fbfcfd;
}

.board-table td:first-child {
  font-weight: 850;
}

.board-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  min-width: 100px;
}

.board-actions button {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.board-actions button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.heatmap-wrap {
  margin-top: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.heatmap-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 12px;
}

.heatmap-table th,
.heatmap-table td {
  padding: 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.heatmap-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf7f5;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.heatmap-table tr {
  cursor: pointer;
}

.heatmap-table tr:hover td {
  background: #fbfcfd;
}

.heatmap-company {
  width: 220px;
}

.heatmap-company strong,
.heatmap-company span {
  display: block;
}

.heatmap-company strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
}

.heatmap-company span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.heat-cell {
  display: grid;
  gap: 3px;
  min-width: 96px;
  min-height: 50px;
  align-content: center;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.heat-cell strong {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  line-height: 1.1;
}

.heat-cell strong span {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.heat-cell small {
  color: inherit;
  font-size: 11px;
  line-height: 1.2;
  opacity: 0.78;
}

.heat-cell--ok {
  border-color: rgba(8, 116, 67, 0.24);
  background: rgba(8, 116, 67, 0.08);
  color: var(--green);
}

.heat-cell--attention {
  border-color: rgba(183, 121, 31, 0.28);
  background: rgba(183, 121, 31, 0.1);
  color: var(--amber);
}

.heat-cell--critical {
  border-color: rgba(180, 35, 24, 0.28);
  background: rgba(180, 35, 24, 0.08);
  color: var(--red);
}

/* ===================== Investidas redesign (Task 6) ===================== */
/* Heatmap rebuilt as a grid of alert-tinted company tiles. */
.heatmap-grid-cell { padding: 0; border: 0; }
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.heatmap-tile {
  appearance: none;
  text-align: left;
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #eef3f6;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.heatmap-tile:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); }
.heatmap-tile.is-active { outline: 2px solid var(--accent); outline-offset: 1px; }
.heatmap-tile__name { font-size: 14px; font-weight: 700; line-height: 1.15; }
.heatmap-tile__reason { font-size: 12px; color: var(--muted); line-height: 1.25; }
.heatmap-tile .pill { justify-self: start; }
.heatmap-tile--red { background: rgba(180, 35, 24, 0.1); border-color: rgba(180, 35, 24, 0.3); }
.heatmap-tile--amber { background: rgba(183, 121, 31, 0.12); border-color: rgba(183, 121, 31, 0.32); }
.heatmap-tile--green { background: rgba(8, 116, 67, 0.1); border-color: rgba(8, 116, 67, 0.28); }
.heatmap-tile--none { background: #eef3f6; border-color: var(--line); }
.eb-legend--row { flex-direction: row; flex-wrap: wrap; gap: var(--space-4); }
.heatmap-legend { margin-top: 14px; }

/* Detail panel: each .detail-section is a single-level .eb-card with an
   .eb-section-head. The first-level blocks rendered inside (scores, edit form,
   committee brief, timeline, meeting brief) drop their own card chrome so they
   read as flush content of the one card instead of cards-within-a-card. */
.detail-section.eb-card { gap: 12px; display: grid; }
.detail-section.eb-card > .dimension-scores,
.detail-section.eb-card > .company-edit-form,
.detail-section.eb-card > .committee-brief-card,
.detail-section.eb-card > .company-timeline,
.detail-section.eb-card > .meeting-brief {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  margin: 0;
}
/* keep the edit form's accent spine as a left rule, without the card box */
.detail-section.eb-card > .company-edit-form {
  border-left: 3px solid var(--teal);
  padding-left: 12px;
}
.detail-section.eb-card > .dimension-scores > .dimension-scores__header,
.detail-section.eb-card > .dimension-scores > .dimension-score-grid {
  padding-left: 0;
  padding-right: 0;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 14px;
  margin-top: 14px;
  align-items: start;
  min-width: 0;
}

body.screen-investidas .workspace {
  grid-template-columns: minmax(0, 1fr);
}

body.screen-investidas .context-rail {
  display: none;
}

body.screen-hoje .context-rail {
  display: none;
}

body.screen-investidas .portfolio-crm {
  grid-template-columns: minmax(640px, 0.95fr) minmax(0, 1.05fr);
  gap: 16px;
}

body.screen-investidas .detail-panel {
  max-height: none;
  overflow: visible;
  position: relative;
}

@media (max-width: 1480px) {
  body.screen-investidas .portfolio-crm {
    grid-template-columns: 1fr;
  }
}

.crm-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
  padding: 18px;
}

.crm-panel__header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.crm-panel__header .section-heading {
  min-width: 0;
}

.crm-panel__header .section-heading h2 {
  max-width: none;
}

.crm-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.crm-kpi {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 5px;
  min-height: 84px;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.crm-kpi span,
.crm-kpi small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  line-height: 1.2;
  text-transform: uppercase;
  overflow-wrap: normal;
  word-break: normal;
}

.crm-kpi strong {
  align-self: center;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.crm-workbar {
  display: grid;
  grid-template-columns: minmax(210px, 0.85fr) minmax(0, 1.15fr);
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

body.screen-investidas .crm-panel {
  overflow: visible;
}

.crm-workbar span {
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.crm-workbar p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  text-align: right;
  max-width: 360px;
  justify-self: end;
}

.company-list {
  display: grid;
  gap: 0;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(101, 119, 137, 0.55) rgba(216, 225, 231, 0.45);
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.company-list::-webkit-scrollbar {
  height: 9px;
}

.company-list::-webkit-scrollbar-track {
  background: rgba(216, 225, 231, 0.45);
  border-radius: 999px;
}

.company-list::-webkit-scrollbar-thumb {
  background: rgba(101, 119, 137, 0.55);
  border-radius: 999px;
}

.company-table-head {
  display: grid;
  grid-template-columns: minmax(260px, 1.25fr) minmax(132px, 0.55fr) minmax(150px, 0.62fr) minmax(180px, 0.68fr) minmax(210px, 0.78fr) minmax(230px, 0.72fr) minmax(150px, 0.44fr);
  gap: 12px;
  width: max(100%, 1420px);
  min-width: 1420px;
  padding: 10px 14px 10px 18px;
  border-bottom: 1px solid var(--line);
  background: #eef3f6;
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.company-table-head span:nth-child(4) {
  display: block;
}

.company-table-head span:nth-child(5) {
  display: block;
}

.company-table-head span:nth-child(7) {
  text-align: center;
}

.company-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.25fr) minmax(132px, 0.55fr) minmax(150px, 0.62fr) minmax(180px, 0.68fr) minmax(210px, 0.78fr) minmax(230px, 0.72fr) minmax(150px, 0.44fr);
  align-items: center;
  gap: 12px;
  width: max(100%, 1420px);
  min-width: 1420px;
  min-height: 0;
  padding: 13px 14px 13px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  text-align: left;
  cursor: pointer;
  position: relative;
  overflow: visible;
}

.company-row__date,
.company-row__next {
  display: flex;
}

.company-row:last-child {
  border-bottom: 0;
}

.company-row::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--line-strong);
}

.company-row--Vermelho::before {
  background: var(--red);
}

.company-row--Amarelo::before {
  background: var(--amber);
}

.company-row--Verde::before {
  background: var(--green);
}

.company-row:hover,
.company-row.is-active {
  background: #fbfcfd;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.company-row h2 {
  font-size: 16px;
  line-height: 1.25;
}

.company-row__identity,
.company-row__owner,
.company-row__status,
.company-row__date,
.company-row__next,
.company-row__score {
  min-width: 0;
}

.company-row__signal {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.35;
  display: -webkit-box;
  overflow-wrap: break-word;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.company-row__owner,
.company-row__status,
.company-row__date,
.company-row__next {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 8px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.25;
}

.company-row__owner,
.company-row__status {
  padding-top: 1px;
}

.company-row__owner strong,
.company-row__date strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}

.company-row__owner span,
.company-row__status span,
.company-row__status small,
.company-row__date span,
.company-row__next span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
}

.company-row__next span {
  display: -webkit-box;
  overflow: hidden;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.company-row__score {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  max-width: 100%;
}

.company-row__score .pill {
  max-width: 100%;
}

.company-row__score small {
  max-width: 100%;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  text-align: left;
  overflow-wrap: break-word;
}

.company-row__open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: stretch;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(18, 107, 100, 0.22);
  border-radius: var(--radius-sm);
  background: #e9f5f2;
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.row-meta,
.row-footer,
.reason-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.reason-stack {
  justify-content: flex-end;
  align-content: start;
  max-width: 280px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.pill--Verde {
  border-color: rgba(8, 116, 67, 0.24);
  background: rgba(8, 116, 67, 0.08);
  color: var(--green);
}

.pill--Amarelo {
  border-color: rgba(183, 121, 31, 0.25);
  background: rgba(183, 121, 31, 0.1);
  color: var(--amber);
}

.pill--Vermelho {
  border-color: rgba(180, 35, 24, 0.24);
  background: rgba(180, 35, 24, 0.08);
  color: var(--red);
}

.pill--Sem-alerta {
  color: var(--muted);
}

.pill--score {
  border-color: rgba(112, 71, 168, 0.22);
  background: rgba(112, 71, 168, 0.09);
  color: var(--violet);
}

.pill--risk-high {
  border-color: rgba(180, 35, 24, 0.28);
  background: rgba(180, 35, 24, 0.1);
  color: var(--red);
}

.pill--risk-medium {
  border-color: rgba(183, 121, 31, 0.28);
  background: rgba(183, 121, 31, 0.1);
  color: var(--amber);
}

.pill--risk-low {
  border-color: rgba(8, 116, 67, 0.25);
  background: rgba(8, 116, 67, 0.08);
  color: var(--green);
}

.detail-panel {
  position: sticky;
  top: 132px;
  min-height: 520px;
  max-height: calc(100vh - 148px);
  padding: 0;
  overflow: auto;
  box-shadow: var(--shadow);
  background: #eef3f6;
}

.detail-panel--focus {
  animation: detail-focus-pulse 1.1s ease-out;
}

@keyframes detail-focus-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(18, 107, 100, 0.34), var(--shadow);
  }
  100% {
    box-shadow: 0 0 0 14px rgba(18, 107, 100, 0), var(--shadow);
  }
}

.detail-header {
  display: grid;
  gap: 14px;
  padding: 18px;
  color: var(--ink);
  background: #fff;
  position: relative;
  overflow: hidden;
}

.detail-header::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: var(--line-strong);
}

.detail-header--Vermelho::before {
  background: var(--red);
}

.detail-header--Amarelo::before {
  background: var(--amber);
}

.detail-header--Verde::before {
  background: var(--green);
}

.detail-header h2 {
  color: var(--ink);
  font-size: 26px;
  line-height: 1.08;
}

.detail-header .row-meta {
  color: var(--muted);
}

.detail-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.detail-record-title {
  display: grid;
  gap: 8px;
}

.detail-record-title > span {
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-record-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.detail-record-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.detail-record-fact {
  display: grid;
  gap: 5px;
  min-height: 62px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.detail-record-fact span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-record-fact strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
}

.detail-hero-summary {
  display: grid;
  grid-template-columns: minmax(220px, 0.78fr) minmax(0, 1.22fr);
  gap: 10px;
  min-width: 0;
}

.detail-hero-summary__primary,
.detail-hero-metric {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.detail-hero-summary__primary {
  display: grid;
  gap: 8px;
  min-height: 126px;
  padding: 13px;
}

.detail-hero-summary__primary span,
.detail-hero-metric span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-hero-summary__primary strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.1;
}

.detail-hero-summary__primary p {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.35;
}

.detail-hero-summary__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
  gap: 8px;
  min-width: 0;
}

.detail-hero-metric {
  display: grid;
  gap: 7px;
  min-height: 126px;
  padding: 12px;
  position: relative;
  min-width: 0;
}

.detail-hero-metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--line-strong);
}

.detail-hero-metric--good::before {
  background: #46d39a;
}

.detail-hero-metric--watch::before {
  background: #fbbf24;
}

.detail-hero-metric--risk::before {
  background: #f97066;
}

.detail-hero-metric strong {
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.detail-hero-metric small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.notion-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(18, 107, 100, 0.22);
  border-radius: var(--radius-sm);
  background: #e9f5f2;
  color: var(--teal);
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}

.score-meter {
  display: grid;
  gap: 8px;
}

.detail-snapshot-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.detail-signal {
  display: grid;
  gap: 5px;
  min-height: 62px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.detail-signal span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-signal strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: break-word;
}

.score-meter__label {
  display: flex;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 850;
}

.score-meter__track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.score-meter__fill {
  height: 100%;
  border-radius: inherit;
  background: #fbbf24;
}

.detail-body {
  padding: 0 18px 18px;
}

.detail-section-nav-spacer {
  height: 0;
}

.detail-section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  position: relative;
  z-index: 18;
  margin: 0 -18px 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(238, 243, 246, 0.98);
  box-shadow: 0 8px 18px rgba(16, 32, 51, 0.08);
}

.detail-section-nav.is-fixed {
  position: fixed;
  top: var(--detail-nav-fixed-top);
  left: var(--detail-nav-fixed-left);
  width: var(--detail-nav-fixed-width);
  z-index: 40;
  margin: 0;
}

.detail-section-nav button {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.detail-section-nav button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.detail-section-nav button.is-active {
  border-color: rgba(18, 107, 100, 0.28);
  background: #e9f5f2;
  color: var(--teal);
}

.detail-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-soft);
  scroll-margin-top: 58px;
}

body.screen-investidas .detail-section {
  scroll-margin-top: var(--detail-section-page-offset);
}

.detail-section + .detail-section {
  margin-top: 12px;
}

.detail-section__heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.detail-section__heading span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-section__heading strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.2;
  text-align: right;
}

.dimension-scores {
  display: grid;
  gap: 10px;
  margin-bottom: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.dimension-scores__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 0;
}

.dimension-scores__header span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.dimension-scores__header strong {
  color: var(--ink);
  font-size: 14px;
}

.dimension-score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
}

.dimension-score {
  display: grid;
  gap: 7px;
  min-height: 94px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.dimension-score__top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.dimension-score__top span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.dimension-score__top strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.dimension-score__track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.dimension-score__fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.dimension-score--watch .dimension-score__fill {
  background: var(--amber);
}

.dimension-score--risk .dimension-score__fill {
  background: var(--red);
}

.dimension-score p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.committee-brief-card {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.committee-brief-card__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.committee-brief-card__header span,
.committee-brief-card__grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.committee-brief-card__header strong {
  color: var(--ink);
  font-size: 14px;
}

.committee-brief-card__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.committee-brief-card__grid div {
  min-height: 68px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.committee-brief-card__grid p {
  margin-top: 6px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-grid--single {
  grid-template-columns: 1fr;
  margin-top: 10px;
}

.company-edit-form {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.company-edit-form[data-save-state="saving"] {
  border-left-color: var(--blue);
}

.company-edit-form[data-save-state="saved"] {
  border-left-color: var(--green);
}

.company-edit-form[data-save-state="error"] {
  border-left-color: var(--red);
}

.company-edit-form__header,
.company-edit-form__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.company-edit-form__header span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.company-edit-form__header strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 15px;
}

.company-edit-form__header p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  text-align: right;
}

.company-edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.company-edit-grid label {
  display: grid;
  gap: 6px;
}

.company-edit-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.company-edit-grid input,
.company-edit-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13px;
}

.company-edit-grid input {
  min-height: 36px;
  padding: 7px 9px;
}

.company-edit-grid textarea {
  resize: vertical;
  min-height: 76px;
  padding: 9px;
  line-height: 1.35;
}

.company-edit-grid__wide {
  grid-column: 1 / -1;
}

.field {
  min-height: 72px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.field span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.field p {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.38;
  overflow-wrap: anywhere;
}

.field--wide {
  grid-column: 1 / -1;
}

.meeting-brief {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.meeting-brief__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.meeting-brief__header span,
.meeting-brief__section span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.meeting-brief__header strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}

.meeting-brief__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.meeting-brief__section {
  display: grid;
  gap: 7px;
  min-height: 102px;
  padding: 11px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.meeting-brief__section--warning {
  border-left-color: var(--amber);
}

.meeting-brief__section--critical {
  border-left-color: var(--red);
}

.meeting-brief__section ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

.meeting-brief__section li {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
}

.metric-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 14px;
}

.mini-metric {
  min-height: 70px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.mini-metric span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.mini-metric strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.company-timeline {
  margin-top: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.timeline-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.timeline-heading span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.timeline-heading strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.2;
}

.timeline-heading em {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
  white-space: nowrap;
}

.timeline-summary {
  margin-top: 9px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.timeline-list {
  display: grid;
  gap: 0;
  margin-top: 14px;
}

.timeline-event {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  position: relative;
  padding-bottom: 16px;
}

.timeline-event:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 17px;
  bottom: 0;
  left: 7px;
  width: 2px;
  background: var(--line);
}

.timeline-dot {
  position: relative;
  z-index: 1;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 1px rgba(3, 105, 116, 0.22);
}

.timeline-event--history .timeline-dot {
  background: var(--blue);
}

.timeline-event--future .timeline-dot {
  background: var(--violet);
}

.timeline-event--risk .timeline-dot {
  background: var(--red);
}

.timeline-event__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.timeline-event__top strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}

.timeline-event__top span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.timeline-event p {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.35;
}

.timeline-event small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.empty-state,
.error-state {
  display: grid;
  min-height: 260px;
  place-content: center;
  gap: 8px;
  padding: 24px;
  border: 1px dashed rgba(101, 119, 137, 0.34);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(248, 250, 251, 0.92));
  color: var(--muted);
  text-align: center;
}

.empty-state h2,
.error-state h2 {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.2;
}

@media (max-width: 1180px) {
  .os-shell {
    grid-template-columns: 1fr;
  }

  .os-sidebar {
    min-height: auto;
    position: static;
  }

  .os-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .os-sidebar-card {
    display: none;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .workspace > :not(.context-rail),
  .context-rail {
    grid-column: 1;
  }

  .context-rail {
    grid-row: auto;
    position: static;
  }

  .hero-grid,
  .priority-grid,
  .board-panel,
  .layout,
  .today-panel,
  .clarity-strip,
  .view-context,
  .crm-panel__header {
    grid-template-columns: 1fr;
    display: grid;
    align-items: stretch;
  }

  body.screen-hoje .command-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    position: static;
    grid-template-columns:
      minmax(260px, 1.35fr)
      repeat(5, minmax(150px, 0.8fr))
      minmax(150px, 0.65fr)
      minmax(140px, 0.7fr);
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 900px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-block {
    min-width: 0;
    max-width: 100%;
  }

  .header-subtitle {
    max-width: min(100%, 340px);
    white-space: normal;
  }

  .global-search-shell {
    grid-template-columns: auto minmax(0, 1fr);
    width: 100%;
  }

  .global-search-shell strong {
    white-space: normal;
  }

  .global-search-shell small {
    display: none;
  }

  .os-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics-grid,
  .command-grid,
  .clarity-strip,
  .signal-strip,
  .executive-actions {
    grid-template-columns: 1fr;
  }

  .toolbar {
    grid-template-columns:
      minmax(240px, 1.35fr)
      repeat(5, minmax(142px, 0.8fr))
      minmax(142px, 0.65fr)
      minmax(134px, 0.7fr);
  }

  .mode-switch,
  .crm-kpis,
  .board-kpis,
  .view-context__stats,
  .detail-hero-summary,
  .detail-hero-summary__grid,
  .detail-snapshot-strip,
  .detail-record-grid,
  .war-room-grid,
  .action-inbox-kpis,
  .action-inbox-controls,
  .risk-map-grid,
  .audit-grid,
  .automation-grid,
  .committee-grid,
  .reporting-grid,
  .collections-grid,
  .history-grid,
  .system-scoreboard,
  .system-integrations {
    grid-template-columns: 1fr;
  }

  .mode-button {
    flex: 1 1 118px;
  }

  .automation-card--version {
    grid-column: auto;
  }

  .runtime-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .header-actions {
    flex-wrap: wrap;
  }

  .workspace {
    padding: 12px;
  }

  .os-sidebar {
    padding: 12px;
  }

  .os-nav {
    grid-template-columns: 1fr;
  }

  .metrics-grid,
  .command-grid,
  .clarity-strip,
  .signal-strip,
  .executive-actions,
  .detail-grid,
  .company-edit-grid,
  .metric-card-grid,
  .meeting-brief__grid,
  .committee-brief-card__grid,
  .dimension-score-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    grid-template-columns:
      minmax(230px, 1.35fr)
      repeat(5, minmax(136px, 0.8fr))
      minmax(136px, 0.65fr)
      minmax(128px, 0.7fr);
    padding: 9px;
  }

  .mode-switch {
    max-height: 168px;
    overflow: auto;
  }

  .runtime-grid,
  .automation-stats,
  .system-scoreboard,
  .system-integrations,
  .crm-kpis,
  .board-kpis,
  .action-inbox-kpis,
  .action-inbox-controls,
  .detail-snapshot-strip {
    grid-template-columns: 1fr;
  }

  .detail-topline {
    display: grid;
  }

  .detail-actions {
    justify-content: flex-start;
  }

  .company-row__score small {
    max-width: none;
    text-align: left;
  }

  .crm-workbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .crm-workbar p {
    text-align: left;
  }

  .detail-header,
  .detail-body,
  .executive-panel,
  .distribution-panel,
  .action-agenda,
  .data-quality-panel,
  .committee-brief,
  .war-room-brief,
  .risk-map-brief,
  .audit-brief,
  .automation-brief,
  .reporting-brief,
  .collections-brief,
  .history-brief,
  .heatmap-brief,
  .focus-panel,
  .table-panel,
  .crm-panel {
    padding: 14px;
  }

  .executive-actions,
  .signal-strip,
  .metrics-grid,
  .command-grid {
    gap: 9px;
  }

  .sync-status {
    white-space: normal;
  }

  .timeline-event__top {
    display: grid;
  }

  .action-inbox-header {
    display: grid;
  }

  .action-inbox-header__actions {
    justify-content: flex-start;
  }

  .reason-stack {
    justify-content: flex-start;
    max-width: none;
  }

  .mirror-modal {
    width: min(100%, calc(100vw - 20px));
    max-height: calc(100vh - 20px);
  }

  .mirror-form__grid,
  .mirror-form__actions {
    grid-template-columns: 1fr;
  }
}

/* --- Global AI assistant sidebar (Task 8, spec §7) ---------------------- */
.assistant-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow);
  font-size: 0.85rem;
}
.assistant-launcher span {
  font-size: 1rem;
  line-height: 1;
}
.assistant-launcher strong {
  font-weight: 600;
}
.assistant-launcher[hidden] {
  display: none;
}

.assistant-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  width: min(420px, 35vw);
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.assistant-sidebar[hidden] {
  display: none;
}

.assistant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.assistant-header__title {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.assistant-header__title strong {
  font-size: 1rem;
  color: var(--ink);
}
.assistant-header__controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.assistant-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.72rem;
  cursor: pointer;
}
.assistant-toggle.is-active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.assistant-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.assistant-empty {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}
.assistant-bubble {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 0.86rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.assistant-bubble--user {
  align-self: flex-end;
  background: var(--blue);
  color: #fff;
  border-bottom-right-radius: 2px;
}
.assistant-bubble--assistant {
  align-self: flex-start;
  background: var(--surface-3);
  color: var(--ink);
  border-bottom-left-radius: 2px;
}
.assistant-bubble--pending .assistant-dots {
  letter-spacing: 2px;
  opacity: 0.6;
}
.assistant-md {
  white-space: normal;
}
.assistant-md > :first-child {
  margin-top: 0;
}
.assistant-md > :last-child {
  margin-bottom: 0;
}
.assistant-md p {
  margin: 0 0 6px;
}
.assistant-md ul,
.assistant-md ol {
  margin: 0 0 6px;
  padding-left: 18px;
}
.assistant-md li {
  margin: 2px 0;
}
.assistant-md a {
  color: var(--blue);
  text-decoration: underline;
}
.assistant-md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82em;
  background: var(--surface-2);
  padding: 1px 4px;
  border-radius: 4px;
}
.assistant-md-table {
  width: 100%;
  border-collapse: collapse;
  margin: 4px 0 8px;
  font-size: 0.8rem;
}
.assistant-md-table th,
.assistant-md-table td {
  border: 1px solid var(--border, #e2e6ea);
  padding: 4px 7px;
  text-align: left;
  vertical-align: top;
}
.assistant-md-table th {
  background: var(--surface-2);
  font-weight: 600;
}
.assistant-error {
  align-self: stretch;
  padding: 9px 12px;
  border: 1px solid var(--red);
  border-radius: var(--radius);
  background: rgba(180, 35, 24, 0.06);
  color: var(--red);
  font-size: 0.82rem;
}

.assistant-preview {
  border-top: 1px solid var(--line);
  padding: 14px 16px;
  background: var(--surface-2);
  max-height: 40vh;
  overflow-y: auto;
}
.assistant-preview[hidden] {
  display: none;
}
.assistant-preview__head strong {
  display: block;
  font-size: 0.95rem;
  color: var(--ink);
  margin-top: 2px;
}
.assistant-preview__head p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}
.assistant-preview__fields {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.assistant-preview__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8rem;
}
.assistant-preview__row span {
  color: var(--muted);
}
.assistant-preview__row strong {
  color: var(--ink);
  text-align: right;
  word-break: break-word;
}
.assistant-preview__critical {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--amber);
  border-radius: var(--radius-sm);
  background: rgba(183, 121, 31, 0.06);
}
.assistant-preview__critical p {
  margin: 0 0 8px;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.assistant-preview__critical input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.assistant-preview__actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.assistant-footer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.assistant-footer textarea {
  flex: 1;
  resize: none;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.86rem;
  line-height: 1.4;
}
.assistant-footer button[disabled] {
  opacity: 0.5;
  cursor: default;
}

@media (max-width: 720px) {
  .assistant-sidebar {
    width: 100vw;
  }
}
