:root {
  --bg: #edf3f5;
  --card: #ffffff;
  --card-soft: #f6fafb;
  --primary: #35575f;
  --primary-2: #4f6e75;
  --text: #173236;
  --muted: #6a7e83;
  --line: #d7e2e6;
  --accent: #087ea4;
  --ok: #1d7f45;
  --mid: #a76b00;
  --bad: #d62828;
  --blue-soft: #e7f4f8;
  --shadow: 0 16px 34px rgba(29, 57, 64, .12);
  --radius: 18px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #e7eff2 0%, #f8fbfc 100%);
  color: var(--text);
}
body.dark {
  --bg: #102025;
  --card: #162b31;
  --card-soft: #1b333a;
  --primary: #274e58;
  --primary-2: #315f6a;
  --text: #eef8fa;
  --muted: #b7c8cc;
  --line: #29464e;
  --blue-soft: #19333b;
  --shadow: 0 16px 34px rgba(0,0,0,.28);
  background: linear-gradient(180deg, #0d1b20 0%, #14262c 100%);
}
.app-shell { display: flex; min-height: 100vh; width: 100%; }
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, var(--primary), #233f47);
  color: #fff;
  padding: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: 10px 0 30px rgba(28, 54, 61, .15);
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand-icon { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: rgba(255,255,255,.16); font-size: 22px; font-weight: 900; }
.brand span { display: block; font-size: 12px; opacity: .78; margin-top: 2px; }
.nav-menu { display: grid; gap: 8px; }
.nav-btn {
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
  color: #fff;
  text-align: left;
  padding: 12px 13px;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
}
.nav-btn.active, .nav-btn:hover { background: rgba(255,255,255,.2); transform: translateX(2px); }
.side-card { margin-top: 18px; padding: 14px; border-radius: 16px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); }
.side-card strong { display: block; font-size: 26px; margin: 4px 0; }
.side-label, .side-card small { opacity: .82; font-size: 12px; }
.main-content { flex: 1; min-width: 0; padding: 18px; }
.hero {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.hero h1 { margin: 0; font-size: 25px; }
.hero p { margin: 4px 0 0; font-size: 13px; opacity: .9; }
.hero-actions, .title-actions, .button-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.menu-toggle { display: none; }
.btn, .mini-btn, .icon-btn, .clear {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
  background: #fff;
  color: var(--primary);
  box-shadow: 0 8px 18px rgba(0,0,0,.10);
}
.btn.secondary, .btn.ghost { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.filters-card, .card, .metric-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.filters-card { padding: 14px; margin-bottom: 14px; }
.filters-grid { display: grid; grid-template-columns: 2fr 1.2fr 1.1fr 1.2fr 1fr auto; gap: 10px; align-items: end; }
.field label { display: block; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; color: var(--primary); margin-bottom: 6px; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 13px;
  padding: 11px 12px;
  outline: none;
  font-size: 13px;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8,126,164,.13); }
.quick-row { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; color: var(--muted); font-size: 13px; align-items: center; }
.quick-row input { width: auto; }
.hint, .muted, .footer-note { color: var(--muted); font-size: 12px; }
.metrics-grid { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.metric-card { padding: 15px; position: relative; overflow: hidden; }
.metric-card::after { content: ''; position: absolute; right: -22px; bottom: -22px; width: 70px; height: 70px; border-radius: 50%; background: var(--blue-soft); }
.metric-title { color: var(--muted); font-weight: 800; font-size: 12px; }
.metric-value { font-size: 26px; font-weight: 900; margin-top: 5px; color: var(--primary); }
.metric-small { color: var(--muted); font-size: 11px; margin-top: 5px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.two-columns { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(360px, .8fr); gap: 14px; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.wide-card { grid-column: 1 / -1; }
.card { overflow: hidden; margin-bottom: 14px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; background: var(--primary-2); color: #fff; }
.card-title h2 { margin: 0; font-size: 17px; }
.tag { display: inline-flex; border-radius: 999px; padding: 5px 9px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.30); font-size: 12px; font-weight: 800; }
.mini-btn { padding: 8px 10px; font-size: 12px; background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.32); }
.table-wrap { width: 100%; overflow: auto; max-height: 68vh; }
.medium-height { max-height: 54vh; }
table { width: 100%; min-width: 1120px; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; }
th { position: sticky; top: 0; z-index: 2; background: var(--card-soft); color: var(--primary); text-transform: uppercase; letter-spacing: .04em; font-size: 11px; user-select: none; }
th[data-sort] { cursor: pointer; }
th[data-sort]::after { content: ' ⇅'; opacity: .45; }
tbody tr:nth-child(even) { background: var(--card-soft); }
tbody tr:hover { background: var(--blue-soft); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.status-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; font-weight: 900; font-size: 12px; white-space: nowrap; }
.st-aprovado { background: #e8f7ee; color: var(--ok); }
.st-atencao { background: #fff6df; color: var(--mid); }
.st-critico { background: #ffe9e9; color: var(--bad); }
.st-pendente { background: #edf1f3; color: var(--muted); }
.score-aprovado { color: var(--ok); font-weight: 900; }
.score-atencao { color: var(--mid); font-weight: 900; }
.score-critico { color: var(--bad); font-weight: 900; }
.progress { height: 10px; min-width: 140px; background: #e2ecef; border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.progress > i.aprovado { background: var(--ok); }
.progress > i.atencao { background: var(--mid); }
.progress > i.critico { background: var(--bad); }
.row-action { padding: 7px 11px; border: 1px solid var(--line); background: var(--card); color: var(--primary); border-radius: 999px; font-weight: 800; cursor: pointer; }
.attention-list { padding: 14px; display: grid; gap: 10px; }
.attention-item { border: 1px solid var(--line); border-left: 5px solid var(--bad); padding: 12px; border-radius: 14px; background: var(--card-soft); }
.attention-item strong { display: block; margin-bottom: 4px; }
.bar-chart, .status-chart, .evolution-chart { padding: 14px; display: grid; gap: 10px; }
.chart-row { display: grid; grid-template-columns: 260px 1fr 70px; align-items: center; gap: 10px; font-size: 13px; }
.chart-track { height: 14px; background: #e2ecef; border-radius: 999px; overflow: hidden; }
.chart-fill { height: 100%; border-radius: 999px; background: var(--accent); }
.status-grid { display: grid; grid-template-columns: repeat(2, minmax(140px, 1fr)); gap: 10px; }
.status-box { padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--card-soft); }
.status-box strong { display: block; font-size: 24px; margin-top: 5px; }
.evo-row { display: grid; grid-template-columns: 260px 1fr; gap: 12px; align-items: center; }
.evo-bars { display: grid; gap: 5px; }
.evo-bar { display: grid; grid-template-columns: 52px 1fr 62px; gap: 8px; align-items: center; font-size: 12px; }
.file-tree, .data-tools { padding: 16px; }
.file-tree { font-family: Consolas, 'Courier New', monospace; background: var(--card-soft); margin: 16px; border-radius: 14px; line-height: 1.75; color: var(--text); }
.code-box { white-space: pre-wrap; overflow: auto; background: var(--card-soft); border: 1px solid var(--line); border-radius: 14px; padding: 12px; color: var(--text); min-height: 70px; }
.modal { border: 0; border-radius: 20px; width: min(980px, calc(100vw - 24px)); max-height: 88vh; padding: 0; background: var(--card); color: var(--text); box-shadow: 0 24px 70px rgba(0,0,0,.32); }
.modal::backdrop { background: rgba(7, 19, 23, .55); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--primary); color: #fff; padding: 15px 18px; }
.modal-head h2 { margin: 0; }
.modal-head p { margin: 4px 0 0; opacity: .85; }
.icon-btn { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; }
.modal-body { padding: 16px; }
@media (max-width: 1100px) {
  .sidebar { position: fixed; left: -280px; transition: left .2s ease; }
  .sidebar.open { left: 0; }
  .menu-toggle { display: inline-grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 14px; cursor: pointer; }
  .main-content { padding: 12px; }
  .filters-grid { grid-template-columns: 1fr 1fr; }
  .metrics-grid { grid-template-columns: 1fr 1fr 1fr; }
  .two-columns, .chart-grid { grid-template-columns: 1fr; }
  .wide-card { grid-column: auto; }
}
@media (max-width: 700px) {
  .hero { align-items: flex-start; flex-direction: column; }
  .hero-actions, .hero-actions .btn { width: 100%; }
  .filters-grid, .metrics-grid { grid-template-columns: 1fr; }
  .chart-row, .evo-row { grid-template-columns: 1fr; }
  .chart-row { gap: 5px; }
  table { min-width: 900px; }
}
@media print {
  body { background: #fff; }
  .sidebar, .filters-card, .hero-actions, .menu-toggle, #tab-dados, #tab-graficos, .row-action { display: none !important; }
  .main-content { padding: 0; }
  .hero, .card, .metric-card { box-shadow: none; border-radius: 0; }
  .tab-panel { display: block !important; }
  .table-wrap { max-height: none; overflow: visible; }
}

/* Ajustes v2: wide com padding, appbar fixa, pills e responsividade */
.main-content {
  padding: 16px 18px 28px;
}
.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 8px 0 10px;
  margin: -8px 0 12px;
  background: linear-gradient(180deg, rgba(231,239,242,.96) 0%, rgba(248,251,252,.88) 100%);
  backdrop-filter: blur(12px);
}
body.dark .appbar {
  background: linear-gradient(180deg, rgba(13,27,32,.96) 0%, rgba(20,38,44,.88) 100%);
}
.hero {
  padding: 13px 16px;
  margin-bottom: 10px;
}
.hero h1 { font-size: clamp(20px, 2vw, 24px); }
.hero p { font-size: 12px; }
.hero-actions .btn { padding: 8px 12px; font-size: 12px; }
.filters-card {
  padding: 12px;
  margin-bottom: 0;
  border-radius: 16px;
}
.filters-grid {
  grid-template-columns: minmax(220px, 1.6fr) minmax(140px, .9fr) minmax(140px, .8fr) minmax(150px, .9fr) minmax(145px, .8fr) auto;
  gap: 8px;
}
.field label { font-size: 10px; margin-bottom: 4px; }
input, select { padding: 9px 10px; font-size: 12px; border-radius: 11px; }
.quick-row { margin-top: 8px; gap: 10px; font-size: 12px; }
.metrics-grid {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}
.metric-card {
  padding: 11px 12px;
  min-height: 86px;
}
.metric-card::after { width: 48px; height: 48px; right: -16px; bottom: -16px; }
.metric-title { font-size: 11px; }
.metric-value { font-size: clamp(18px, 1.7vw, 22px); margin-top: 3px; line-height: 1.15; }
.metric-small { font-size: 10px; margin-top: 4px; }
.card { border-radius: 18px; }
.card-title { padding: 12px 16px; }
.card-title h2 { font-size: clamp(15px, 1.6vw, 17px); }
.table-wrap {
  padding: 10px;
  overflow: auto;
  scrollbar-gutter: stable;
}
.table-wrap table {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
}
th, td { padding: 9px 11px; }
.stage-pill,
.activity-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 999px;
  padding: 4px 9px;
  font-weight: 900;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
}
.stage-1 { background: #e7f4ff; color: #0b6599; border-color: #b9dff4; }
.stage-2 { background: #f1ecff; color: #6246a9; border-color: #d8ccff; }
body.dark .stage-1 { background: #16374a; color: #bde7ff; border-color: #285e7c; }
body.dark .stage-2 { background: #2b244d; color: #d8ccff; border-color: #4c4382; }
.activity-prova { background: #ffeaea; color: #b32626; border-color: #ffc7c7; }
.activity-grupo { background: #e8f7ee; color: #1d7f45; border-color: #bde8cb; }
.activity-individual { background: #fff6df; color: #8b5a00; border-color: #f4dda4; }
.activity-default { background: #edf1f3; color: var(--muted); border-color: var(--line); }
body.dark .activity-prova { background: #4a2020; color: #ffc7c7; border-color: #7a3838; }
body.dark .activity-grupo { background: #183f2a; color: #bde8cb; border-color: #2d7046; }
body.dark .activity-individual { background: #493713; color: #ffe6a8; border-color: #745723; }
body.dark .activity-default { background: #1c3740; color: var(--muted); border-color: var(--line); }
.bar-chart, .status-chart, .evolution-chart {
  padding: 16px;
  overflow: visible;
  gap: 12px;
}
.chart-row {
  grid-template-columns: minmax(150px, 260px) minmax(180px, 1fr) 66px;
  width: 100%;
}
.chart-row strong,
.evo-row > strong {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
}
.chart-track { min-width: 0; height: 13px; }
.evo-row {
  grid-template-columns: minmax(150px, 260px) minmax(220px, 1fr);
  width: 100%;
}
.evo-bar { grid-template-columns: 92px minmax(120px, 1fr) 62px; }
.evo-bar .stage-pill { width: fit-content; }
.evo-1 .chart-fill { background: #0b7fab; }
.evo-2 .chart-fill { background: #7255bd; }
.modal {
  width: min(1020px, calc(100vw - 28px));
  max-height: min(88vh, 860px);
  overflow: hidden;
}
.modal-body {
  padding: 14px;
  overflow: auto;
  max-height: calc(88vh - 86px);
}
.modal-body .metrics-grid { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
@media (max-width: 1280px) {
  .filters-grid { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
  .clear { justify-self: start; }
  .metrics-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
}
@media (max-width: 1100px) {
  .appbar { margin-top: -4px; }
  .main-content { padding: 12px; }
  .hero { padding: 12px; }
  .filters-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters-grid .wide-field { grid-column: 1 / -1; }
  .chart-row, .evo-row { grid-template-columns: minmax(130px, 210px) minmax(180px, 1fr); }
  .chart-row .num { grid-column: 2; justify-self: end; }
  .evo-bar { grid-template-columns: 84px minmax(120px, 1fr) 58px; }
}
@media (max-width: 760px) {
  .appbar { position: sticky; top: 0; padding-bottom: 8px; }
  .hero { gap: 10px; }
  .hero-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .filters-card { padding: 10px; }
  .filters-grid, .metrics-grid { grid-template-columns: 1fr; }
  .quick-row { display: grid; gap: 7px; }
  .metric-card { min-height: auto; }
  .two-columns, .chart-grid { gap: 10px; }
  .chart-row, .evo-row, .evo-bar { grid-template-columns: 1fr; }
  .chart-row .num { grid-column: auto; justify-self: start; }
  .status-grid { grid-template-columns: 1fr; }
  .table-wrap { padding: 8px; }
  table { min-width: 760px; }
  th, td { padding: 8px 9px; font-size: 12px; }
  .modal { width: calc(100vw - 16px); }
  .modal-body .metrics-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .main-content { padding: 8px; }
  .appbar { margin: -4px 0 8px; }
  .hero h1 { font-size: 18px; }
  .hero p { display: none; }
  .btn, .mini-btn, .clear { padding: 9px 11px; font-size: 12px; }
  .card-title { align-items: flex-start; flex-direction: column; }
  table { min-width: 680px; }
}

/* Ajustes v3: tabelas realmente responsivas, sem rolagem horizontal desnecessária */
.table-wrap {
  overflow-x: hidden;
  overflow-y: auto;
}
.table-wrap table,
table {
  width: 100%;
  min-width: 0 !important;
  table-layout: fixed;
}
th, td {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}
.progress {
  width: 100%;
  min-width: 0;
}

/* Dashboard: 4 colunas cabendo dentro do card */
#dashboardTable th:nth-child(1),
#dashboardTable td:nth-child(1) { width: 54%; }
#dashboardTable th:nth-child(2),
#dashboardTable td:nth-child(2) { width: 14%; }
#dashboardTable th:nth-child(3),
#dashboardTable td:nth-child(3) { width: 16%; }
#dashboardTable th:nth-child(4),
#dashboardTable td:nth-child(4) { width: 16%; }
#dashboardTable .progress { max-width: 100%; }

/* Resumo: mantém todas as colunas visíveis em wide */
#summaryTable th:nth-child(1),
#summaryTable td:nth-child(1) { width: 25%; }
#summaryTable th:nth-child(2),
#summaryTable td:nth-child(2),
#summaryTable th:nth-child(3),
#summaryTable td:nth-child(3) { width: 12%; }
#summaryTable th:nth-child(4),
#summaryTable td:nth-child(4) { width: 11%; }
#summaryTable th:nth-child(5),
#summaryTable td:nth-child(5) { width: 11%; }
#summaryTable th:nth-child(6),
#summaryTable td:nth-child(6) { width: 9%; }
#summaryTable th:nth-child(7),
#summaryTable td:nth-child(7) { width: 14%; }
#summaryTable th:nth-child(8),
#summaryTable td:nth-child(8) { width: 6%; }

/* Detalhes */
#detailTable th:nth-child(1),
#detailTable td:nth-child(1) { width: 30%; }
#detailTable th:nth-child(2),
#detailTable td:nth-child(2) { width: 15%; }
#detailTable th:nth-child(3),
#detailTable td:nth-child(3) { width: 22%; }
#detailTable th:nth-child(4),
#detailTable td:nth-child(4),
#detailTable th:nth-child(5),
#detailTable td:nth-child(5) { width: 11%; }
#detailTable th:nth-child(6),
#detailTable td:nth-child(6) { width: 11%; }

.status-pill, .stage-pill, .activity-pill, .row-action {
  max-width: 100%;
  white-space: normal;
  text-align: center;
}

@media (max-width: 980px) {
  th, td { padding: 8px 7px; font-size: 12px; }
  th { font-size: 10px; }
  .status-pill, .stage-pill, .activity-pill { padding: 4px 7px; font-size: 10px; }
  .row-action { padding: 6px 8px; font-size: 11px; }
  #summaryTable th:nth-child(1), #summaryTable td:nth-child(1) { width: 22%; }
  #summaryTable th:nth-child(7), #summaryTable td:nth-child(7) { width: 12%; }
}

/* Celular: vira cartões para ficar legível e sem scroll lateral */
@media (max-width: 700px) {
  .table-wrap { overflow: visible; max-height: none; padding: 8px; }
  table, thead, tbody, tr, th, td { display: block; width: 100% !important; }
  thead { display: none; }
  tbody tr {
    border: 1px solid var(--line);
    border-radius: 14px;
    margin-bottom: 10px;
    overflow: hidden;
    background: var(--card);
  }
  tbody tr:nth-child(even) { background: var(--card); }
  td {
    display: grid;
    grid-template-columns: 44% 1fr;
    gap: 10px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    text-align: right;
  }
  td:last-child { border-bottom: 0; }
  td::before {
    content: attr(data-label);
    text-align: left;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--primary);
  }
  td.num { text-align: right; }
  .progress { height: 11px; }
}

/* Ajustes v4: média com pendências e aviso claro de notas não lançadas */
.status-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}
.num.status-cell { justify-content: flex-end; }
.pending-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  background: #fff3cd;
  color: #8a5a00;
  border: 1px solid #f1d381;
  white-space: normal;
  text-align: center;
}
body.dark .pending-pill {
  background: #493713;
  color: #ffe6a8;
  border-color: #745723;
}
.quick-row label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
#calcHint {
  font-weight: 800;
}
@media (max-width: 700px) {
  .status-cell { justify-content: end; }
  .pending-pill { font-size: 10px; padding: 4px 7px; }
}


/* Ajustes v5: modo de cálculo visível, tabela com pendências e visual realmente alterado */
.calc-mode-box {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px dashed var(--line);
  background: var(--card-soft);
  border-radius: 14px;
}
.calc-mode-box > span {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--primary);
  margin-right: 4px;
}
.mode-option {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}
.mode-option input { width: auto; }
.mode-option small { color: var(--muted); font-weight: 700; }
.mode-option.active {
  background: linear-gradient(135deg, #e8f7ee, #e7f4ff);
  border-color: #9fd6bb;
  color: var(--ok);
  box-shadow: 0 8px 18px rgba(29,127,69,.12);
}
body.dark .mode-option.active { background: linear-gradient(135deg, #183f2a, #16374a); }
.calc-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 900;
  white-space: normal;
  text-align: center;
  border: 1px solid var(--line);
}
.calc-pill.partial { background: #e7f4ff; color: #0b6599; border-color: #b9dff4; }
.calc-pill.zero { background: #ffeaea; color: #b32626; border-color: #ffc7c7; }
.calc-pill.complete { background: #e8f7ee; color: var(--ok); border-color: #bde8cb; }
.cell-note {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
#summaryTable th:nth-child(1), #summaryTable td:nth-child(1) { width: 20%; }
#summaryTable th:nth-child(2), #summaryTable td:nth-child(2),
#summaryTable th:nth-child(3), #summaryTable td:nth-child(3) { width: 10%; }
#summaryTable th:nth-child(4), #summaryTable td:nth-child(4) { width: 9%; }
#summaryTable th:nth-child(5), #summaryTable td:nth-child(5) { width: 14%; }
#summaryTable th:nth-child(6), #summaryTable td:nth-child(6) { width: 8%; }
#summaryTable th:nth-child(7), #summaryTable td:nth-child(7) { width: 10%; }
#summaryTable th:nth-child(8), #summaryTable td:nth-child(8) { width: 8%; }
#summaryTable th:nth-child(9), #summaryTable td:nth-child(9) { width: 9%; }
#summaryTable th:nth-child(10), #summaryTable td:nth-child(10) { width: 5%; }
#summaryTable .status-cell { align-items: flex-start; }
.quick-row { align-items: stretch; }
@media (max-width: 900px) {
  .calc-mode-box { align-items: stretch; }
  .mode-option { flex: 1 1 240px; justify-content: center; }
  th, td { font-size: 11.5px; padding: 7px 6px; }
}
@media (max-width: 700px) {
  .calc-mode-box { display: grid; grid-template-columns: 1fr; }
  .mode-option { width: 100%; }
}


/* Ajustes v7: gráfico comparativo com cores separadas e cards superiores compactos */
.metrics-grid {
  grid-template-columns: repeat(6, minmax(115px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.metric-card {
  padding: 9px 10px;
  min-height: 68px;
  border-radius: 14px;
}
.metric-card::after {
  width: 34px;
  height: 34px;
  right: -12px;
  bottom: -12px;
  opacity: .75;
}
.metric-title { font-size: 10.5px; line-height: 1.1; }
.metric-value {
  font-size: clamp(17px, 1.35vw, 20px);
  margin-top: 2px;
  line-height: 1.08;
  word-break: normal;
}
.metric-small { font-size: 9.5px; margin-top: 3px; line-height: 1.2; }
.evo-bar.evo-1 .chart-fill { background: #0b7fab !important; }
.evo-bar.evo-2 .chart-fill { background: #7b4cc2 !important; }
.evo-bar.evo-1 .chart-track { background: #d9edf3; }
.evo-bar.evo-2 .chart-track { background: #e6ddf4; }
body.dark .evo-bar.evo-1 .chart-track { background: #183b47; }
body.dark .evo-bar.evo-2 .chart-track { background: #2c2345; }
.evo-bar .stage-pill { min-width: 34px; padding-inline: 7px; }
@media (max-width: 1200px) {
  .metrics-grid { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
}
@media (max-width: 760px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card { min-height: 62px; }
}
@media (max-width: 460px) {
  .metrics-grid { grid-template-columns: 1fr; }
}


/* Ajustes v8: cards mínimos, situação sem quebrar letra por letra e cores do comparativo reforçadas */
.metrics-grid {
  grid-template-columns: repeat(7, minmax(128px, 1fr));
  gap: 7px;
  align-items: stretch;
}
.metric-card {
  padding: 7px 9px;
  min-height: 54px;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(29, 57, 64, .08);
}
.metric-card::after {
  width: 24px;
  height: 24px;
  right: -8px;
  bottom: -8px;
  opacity: .55;
}
.metric-title {
  font-size: 10px;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metric-value {
  font-size: clamp(15px, 1.12vw, 18px);
  margin-top: 1px;
  line-height: 1.05;
  overflow-wrap: normal;
  word-break: normal;
}
.metric-small {
  font-size: 9px;
  margin-top: 1px;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-pill,
.stage-pill,
.activity-pill,
.calc-pill,
.pending-pill,
.row-action {
  white-space: nowrap !important;
  word-break: keep-all;
  overflow-wrap: normal;
}
.status-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center !important;
  min-width: 0;
}
#dashboardTable th:nth-child(1),
#dashboardTable td:nth-child(1) { width: 48%; }
#dashboardTable th:nth-child(2),
#dashboardTable td:nth-child(2) { width: 15%; }
#dashboardTable th:nth-child(3),
#dashboardTable td:nth-child(3) { width: 19%; }
#dashboardTable th:nth-child(4),
#dashboardTable td:nth-child(4) { width: 18%; }
#dashboardTable .status-pill { max-width: none; }
.evo-bar.evo-1 .chart-fill,
.evo-bar .evo-1-fill {
  background: #0b7fab !important;
}
.evo-bar.evo-2 .chart-fill,
.evo-bar .evo-2-fill {
  background: #7b4cc2 !important;
}
.evo-bar.evo-1 .chart-track { background: #d7edf4 !important; }
.evo-bar.evo-2 .chart-track { background: #ebe3f7 !important; }
body.dark .evo-bar.evo-1 .chart-track { background: #153945 !important; }
body.dark .evo-bar.evo-2 .chart-track { background: #2c2345 !important; }
@media (max-width: 1500px) {
  .metrics-grid { grid-template-columns: repeat(4, minmax(128px, 1fr)); }
}
@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
}
@media (max-width: 760px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card { min-height: 50px; }
  .metric-value { font-size: 16px; }
}
@media (max-width: 460px) {
  .metrics-grid { grid-template-columns: 1fr; }
}

/* Ajustes v9: resumo superior em pills discretos, sem cards grandes */
.metrics-grid {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 4px 0 14px;
}
.metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: min(360px, 100%);
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid var(--line);
  box-shadow: 0 6px 14px rgba(29, 57, 64, .06);
  color: var(--text);
  white-space: nowrap;
}
.metric-pill .metric-title {
  flex: 0 0 auto;
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
  color: var(--muted);
  text-transform: none;
  overflow: visible;
  text-overflow: clip;
}
.metric-pill .metric-value {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: var(--primary);
  font-size: 14px;
  line-height: 1;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.dark .metric-pill {
  background: rgba(22, 43, 49, .82);
  border-color: rgba(255,255,255,.12);
}
.metric-card { display: none; }
@media (max-width: 760px) {
  .metrics-grid { gap: 6px; }
  .metric-pill {
    width: 100%;
    justify-content: space-between;
    max-width: 100%;
    border-radius: 14px;
  }
  .metric-pill .metric-value { text-align: right; }
}


/* Ajustes v10: remover pills de resumo e deixar filtros mais discretos */
.metrics-grid,
#metricsGrid {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.appbar {
  gap: 8px;
  padding-bottom: 8px;
}

.hero {
  min-height: auto;
  padding: 12px 16px;
  border-radius: 14px;
}

.hero h1 {
  font-size: clamp(20px, 1.7vw, 27px);
  line-height: 1.05;
}

.hero p {
  margin-top: 4px;
  font-size: 12px;
  opacity: .92;
}

.hero-actions {
  gap: 7px;
}

.hero-actions .btn,
.btn {
  min-height: 32px;
  padding: 8px 12px;
  font-size: 12px;
}

.filters-card {
  padding: 8px 10px !important;
  margin-bottom: 8px !important;
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(20, 45, 52, .08);
}

.filters-grid {
  grid-template-columns: minmax(220px, 1.8fr) minmax(130px, 1fr) minmax(120px, .9fr) minmax(130px, 1fr) minmax(120px, .9fr) auto !important;
  gap: 8px !important;
}

.field label {
  font-size: 10px;
  letter-spacing: .07em;
  margin-bottom: 3px;
}

input,
select {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.filters-card .clear {
  min-height: 34px;
  align-self: end;
  box-shadow: 0 8px 16px rgba(20, 45, 52, .10);
}

.quick-row {
  margin-top: 7px;
  gap: 8px 12px;
  align-items: center;
  font-size: 11px;
}

.quick-row label {
  white-space: nowrap;
}

.quick-row input[type="checkbox"],
.quick-row input[type="radio"] {
  width: 14px;
  height: 14px;
  min-height: 14px;
}

.calc-mode-box {
  min-height: 30px;
  padding: 4px 7px;
  gap: 6px;
  border-radius: 10px;
  background: rgba(238, 247, 249, .72);
}

.calc-mode-box > span {
  font-size: 10px;
  letter-spacing: .06em;
}

.mode-option {
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
}

.mode-option small {
  font-size: 9px;
}

.hint {
  flex-basis: 100%;
  margin-top: 0;
  font-size: 10.5px;
  line-height: 1.2;
  opacity: .85;
}

.tab-panel {
  margin-top: 8px;
}

.two-columns {
  gap: 12px;
}

.card-title {
  padding: 12px 14px;
}

.card-title h2 {
  font-size: 16px;
}

.table-wrap {
  padding: 8px;
}

@media (max-width: 1280px) {
  .filters-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto !important;
  }
  .filters-grid .wide-field {
    grid-column: span 2;
  }
}

@media (max-width: 900px) {
  .appbar {
    position: sticky;
    top: 0;
  }
  .hero {
    padding: 10px 12px;
  }
  .hero p {
    display: none;
  }
  .hero-actions {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .filters-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  .filters-grid .wide-field {
    grid-column: 1 / -1;
  }
  .filters-card .clear {
    width: 100%;
  }
  .quick-row {
    align-items: flex-start;
  }
  .calc-mode-box {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }
}

@media (max-width: 560px) {
  .filters-grid {
    grid-template-columns: 1fr !important;
  }
  .hero-actions .btn,
  .btn {
    padding: 7px 10px;
    font-size: 11px;
  }
  .quick-row label {
    white-space: normal;
  }
  .calc-mode-box {
    flex-wrap: wrap;
  }
}

/* Ajustes v11: mobile com bottom navbar, filtros recolhíveis e tabelas/cartões mais confortáveis */
.filter-mobile-head,
.bottom-nav {
  display: none;
}

@media (max-width: 760px) {
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    display: none !important;
  }

  .main-content {
    width: 100%;
    padding: 8px 8px 0;
  }

  .appbar {
    position: sticky;
    top: 0;
    z-index: 30;
    margin: 0 0 8px;
    padding: 0 0 8px;
    background: linear-gradient(180deg, rgba(237, 243, 245, .98), rgba(237, 243, 245, .88));
    backdrop-filter: blur(12px);
  }

  body.dark .appbar {
    background: linear-gradient(180deg, rgba(16, 32, 37, .98), rgba(16, 32, 37, .86));
  }

  .hero {
    border-radius: 14px;
    padding: 10px;
    align-items: center;
    gap: 8px;
  }

  .menu-toggle {
    display: none !important;
  }

  .hero h1 {
    font-size: 17px;
    line-height: 1.1;
  }

  .hero-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    width: auto;
    max-width: 48vw;
    justify-content: flex-end;
    scrollbar-width: none;
  }

  .hero-actions::-webkit-scrollbar {
    display: none;
  }

  .hero-actions .btn {
    white-space: nowrap;
    min-height: 30px;
    padding: 7px 9px;
    font-size: 11px;
    box-shadow: none;
  }

  .filters-card {
    padding: 0 !important;
    overflow: hidden;
    border-radius: 13px;
  }

  .filter-mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
  }

  .filter-mobile-head strong {
    display: block;
    font-size: 12px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: .06em;
  }

  .filter-mobile-head span {
    display: block;
    font-size: 10px;
    color: var(--muted);
    margin-top: 1px;
  }

  .filter-toggle-btn {
    border: 1px solid var(--line);
    background: var(--card-soft);
    color: var(--primary);
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 11px;
    font-weight: 900;
  }

  .filters-card .filters-body {
    display: none;
    padding: 0 10px 10px;
  }

  .filters-card.open .filters-body {
    display: block;
  }

  .filters-grid {
    grid-template-columns: 1fr !important;
    gap: 7px !important;
  }

  .filters-grid .wide-field {
    grid-column: auto !important;
  }

  .quick-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
    margin-top: 8px;
    font-size: 11px;
  }

  .quick-row label {
    white-space: normal;
  }

  .calc-mode-box {
    width: 100%;
    overflow: visible;
    flex-wrap: wrap;
  }

  .bottom-nav {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    padding: 6px;
    border-radius: 18px;
    background: rgba(53, 87, 95, .96);
    box-shadow: 0 14px 34px rgba(13, 34, 39, .30);
    border: 1px solid rgba(255,255,255,.18);
    backdrop-filter: blur(14px);
  }

  .bottom-nav .nav-btn {
    display: grid;
    place-items: center;
    gap: 2px;
    min-height: 48px;
    padding: 5px 3px;
    border-radius: 14px;
    text-align: center;
    transform: none !important;
    background: transparent;
    border: 0;
  }

  .bottom-nav .nav-btn.active {
    background: rgba(255,255,255,.18);
  }

  .bottom-nav .nav-btn span {
    font-size: 16px;
    line-height: 1;
  }

  .bottom-nav .nav-btn strong {
    font-size: 9.5px;
    line-height: 1;
  }

  .card {
    border-radius: 14px;
    margin-bottom: 10px;
  }

  .card-title {
    padding: 10px 11px;
    flex-direction: row;
    align-items: center;
  }

  .card-title h2 {
    font-size: 14px;
  }

  .tag,
  .mini-btn {
    font-size: 10px;
    padding: 5px 8px;
  }

  .two-columns,
  .chart-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .medium-height,
  .table-wrap {
    max-height: none;
  }

  td {
    min-height: 40px;
  }

  td::before {
    padding-right: 8px;
  }

  .status-cell {
    justify-content: flex-end;
  }

  .progress {
    max-width: 150px;
    justify-self: end;
  }

  .attention-list {
    padding: 10px;
  }

  .attention-item {
    padding: 10px;
    border-radius: 12px;
  }

  .bar-chart,
  .status-chart,
  .evolution-chart {
    padding: 10px;
  }

  .chart-row,
  .evo-row,
  .evo-bar {
    grid-template-columns: 1fr !important;
  }

  .chart-track {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .hero {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-actions {
    max-width: 100%;
    justify-content: flex-start;
  }

  .bottom-nav {
    left: 6px;
    right: 6px;
    bottom: calc(6px + env(safe-area-inset-bottom));
    border-radius: 16px;
  }

  .bottom-nav .nav-btn strong {
    font-size: 9px;
  }
}

/* Ajustes v12: mobile com expanders fechados para organizar cards, disciplinas e notas */
.mobile-accordion-list {
  display: none;
}

@media (max-width: 760px) {
  .card.mobile-expander > .card-title {
    cursor: pointer;
    user-select: none;
  }

  .card.mobile-expander > .card-title::after {
    content: 'Abrir';
    margin-left: auto;
    flex: 0 0 auto;
    border: 1px solid rgba(255,255,255,.35);
    background: rgba(255,255,255,.14);
    color: #fff;
    border-radius: 999px;
    padding: 5px 8px;
    font-size: 10px;
    font-weight: 900;
  }

  .card.mobile-expander.mobile-open > .card-title::after {
    content: 'Fechar';
  }

  .card.mobile-expander:not(.mobile-open) > :not(.card-title) {
    display: none !important;
  }

  .card.mobile-expander:not(.mobile-open) {
    margin-bottom: 7px;
  }

  .card.mobile-expander:not(.mobile-open) .card-title {
    border-radius: 14px;
  }

  #tab-resumo .table-wrap,
  #tab-detalhes .table-wrap {
    display: none;
  }

  #summaryMobileAccordions,
  #detailMobileAccordions {
    display: grid;
    gap: 8px;
    padding: 9px;
  }

  .mobile-disc-acc {
    border: 1px solid var(--line);
    background: var(--card-soft);
    border-radius: 14px;
    overflow: hidden;
  }

  .mobile-disc-acc summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 12px;
    cursor: pointer;
  }

  .mobile-disc-acc summary::-webkit-details-marker {
    display: none;
  }

  .mobile-disc-acc summary::after {
    content: '＋';
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: var(--primary);
    background: var(--card);
    border: 1px solid var(--line);
    font-weight: 900;
  }

  .mobile-disc-acc[open] summary::after {
    content: '−';
  }

  .mobile-disc-acc summary span {
    min-width: 0;
  }

  .mobile-disc-acc summary strong {
    display: block;
    color: var(--text);
    line-height: 1.18;
  }

  .mobile-disc-acc summary small {
    display: block;
    color: var(--muted);
    margin-top: 3px;
    font-size: 10.5px;
  }

  .mobile-disc-acc summary b {
    margin-left: auto;
    font-size: 14px;
    white-space: nowrap;
  }

  .mobile-acc-body {
    display: grid;
    gap: 8px;
    padding: 0 10px 10px;
  }

  .mobile-kpis {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }

  .mobile-kpis span,
  .mobile-note-line {
    border: 1px solid var(--line);
    background: var(--card);
    border-radius: 12px;
    padding: 8px;
  }

  .mobile-kpis span {
    display: grid;
    gap: 4px;
    font-size: 11px;
    color: var(--muted);
  }

  .mobile-kpis strong {
    color: var(--primary);
    font-size: 14px;
  }

  .mobile-progress {
    max-width: 100%;
    width: 100%;
  }

  .mobile-row-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
  }

  .mobile-note-line {
    display: grid;
    gap: 7px;
  }

  .mobile-note-main {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
  }

  .mobile-note-values {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    font-size: 12px;
    color: var(--muted);
  }

  .mobile-note-values strong {
    color: var(--primary);
  }

  body.dark .mobile-disc-acc {
    background: var(--card-soft);
  }

  body.dark .mobile-kpis span,
  body.dark .mobile-note-line,
  body.dark .mobile-disc-acc summary::after {
    background: var(--card);
  }
}


/* Ajustes v13: tema juvenil delicado, com cara de app feminino sem perder legibilidade */
:root {
  --bg: #fff7fb;
  --card: rgba(255, 255, 255, .92);
  --card-soft: #fff0f8;
  --primary: #8b5fbf;
  --primary-2: #d983b9;
  --text: #44334f;
  --muted: #8a7892;
  --line: #f1d6ea;
  --accent: #b983c9;
  --ok: #3c9b73;
  --mid: #c27b2b;
  --bad: #d64b70;
  --blue-soft: #f5eaff;
  --shadow: 0 14px 32px rgba(149, 94, 151, .14);
  --radius: 20px;
}

body {
  font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 210, 236, .95), transparent 34%),
    radial-gradient(circle at top right, rgba(212, 195, 255, .90), transparent 30%),
    linear-gradient(180deg, #fff7fb 0%, #f8f1ff 54%, #fffdf7 100%);
}

body.dark {
  --bg: #21172b;
  --card: rgba(47, 33, 61, .94);
  --card-soft: #392847;
  --primary: #d4a7f2;
  --primary-2: #ba75bf;
  --text: #fff7ff;
  --muted: #d9c5df;
  --line: #594365;
  --accent: #ffc0e1;
  --blue-soft: #443151;
  --shadow: 0 14px 32px rgba(0,0,0,.28);
  background:
    radial-gradient(circle at top left, rgba(124, 80, 150, .35), transparent 34%),
    radial-gradient(circle at top right, rgba(255, 154, 209, .18), transparent 30%),
    linear-gradient(180deg, #1b1324 0%, #271934 100%);
}

.sidebar {
  background: linear-gradient(180deg, #b983c9 0%, #db8abb 46%, #8b5fbf 100%);
  box-shadow: 12px 0 28px rgba(161, 100, 168, .18);
}

.brand-icon {
  background: rgba(255,255,255,.26);
  border: 1px solid rgba(255,255,255,.38);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.10);
}

.brand strong { letter-spacing: .01em; }

.nav-btn {
  border-color: rgba(255,255,255,.25);
  background: rgba(255,255,255,.12);
  border-radius: 18px;
}
.nav-btn.active,
.nav-btn:hover {
  background: rgba(255,255,255,.28);
  transform: translateX(2px) scale(1.01);
}

.side-card {
  background: rgba(255,255,255,.16);
  border-color: rgba(255,255,255,.28);
}

.main-content { padding-inline: clamp(12px, 2vw, 26px); }

.appbar {
  background: linear-gradient(180deg, rgba(255,247,251,.96), rgba(255,247,251,.78));
  backdrop-filter: blur(14px);
}
body.dark .appbar {
  background: linear-gradient(180deg, rgba(27,19,36,.96), rgba(27,19,36,.78));
}

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 18%, rgba(255,255,255,.35), transparent 25%),
    linear-gradient(135deg, #b983c9 0%, #ee9bc9 54%, #ffcf87 100%);
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 22px;
  box-shadow: 0 16px 36px rgba(196, 113, 174, .18);
}
.hero::after {
  content: "✦ ✧ ✦";
  position: absolute;
  right: 18px;
  bottom: 8px;
  font-size: 34px;
  line-height: 1;
  color: rgba(255,255,255,.38);
  pointer-events: none;
}
.hero h1 {
  font-size: clamp(21px, 2.1vw, 31px);
  letter-spacing: -.02em;
}
.hero p { max-width: 760px; }

.btn, .mini-btn, .icon-btn, .clear, .row-action, .filter-toggle-btn {
  border-radius: 999px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.btn:hover, .mini-btn:hover, .icon-btn:hover, .clear:hover, .row-action:hover, .filter-toggle-btn:hover {
  transform: translateY(-1px);
}
.hero-actions .btn,
.btn {
  box-shadow: 0 9px 20px rgba(143, 85, 157, .13);
}
.btn:not(.ghost):not(.secondary), .clear {
  background: #fff;
  color: #8b5fbf;
}
.btn.secondary, .btn.ghost {
  background: rgba(255,255,255,.20);
  border-color: rgba(255,255,255,.45);
}

.filters-card, .card, .metric-card {
  background: var(--card);
  border-color: rgba(221, 160, 208, .42);
  box-shadow: 0 10px 24px rgba(166, 105, 175, .10);
}
.filters-card {
  padding: 7px 9px !important;
  border-radius: 16px;
}
.field label {
  color: #9b65ad;
}
input, select {
  border-color: #ecd1e9;
  background: rgba(255,255,255,.84);
  border-radius: 14px;
}
input:focus, select:focus {
  border-color: #d983b9;
  box-shadow: 0 0 0 3px rgba(217, 131, 185, .18);
}
body.dark input, body.dark select { background: rgba(47,33,61,.92); }
.quick-row { color: var(--muted); }
.calc-mode-box {
  border-color: #efd5eb;
  background: linear-gradient(135deg, rgba(255,245,251,.88), rgba(246,235,255,.88));
}
body.dark .calc-mode-box {
  border-color: #594365;
  background: rgba(57,40,71,.72);
}
.mode-option.active {
  border-color: #d983b9;
  background: rgba(255, 232, 246, .86);
  color: #7d3f88;
}
body.dark .mode-option.active {
  background: rgba(217,131,185,.20);
  color: #ffd5eb;
}

.card {
  border-radius: 20px;
}
.card-title {
  background: linear-gradient(135deg, #b983c9 0%, #df8ec2 100%);
  padding: 12px 15px;
}
.card-title h2 {
  font-size: 16px;
  letter-spacing: -.01em;
}
.tag {
  background: rgba(255,255,255,.22);
}

.table-wrap {
  border-radius: 0 0 20px 20px;
}
table { min-width: 0; }
th {
  background: #fff0f8;
  color: #8b5fbf;
}
body.dark th { background: #392847; color: #ffd5eb; }
tbody tr:nth-child(even) { background: rgba(255,240,248,.55); }
tbody tr:hover { background: #f5eaff; }
body.dark tbody tr:nth-child(even) { background: rgba(57,40,71,.55); }
body.dark tbody tr:hover { background: #443151; }

.status-pill, .stage-pill, .activity-pill {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
}
.stage-b1, .stage-1 {
  background: #fce4f3 !important;
  color: #a53c8d !important;
}
.stage-b2, .stage-2 {
  background: #e9ddff !important;
  color: #6841a3 !important;
}
.activity-pill {
  background: #fff4d9;
  color: #9a6a13;
  border: 1px solid #ffe3a6;
}

.chart-track, .progress {
  background: #f1dceb;
}
.chart-fill, .progress > i {
  background: linear-gradient(90deg, #d983b9, #b983c9);
}
.progress > i.aprovado { background: linear-gradient(90deg, #72d9ad, #3c9b73); }
.progress > i.atencao { background: linear-gradient(90deg, #ffd07a, #c27b2b); }
.progress > i.critico { background: linear-gradient(90deg, #ff98b2, #d64b70); }
.evo-bar:nth-child(1) .chart-fill { background: linear-gradient(90deg, #ef8fbd, #d983b9) !important; }
.evo-bar:nth-child(2) .chart-fill { background: linear-gradient(90deg, #a78bfa, #8b5fbf) !important; }

.mobile-disc-acc {
  border-radius: 18px;
  border-color: rgba(221,160,208,.45);
  background: rgba(255,255,255,.76);
}
.mobile-disc-acc summary::after {
  background: #fff0f8;
  color: #9b65ad;
}
.mobile-kpis span,
.mobile-note-line {
  border-color: rgba(221,160,208,.45);
}

.bottom-nav {
  background: rgba(255, 250, 253, .92);
  border-color: rgba(217, 131, 185, .34);
  box-shadow: 0 12px 32px rgba(143, 85, 157, .20);
  backdrop-filter: blur(16px);
}
.bottom-nav .nav-btn {
  color: #8b5fbf;
}
.bottom-nav .nav-btn.active {
  background: linear-gradient(135deg, #fff0f8, #efe7ff);
  color: #7d3f88;
}
body.dark .bottom-nav {
  background: rgba(47, 33, 61, .92);
  border-color: rgba(255,255,255,.12);
}
body.dark .bottom-nav .nav-btn { color: #ffd5eb; }
body.dark .bottom-nav .nav-btn.active { background: rgba(217,131,185,.20); }

.modal {
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,.28);
}
.modal-head {
  background: linear-gradient(135deg, #b983c9 0%, #df8ec2 100%);
}

@media (max-width: 760px) {
  .main-content { padding-inline: 9px; }
  .hero {
    border-radius: 18px;
    padding: 10px 11px;
  }
  .hero::after { font-size: 24px; right: 12px; bottom: 6px; }
  .filters-card { border-radius: 16px; }
  .filter-mobile-head strong { color: #9b65ad; }
  .card { border-radius: 18px; }
  .card-title { padding: 11px 12px; }
  .card.mobile-expander > .card-title::after {
    content: 'Abrir ✨';
    border-color: rgba(255,255,255,.45);
  }
  .card.mobile-expander.mobile-open > .card-title::after { content: 'Fechar'; }
}

@media (prefers-reduced-motion: no-preference) {
  .card, .filters-card, .hero, .mobile-disc-acc {
    animation: soft-pop .22s ease both;
  }
  @keyframes soft-pop {
    from { transform: translateY(4px); opacity: .88; }
    to { transform: translateY(0); opacity: 1; }
  }
}
