/* Valnutri Industrial Manager — mobile-first, sem recursos externos. */

@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/fonts/manrope.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/fonts/bricolage.woff2") format("woff2"); }

:root {
  --bg: #f3f4f1;
  --surface: #ffffff;
  --surface-2: #f6f7f4;
  --surface-3: #eef0ec;
  --text: #111814;
  --text-2: #47504b;
  --text-3: #68716c;
  --border: #e4e6e1;
  --border-strong: #d2d6cf;
  --line: #eef0ec;
  --ink: #111814;
  --ink-text: #ffffff;
  --brand: #1d6b47;
  --brand-2: #1d6b47;
  --brand-ink: #ffffff;
  --brand-soft: #e3efe8;
  --link: #1d5fb8;
  --focus: #2a78d6;
  --ok: #0f7a3d;
  --ok-soft: #dff2e6;
  --warn: #8a4b00;
  --warn-soft: #fdf0d5;
  --bad: #b42318;
  --bad-soft: #fde4e1;
  --info: #1d5fb8;
  --info-soft: #e6eefb;
  --muted-soft: #eef0ec;
  /* Dados: paleta categórica validada (claro) e cores de estado reservadas. */
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100;
  --mark-muted: #b9beb8;
  --st-good: #0ca30c; --st-warn: #fab219; --st-bad: #d03b3b;
  --tip-bg: #111814; --tip-text: #ffffff; --tip-sub: #c9d0cb;
  --shadow: 0 1px 2px rgba(16, 24, 20, .04), 0 14px 34px -22px rgba(16, 24, 20, .2);
  --shadow-lg: 0 16px 40px rgba(16, 24, 20, .22);
  --radius: 20px;
  --radius-sm: 12px;
  --header-h: 64px;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Bricolage Grotesque", "Manrope", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1110;
    --surface: #161a18;
    --surface-2: #1c211f;
    --surface-3: #232926;
    --text: #eef1ef;
    --text-2: #b4bdb8;
    --text-3: #949d98;
    --border: #262c29;
    --border-strong: #353d39;
    --line: #222825;
    --ink: #eef1ef;
    --ink-text: #111814;
    --brand: #3fae76;
    --brand-2: #57c48c;
    --brand-ink: #06140c;
    --brand-soft: #173326;
    --link: #8db4ff;
    --focus: #3987e5;
    --ok: #5fd08f;
    --ok-soft: #153325;
    --warn: #f0b552;
    --warn-soft: #3a2a10;
    --bad: #ff8a80;
    --bad-soft: #3d1a17;
    --info: #8db4ff;
    --info-soft: #1a2747;
    --muted-soft: #222825;
    --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500;
    --mark-muted: #4a524e;
    --tip-bg: #eef1ef; --tip-text: #111814; --tip-sub: #47504b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
/* Ícones inline: tamanho por omissão (os gráficos .chart definem o seu). */
svg { width: 20px; height: 20px; flex: none; }
a { color: var(--link); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; }
@media (min-width: 900px) { h1 { font-size: 1.9rem; } }
h2 { font-size: 1rem; font-weight: 700; }
h3 { font-size: 1rem; }
p { margin: 0 0 .5rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[data-page-title]:focus, main:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
.noscript { padding: 24px; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hide { display: none !important; }
.grow { flex: 1 1 auto; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--text-2); }

/* ---------- Estrutura ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--header-h);
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px 0 16px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--text);
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 800; letter-spacing: -.01em; min-width: 0; font-size: 15px; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 19px; height: 19px; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { font-weight: 600; color: var(--text-3); }
.topnav { display: none; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 12px;
  border: 0; background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn svg { width: 21px; height: 21px; }
.searchbox-btn {
  display: none; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px; min-width: 230px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-2); cursor: pointer; font: inherit; font-size: .9rem; font-weight: 600; white-space: nowrap;
}
.searchbox-btn:hover { border-color: var(--border-strong); color: var(--text); }
.searchbox-btn svg { width: 17px; height: 17px; }
.searchbox-btn kbd { margin-left: auto; font: 11px var(--mono); color: var(--text-3); border: 1px solid var(--border-strong); border-radius: 6px; padding: 1px 5px; }
.offline-badge { background: #fbbf24; color: #3a2400; font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: .8rem; }

main { flex: 1; width: 100%; max-width: 1320px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + var(--safe-b) + 24px); }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--nav-h) + var(--safe-b)); padding: 6px 4px var(--safe-b);
  display: grid; grid-template-columns: repeat(6, 1fr);
  background: color-mix(in srgb, var(--surface) 94%, transparent); border-top: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 44px; color: var(--text-3); text-decoration: none; font-size: .68rem; font-weight: 700;
}
.bottomnav a svg { width: 22px; height: 22px; padding: 3px 14px; box-sizing: content-box; border-radius: 999px; transition: background-color .2s; }
.bottomnav a[aria-current="page"] { color: var(--text); }
.bottomnav a[aria-current="page"] svg { background: var(--brand-soft); color: var(--brand); }
body.kb-open .bottomnav { display: none; }
body.kb-open main { padding-bottom: 24px; }

@media (min-width: 900px) {
  .topbar { padding: 0 24px; gap: 16px; }
  .bottomnav { display: none; }
  main { padding: 28px 32px 48px; }
  .topnav { display: flex; gap: 2px; margin-left: 8px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .topnav a {
    color: var(--text-2); text-decoration: none; font-weight: 600; font-size: .9rem;
    display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 999px; white-space: nowrap;
  }
  .topnav a:hover { background: var(--surface-3); color: var(--text); }
  .topnav a[aria-current="page"] { background: var(--ink); color: var(--ink-text); }
  .searchbox-btn { display: flex; }
  .search-icon-btn { display: none; }
}
@media (min-width: 900px) and (max-width: 1180px) { .searchbox-btn { min-width: 0; } .searchbox-btn .lbl, .searchbox-btn kbd { display: none; } }
@media (min-width: 900px) and (max-width: 1400px) { .brand small { display: none; } }

/* ---------- Cabeçalho da página ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: .85rem; color: var(--text-2); margin: 2px 0 6px; }
.crumbs a { color: var(--text-2); text-decoration: none; padding: 6px 2px; }
.crumbs a:hover { color: var(--brand-2); text-decoration: underline; }
.crumbs .sep { opacity: .5; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 18px; }
.page-head h1, .dash-title { font-family: var(--display); font-weight: 650; letter-spacing: -.025em; }
.page-head h1 { flex: 1 1 auto; min-width: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none; white-space: nowrap;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.btn-primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--bg)); border-color: transparent; }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); }
.btn-danger.armed { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .875rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-saved { background: var(--surface-3); color: var(--text-2); border-color: var(--surface-3); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row.end { justify-content: flex-end; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--link); font: inherit; cursor: pointer; text-decoration: underline; min-height: 0; }

/* ---------- Cartões e secções ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
@media (min-width: 700px) { .card-pad { padding: 22px; } }
.card + .card, .section + .section { margin-top: 14px; }
.section { margin-top: 18px; }
.section-head { display: flex; align-items: baseline; gap: 8px; margin: 0 2px 8px; }
.section-head h2 { flex: 1; }
.section-head a, .section-head .linkbtn { font-size: .875rem; font-weight: 600; text-decoration: none; }
.section-head a:hover { text-decoration: underline; }
.grid { display: grid; gap: 16px; }
@media (min-width: 700px) { .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .grid-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; } }

/* ---------- Listas ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--border); }
.row {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 16px; min-height: 56px; color: inherit; text-decoration: none;
}
a.row:hover, button.row:hover { background: var(--surface-2); }
button.row { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.row .title { font-weight: 600; overflow-wrap: anywhere; }
.row .sub { color: var(--text-2); font-size: .85rem; display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; }
.row .end { margin-left: auto; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.row .chev { color: var(--text-3); flex: none; }
.more { display: flex; justify-content: center; padding: 12px; }
.empty { padding: 28px 16px; text-align: center; color: var(--text-2); }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }
.count-line { font-size: .85rem; color: var(--text-2); margin: 0 2px 8px; }

/* ---------- Etiquetas ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .75rem; font-weight: 700; line-height: 1; padding: 5px 8px; border-radius: 999px;
  background: var(--muted-soft); color: var(--text-2); white-space: nowrap;
}
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad { background: var(--bad-soft); color: var(--bad); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-brand { background: var(--brand-soft); color: var(--brand-2); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; background: var(--text-3); }
.dot.critica, .dot.bad { background: var(--bad); }
.dot.alta, .dot.warn { background: #e07b00; }
.dot.media, .dot.info { background: var(--info); }
.dot.baixa, .dot.ok { background: var(--ok); }

/* ---------- Dashboard ---------- */
.hero { padding: 18px 16px; }
.hero-line { font-size: 1.15rem; font-weight: 700; margin-bottom: 12px; }
.hero-line .n { color: var(--brand-2); }
.hero .btn { white-space: normal; text-align: center; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.quick .btn { flex: 1 1 auto; }
@media (min-width: 700px) { .quick .btn { flex: 0 0 auto; } }
.view-switch { margin-bottom: 12px; }
.signals { display: grid; gap: 8px; }
@media (min-width: 700px) { .signals { grid-template-columns: repeat(2, 1fr); } }
.signal {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 56px;
  border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border);
  text-decoration: none; color: inherit; border-left: 4px solid var(--warn);
}
.signal.bad { border-left-color: var(--bad); }
.signal.info { border-left-color: var(--info); }
.signal:hover { background: var(--surface-2); }
.signal .num { flex: none; font-size: 1.35rem; font-weight: 800; min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }
/* Linhas por fábrica: o layout depende da largura do cartão, não do ecrã. */
.fab-list { container-type: inline-size; }
.fab-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name btn" "score score" "meta meta"; gap: 6px 12px; padding: 12px 16px; align-items: center; }
.fab-row .name { font-weight: 700; grid-area: name; }
.fab-row .meta { display: flex; gap: 12px; align-items: center; font-size: .85rem; color: var(--text-2); flex-wrap: wrap; min-width: 0; }
.fab-row .meta.sc { grid-area: score; flex-wrap: nowrap; }
.fab-row .meta.mt { grid-area: meta; }
.fab-row > .btn, .fab-row > .act { grid-area: btn; }
@container (min-width: 640px) {
  .fab-row { grid-template-columns: 170px minmax(120px, 1fr) minmax(150px, auto) auto; grid-template-areas: "name score meta btn"; }
}
.scorebar { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 80px; flex: 1; }
.scorebar > i { display: block; height: 100%; border-radius: inherit; background: var(--text-3); }
.scorebar.good > i { background: var(--ok); }
.scorebar.warn > i { background: #e59a1d; }
.scorebar.bad > i { background: var(--bad); }
.score { font-weight: 800; font-variant-numeric: tabular-nums; }
.score.good { color: var(--ok); } .score.warn { color: var(--warn); } .score.bad { color: var(--bad); }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; text-decoration: none; color: inherit; display: block; }
a.kpi:hover { background: var(--surface-2); }
.kpi .v { font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: .8rem; color: var(--text-2); }
.kpi.bad .v { color: var(--bad); } .kpi.warn .v { color: var(--warn); } .kpi.ok .v { color: var(--ok); }

/* ---------- Filtros ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: 0 -2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.chip[aria-pressed="true"], .chip[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.chip .c { font-variant-numeric: tabular-nums; opacity: .85; }
.input-search { flex: 1 1 200px; min-width: 0; }
.seg { display: inline-flex; gap: 2px; padding: 4px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); max-width: 100%; overflow-x: auto; }
.seg button, .seg a {
  min-height: 36px; padding: 0 14px; border: 0; border-radius: 10px; background: none; font: inherit; font-weight: 600; font-size: .9rem;
  color: var(--text-2); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; white-space: nowrap;
}
.seg button:hover, .seg a:hover { color: var(--text); }
.seg [aria-pressed="true"], .seg [aria-current="page"] { background: var(--ink); color: var(--ink-text); }
.seg [aria-pressed="true"]:hover, .seg [aria-current="page"]:hover { color: var(--ink-text); }
.seg.full { display: flex; } .seg.full > * { flex: 1; justify-content: center; }

/* ---------- Formulários ---------- */
.form { display: grid; gap: 14px; }
.form-grid { display: grid; gap: 14px; }
@media (min-width: 700px) { .form-grid.two { grid-template-columns: 1fr 1fr; } .form-grid .span2 { grid-column: 1 / -1; } }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-weight: 600; font-size: .9rem; }
.field .req { color: var(--bad); margin-left: 2px; }
.field .hint { font-size: .8rem; color: var(--text-2); }
.field-error { color: var(--bad); font-size: .85rem; font-weight: 600; min-height: 0; }
.field-error:empty { display: none; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--border-strong); border-radius: 12px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px;
}
textarea { min-height: 88px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--brand); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text); opacity: 1; -webkit-text-fill-color: var(--text); border-style: dashed; }
[aria-invalid="true"] { border-color: var(--bad) !important; box-shadow: 0 0 0 1px var(--bad); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; cursor: pointer; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline > input, .inline > select { flex: 1 1 140px; width: auto; }
.shortcuts { display: flex; gap: 6px; flex-wrap: wrap; }
details.more-fields { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 0 14px; }
details.more-fields > summary { cursor: pointer; font-weight: 600; min-height: 48px; display: flex; align-items: center; color: var(--text-2); list-style: none; }
details.more-fields > summary::-webkit-details-marker { display: none; }
details.more-fields > summary::before { content: "+"; display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px; border-radius: 6px; background: var(--surface-2); }
details.more-fields[open] > summary::before { content: "−"; }
details.more-fields[open] { padding-bottom: 14px; }
.form-actions { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b)); z-index: 5; display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 0; background: linear-gradient(to top, var(--bg) 70%, transparent); }
body.kb-open .form-actions { bottom: 0; }
@media (min-width: 900px) { .form-actions { bottom: 0; } }
.form-actions .btn-primary { flex: 1 1 auto; }
@media (min-width: 700px) { .form-actions .btn-primary { flex: 0 0 auto; min-width: 160px; } }
.readonly-note { background: var(--info-soft); color: var(--info); border-radius: var(--radius-sm); padding: 10px 12px; font-size: .9rem; font-weight: 600; }
.form-error { background: var(--bad-soft); color: var(--bad); border-radius: var(--radius-sm); padding: 10px 12px; font-weight: 600; }
.form-error:empty { display: none; }

