:root {
  --ink:        #111827;
  --muted:      #6b7280;
  --muted-2:    #9ca3af;
  --line:       #e4e9ef;
  --line-2:     #f0f3f7;
  --surface:    #ffffff;
  --panel:      #ffffff;
  --paper:      #f2f5f9;
  --navy:       #07131f;
  --navy-2:     #0d1d2c;
  --green:      #0a9b68;
  --green-deep: #088755;
  --green-soft: #e6f7f0;
  --green-card:        #e8f5ee;
  --green-card-border: #b8dfc8;
  --yellow:     #f4b63d;
  --yellow-soft: #fff5d7;
  --red:        #df4d45;
  --red-soft:   #fef0ef;
  --blue:       #2c6fbb;
  --blue-soft:  #e8f1fb;
  --shadow:     0 1px 3px rgba(15,23,42,.04), 0 4px 14px rgba(15,23,42,.06);
  --shadow-md:  0 2px 8px rgba(15,23,42,.06), 0 12px 28px rgba(15,23,42,.08);
  --shadow-lg:  0 8px 32px rgba(15,23,42,.10), 0 2px 8px rgba(15,23,42,.05);
  --sidebar-bg: linear-gradient(165deg, #4e9d8e 0%, #4da89a 22%, #46a87d 52%, #3b9870 78%, #2b8460 100%);
  --sidebar-text: rgba(255,255,255,.76);
  --font-display: 'Sora', 'Segoe UI', system-ui, sans-serif;
  --font-body:    'DM Sans', 'Segoe UI', system-ui, sans-serif;
}

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

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.topstrip { display: none; }

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

/* ── App Shell ─────────────────────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 11px;
  color: rgba(255,255,255,.88);
  background: var(--sidebar-bg);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 3px 0 24px rgba(7,19,31,.15);
  z-index: 20;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

/* Dot texture overlay */
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
  z-index: 0;
}

.brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 4px 18px;
  border-bottom: 1px solid rgba(255,255,255,.10);
  flex-shrink: 0;
}

.brand-logo {
  width: 110px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.18));
}

.nav-list {
  display: grid;
  gap: 1px;
  flex: 1;
  position: relative;
  z-index: 1;
}

.nav-group-label {
  padding: 14px 10px 4px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: rgba(255,255,255,.35);
  user-select: none;
  font-family: var(--font-display);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  color: var(--sidebar-text);
  background: transparent;
  text-align: left;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: .01em;
  transition: background .18s, color .18s;
  position: relative;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,.11);
}

.nav-item.active {
  color: #fff;
  background: rgba(255,255,255,.20);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  background: rgba(255,255,255,.92);
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 10px rgba(255,255,255,.45);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  opacity: .82;
  transition: opacity .15s;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity: 1; }

/* ── Workspace ─────────────────────────────────────────────────────────────── */
.workspace {
  min-width: 0;
  padding: 0 28px 32px;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ────────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  /* Negative margin spans to workspace edges, padding brings content back */
  margin: 0 -28px 24px;
  padding: 14px 28px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--line);
}

.topbar-greeting {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  font-family: var(--font-display);
  letter-spacing: -.01em;
}

/* ── Topbar summary ────────────────────────────────────────────────────────── */
.topbar-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 4px 0 0;
  justify-content: center;
}

.topbar-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.topbar-stat svg { flex-shrink: 0; }
.topbar-stat strong { color: var(--ink); font-weight: 700; }

.topbar-stat-critical { color: var(--red); }
.topbar-stat-critical strong { color: var(--red); }

/* ── Empresa pill ──────────────────────────────────────────────────────────── */
.empresa-pill-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.empresa-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px 6px 7px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: .01em;
  transition: border-color .18s;
  white-space: nowrap;
  min-width: 160px;
  user-select: none;
  box-shadow: var(--shadow);
}
.empresa-pill:hover {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(10,155,104,.09), var(--shadow);
}
.empresa-pill[data-open="true"] {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(10,155,104,.11), var(--shadow);
}

.empresa-pill-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  border: 1.5px solid var(--green);
  background: var(--green-soft);
  color: var(--green);
  font-size: 18px;
  font-weight: 400;
  flex-shrink: 0;
  line-height: 1;
}

.empresa-pill-name { flex: 1; text-align: left; }
.empresa-pill-chevron { color: var(--muted); flex-shrink: 0; transition: transform .2s; }
.empresa-pill[data-open="true"] .empresa-pill-chevron { transform: rotate(180deg); }

