/* NUTRI CMEI — design system
   Tokens por papel; tema escuro selecionado (não invertido automaticamente). */
:root {
  color-scheme: light;
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --surface-3: #eef2f5;
  --border: #e2e8ee;
  --border-strong: #cfd8e1;
  --text: #0f1b2a;
  --text-2: #4a5a6c;
  --text-3: #7a8898;
  --brand: #0f766e;
  --brand-2: #14b8a6;
  --brand-soft: #e6f6f4;
  --brand-ink: #0b5953;
  --side-bg: #0b1726;
  --side-bg-2: #102236;
  --side-text: #a9b8c9;
  --side-text-strong: #ffffff;
  --good: #0ca30c;  --good-soft: #e3f6e3;  --good-ink: #0a6e0a;
  --warn: #fab219;  --warn-soft: #fff4d6;  --warn-ink: #8a5a00;
  --serious: #ec835a; --serious-soft: #fde9e0;
  --crit: #d03b3b;  --crit-soft: #fbe4e4;  --crit-ink: #a12626;
  --info: #2a78d6;  --info-soft: #e3eefb;  --info-ink: #1c5cab;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
  --grid: #e8edf2;
  --shadow-sm: 0 1px 2px rgba(15, 27, 42, .06);
  --shadow: 0 1px 3px rgba(15, 27, 42, .06), 0 8px 24px -12px rgba(15, 27, 42, .12);
  --shadow-lg: 0 24px 60px -20px rgba(15, 27, 42, .35);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --side-w: 256px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b121b; --surface: #111a26; --surface-2: #152131; --surface-3: #1a283a;
    --border: #213246; --border-strong: #2d4259;
    --text: #e8eef5; --text-2: #a7b6c7; --text-3: #7488a0;
    --brand: #2dd4bf; --brand-2: #5eead4; --brand-soft: #0f2e30; --brand-ink: #7ff0de;
    --side-bg: #070d15; --side-bg-2: #0d1826;
    --good-soft: #10301a; --good-ink: #6ad86a; --warn-soft: #3a2c08; --warn-ink: #f8c95a;
    --serious-soft: #3a2116; --crit-soft: #3a1717; --crit-ink: #f08a8a; --info-soft: #11263f; --info-ink: #7fb2ef;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --grid: #1c2a3b;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b121b; --surface: #111a26; --surface-2: #152131; --surface-3: #1a283a;
  --border: #213246; --border-strong: #2d4259;
  --text: #e8eef5; --text-2: #a7b6c7; --text-3: #7488a0;
  --brand: #2dd4bf; --brand-2: #5eead4; --brand-soft: #0f2e30; --brand-ink: #7ff0de;
  --side-bg: #070d15; --side-bg-2: #0d1826;
  --good-soft: #10301a; --good-ink: #6ad86a; --warn-soft: #3a2c08; --warn-ink: #f8c95a;
  --serious-soft: #3a2116; --crit-soft: #3a1717; --crit-ink: #f08a8a; --info-soft: #11263f; --info-ink: #7fb2ef;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --grid: #1c2a3b;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.hidden { display: none !important; }
svg.lucide { width: 18px; height: 18px; stroke-width: 1.9; flex: none; }

/* ------------------------------------------------------------------ shell */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side { background: linear-gradient(180deg, var(--side-bg), var(--side-bg-2)); color: var(--side-text);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 14px; z-index: 30; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 20px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, #14b8a6, #0f766e); color: #fff; box-shadow: 0 6px 18px -6px #14b8a6; }
.brand-mark svg { width: 22px; height: 22px; }
.brand b { display: block; color: var(--side-text-strong); font-size: 16px; letter-spacing: .02em; }
.brand small { color: var(--side-text); font-size: 11px; }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: #6b7f96; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--side-text);
  font-weight: 500; text-decoration: none; transition: background .15s, color .15s; }
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.ativo { background: rgba(20,184,166,.14); color: #fff; box-shadow: inset 3px 0 0 #14b8a6; }
.nav a.ativo svg { color: #2dd4bf; }
.nav .badge { margin-left: auto; }
.side-foot { border-top: 1px solid rgba(255,255,255,.07); padding-top: 12px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #1d3a52; color: #7ff0de; display: grid;
  place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.side-foot .quem { flex: 1; min-width: 0; }
.side-foot .quem b { color: #fff; font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .quem small { font-size: 11px; }
.side-foot button { background: none; border: 0; color: var(--side-text); cursor: pointer; padding: 6px; border-radius: 8px; }
.side-foot button:hover { background: rgba(255,255,255,.07); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); }
.top .menu-btn { display: none; }
.busca { flex: 1; max-width: 460px; position: relative; }
.busca input { width: 100%; padding: 9px 12px 9px 38px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); outline: none; }
.busca input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.busca > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.busca-res { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 420px; overflow: auto; padding: 6px; }
.busca-res a { display: flex; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; align-items: flex-start; }
.busca-res a:hover, .busca-res a.sel { background: var(--surface-3); }
.busca-res small { display: block; color: var(--text-3); }
.top-acoes { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.view { padding: 24px 28px 48px; max-width: 1560px; width: 100%; }

/* ------------------------------------------------------------------ cabeçalho de página */
.pg-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.pg-head h1 { font-size: 24px; font-weight: 750; }
.pg-head p { margin: 4px 0 0; color: var(--text-2); }
.pg-head .acoes { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 12.5px; color: var(--text-3); margin-bottom: 4px; }
.crumbs a { color: var(--text-2); }

/* ------------------------------------------------------------------ botões e controles */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s; text-decoration: none; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; }
:root[data-theme="dark"] .btn.pri { color: #04201d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.pri { color: #04201d; } }
.btn.pri:hover { filter: brightness(1.07); background: var(--brand); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.perigo { color: var(--crit); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.icon { padding: 7px; }
.btn svg { width: 16px; height: 16px; }
.grupo-btn { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; background: var(--surface); }
.grupo-btn button { border: 0; background: none; padding: 7px 12px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-2);
  display: inline-flex; align-items: center; gap: 6px; }
.grupo-btn button + button { border-left: 1px solid var(--border); }
.grupo-btn button.on { background: var(--brand-soft); color: var(--brand-ink); }

.campo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.campo > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.campo > span em { color: var(--crit); font-style: normal; }
.inp, .campo input, .campo select, .campo textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; min-height: 38px; }
.campo textarea { min-height: 84px; resize: vertical; }
.inp:focus, .campo input:focus, .campo select:focus, .campo textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.campo small { color: var(--text-3); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px 16px; }
.c12 { grid-column: span 12; } .c11 { grid-column: span 11; } .c10 { grid-column: span 10; } .c9 { grid-column: span 9; }
.c8 { grid-column: span 8; } .c7 { grid-column: span 7; } .c6 { grid-column: span 6; } .c5 { grid-column: span 5; }
.c4 { grid-column: span 4; } .c3 { grid-column: span 3; } .c2 { grid-column: span 2; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }

.filtros { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.filtros .campo { min-width: 150px; }
.filtros .campo.grow { flex: 1; min-width: 220px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-3);
  border: 1px solid var(--border); font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; user-select: none; }
.chip.on { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 40%, transparent); color: var(--brand-ink); }
.chip .x { opacity: .6; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

/* multi-seleção */
.multi { position: relative; }
.multi > button { width: 100%; text-align: left; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface);
  cursor: pointer; min-height: 38px; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.multi > button span { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.multi-pop { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; min-width: 100%; width: max-content; max-width: 320px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; max-height: 320px; overflow: auto; }
.multi-pop label { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 8px; cursor: pointer; }
.multi-pop label:hover { background: var(--surface-3); }
.multi-pop .todos { border-bottom: 1px solid var(--border); margin-bottom: 4px; font-weight: 600; }

/* ------------------------------------------------------------------ cards e grade */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.s3 { grid-column: span 3; } .s4 { grid-column: span 4; } .s5 { grid-column: span 5; } .s6 { grid-column: span 6; }
.s7 { grid-column: span 7; } .s8 { grid-column: span 8; } .s12 { grid-column: span 12; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px 0; }
.card-h h3 { font-size: 14.5px; font-weight: 700; }
.card-h .sub { font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.card-h .acoes { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-b { padding: 14px 18px 18px; }
.card-b.flush { padding: 8px 0 0; }
.chart { width: 100%; height: 300px; }
.chart.alto { height: 380px; }
.chart.baixo { height: 230px; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { position: relative; padding: 15px 16px 14px; overflow: hidden; cursor: default; }
.kpi .rot { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.kpi .rot svg { width: 16px; height: 16px; color: var(--brand); }
.kpi .val { font-size: 28px; font-weight: 750; margin-top: 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .val small { font-size: 15px; font-weight: 650; color: var(--text-2); margin-left: 2px; }
.kpi .det { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.kpi .var { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; padding: 2px 7px; border-radius: 999px; margin-left: 8px; vertical-align: 5px; }
.var.bom { background: var(--good-soft); color: var(--good-ink); }
.var.ruim { background: var(--crit-soft); color: var(--crit-ink); }
.var.neutro { background: var(--surface-3); color: var(--text-2); }
.var svg { width: 13px; height: 13px; }
.kpi .spark { position: absolute; right: 10px; bottom: 8px; width: 90px; height: 34px; opacity: .9; }

/* badges de status (sempre com ícone/rótulo, nunca só cor) */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2); border: 1px solid transparent; }
.badge svg { width: 13px; height: 13px; }
.b-good { background: var(--good-soft); color: var(--good-ink); }
.b-warn { background: var(--warn-soft); color: var(--warn-ink); }
.b-crit { background: var(--crit-soft); color: var(--crit-ink); }
.b-info { background: var(--info-soft); color: var(--info-ink); }
.b-brand { background: var(--brand-soft); color: var(--brand-ink); }
.b-count { background: #14b8a6; color: #032b27; min-width: 20px; justify-content: center; padding: 1px 6px; font-size: 11px; }
.b-count.crit { background: var(--crit); color: #fff; }

/* alertas */
.alertas { display: flex; flex-direction: column; gap: 8px; max-height: 318px; overflow-y: auto; padding-right: 4px; }
.alerta { display: flex; gap: 12px; align-items: flex-start; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); text-decoration: none; transition: transform .12s, box-shadow .12s; }
.alerta:hover { text-decoration: none; transform: translateX(2px); box-shadow: var(--shadow-sm); }
.alerta .ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.alerta b { display: block; font-size: 13.5px; }
.alerta span { font-size: 12.5px; color: var(--text-2); }
.alerta.CRITICO .ic { background: var(--crit-soft); color: var(--crit); }
.alerta.ATENCAO .ic { background: var(--warn-soft); color: var(--warn-ink); }
.alerta.INFO .ic { background: var(--info-soft); color: var(--info); }
.alerta .seta { margin-left: auto; color: var(--text-3); align-self: center; }

/* cartões das unidades */
.unidades { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.un { padding: 16px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s;
  border-top: 3px solid var(--un-cor, var(--brand)); }
.un:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.un.principal { background: linear-gradient(180deg, var(--brand-soft), var(--surface) 60%); }
.un-top { display: flex; gap: 10px; align-items: flex-start; }
.un-top h4 { font-size: 15px; font-weight: 700; }
.un-top small { color: var(--text-3); font-size: 12px; }
.gauge { position: relative; flex: none; }
.un-top .gauge { margin-left: auto; width: 64px; height: 64px; }
.gauge svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.gauge b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; font-weight: 750; font-variant-numeric: tabular-nums; }
.un-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.un-stats div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 7px 9px; }
.un-stats b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.un-stats span { font-size: 11px; color: var(--text-3); font-weight: 600; }
.un-foot { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--text-2); flex-wrap: wrap; }
.comp { display: grid; gap: 6px; }
.comp-l { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 12px; }
.comp-l .bar { grid-column: span 2; height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.comp-l .bar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.comp-l.sem .bar i { background: transparent; }
.comp-l.sem span:last-child { color: var(--text-3); font-style: italic; }

/* tabelas */
.tbl-wrap { overflow: auto; border-radius: 0 0 var(--radius) var(--radius); }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 700; padding: 10px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--border); position: sticky; top: 0; white-space: nowrap; cursor: pointer; user-select: none; }
.tbl th.ord::after { content: " ▲"; font-size: 9px; }
.tbl th.ord.desc::after { content: " ▼"; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl td.n, .tbl th.n { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .desc { max-width: 420px; }
.tbl .desc small { display: block; color: var(--text-3); }
.tbl-foot { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); flex-wrap: wrap; }
.tbl-foot .acoes { margin-left: auto; display: flex; gap: 6px; }
.vazio { padding: 40px 20px; text-align: center; color: var(--text-3); }
.vazio svg { width: 34px; height: 34px; margin-bottom: 8px; opacity: .7; }

/* timeline / listas */
.lista { display: flex; flex-direction: column; }
.item { display: flex; gap: 12px; padding: 11px 18px; border-top: 1px solid var(--border); align-items: center; text-decoration: none; color: var(--text); }
.item:first-child { border-top: 0; }
.item:hover { background: var(--surface-2); text-decoration: none; }
.data-box { width: 46px; flex: none; text-align: center; border-radius: 10px; background: var(--surface-3); padding: 5px 0; }
.data-box b { display: block; font-size: 17px; line-height: 1.1; }
.data-box small { font-size: 10.5px; text-transform: uppercase; color: var(--text-3); font-weight: 700; }
.item .meio { flex: 1; min-width: 0; }
.item .meio b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .meio span { font-size: 12.5px; color: var(--text-2); }

/* kanban */
.kanban { display: grid; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 14px; align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); min-height: 200px; }
.col-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 700; font-size: 13.5px; }
.col-h .badge { margin-left: auto; }
.col-b { padding: 0 10px 10px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.col.drop { outline: 2px dashed var(--brand); outline-offset: -4px; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 11px 12px; box-shadow: var(--shadow-sm); cursor: grab;
  border-left: 3px solid var(--k-cor, var(--border-strong)); }
.kcard:active { cursor: grabbing; }
.kcard b { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.kcard .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--text-2); }

/* modal e gaveta */
.overlay { position: fixed; inset: 0; background: rgba(8, 15, 26, .5); backdrop-filter: blur(3px); z-index: 90; display: flex; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
@keyframes sobe { from { transform: translateY(14px); opacity: 0; } }
@keyframes entra { from { transform: translateX(40px); opacity: 0; } }
.modal { margin: auto; width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: sobe .2s; border: 1px solid var(--border); }
.modal.lg { width: min(980px, calc(100vw - 32px)); }
.modal.sm { width: min(460px, calc(100vw - 32px)); }
.gaveta { margin-left: auto; width: min(640px, 100vw); height: 100vh; background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: entra .2s; border-left: 1px solid var(--border); }
.m-h { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.m-h h2 { font-size: 17px; font-weight: 700; }
.m-h p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.m-h .fechar { margin-left: auto; }
.m-b { padding: 20px 22px; overflow: auto; flex: 1; }
.m-f { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 18px 18px; }
.gaveta .m-f { border-radius: 0; }

/* toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; min-width: 280px; max-width: 420px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); animation: sobe .2s; border-left: 4px solid var(--brand); }
.toast.erro { border-left-color: var(--crit); }
.toast.erro svg { color: var(--crit); }
.toast svg { color: var(--brand); margin-top: 1px; }

/* abas */
.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.abas button { background: none; border: 0; padding: 10px 14px; font-weight: 600; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent;
  display: inline-flex; gap: 7px; align-items: center; white-space: nowrap; }
.abas button.on { color: var(--brand-ink); border-bottom-color: var(--brand); }

/* checklist */
.ck-cat { margin-bottom: 18px; }
.ck-cat h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.ck-item { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; margin-bottom: 6px; background: var(--surface); }
.ck-item.nc { border-color: color-mix(in srgb, var(--crit) 45%, transparent); background: var(--crit-soft); }
.ck-item.c { border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.ck-item input[type=text] { grid-column: span 2; }
.ck-opts { display: inline-flex; gap: 4px; }
.ck-opts button { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 8px; padding: 5px 10px; font-weight: 700; font-size: 12px; cursor: pointer; color: var(--text-2); }
.ck-opts button.on.C { background: var(--good); border-color: var(--good); color: #fff; }
.ck-opts button.on.NC { background: var(--crit); border-color: var(--crit); color: #fff; }
.ck-opts button.on.NA { background: var(--text-3); border-color: var(--text-3); color: #fff; }
.ck-resumo { position: sticky; top: 0; z-index: 2; background: var(--surface); padding-bottom: 12px; margin-bottom: 8px; border-bottom: 1px solid var(--border); display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.progresso { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; flex: 1; min-width: 120px; display: flex; }
.progresso i { display: block; height: 100%; }

/* lançamento de visita (linhas dinâmicas, como na planilha) */
.lanc-sec { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface-2); }
.lanc-tit { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.lanc-tit svg { color: var(--brand); }
.lanc-tit .btn { margin-left: auto; }
.lanc-linha { display: grid; grid-template-columns: 2.2fr 1.2fr 1.4fr auto auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.lanc-linha[data-l="pend"] { grid-template-columns: 2.6fr 1fr 1fr auto; }
@media (max-width: 900px) { .lanc-linha, .lanc-linha[data-l="pend"] { grid-template-columns: 1fr 1fr; } .lanc-linha > :first-child { grid-column: span 2; } }

/* marcação de unidades por usuário */
.un-marcar { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.chip-check { padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.chip-check:has(input:checked) { border-color: color-mix(in srgb, var(--brand) 55%, transparent); background: var(--brand-soft); }
.lanc-tit .btn + .btn { margin-left: 0; }

/* anexos */
.anx { display: flex; flex-direction: column; gap: 10px; }
.anx-zona { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border: 1.5px dashed var(--border-strong); border-radius: 12px;
  background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.anx-zona:hover, .anx-zona:focus, .anx-zona.sobre { border-color: var(--brand); background: var(--brand-soft); outline: none; }
.anx-zona svg { width: 22px; height: 22px; color: var(--brand); }
.anx-zona b { display: block; font-size: 13.5px; }
.anx-zona small { color: var(--text-3); font-size: 12px; }
.anx-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.anx-item { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); min-width: 0; }
.anx-thumb { width: 48px; height: 48px; flex: none; border-radius: 9px; background: var(--surface-3); display: grid; place-items: center; overflow: hidden; }
.anx-thumb img { width: 100%; height: 100%; object-fit: cover; }
.anx-thumb svg { width: 22px; height: 22px; }
.anx-info { flex: 1; min-width: 0; }
.anx-info b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.anx-info small { color: var(--text-3); font-size: 11.5px; }
.anx-lightbox { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.anx-lightbox img { max-width: 100%; max-height: calc(100vh - 240px); border-radius: 10px; }
.anx-nav { display: flex; gap: 12px; align-items: center; }

/* calendário (FullCalendar) */
.fc { --fc-border-color: var(--border); --fc-page-bg-color: var(--surface); --fc-neutral-bg-color: var(--surface-2); --fc-today-bg-color: var(--brand-soft);
  --fc-button-bg-color: var(--surface); --fc-button-border-color: var(--border-strong); --fc-button-text-color: var(--text); --fc-button-hover-bg-color: var(--surface-3);
  --fc-button-hover-border-color: var(--border-strong); --fc-button-active-bg-color: var(--brand-soft); --fc-button-active-border-color: var(--brand);
  --fc-event-border-color: transparent; font-size: 13px; }
.fc .fc-toolbar-title { font-size: 18px; font-weight: 700; }
.fc .fc-toolbar-title::first-letter { text-transform: uppercase; }
.fc .fc-button { font-weight: 600; border-radius: 9px !important; box-shadow: none !important; text-transform: capitalize; }
.fc .fc-button-primary:not(:disabled).fc-button-active { color: var(--brand-ink); }
.fc .fc-daygrid-day-number, .fc .fc-col-header-cell-cushion { color: var(--text-2); text-decoration: none; }
.fc-event { border-radius: 7px !important; padding: 1px 4px; cursor: pointer; }
.ev { display: flex; gap: 5px; align-items: center; overflow: hidden; font-size: 12px; font-weight: 600; }
.ev i { font-style: normal; opacity: .85; font-weight: 500; }
.ev.CANCELADA { text-decoration: line-through; opacity: .6; }

/* heatmap legenda */
.leg { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); align-items: center; }
.leg span { display: inline-flex; gap: 6px; align-items: center; }

/* login */
.login-bg { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); }
.login-hero { background: radial-gradient(1200px 600px at 20% 10%, #14b8a6 0%, transparent 55%), radial-gradient(900px 700px at 90% 90%, #2a78d6 0%, transparent 50%), #0b1726;
  color: #e8f4f3; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-hero h1 { font-size: 40px; font-weight: 800; letter-spacing: -.02em; max-width: 520px; }
.login-hero p { font-size: 16px; color: #b9d7d4; max-width: 480px; }
.login-hero ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.login-hero li { display: flex; gap: 10px; align-items: center; color: #d9efec; }
.login-hero li svg { color: #5eead4; }
.login-box { display: grid; place-items: center; padding: 32px 16px; }
.login-card { width: min(400px, 100%); }
.login-card h2 { font-size: 24px; font-weight: 750; margin-bottom: 4px; }
.erro-msg { background: var(--crit-soft); color: var(--crit-ink); padding: 10px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; }

/* skeleton */
.skel { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; }
@keyframes sk { to { background-position: -200% 0; } }

/* impressão */
@media print {
  .side, .top, .pg-head .acoes, .filtros, .card-h .acoes { display: none !important; }
  .app { display: block; }
  .view { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ------------------------------------------------------------------ responsivo */
@media (max-width: 1200px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .s3, .s4, .s5, .s7, .s8 { grid-column: span 12; }
  .s6 { grid-column: span 12; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; width: var(--side-w); transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .side.aberta { transform: none; }
  .top { padding: 10px 16px; }
  .top .menu-btn { display: inline-flex; }
  .view { padding: 16px 16px 40px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .c2, .c3, .c4, .c5, .c6, .c7, .c8, .c9, .c10, .c11 { grid-column: span 12; }
  .login-bg { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .pg-head h1 { font-size: 20px; }
  .top-acoes .rotulo { display: none; }
}