.radio-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.radio-seg label { position: relative; }
.radio-seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.radio-seg span {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); font-weight: 600; font-size: .9rem; cursor: pointer;
}
.radio-seg input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.radio-seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.radio-seg input:disabled + span { cursor: default; opacity: .75; }

/* Fotografias */
.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.photo { position: relative; width: 96px; height: 96px; border-radius: 10px; overflow: hidden; background: var(--surface-3); border: 1px solid var(--border); }
.photo img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.photo .rm { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; display: grid; place-items: center; }
.photo .tag { position: absolute; left: 4px; bottom: 4px; font-size: .7rem; background: rgba(0,0,0,.6); color: #fff; padding: 2px 6px; border-radius: 6px; }
.photo-add { width: 96px; height: 96px; border-radius: 10px; border: 2px dashed var(--border-strong); display: grid; place-items: center; text-align: center; color: var(--text-2); font-size: .8rem; font-weight: 600; cursor: pointer; padding: 6px; }
.photo-add input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.photo-add:focus-within { outline: 3px solid var(--focus); }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .75rem; color: var(--text-3); font-weight: 700; letter-spacing: .03em; background: var(--surface-2); position: sticky; top: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--surface-2); }
.table a.cell { display: block; color: inherit; text-decoration: none; font-weight: 700; padding: 4px; border-radius: 6px; text-align: center; }
.table a.cell:hover { background: var(--brand-soft); }