.empresa-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 300px;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  padding: 8px;
  max-height: 380px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.empresa-dd-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1.5px solid var(--green);
  border-radius: 8px;
  background: var(--surface);
  flex-shrink: 0;
}
.empresa-dd-search svg { color: var(--muted); flex-shrink: 0; }
.empresa-dd-input {
  border: none;
  outline: none;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  width: 100%;
  background: transparent;
}
.empresa-dd-input::placeholder { color: var(--muted); }

.empresa-dd-count {
  margin: 6px 2px 4px;
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

.empresa-dd-list { overflow-y: auto; flex: 1; }

.empresa-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border: none;
  background: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink);
  transition: background .12s;
}
.empresa-dropdown-item:hover { background: var(--paper); }
.empresa-dropdown-item.active { background: var(--green-soft); }

.empresa-dd-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--green);
  background: var(--green-soft);
  color: var(--green);
  font-size: 18px;
  font-weight: 400;
  flex-shrink: 0;
  line-height: 1;
}

.empresa-dd-info { flex: 1; min-width: 0; }
.empresa-dd-info strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.empresa-dd-info span { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.empresa-dd-check { color: var(--green); flex-shrink: 0; }

.empresa-dropdown-empty {
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ── Typography ────────────────────────────────────────────────────────────── */
.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  font-family: var(--font-display);
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.15;
  font-family: var(--font-display);
  font-weight: 700;
}

h2 {
  margin-bottom: 4px;
  font-size: 16px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -.015em;
  color: var(--navy);
}

.panel-header p,
.upload-panel span,
.metric-card em,
.metric-card span { color: var(--muted); }

/* ── Topbar actions ────────────────────────────────────────────────────────── */
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.topbar-user {
  font-size: 12px;
  color: var(--muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

#pdfInput {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.primary-button,
.ghost-button,
.small-button,
.segment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background .16s, color .15s, transform .12s;
  font-family: var(--font-body);
  font-size: 13.5px;
  letter-spacing: .01em;
}

.ghost-button:disabled,
.small-button:disabled,
.primary-button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.primary-button {
  border: 1px solid transparent;
  color: #fff;
  background: linear-gradient(135deg, #0bae78 0%, var(--green) 55%, #088350 100%);
  background-size: 200% 100%;
  box-shadow: 0 2px 8px rgba(10,155,104,.22), 0 1px 2px rgba(10,155,104,.15);
}
.primary-button:hover:not(:disabled) {
  background-position: 100% 0;
  box-shadow: 0 4px 16px rgba(10,155,104,.32);
}
.primary-button:active:not(:disabled) {
  transform: scale(.99);
  box-shadow: 0 1px 4px rgba(10,155,104,.18);
}

.ghost-button,
.small-button,
.segment {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
}
.ghost-button:hover:not(:disabled),
.small-button:hover:not(:disabled) {
  background: var(--paper);
  border-color: #c5cbd3;
  color: var(--navy);
}

.small-button { min-height: 34px; padding-inline: 12px; font-size: 13px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  cursor: pointer;
  color: var(--muted);
  flex-shrink: 0;
  transition: background .13s, color .13s, border-color .13s;
}
.icon-btn:hover { background: var(--paper); color: var(--ink); border-color: #c5cbd3; }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); border-color: var(--red); }

/* ── Upload panel ──────────────────────────────────────────────────────────── */
.upload-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1.5px dashed #c8d4dc;
  border-radius: 10px;
  background: var(--surface);
  transition: border-color .2s, background .2s;
}
.upload-panel.drag-over { border-color: var(--green); background: var(--green-soft); }

.upload-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  color: var(--green);
  background: var(--green-soft);
  font-weight: 900;
}

.upload-panel strong,
.upload-panel span { display: block; }
.upload-panel span { margin-top: 4px; font-size: 13px; }

/* ── Status message ────────────────────────────────────────────────────────── */
.status-message {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 14px;
}
.status-message.error  { color: #9f211b; border-color: #ffc6c0; background: var(--red-soft); }
.status-message.success { color: #096343; border-color: #bfe8d1; background: var(--green-soft); }

/* ── Tab panels ────────────────────────────────────────────────────────────── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Metric grid / Painel grid ─────────────────────────────────────────────── */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

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

/* ── Entrance animation ────────────────────────────────────────────────────── */
@keyframes cardEntrance {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Metric cards ──────────────────────────────────────────────────────────── */
.metric-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 136px;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
  transition: transform .22s ease;
  border-left: 3px solid var(--line);
  animation: cardEntrance .45s cubic-bezier(.22,.68,0,1.1) both;
}
.metric-card:nth-child(1) { animation-delay: .04s; }
.metric-card:nth-child(2) { animation-delay: .10s; }
.metric-card:nth-child(3) { animation-delay: .16s; }
.metric-card:nth-child(4) { animation-delay: .22s; }

.metric-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.metric-body {
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.metric-card span {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-family: var(--font-display);
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 10px 0 5px;
  font-size: 48px;
  line-height: 1;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -.03em;
}

.metric-card em {
  display: block;
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
}

.metric-ico {
  flex-shrink: 0;
  margin-left: 16px;
  position: relative;
  z-index: 1;
  color: var(--green);
  opacity: .08;
}

/* Colorful painel metric variants */
.metric-card.metric-pesq {
  background: linear-gradient(135deg, #4e9e90 0%, #42a07a 48%, #2d8a5e 100%);
  border: none;
  border-left: none;
  box-shadow: 0 4px 20px rgba(46,138,94,.26), 0 1px 4px rgba(0,0,0,.08);
}
.metric-card.metric-pesq:hover {
  box-shadow: 0 8px 28px rgba(46,138,94,.34), 0 2px 6px rgba(0,0,0,.10);
}
.metric-card.metric-pesq .metric-body span { color: rgba(255,255,255,.66); }
.metric-card.metric-pesq .metric-body strong { color: #fff; }
.metric-card.metric-pesq .metric-body em { color: rgba(255,255,255,.56); }
.metric-card.metric-pesq .metric-ico { color: rgba(255,255,255,1); opacity: .16; }

.metric-card.metric-resp {
  background: linear-gradient(135deg, #3580d4 0%, #2469be 48%, #1a55a8 100%);
  border: none;
  border-left: none;
  box-shadow: 0 4px 20px rgba(36,105,190,.30), 0 1px 4px rgba(0,0,0,.08);
}
.metric-card.metric-resp:hover {
  box-shadow: 0 8px 28px rgba(36,105,190,.38), 0 2px 6px rgba(0,0,0,.10);
}
.metric-card.metric-resp .metric-body span { color: rgba(255,255,255,.62); }
.metric-card.metric-resp .metric-body strong { color: #fff; }
.metric-card.metric-resp .metric-body em { color: rgba(255,255,255,.52); }
.metric-card.metric-resp .metric-ico { color: rgba(255,255,255,1); opacity: .14; }

.metric-card.metric-green {
  border-left-color: var(--green);
  background: linear-gradient(150deg, var(--surface) 45%, #e8f5ee);
}

.metric-card.attention {
  border-left-color: var(--yellow);
  background: linear-gradient(150deg, var(--surface) 45%, var(--yellow-soft));
}

.metric-card.danger {
  border-left-color: var(--red);
  background: linear-gradient(150deg, var(--surface) 45%, var(--red-soft));
}

/* ── Dashboard grid ────────────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 16px;
}

/* ── Panel ─────────────────────────────────────────────────────────────────── */
.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.panel-header p {
  margin-bottom: 0;
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.5;
}

/* ── Bar chart ─────────────────────────────────────────────────────────────── */
.domain-chart {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(0, 1fr) 40px;
  align-items: center;
  gap: 12px;
  min-height: 32px;
  font-size: 13px;
  color: var(--ink);
}

.bar-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: var(--line-2);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), #2bb87e);
  transition: width .55s cubic-bezier(.4,0,.2,1);
}

/* ── Priority list ─────────────────────────────────────────────────────────── */
.priority-list {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
}

.priority-card {
  display: grid;
  gap: 7px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfd;
  border-left: 3.5px solid var(--line);
  transition: transform .18s ease;
}
.priority-card:hover {
  transform: translateX(3px);
}
.priority-card:has(.tag.critical)  { border-left-color: var(--red); }
.priority-card:has(.tag.attention) { border-left-color: var(--yellow); }
.priority-card:has(.tag.control)   { border-left-color: var(--green); }

.priority-card strong { font-size: 13.5px; font-weight: 600; color: var(--navy); }
.priority-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

/* ── Tags ──────────────────────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 21px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-family: var(--font-display);
}
.tag.control   { color: #065f46; background: #d1fae5; }
.tag.attention { color: #7c5600; background: #fef9c3; border: 1px solid #fde68a; }
.tag.critical  { color: #991b1b; background: #fee2e2; border: 1px solid #fecaca; }

/* ── Segmented control ─────────────────────────────────────────────────────── */
.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
}

.segment {
  min-height: 28px;
  border: 0;
  background: transparent;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  border-radius: 7px;
  transition: background .15s, color .15s;
  padding-inline: 12px;
}
.segment:hover:not(.active) { background: rgba(0,0,0,.04); color: var(--ink); }
.segment.active {
  color: #fff;
  background: var(--navy);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(7,19,31,.25);
}

/* ── Tables ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 840px;
}

th, td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: #f7f9fb;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-family: var(--font-display);
  white-space: nowrap;
}

td { font-size: 13.5px; color: var(--ink); }

tbody tr { transition: background .12s; }
tbody tr:hover { background: #f5f8fb; }
tbody tr:last-child td { border-bottom: none; }

/* ── Action board ──────────────────────────────────────────────────────────── */
.action-board { padding: 16px; display: grid; gap: 16px; }

/* ── Action stats ──────────────────────────────────────────────────────────── */
.action-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.action-stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  text-align: center;
  border-top: 3px solid var(--line);
  transition: transform .18s ease;
}
.action-stat-card:hover { transform: translateY(-2px); }
.action-stat-card.stat-success { border-top-color: var(--green); }
.action-stat-card.stat-danger  { border-top-color: var(--red); }

.stat-num {
  font-size: 30px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
  font-family: var(--font-display);
  letter-spacing: -.02em;
}
.stat-label { font-size: 11.5px; color: var(--muted); margin-top: 6px; font-weight: 500; }

/* ── Toggle switch ─────────────────────────────────────────────────────────── */
.toggle-switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track { position: absolute; inset: 0; background: var(--line); border-radius: 999px; cursor: pointer; transition: background .22s; }
.toggle-track::after { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .22s; box-shadow: 0 1px 4px rgba(0,0,0,.20); }
.toggle-switch input:checked + .toggle-track { background: var(--green); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(20px); }

/* ── Impl toggle bar ───────────────────────────────────────────────────────── */
.impl-toggle-bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 20px; background: var(--paper); }
.impl-toggle-bar strong { font-size: 14px; color: var(--ink); display: block; }
.impl-toggle-bar p { font-size: 12px; color: var(--muted); margin: 3px 0 0; }

/* ── Action filter bar ─────────────────────────────────────────────────────── */
.action-filter-bar { display: flex; gap: 6px; padding: 12px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.action-filter { padding: 5px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: inherit; font-size: 12.5px; cursor: pointer; color: var(--muted); transition: all .15s; }
.action-filter.active { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; box-shadow: 0 1px 4px rgba(7,19,31,.20); }
.action-filter:hover:not(.active) { border-color: var(--green); color: var(--green); background: var(--green-soft); }

/* ── 5W2H dimension groups ─────────────────────────────────────────────────── */
.dim-action-group { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.dim-group-header { padding: 14px 18px; background: var(--paper); border-bottom: 1px solid var(--line); }
.dim-group-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.dim-group-title strong { font-size: 14px; color: var(--navy); font-family: var(--font-display); }
.dim-group-meta { font-size: 12px; color: var(--muted); }
.action-5w2h { border-top: 1px solid var(--line); }
.action-5w2h-header { padding: 12px 18px 8px; }
.action-5w2h-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.action-5w2h-top strong { font-size: 13px; color: var(--navy); flex: 1; min-width: 0; }
.action-5w2h-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.action-status-select { font-size: 12px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-family: inherit; cursor: pointer; }
.action-deadline-input { font-size: 12px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; font-family: inherit; }
.action-5w2h-body { padding: 0 18px 14px; }
.action-5w2h-row { display: grid; grid-template-columns: 80px 1fr; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; line-height: 1.45; }
.action-5w2h-row:last-child { border-bottom: none; }
.w2h-key { font-weight: 700; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding-top: 2px; }

/* ── Pesquisa cards ────────────────────────────────────────────────────────── */
.pesq-list { display: grid; gap: 10px; }

.pesquisa-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.pesquisa-card[data-status="ativa"]     { border-left-color: var(--green); }
.pesquisa-card[data-status="encerrada"] { border-left-color: var(--red); }
.pesquisa-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.pesq-card-body { padding: 16px 20px; }

.pesq-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.pesq-status-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 1px;
}

.pesq-titulo {
  display: block;
  font-size: 15px;
  color: var(--navy);
  margin: 0 0 10px;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: -.01em;
}

.pesq-meta { display: flex; flex-wrap: wrap; gap: 3px 16px; }

.pesq-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}
.pesq-meta-item svg { flex-shrink: 0; opacity: .65; }

.pesq-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pesq-ativar-btn {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, #0bae78 0%, var(--green) 55%, #088350 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0 14px;
  min-height: 32px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background .15s, transform .12s;
  box-shadow: 0 2px 8px rgba(10,155,104,.25);
  white-space: nowrap;
}
.pesq-ativar-btn:hover { box-shadow: 0 4px 14px rgba(10,155,104,.35); transform: scale(1.01); }

.pesq-links-list {
  margin-top: 12px;
  border-top: 1px solid var(--line-2);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pesq-link-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pesq-link-nome { font-weight: 600; font-size: 12px; color: var(--navy); min-width: 110px; }
.pesq-link-url { font-size: 11px; color: var(--blue); word-break: break-all; flex: 1; }
.pesq-link-copy {
  font-size: 11px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.pesq-link-copy:hover { background: var(--blue); color: #fff; border-color: var(--blue); }

.pesq-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.7;
  letter-spacing: .025em;
  font-family: var(--font-display);
  white-space: nowrap;
}
.pesq-badge-draft  { background: #f3f4f6; color: #6b7280; }
.pesq-badge-active { background: #d1fae5; color: #065f46; }
.pesq-badge-closed { background: #fee2e2; color: #991b1b; }
.pesq-badge-dist   { background: var(--blue-soft); color: var(--blue); }
.pesq-badge-meta   { background: var(--line-2); color: var(--muted); }

/* Legacy avatar — hidden in new card layout */
.pesq-avatar { display: none; }
.pesq-card-left { display: contents; }
.pesq-card-info { display: contents; }

/* ── Distribution options ──────────────────────────────────────────────────── */
.dist-option { border: 2px solid var(--line); border-radius: 10px; padding: 14px 16px; cursor: pointer; transition: border-color .18s, background .18s; }
.dist-option:hover { border-color: var(--navy); background: var(--paper); }
.dist-option.selected { border-color: var(--navy); background: var(--surface); box-shadow: 0 0 0 1px var(--navy); }
.dist-option strong { display: block; font-size: 14px; color: var(--navy); margin-bottom: 4px; font-family: var(--font-display); }
.dist-option span { font-size: 13px; color: var(--muted); line-height: 1.4; }

.relatorio-card { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--line); transition: background .12s; }
.relatorio-card:last-child { border-bottom: none; }
.relatorio-card:hover { background: var(--paper); }
.relatorio-card-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--green-soft); display: grid; place-items: center; font-size: 18px; flex-shrink: 0; }
.relatorio-card-info { flex: 1; min-width: 0; }
.relatorio-card-info strong { display: block; font-size: 14px; color: var(--navy); font-family: var(--font-display); }
.relatorio-card-info span { font-size: 13px; color: var(--muted); display: block; margin-top: 3px; }

/* ── Scope tabs ────────────────────────────────────────────────────────────── */
.scope-tabs { display: flex; gap: 2px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.scope-tab { padding: 6px 14px; border: none; background: transparent; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; transition: all .15s; white-space: nowrap; }
.scope-tab:hover { color: var(--ink); background: var(--surface); }
.scope-tab.active { background: var(--surface); color: var(--navy); font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* ── Scope filter bar ──────────────────────────────────────────────────────── */
.scope-filter-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; }

/* ── Result sub-tabs ───────────────────────────────────────────────────────── */
.result-subtabs { display: flex; border-bottom: 2px solid var(--line); margin-bottom: 18px; gap: 0; }
.result-subtab { padding: 10px 22px; background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; transition: color .15s, border-color .15s; white-space: nowrap; font-weight: 500; }
.result-subtab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 700; }
.result-subtab:hover:not(.active) { color: var(--ink); }
.result-subpanel[hidden] { display: none; }

/* ── Resumo geral layout ───────────────────────────────────────────────────── */
.resumo-top-row { display: grid; grid-template-columns: 280px 1fr; gap: 16px; margin-bottom: 16px; }
.gauge-card { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center; gap: 2px; }
.gauge-empty { color: var(--muted); font-size: 13px; }
.zone-badge { display: inline-block; padding: 4px 14px; border-radius: 20px; font-size: 12px; font-weight: 700; margin-top: 8px; font-family: var(--font-display); }
.gauge-score { font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.55; }
.amostra-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 32px 24px; text-align: center; }
.amostra-label { font-size: 11px; font-weight: 700; color: var(--muted); margin-top: 8px; text-transform: uppercase; letter-spacing: .09em; font-family: var(--font-display); }
.amostra-card strong { font-size: 54px; font-weight: 700; color: var(--navy); line-height: 1; margin: 4px 0; font-family: var(--font-display); letter-spacing: -.03em; }
.amostra-sub { font-size: 13px; color: var(--muted); }
.radar-panel { margin-bottom: 16px; }

/* ── Summary counters ──────────────────────────────────────────────────────── */
.summary-counters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }

.counter-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  transition: transform .2s ease;
}
.counter-card:hover { transform: translateY(-3px); }
.counter-fav  { border-color: #86efac; background: #f0fdf4; }
.counter-att  { border-color: #fde68a; background: #fffbeb; }
.counter-risk { border-color: #fecaca; background: #fef2f2; }

.counter-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.counter-fav  .counter-icon { background: #dcfce7; color: #16a34a; }
.counter-att  .counter-icon { background: #fef9c3; color: #ca8a04; }
.counter-risk .counter-icon { background: #fee2e2; color: #dc2626; }

.counter-body { display: flex; flex-direction: column; }
.counter-body strong { font-size: 36px; font-weight: 700; line-height: 1.05; font-family: var(--font-display); letter-spacing: -.03em; }
.counter-fav  .counter-body strong { color: #15803d; }
.counter-att  .counter-body strong { color: #b45309; }
.counter-risk .counter-body strong { color: #dc2626; }
.counter-body span { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.counter-body em { font-size: 12px; color: var(--muted); font-style: normal; }

/* ── Top 5 grid ────────────────────────────────────────────────────────────── */
.top5-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.top5-col { padding: 20px 22px; }
.t5-title { font-size: 11px; font-weight: 700; margin-bottom: 14px; text-transform: uppercase; letter-spacing: .08em; font-family: var(--font-display); }
.t5-title-risk { color: var(--red); }
.t5-title-good { color: var(--green); }
.t5-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.t5-list li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.t5-num { font-size: 11px; color: var(--muted); width: 14px; flex-shrink: 0; text-align: right; }
.t5-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.t5-risk { background: var(--red); }
.t5-good { background: var(--green); }
.t5-name { flex: 1; color: var(--ink); }
.t5-pct { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 5px; margin-left: auto; flex-shrink: 0; font-family: var(--font-display); }
.t5-pct-risk { background: var(--red-soft); color: var(--red); }
.t5-pct-good { background: var(--green-soft); color: var(--green); }
.t5-empty { font-size: 13px; color: var(--muted); padding: 12px 0; }

/* ── PGR Inventory ─────────────────────────────────────────────────────────── */
.pgr-legend-panel { margin-bottom: 14px; }
.pgr-legend-toggle { display: flex; align-items: center; gap: 8px; width: 100%; padding: 12px 16px; background: none; border: none; cursor: pointer; font: inherit; font-size: 13px; text-align: left; }
.pgr-legend-toggle strong { flex: 1; }
.pgr-chevron { transition: transform .2s; }
.pgr-legend-panel.collapsed .pgr-chevron { transform: rotate(180deg); }
.pgr-legend-panel.collapsed .pgr-legend-items { display: none; }
.pgr-legend-items { display: flex; gap: 10px; flex-wrap: wrap; padding: 0 16px 16px; }
.aiha-legend-item { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.aiha-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pgr-table-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink); padding: 14px 16px; border-bottom: 1px solid var(--line); font-family: var(--font-display); }
.pgr-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.pgr-table th { padding: 10px 12px; text-align: left; font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; border-bottom: 1px solid var(--line); background: #f9fafb; white-space: nowrap; font-family: var(--font-display); }
.pgr-table td { padding: 12px; vertical-align: top; border-bottom: 1px solid var(--line); line-height: 1.5; }
.pgr-table tr:last-child td { border-bottom: none; }
.pgr-table tbody tr:hover { background: var(--paper); }
.pgr-agente { max-width: 210px; font-size: 12px; }
.pgr-danos { max-width: 250px; font-size: 11.5px; color: var(--muted); }
.pgr-num { text-align: center !important; font-weight: 600; }
.pgr-score-badge { display: inline-block; padding: 2px 8px; border-radius: 5px; font-weight: 600; font-size: 12px; background: #f3f4f6; color: #374151; }
.aiha-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }

/* ── Scope guide ───────────────────────────────────────────────────────────── */
.scope-guide-item { padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; line-height: 1.5; background: var(--surface); }
.scope-guide-item strong { color: var(--navy); font-family: var(--font-display); }

/* ── Grupo cards ───────────────────────────────────────────────────────────── */
.grupo-card { margin-bottom: 12px; }
.grupo-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.grupo-card-titulo { font-size: 15px; color: var(--navy); font-weight: 700; font-family: var(--font-display); }
.grupo-dims { display: grid; gap: 6px; }
.grupo-dim-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.grupo-dim-name { flex: 1; min-width: 0; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grupo-dim-bar { flex: 0 0 80px; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.grupo-dim-bar-fill { height: 100%; border-radius: 3px; }
.grupo-dim-bar-fill.critical  { background: var(--red); }
.grupo-dim-bar-fill.attention { background: #f59e0b; }
.grupo-dim-bar-fill.control   { background: var(--green); }

/* ── Cargo checklist ───────────────────────────────────────────────────────── */
.cargo-checklist { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; min-height: 42px; background: var(--surface); }
.cargo-check-item { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; cursor: pointer; background: var(--paper); transition: background .12s, border-color .12s; }
.cargo-check-item:hover { background: var(--surface); border-color: #c5cbd3; }
.cargo-check-item input { accent-color: var(--green); }

/* ── Report config modal ───────────────────────────────────────────────────── */
.rc-section { background: var(--green-soft); border: 1px solid #bfe8d1; border-radius: 10px; padding: 14px 16px; }
.rc-hint { font-size: 12.5px; color: #064e3b; margin: 6px 0 12px; line-height: 1.5; }
.rc-label { font-weight: 700; font-size: 13px; color: var(--navy); margin-bottom: 8px; display: block; font-family: var(--font-display); }
.rc-sections-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rc-section-check { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); cursor: pointer; line-height: 1.3; transition: background .12s; }
.rc-section-check:hover { background: var(--paper); }
.rc-section-check input { accent-color: var(--green); width: 15px; height: 15px; flex-shrink: 0; }
.rc-section-check.locked { opacity: .65; cursor: default; }

/* ── Action card ───────────────────────────────────────────────────────────── */
.action-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbfd;
  transition: transform .18s ease;
}
.action-card:hover { transform: translateY(-2px); }

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

.action-card h3 { margin: 0; font-size: 15px; font-family: var(--font-display); color: var(--navy); }

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

.action-meta span {
  display: block;
  padding: 8px;
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  border: 1px solid var(--line);
}

.action-meta strong { display: block; margin-top: 2px; color: var(--ink); font-size: 13px; }

.action-card ol { display: grid; gap: 8px; margin: 0; padding-left: 20px; }
.action-card li { color: #344054; line-height: 1.45; }

.report-preview article { padding: 20px; max-width: 980px; line-height: 1.65; }

.empty-state { padding: 20px; color: var(--muted); font-size: 13.5px; }

/* ── Inline forms ──────────────────────────────────────────────────────────── */
.inline-form {
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.form-group { display: grid; gap: 6px; }

.form-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  font-family: var(--font-display);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  background: var(--surface);
  color: var(--ink);
  transition: border-color .15s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(10,155,104,.10);
}

input.field-invalid,
select.field-invalid {
  border: 1.5px solid var(--red) !important;
  outline: none !important;
}

.field-err { display: block; font-size: 12px; font-weight: 600; color: var(--red); margin-top: 3px; }

.form-actions { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(7,19,31,.55);
}

.modal {
  width: 100%;
  max-width: 560px;
  padding: 24px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 24px 64px rgba(7,19,31,.22), 0 4px 16px rgba(7,19,31,.10);
  animation: cardEntrance .35s cubic-bezier(.22,.68,0,1.1) both;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--navy);
  font-family: var(--font-display);
  letter-spacing: -.01em;
}

/* ── Empresa logo upload ────────────────────────────────────────────────────── */
.emp-logo-area {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 2px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: border-color .15s, background .15s;
  background: var(--paper);
  flex-shrink: 0;
}
.emp-logo-area:hover { border-color: var(--green); background: var(--green-soft); }
.emp-logo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  pointer-events: none;
  user-select: none;
}

.link-box {
  padding: 14px;
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  background: var(--paper);
  word-break: break-all;
  font-size: 13.5px;
  color: var(--blue);
}

/* ── Table actions ─────────────────────────────────────────────────────────── */
td .small-button { margin-right: 4px; }

/* ── Context bar ───────────────────────────────────────────────────────────── */
.context-bar {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  padding: 14px 18px;
  flex-wrap: wrap;
}

.context-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 5px;
  font-family: var(--font-display);
}

.context-select {
  min-width: 280px;
  padding: 9px 32px 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background-color: var(--panel);
  color: var(--ink);
  transition: border-color .15s;
}
.context-select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(10,155,104,.10);
}

/* ── Import result bar ─────────────────────────────────────────────────────── */
.import-result {
  padding: 10px 18px;
  font-size: 13px;
  line-height: 1.6;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

/* ── Select native ─────────────────────────────────────────────────────────── */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px !important;
  cursor: pointer;
}

/* ── Responsive 1040px — icon-only sidebar ─────────────────────────────────── */
@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .brand,
  .nav-group-label { display: none; }

  .sidebar::before { background-size: 18px 18px; }

  .nav-item:not(.active) { font-size: 0; }

  .nav-item {
    justify-content: center;
    padding: 0;
    min-height: 44px;
  }

  .nav-item.active::before { display: none; }
  .nav-item.active { border-radius: 10px; }

  .nav-icon { font-size: 16px; }
  .sidebar-footer { display: none; }

  .metric-grid,
  .painel-grid,
  .dashboard-grid,
  .action-board { grid-template-columns: 1fr; }

  .workspace { padding: 0 20px 24px; }

  .topbar { margin: 0 -20px 24px; padding: 14px 20px; }
}

/* ── Responsive 720px — horizontal nav ────────────────────────────────────── */
@media (max-width: 720px) {
  .app-shell { display: block; }

  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    box-shadow: 0 2px 12px rgba(15,23,42,.15);
    overflow-x: auto;
    overflow-y: visible;
  }

  .sidebar::before { display: none; }

  .nav-item.active::before { display: none; }
  .nav-group-label,
  .brand { display: none; }

  .nav-list {
    display: flex;
    flex-direction: row;
    flex: 1;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-item {
    flex-shrink: 0;
    min-width: 40px;
    min-height: 38px;
    justify-content: center;
    padding: 0 10px;
    font-size: 0;
    border-radius: 8px;
  }
  .nav-item.active { font-size: 0; }
  .nav-icon { opacity: 1; }

  .workspace { padding: 12px; }

  .topbar {
    position: relative;
    margin: 0 0 14px;
    padding: 8px 0 10px;
    background: transparent;
    backdrop-filter: none;
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: none;
    border-bottom: 1px solid var(--line);
  }

  .panel-header { align-items: stretch; flex-direction: column; gap: 10px; }

  .upload-panel { align-items: stretch; flex-direction: column; grid-template-columns: 1fr; }

  .topbar-actions { width: 100%; display: flex; justify-content: flex-end; gap: 8px; }
  .topbar-summary { flex-wrap: wrap; gap: 8px 16px; margin-top: 4px; }
  .empresa-pill { min-width: 140px; }

  .metric-card strong { font-size: 34px; }
  .action-stats-grid { grid-template-columns: repeat(2, 1fr); }

  .context-select { min-width: 0; width: 100%; }
  .context-bar { padding: 10px 14px; gap: 10px; }

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

  h1 { font-size: 22px; }
  h2 { font-size: 15px; }

  .modal { padding: 18px; border-radius: 12px; }

  .rc-sections-grid { grid-template-columns: 1fr; }
  .resumo-top-row { grid-template-columns: 1fr; }
  .summary-counters { grid-template-columns: 1fr; }
  .top5-grid { grid-template-columns: 1fr; }
  .result-subtabs { overflow-x: auto; }
  .scope-tabs { overflow-x: auto; }
  .form-grid { grid-template-columns: 1fr; }
}
