@font-face { font-family: "Sora"; font-weight: 400; font-display: swap; src: url(/static/fonts/sora-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Sora"; font-weight: 600; font-display: swap; src: url(/static/fonts/sora-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Sora"; font-weight: 700; font-display: swap; src: url(/static/fonts/sora-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Sora"; font-weight: 800; font-display: swap; src: url(/static/fonts/sora-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: "Funnel Display"; font-weight: 700; font-display: swap; src: url(/static/fonts/funnel-display-latin-700-normal.woff2) format("woff2"); }

:root {
  color-scheme: light;
  /* Design system YouX Group: vinho-800 (Marsala YOUX), vinho-900, rosa-400, tinta e cinzas */
  --brand: #891d48; --brand-dark: #5e0b2d; --brand-accent: #891d48; /* brand-accent = token foco */
  --title: #891d48;
  --page: #ffffff; --surface-1: #f2f2f2; --surface-2: #ffffff;
  --text-primary: #1d1d1b; --text-secondary: #595959; --text-muted: #595959;
  --grid: #e7e6e6; --axis: #c9c8c4; --border: #dcdbdb;
  --font-display: "Funnel Display", "Sora", system-ui, sans-serif;
  --font-text: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Espaçamento e forma (espaco-1..5, radius-md, radius-pill do design system) */
  --space-1: 4px; --space-2: 8px; --space-3: 16px; --space-4: 24px; --space-5: 32px;
  --radius-md: 12px; --radius-pill: 999px;
  /* Paleta categórica validada (ordem fixa) */
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  /* Sequencial (azul) */
  --seq-100: #cde2fb; --seq-300: #6da7ec; --seq-450: #2a78d6; --seq-600: #184f95;
  /* Status (reservado; sempre com ícone + texto) */
  --status-good: #0ca30c; --status-warning: #fab219; --status-serious: #ec835a; --status-critical: #d03b3b;
  --good-text: #006300; --critical-text: #b42f2f; --serious-text: #a44a1f; --warning-text: #7a5600;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --brand: #9e184b; --brand-dark: #5e0b2d; --brand-accent: #eb5189; --title: #eb5189;
    --page: #121211; --surface-1: #1a1a19; --surface-2: #232321;
    --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #a3a29a;
    --grid: #2e2e2b; --axis: #4a4a46; --border: #33332f;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #0ca30c; --series-7: #9085e9; --series-8: #e66767;
    --seq-100: #104281; --seq-300: #256abf; --seq-450: #5598e7; --seq-600: #9ec5f4;
    --good-text: #4cc94c; --critical-text: #f08080; --serious-text: #f0a080; --warning-text: #fab219;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font-text); font-size: 14px; line-height: 1.5;
  color: var(--text-primary); background: var(--page); }
a { color: var(--brand); }
@media (prefers-color-scheme: dark) { a { color: var(--brand-accent); } }
h1, h2, h3 { line-height: 1.25; font-family: var(--font-display); font-weight: 700; }
.muted { color: var(--text-secondary); }
.small { font-size: 12px; }
.hidden { display: none !important; }

.dev-banner { background: #fab219; color: #1e1e1e; text-align: center; padding: 4px; font-size: 12px; font-weight: 600; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 24px;
  background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 10; }
.brand { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 14px; }
.brand-logo { height: 22px; width: auto; display: block; }
.brand-sub { font-family: var(--font-text); font-size: 14px; border-left: 1px solid rgba(255,255,255,.6); padding-left: 14px; }
.topnav { display: flex; align-items: center; gap: 18px; font-size: 13px; }
.topnav a, .topnav summary { color: #fff; text-decoration: none; cursor: pointer; }
.topnav a:hover, .topnav summary:hover { text-decoration: underline; }
.who { opacity: .85; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::after { content: " ▾"; }
.menu-list { position: absolute; right: 0; top: 28px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 6px; min-width: 240px; }
.menu-list a { display: block; color: var(--text-primary); padding: 7px 10px; border-radius: 6px; }
.menu-list a:hover { background: var(--surface-1); text-decoration: none; }

.page { max-width: 1440px; margin: 0 auto; padding: var(--space-4); }
.page-title { font-size: 28px; font-weight: 700; margin: 0 0 var(--space-1); color: var(--title); }
.foot { max-width: 1440px; margin: 0 auto; padding: var(--space-3) var(--space-4) var(--space-5); color: var(--text-muted); font-size: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; border-top: 1px solid var(--border); }
.foot-main { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.foot-logo { height: 18px; width: auto; display: block; }
.foot-logo.on-dark { display: none; }
.lema { font-family: var(--font-text); font-size: 12px; color: var(--text-secondary); margin: 0; }
@media (prefers-color-scheme: dark) { .foot-logo.on-light { display: none; } .foot-logo.on-dark { display: block; } }
.warn-text { color: var(--critical-text); font-weight: 600; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-pill); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-primary); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--brand); }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-small { padding: 4px 10px; font-size: 12px; }
.btn-danger { color: var(--critical-text); }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; font-size: 12px; padding: 0; }
:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 2px; }
.topbar :focus-visible { outline-color: #fff; }

.login { max-width: 420px; margin: 10vh auto; background: var(--surface-1); padding: 36px; border-radius: var(--radius-md);
  border: 1px solid var(--border); text-align: center; }
.login h1 { margin-top: 0; color: var(--title); }
.dev-form { display: grid; gap: 12px; text-align: left; }
.dev-form input { width: 100%; }
.alert { background: #fdecec; color: #8a1f1f; padding: 10px 12px; border-radius: 8px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-3); margin-top: var(--space-3); }
.card { display: block; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px 20px;
  color: var(--text-primary); text-decoration: none; transition: border-color .15s; position: relative; }
.card:hover { border-color: var(--brand); }
.card h2 { margin: 0 0 6px; font-size: 18px; color: var(--title); }
.card p { margin: 0; color: var(--text-secondary); font-size: 13px; }
.tag { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 8px; border-radius: var(--radius-pill); background: var(--page); color: var(--text-secondary); border: 1px solid var(--border); }
.card .tag { position: absolute; top: 14px; right: 14px; }
.empty { background: var(--surface-1); border: 1px dashed var(--border); border-radius: var(--radius-md); padding: 32px; text-align: center; margin-top: 24px; }

.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0; position: sticky; top: 52px; z-index: 5;
  background: var(--page); padding: 8px 0; }
.filter { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
select, input[type=text], input[type=email], input[type=search] { font: inherit; font-size: 13px; text-transform: none; letter-spacing: 0;
  padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary); min-width: 160px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; }
.kpi-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.kpi-value { font-family: var(--font-display); font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.kpi-good .status-dot { background: var(--status-good); } .kpi-good .kpi-sub { color: var(--good-text); }
.kpi-critical .status-dot { background: var(--status-critical); } .kpi-critical .kpi-sub { color: var(--critical-text); }
.kpi-serious .status-dot { background: var(--status-serious); } .kpi-serious .kpi-sub { color: var(--serious-text); }
.kpi-warning .status-dot { background: var(--status-warning); } .kpi-warning .kpi-sub { color: var(--warning-text); }

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1000px) { .grid.g2, .grid.g3 { grid-template-columns: 1fr; } }
.panel { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-3); margin-bottom: 16px; min-width: 0; }
.grid > .panel { margin-bottom: 0; }
.panel-title { font-size: 16px; font-weight: 700; margin: 0 0 10px; color: var(--title); }
.note { font-size: 12px; color: var(--text-secondary); margin: 6px 0 0; }
.chart { width: 100%; }
.sources { font-size: 12px; color: var(--text-muted); }

.table-block { display: grid; gap: 8px; }
.table-tools { display: flex; justify-content: space-between; gap: 8px; }
.table-wrap { overflow: auto; max-height: 560px; border: 1px solid var(--border); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data th, table.data td, table.matrix th, table.matrix td { padding: 7px 10px; border-bottom: 1px solid var(--grid); text-align: left; vertical-align: top; }
table.data thead th, table.matrix thead th { position: sticky; top: 0; background: var(--surface-2); font-size: 12px; color: var(--text-secondary);
  cursor: pointer; user-select: none; white-space: nowrap; z-index: 1; }
table.data tfoot td { font-weight: 700; background: var(--surface-2); position: sticky; bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tbody tr:hover { background: var(--page); }
.neg { color: var(--critical-text); font-weight: 600; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  border: 1px solid currentColor; }
.badge-good { color: var(--good-text); } .badge-critical { color: var(--critical-text); }
.badge-serious { color: var(--serious-text); } .badge-warning { color: var(--warning-text); } .badge-neutral { color: var(--text-secondary); }
.bar-cell { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.bar-cell .track { width: 70px; height: 6px; background: var(--grid); border-radius: 3px; overflow: hidden; }
.bar-cell .fill { height: 100%; background: var(--series-1); border-radius: 3px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 16px 0; flex-wrap: wrap; }
.tab { background: none; border: 0; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-panel { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-3); }
.matrix td { text-align: center; } .matrix th { min-width: 120px; }
.matrix tbody th { white-space: nowrap; font-weight: 600; }
.row-all th, .row-group th { color: var(--brand); }
/* no tema escuro o Marsala não atinge 4,5:1 sobre a superfície; usa a variação clara da marca */
@media (prefers-color-scheme: dark) {
  .tab.active { color: var(--brand-accent); border-bottom-color: var(--brand-accent); }
  .row-all th, .row-group th { color: var(--brand-accent); }
}
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.group-card { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px; background: var(--surface-2); }
.group-card h3 { margin: 0; }
.ok { color: var(--good-text); font-weight: 600; } .bad { color: var(--critical-text); font-weight: 600; }
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--text-primary); color: var(--page); padding: 10px 16px; border-radius: var(--radius-md);
  opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; } .toast.bad { background: var(--status-critical); color: #fff; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-pill); overflow: hidden; }
.seg button { background: var(--surface-2); border: 0; padding: 6px 12px; font: inherit; font-size: 12px; cursor: pointer; color: var(--text-secondary); }
.seg button.on { background: var(--brand); color: #fff; }
table.matrix thead th { white-space: normal; min-width: 110px; vertical-align: bottom; }
table.matrix thead th:first-child { min-width: 240px; }
/* Acompanhamento de projeto: seleção de contratos e linha do tempo */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); border: 0; padding: 0; margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface-2); font-size: 13px; cursor: pointer; }
.chip input { accent-color: var(--brand); }
.tl { display: grid; gap: var(--space-2); }
.tl-row { display: grid; grid-template-columns: minmax(120px, 220px) 1fr minmax(150px, 260px); gap: var(--space-3); align-items: center; font-size: 13px; }
.tl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.tl-info { color: var(--text-secondary); font-size: 12px; }
.tl-track { position: relative; height: 22px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill); }
.tl-bar { position: absolute; top: 3px; bottom: 3px; border-radius: var(--radius-pill); background: var(--seq-100); overflow: hidden; border: 1px solid var(--seq-450); }
.tl-fill { height: 100%; background: var(--seq-450); }
.tl-today { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--critical-text); }
@media (max-width: 700px) { .tl-row { grid-template-columns: 1fr; gap: var(--space-1); } }
.org-dir { font-weight: 700; padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: var(--radius-md); background: var(--surface-2); margin: var(--space-3) 0; }
.org-gps { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-3); align-items: start; }
.org-gp { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-2); padding: var(--space-3); }
.org-titulo { margin: 0; font-size: 15px; }
.org-meta { color: var(--text-secondary); font-size: 12px; }
.org-dm { border-left: 3px solid var(--border); padding-left: var(--space-2); margin-top: var(--space-3); }
.org-dm .org-titulo { font-size: 14px; }
.org-lista { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 6px 0 0; }
.org-pessoa { display: flex; flex-direction: column; gap: 2px; }
.org-tambem { color: var(--text-secondary); font-size: 11px; }