/* ---------- Quadro de tarefas ---------- */
.board { display: grid; gap: 12px; }
@media (min-width: 900px) { .board { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; } }
.col { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.col.drop { outline: 2px dashed var(--brand-2); }
.col h3 { display: flex; justify-content: space-between; padding: 4px 6px 10px; }
.tcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow); }
.tcard + .tcard { margin-top: 8px; }
.tcard[draggable="true"] { cursor: grab; }
.tcard a { color: inherit; text-decoration: none; display: block; }
.tcard .title { font-weight: 600; overflow-wrap: anywhere; }
.tcard .sub { color: var(--text-2); font-size: .8rem; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.tcard .moves { display: flex; gap: 6px; margin-top: 8px; }

/* ---------- Auditoria ---------- */
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand-2); }
.point { padding: 14px 16px; }
.point + .point { border-top: 1px solid var(--border); }
.point .ptxt { font-weight: 600; margin-bottom: 10px; overflow-wrap: anywhere; }
.results { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.results button {
  min-height: 48px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface);
  font: inherit; font-weight: 700; font-size: .85rem; cursor: pointer; color: var(--text); padding: 0 4px;
}
.results button[aria-pressed="true"].r-C { background: var(--ok); border-color: var(--ok); color: #fff; }
.results button[aria-pressed="true"].r-A { background: #d98a0b; border-color: #d98a0b; color: #fff; }
.results button[aria-pressed="true"].r-NC { background: var(--bad); border-color: var(--bad); color: #fff; }
.results button[aria-pressed="true"].r-NA { background: var(--text-2); border-color: var(--text-2); color: var(--surface); }
.results button:disabled { cursor: default; opacity: .8; }
.point-extra { margin-top: 10px; display: grid; gap: 10px; }
.cat-nav { display: flex; gap: 8px; justify-content: space-between; margin-top: 14px; }

/* ---------- Gráficos ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--text-2); font-size: 11px; font-family: var(--font); }
.chart .bar { fill: var(--c1); }
.chart .bar.alt { fill: var(--c2); }
.chart .grid line { stroke: var(--line); }
.chart .val { fill: var(--text); font-weight: 700; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 34%) minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: .875rem; }
.hbar-row .track { height: 12px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.hbar-row .track i { display: block; height: 100%; background: var(--c1); border-radius: inherit; }
.legend { display: flex; gap: 12px; font-size: .8rem; color: var(--text-2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* ---------- Diálogos, toasts, pesquisa ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 12px); z-index: 60; display: grid; gap: 8px; width: min(520px, calc(100vw - 24px)); pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: 20px; } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; background: #111814; color: #fff; padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 600; animation: toast-in .18s ease-out; }
.toast.err { background: #7a1810; }
.toast button { margin-left: auto; background: none; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 8px; min-height: 36px; padding: 0 12px; font: inherit; font-weight: 700; cursor: pointer; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(10, 16, 13, .5); display: flex; align-items: flex-start; justify-content: center; padding: 0; }
@media (min-width: 700px) { .overlay { padding: 8vh 16px; } }
.dialog { background: var(--surface); width: 100%; max-width: 640px; border: 1px solid var(--border); max-height: 100vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
@media (min-width: 700px) { .dialog { border-radius: 20px; max-height: 80vh; overflow: hidden; } }
.dialog-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.dialog-head input { border: 0; font-size: 17px; min-height: 48px; padding: 0 8px; background: transparent; }
.dialog-head input:focus { outline: none; }
.dialog-body { overflow-y: auto; padding: 6px 0; }
.dialog-foot { padding: 8px 14px; border-top: 1px solid var(--border); font-size: .8rem; color: var(--text-2); display: flex; gap: 14px; flex-wrap: wrap; }
.sr-group { padding: 8px 16px 4px; font-size: .75rem; font-weight: 800; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.sr-item { display: flex; gap: 12px; align-items: center; padding: 10px 16px; min-height: 48px; cursor: pointer; color: inherit; text-decoration: none; }
.sr-item[aria-selected="true"] { background: var(--surface-3); }
.sr-item .k { margin-left: auto; font-size: .75rem; color: var(--text-2); }
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.9); display: grid; place-items: center; padding: 16px; }
.lightbox img { max-height: 90vh; max-width: 100%; object-fit: contain; }
.lightbox button { position: absolute; top: 12px; right: 12px; }

.banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--info-soft); color: var(--info); font-weight: 600; margin-bottom: 12px; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner .btn { margin-left: auto; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 20% -10%, var(--brand-soft), transparent 60%), var(--bg); }
.login h1 { font-family: var(--display); font-weight: 650; letter-spacing: -.02em; }
.login .card { width: 100%; max-width: 400px; padding: 24px; }
.login h1 { margin: 12px 0 4px; }
.login .logo { width: 56px; height: 56px; border-radius: 14px; }

/* ---------- Diversos ---------- */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; font-size: .9rem; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps a { display: flex; gap: 12px; align-items: center; padding: 12px 16px; text-decoration: none; color: inherit; min-height: 52px; }
.steps a:hover { background: var(--surface-2); }
.steps li + li { border-top: 1px solid var(--border); }
.tick { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 2px solid var(--border-strong); }
.tick.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.diff { width: 100%; border-collapse: collapse; font-size: .85rem; }
.diff td, .diff th { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.diff .old { color: var(--bad); text-decoration: line-through; }
.diff .new { color: var(--ok); }
.denied { background: var(--bad-soft); }
.hr { height: 1px; background: var(--border); margin: 14px 0; border: 0; }
.drag-handle { cursor: grab; }
.order-btns { display: flex; gap: 2px; }
.order-btns .icon-btn { width: 36px; height: 36px; color: var(--text-2); }
.order-btns .icon-btn:hover { background: var(--surface-2); }
.inline-edit { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) { .inline-edit { grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; } }

/* ---------- Início: painel bento (direção B) ---------- */
.dash { display: flex; flex-direction: column; gap: 18px; }
.dash-hello { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.dash-hello .when { font-size: .8rem; font-weight: 600; color: var(--text-3); }
.dash-title { margin: 2px 0 0; font-size: 2rem; line-height: 1.05; }
@media (min-width: 900px) { .dash-title { font-size: 2.5rem; } }
.dash-sum { margin: 8px 0 0; font-size: 1rem; color: var(--text-2); max-width: 760px; text-wrap: pretty; }
.dash-sum strong { color: var(--text); }
.dash-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.dash-filters .note { margin-left: auto; font-size: .8rem; color: var(--text-3); }
.selbox { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 5px 0 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.selbox span { font-size: .8rem; font-weight: 600; color: var(--text-3); }
.selbox select { min-height: 36px; height: 36px; width: auto; border: 0; border-radius: 10px; background-color: var(--surface-3); padding: 0 32px 0 10px; font-weight: 700; font-size: .9rem; }
.bento { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; }
.bento > .tile-card { flex: 1 1 340px; min-width: 0; }
.bento > .w-dec { flex: 1 1 320px; }
.bento > .w-met { flex: 2.4 1 600px; }
.bento > .w-full { flex: 1 1 100%; }
.bento > .w-aud { flex: 1 1 380px; }
.bento > .w-cz { flex: 1 1 340px; }
.bento > .w-pf { flex: 1.2 1 380px; }
.bento > .w-half { flex: 1 1 420px; }
.tile-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
@media (min-width: 700px) { .tile-card { padding: 22px; } }
.tile-card.flush { padding: 0; gap: 0; overflow: hidden; }
.tile-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 10px; flex-wrap: wrap; }
.tile-head h2 { margin: 0; font-size: .95rem; }
.tile-head .sub { font-size: .8rem; color: var(--text-3); }
.tile-head a { font-size: .85rem; font-weight: 600; text-decoration: none; }
.pill { font-size: .78rem; font-weight: 600; color: var(--text-2); background: var(--surface-3); border-radius: 999px; padding: 3px 10px; }
.note-sm { margin: 0; font-size: .8rem; color: var(--text-2); text-wrap: pretty; }
.note-sm.mt { margin-top: auto; }
.est { font-size: .72rem; font-weight: 700; color: var(--warn); background: var(--warn-soft); border-radius: 999px; padding: 1px 7px; vertical-align: 1px; }

/* Itens a decidir */
.hero-n { display: flex; align-items: baseline; gap: 12px; }
.hero-n b { font-size: 4rem; font-weight: 800; letter-spacing: -.04em; line-height: .95; font-variant-numeric: tabular-nums; }
.hero-n span { color: var(--text-2); }
.stack { display: flex; gap: 2px; height: 14px; }
.stack i { min-width: 6px; flex: var(--n) 1 0; background: var(--cl); transition: opacity .2s, flex-grow .6s cubic-bezier(.2,.8,.2,1); }
.stack i:first-child { border-radius: 4px 0 0 4px; } .stack i:last-child { border-radius: 0 4px 4px 0; } .stack i:only-child { border-radius: 4px; }
.stack i.dimmed, .leg-item.dimmed { opacity: .3; }
.legend-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 12px; }
.leg-item { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 8px; margin-left: -8px; border-radius: 9px; color: inherit; text-decoration: none; transition: opacity .2s; }
.leg-item:hover { background: var(--surface-2); }
.leg-item .sw { width: 10px; height: 10px; border-radius: 3px; background: var(--cl); flex: none; }
.leg-item .l { flex: 1; font-size: .82rem; color: var(--text-2); }
.leg-item b { font-size: .9rem; font-variant-numeric: tabular-nums; }
.top-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.top-list li { border-bottom: 1px solid var(--line); }
.top-list a { display: flex; align-items: center; gap: 10px; padding: 10px 0; color: inherit; text-decoration: none; }
.top-list a:hover .t { text-decoration: underline; }
.top-list .dot { width: 8px; height: 8px; }
.top-list .t { font-weight: 600; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.top-list .m { font-size: .76rem; color: var(--text-3); display: block; }
.cta { margin-top: auto; min-height: 46px; border-radius: 14px; }

/* Métrica em foco */
.met-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 10px; }
.met-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 96px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: inherit; text-decoration: none; text-align: left; transition: border-color .15s, box-shadow .15s; }
.met-tile:hover { border-color: var(--border-strong); }
.met-tile[aria-current="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset; background: var(--surface-2); }
.met-tile .l { font-size: .8rem; font-weight: 600; color: var(--text-2); }
.met-tile .v { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 700; border-radius: 999px; padding: 1px 8px; background: var(--surface-3); color: var(--text-2); }
.delta svg { width: 11px; height: 11px; }
.delta.up svg { transform: rotate(0deg); } .delta.down svg { transform: rotate(180deg); }
.delta.good { color: var(--ok); background: var(--ok-soft); } .delta.bad { color: var(--bad); background: var(--bad-soft); }

.area { display: flex; flex-direction: column; gap: 6px; }
.area-plot { position: relative; height: 240px; margin: 8px 0 0 52px; touch-action: pan-y; cursor: crosshair; }
.area-grid { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.area-tick { position: absolute; left: -52px; width: 44px; text-align: right; transform: translateY(-50%); font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.area-ref { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--mark-muted); }
.area-ref span { position: absolute; right: 0; transform: translateY(-120%); font-size: 11px; font-weight: 600; color: var(--text-2); background: color-mix(in srgb, var(--surface) 85%, transparent); padding: 0 4px; border-radius: 4px; }
.area-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.area-fill { fill: var(--c1); opacity: .14; }
.area-line { fill: none; stroke: var(--c1); stroke-width: 2.2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.area-svg.draw { animation: tracar 1s cubic-bezier(.45,0,.2,1) both; }
@keyframes tracar { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.area-mark { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--c1); box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.area-mark-l { position: absolute; transform: translate(-50%, calc(-100% - 8px)); font-size: 11.5px; font-weight: 700; white-space: nowrap; pointer-events: none; background: color-mix(in srgb, var(--surface) 90%, transparent); border-radius: 4px; padding: 0 4px; }
.area-mark-l.r { transform: translate(calc(-100% + 6px), calc(-100% - 8px)); }
.area-mark-l.b { transform: translate(-50%, 10px); } .area-mark-l.r.b { transform: translate(calc(-100% + 6px), 10px); }
.area-hover { position: absolute; inset: 0; pointer-events: none; }
.area-cross { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--mark-muted); }
.area-dot { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--c1); box-shadow: 0 0 0 2px var(--surface), 0 2px 6px rgba(16,24,20,.25); }
.area-tip { position: absolute; z-index: 5; transform: translate(-50%, calc(-100% - 14px)); background: var(--tip-bg); color: var(--tip-text); border-radius: 12px; padding: 8px 12px; white-space: nowrap; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 1px; }
.area-tip.below { transform: translate(-50%, 16px); }
.area-tip strong { font-size: .95rem; font-weight: 800; } .area-tip span { font-size: .75rem; color: var(--tip-sub); }
.area-x { position: relative; height: 18px; margin-left: 52px; }
.area-x span { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--text-3); white-space: nowrap; }
.float-tip { position: absolute; z-index: 80; transform: translate(-50%, calc(-100% - 8px)); pointer-events: none; background: var(--tip-bg); color: var(--tip-text); border-radius: 10px; padding: 7px 10px; white-space: nowrap; display: flex; flex-direction: column; gap: 1px; box-shadow: var(--shadow-lg); font-size: .82rem; }
.float-tip span { font-size: .75rem; color: var(--tip-sub); }

/* Tabela de fábricas (da direção A) */
.fabt-wrap { container-type: inline-size; }
.fabt { width: 100%; border-collapse: collapse; font-size: .875rem; }
.fabt th { text-align: left; color: var(--text-3); font-size: .7rem; letter-spacing: .05em; text-transform: uppercase; font-weight: 700; padding: 8px 12px; border-top: 1px solid var(--line); white-space: nowrap; }
.fabt th:first-child, .fabt td:first-child { padding-left: 22px; } .fabt th:last-child, .fabt td:last-child { padding-right: 22px; }
.fabt td { padding: 6px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.fabt .num { text-align: right; font-variant-numeric: tabular-nums; }
.fabt tr.sel td { background: color-mix(in srgb, var(--brand-soft) 60%, transparent); }
.fabt tbody tr:hover td { background: var(--surface-2); }
.fabt .fname { min-height: 40px; display: inline-flex; align-items: center; gap: 8px; padding: 0 8px; margin-left: -8px; border: 0; border-radius: 9px; background: transparent; font: inherit; font-weight: 700; color: inherit; cursor: pointer; text-align: left; }
.fabt .fname:hover { background: var(--surface-3); }
.fabt .fname i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--mark-muted); flex: none; }
.fabt tr.sel .fname i { background: var(--brand); border-color: var(--brand); }
.cellrow { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.cellrow .v { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 50px; }
.cellrow .d { font-size: .76rem; font-weight: 600; }
.d.good { color: var(--ok); } .d.bad { color: var(--bad); } .d.flat { color: var(--text-3); }
.spark { width: 72px; height: 22px; flex: none; overflow: visible; }
.spark-line { fill: none; stroke: var(--mark-muted); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark-end { fill: none; stroke: var(--c1); stroke-width: 2.2; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.spark-empty { display: inline-block; width: 72px; height: 1px; border-top: 1px dashed var(--border-strong); }
.meter { width: 84px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; flex: none; }
.meter > i { display: block; height: 100%; width: 0; border-radius: 0 3px 3px 0; background: var(--mark-muted); transition: width .8s cubic-bezier(.2,.8,.2,1); width: var(--g, 0%); }
.st { display: inline-flex; align-items: center; gap: 5px; font-size: .76rem; font-weight: 600; color: var(--text-2); }
.st > i { width: 8px; height: 8px; border-radius: 2px; background: var(--mark-muted); flex: none; }
.good > i, .meter.good > i { background: var(--st-good); } .warn > i, .meter.warn > i { background: var(--st-warn); } .bad > i, .meter.bad > i { background: var(--st-bad); }
.two-line { display: flex; flex-direction: column; line-height: 1.25; }
.two-line small { font-size: .74rem; color: var(--text-3); }
.two-line small.bad { color: var(--bad); font-weight: 600; }
.audage { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.audage svg { width: 13px; height: 13px; color: var(--warn); }
/* Telemóvel: cada fábrica passa a cartão compacto. */
@container (max-width: 760px) {
  .fabt thead { display: none; }
  .fabt, .fabt tbody { display: block; }
  .fabt tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; padding: 12px 18px 14px; border-top: 1px solid var(--line); align-items: start; }
  .fabt td { display: block; padding: 0 !important; border: 0; min-width: 0; }
  .fabt td[data-l]::before { content: attr(data-l); display: block; font-size: .7rem; font-weight: 600; color: var(--text-3); margin-bottom: 1px; }
  .fabt td.c-name { grid-column: 1; align-self: center; } .fabt td.c-act { grid-column: 2; grid-row: 1; justify-self: end; }
  .fabt td.c-disp { grid-column: 1 / -1; }
  .fabt td.c-disp::before { display: none !important; }
  .fabt .num { text-align: left; }
  .fabt .meter { display: none; }
  .fabt .c-aud .cellrow { gap: 6px; } .fabt .c-aud .v { min-width: 0; }
  .fabt .two-line { flex-direction: row; gap: 6px; align-items: baseline; }
  .fabt tr.sel { background: color-mix(in srgb, var(--brand-soft) 60%, transparent); }
  .fabt tr.sel td, .fabt tbody tr:hover td { background: none; }
}

/* Anéis de auditoria */
.rings { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; }
.ring { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 12px 4px 10px; border: 0; border-radius: 16px; background: transparent; font: inherit; color: inherit; cursor: pointer; }
.ring:hover { background: var(--surface-2); }
.ring[aria-pressed="true"] { background: var(--info-soft); box-shadow: 0 0 0 1.5px var(--c1) inset; }
.ring .rw { position: relative; width: 80px; height: 80px; }
.ring .rw svg { width: 80px; height: 80px; display: block; }
.ring .rw b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.1rem; font-weight: 800; letter-spacing: -.02em; }
.ring .n { font-weight: 700; font-size: .85rem; }
.ring-track { fill: none; stroke: var(--surface-3); stroke-width: 8; }
.ring-val { fill: none; stroke: var(--mark-muted); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset .9s cubic-bezier(.2,.8,.2,1); }
.ring-val.good { stroke: var(--st-good); } .ring-val.warn { stroke: var(--st-warn); } .ring-val.bad { stroke: var(--st-bad); }

/* Barras horizontais (causas) e colunas (produção perdida) */
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; }
.bar-row .n { font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .v { font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar-row .tr { grid-column: 1 / -1; height: 10px; }
.bar-row .tr i { display: block; height: 100%; width: var(--g, 0%); min-width: 4px; background: var(--mark-muted); border-radius: 0 5px 5px 0; transition: width .7s cubic-bezier(.2,.8,.2,1); }
.bar-row.hi .tr i { background: var(--c1); }
.cols { position: relative; height: 200px; display: flex; align-items: flex-end; gap: 8px; padding-top: 24px; border-bottom: 1px solid var(--border-strong); }
.col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; padding: 0; border: 0; background: transparent; font: inherit; color: inherit; cursor: pointer; }
.col .cv { font-size: .74rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.col .cb { display: block; width: 100%; max-width: 30px; height: var(--g, 0%); min-height: 3px; background: var(--mark-muted); border-radius: 5px 5px 0 0; transition: height .7s cubic-bezier(.2,.8,.2,1), filter .15s; }
.col.hi .cb { background: var(--c2); }
.col:hover .cb, .col:focus-visible .cb { filter: brightness(.9); }
.col[aria-pressed="true"] .cb { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--ink); }
.col-labels { display: flex; gap: 8px; margin-top: -6px; }
.col-labels span { flex: 1 1 0; min-width: 0; text-align: center; font-size: .72rem; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg.mini { padding: 3px; border-radius: 11px; background: var(--surface-3); border: 0; }
.seg.mini button { min-height: 30px; padding: 0 12px; font-size: .8rem; border-radius: 8px; }

/* Fora do normal e atividade */
.sig-list { list-style: none; margin: 0; padding: 0; }
.sig { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 10px; margin: 0 -10px; border-radius: 12px; color: inherit; text-decoration: none; }
.sig:hover { background: var(--surface-2); }
.sig .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--warn-soft); color: var(--warn); }
.sig .ic svg { width: 17px; height: 17px; }
.sig.bad .ic { background: var(--bad-soft); color: var(--bad); } .sig.info .ic { background: var(--info-soft); color: var(--info); }
.sig b { font-size: 1.1rem; font-weight: 800; letter-spacing: -.02em; min-width: 48px; font-variant-numeric: tabular-nums; }
.sig .t { flex: 1; color: var(--text-2); font-size: .9rem; }
.sig > svg:last-child { color: var(--text-3); width: 16px; height: 16px; }
.act-list { list-style: none; margin: 0; padding: 0; }
.act-list li { border-bottom: 1px solid var(--line); }
.act-list li:last-child { border-bottom: 0; }
.act-list a { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 10px 0; color: inherit; text-decoration: none; }
.act-list a:hover .w { text-decoration: underline; }
.act-list .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; font-weight: 800; background: var(--surface-3); color: var(--text-2); }
.act-list .av.k1 { background: var(--brand-soft); color: var(--brand); } .act-list .av.k2 { background: var(--info-soft); color: var(--info); }
.act-list .av.k3 { background: var(--warn-soft); color: var(--warn); }
.act-list .w { font-size: .86rem; color: var(--text-2); text-wrap: pretty; }
.act-list .w strong { color: var(--text); }
.act-list .q { font-size: .75rem; color: var(--text-3); white-space: nowrap; }
.cover { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--text-2); }
.cover .meter { width: 64px; }

/* Restantes vistas do Início: secções em cartões arredondados */
.hero { padding: 22px; border-radius: var(--radius); }
.hero-line { font-family: var(--display); font-size: 1.35rem; font-weight: 650; letter-spacing: -.02em; }
.hero-line .n { color: var(--brand); }
.signal { border-radius: 14px; border-left-width: 4px; }

@media (prefers-reduced-motion: reduce) {
  .area-svg.draw { animation: none; }
  .ring-val, .meter > i, .bar-row .tr i, .col .cb, .stack i { transition: none; }
}

@media print {
  .topbar, .bottomnav, .form-actions, .toasts { display: none !important; }
  main { padding: 0; }
}
/* Atalhos do painel: uma linha deslizante no telemóvel. */
.dash > .quick { margin-top: -6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px; margin-left: -2px; margin-right: -2px; }
.dash > .quick::-webkit-scrollbar { display: none; }
.dash > .quick .btn { flex: none; min-height: 40px; border-radius: 999px; font-size: .875rem; background: var(--surface); border-color: var(--border); }
.dash > .quick .btn:hover { border-color: var(--border-strong); }
@media (max-width: 699px) {
  .met-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .met-tile { min-height: 0; padding: 10px 12px; } .met-tile .v { font-size: 1.25rem; }
  .area-plot { height: 200px; margin-left: 40px; } .area-tick { left: -40px; width: 34px; } .area-x { margin-left: 40px; }
  .dash-filters .note { margin-left: 0; width: 100%; }
  .dash-filters .seg { flex: 1 1 auto; } .dash-filters .seg button { flex: 1; justify-content: center; }
  .dash-filters .selbox { flex: 1 1 auto; } .dash-filters .selbox select { flex: 1; }
  .hero-n b { font-size: 3.2rem; }
}
