/* EL3D Gestão — Design System "Oficina" v3
   Industrial escuro + laranja EL3D. Sem libs externas e sem inline (CSP 'self').
   Tokens no topo; espelhados em dev/design-tokens.json. */

:root {
  color-scheme: dark;
  --bg: #07090c; --bg-2: #090c10; --bg-3: #0d1015;
  --surface: #11151b; --surface-2: #151a22; --surface-3: #191e27;
  --line: rgba(255,255,255,.075); --line-2: #2e3744; --line-ctrl: #5b6677;
  --ink: #f5f7fa; --ink-2: #a9b1bf; --ink-3: #8993a4;
  --accent: #ff8a00; --accent-2: #ffaa00; --accent-3: #ffc04d; --amber: #efa51b;
  --accent-ink: #1a0e00; --accent-text: #ffa733;
  --accent-soft: rgba(255,138,0,.13); --accent-line: rgba(255,138,0,.5);
  --grad-accent: linear-gradient(135deg, #ffaa00 0%, #ff8a00 55%, #f06a00 100%);
  --ok: #2ed47a; --info: #29b6f6; --err: #ff4d5a; --warn: #ffb020; --err-ink: #1a0508;
  --raio-sm: 9px; --raio: 14px; --raio-lg: 20px;
  --sombra: 0 12px 35px rgba(0,0,0,.30), 0 1px 0 rgba(255,255,255,.04) inset;
  --glow: 0 8px 30px rgba(255,138,0,.10);
  --card: linear-gradient(145deg, rgba(20,25,32,.96), rgba(11,14,19,.96));
  --card-hi: linear-gradient(135deg, #16120b, #231607 55%, #11151b);
  --borda: rgba(255,255,255,.07); --borda-hover: rgba(255,138,0,.25); --borda-sel: rgba(255,138,0,.6);
  --f-corpo: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  --f-titulo: "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, -apple-system, Roboto, sans-serif;
  --f-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
  --side-w: 248px; --t: .18s;
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f1ec; --bg-2: #ece9e1; --bg-3: #e6e2d8;
  --surface: #ffffff; --surface-2: #f8f6f1; --surface-3: #efece4;
  --line: #ddd8cc; --line-2: #cfc9bb; --line-ctrl: #8a8472;
  --ink: #14171c; --ink-2: #454c5a; --ink-3: #5f6776;
  --accent: #ff8a00; --accent-2: #ffaa00; --accent-3: #ffc04d; --amber: #b87400;
  --accent-ink: #1a0e00; --accent-text: #a85200;
  --accent-soft: rgba(255,138,0,.14); --accent-line: rgba(200,100,0,.55);
  --ok: #0b6b3f; --info: #0a6f96; --err: #c4203a; --warn: #8a5300; --err-ink: #ffffff;
  --sombra: 0 1px 2px rgba(20,22,26,.06), 0 16px 30px -22px rgba(20,22,26,.35);
  --glow: 0 8px 26px rgba(240,110,0,.14);
  --card: #ffffff; --card-hi: linear-gradient(135deg, #fff1dc, #ffffff 70%);
  --borda: rgba(20,22,26,.1); --borda-hover: rgba(200,100,0,.4); --borda-sel: rgba(200,100,0,.7);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--f-corpo); font-size: 15px; line-height: 1.5; color: var(--ink);
  background-color: var(--bg);
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--f-titulo); letter-spacing: -.015em; line-height: 1.15; }
h1 { font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.3rem); margin: 0 0 1.2rem; font-weight: 750; }
h2 { font-size: 1.05rem; margin: 1.6rem 0 .7rem; font-weight: 700; }
h2.mt0 { margin-top: 0; }
h3 { font-size: 1rem; margin: 0; font-weight: 650; }
p { margin: .5rem 0 .9rem; }
b, strong { font-weight: 650; }
.mut { color: var(--ink-2); }
.mono, .kpi b, td.num { font-variant-numeric: tabular-nums; }
.ic { width: 20px; height: 20px; flex: none; }
code { font-family: var(--f-mono); font-size: .85em; }

/* ---------- Shell: sidebar ---------- */
.shell { display: flex; min-height: 100vh; }
.side {
  width: var(--side-w); flex: none; background: rgba(8,11,15,.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-right: 1px solid #262d37;
  padding: 1.1rem .8rem 1rem; display: flex; flex-direction: column; gap: 3px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40;
  background-image: linear-gradient(180deg, transparent 60%, rgba(255,138,0,.045));
}
[data-theme="light"] .side { background: rgba(236,233,225,.97); border-right-color: var(--line); }
.logo { display: flex; align-items: center; gap: .7rem; padding: .1rem .4rem 1rem; color: var(--ink); }
.logo-img { width: 50px; height: auto; flex: none; display: block; }
.logo-txt { font-family: var(--f-titulo); font-size: 1.3rem; font-weight: 800; letter-spacing: .01em; line-height: 1; }
.logo-txt small { display: block; margin-top: .3rem; font-family: var(--f-corpo); font-weight: 600; font-size: .62rem; letter-spacing: .32em; text-transform: uppercase; color: var(--ink-2); }
.nav-t { display: flex; align-items: center; gap: .6rem; font-size: .66rem; text-transform: uppercase; letter-spacing: .16em; color: var(--ink-3); margin: 1.2rem .6rem .4rem; font-weight: 650; }
.nav-t::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.nl {
  display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border-radius: var(--raio-sm);
  color: var(--ink-2); font-weight: 560; border: 1px solid transparent; font-size: .92rem;
  transition: background var(--t), color var(--t), border-color var(--t), transform var(--t);
}
.nl .ic { opacity: .9; }
.nl:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; transform: translateX(2px); }
.nl.ativo {
  color: #fff; font-weight: 700; border-color: var(--accent-line);
  background: linear-gradient(90deg, rgba(255,138,0,.34), rgba(255,138,0,.12)); box-shadow: 0 8px 24px -14px rgba(255,138,0,.5);
}
[data-theme="light"] .nl.ativo { color: var(--accent-ink); background: linear-gradient(90deg, rgba(255,170,0,.55), rgba(255,138,0,.2)); }
.nl.ativo .ic { color: var(--accent-3); opacity: 1; }
[data-theme="light"] .nl.ativo .ic { color: #8a4400; }
button.nl { width: 100%; background: none; font: inherit; font-size: .92rem; font-weight: 560; text-align: left; cursor: pointer; }
.push { flex: 1; }
.empresa { display: flex; align-items: center; gap: .7rem; border-top: 1px solid var(--line); padding: .9rem .3rem .2rem; margin-top: .6rem; }
.avatar {
  width: 40px; height: 40px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--line-2);
  display: grid; place-items: center; font-family: var(--f-titulo); font-weight: 750; color: var(--accent-text); flex: none; letter-spacing: .02em;
}
.empresa div { min-width: 0; }
.empresa b { display: block; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empresa span { display: block; font-size: .76rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Shell: topbar ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: .9rem; padding: .7rem 1.5rem; position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.busca { position: relative; flex: 1; max-width: 520px; margin: 0; }
.busca input { padding-left: 2.6rem; padding-right: 4.6rem; background: var(--surface); border-color: var(--line-2); min-height: 42px; }
.busca .ic { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-2); pointer-events: none; }
.busca kbd {
  position: absolute; right: .7rem; top: 50%; transform: translateY(-50%); font-family: var(--f-mono); font-size: .7rem; color: var(--ink-2);
  border: 1px solid var(--line-2); border-radius: 6px; padding: .12rem .45rem; background: var(--surface-2); pointer-events: none;
}
.crumb { font-family: var(--f-mono); font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.crumb b { color: var(--ink-2); font-weight: 600; }
.topo-dir { margin-left: auto; display: flex; align-items: center; gap: .7rem; }
.ola { line-height: 1.25; text-align: right; font-size: .76rem; color: var(--ink-2); }
.ola b { display: block; color: var(--ink); font-size: .9rem; }
.ola span { display: block; max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  position: relative; width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); cursor: pointer; padding: 0; transition: border-color var(--t), color var(--t), background var(--t);
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent-text); text-decoration: none; }
.icon-btn .pip {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px; background: var(--accent);
  color: var(--accent-ink); font-size: .68rem; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg);
}
.avatar-sm { width: 42px; height: 42px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--line-2); display: grid; place-items: center; font-weight: 750; font-family: var(--f-titulo); color: var(--ink); }
.tema-lua { display: none; } [data-theme="light"] .tema-sol { display: none; } [data-theme="light"] .tema-lua { display: block; }
.menu-btn { display: none; }
.side-sair { display: none; }
.scrim { display: none; }
.conteudo { padding: 0 1.5rem 2.4rem; flex: 1; width: 100%; max-width: 1360px; margin: 0 auto; }
.rodape { padding: 1.1rem 1.5rem; color: var(--ink-3); font-size: .74rem; border-top: 1px solid var(--line); font-family: var(--f-mono); letter-spacing: .08em; }

/* ---------- Hero / cabeçalho de página ---------- */
.hero { position: relative; margin: 0 0 1.3rem; padding: 2.1rem 0 1.5rem; min-height: 150px; display: flex; flex-direction: column; justify-content: center; }
.hero > * { position: relative; z-index: 1; }
.hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, rgba(255,138,0,.5), var(--line) 28%, transparent 85%); }
.hero-eyebrow { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-2); }
.hero h1 { margin: .4rem 0 .4rem; font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3rem); font-weight: 800; letter-spacing: -.025em; max-width: 16ch; }
.hero h1 em { font-style: normal; color: var(--accent-text); }
.hero p { color: var(--ink-2); max-width: 54ch; margin: 0 0 1.1rem; }
.hero .acoes { margin: 0; }
.hero.compacto { min-height: 0; }

/* ---------- Painéis e grades ---------- */
.card, .painel {
  background: var(--card); border: 1px solid var(--borda); border-radius: var(--raio);
  padding: 1.15rem 1.35rem; margin-bottom: 1.1rem; box-shadow: var(--sombra);
}
.painel-t, .card-t { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.painel-t h2, .card-t h2 { margin: 0; display: flex; align-items: center; gap: .6rem; font-size: 1.02rem; }
.painel-t h2 .ic, .card-t h2 .ic { color: var(--accent-text); }
.painel-t a, .card-t a { font-size: .82rem; font-weight: 650; white-space: nowrap; }
.grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 1.1rem; }
.grade > .card { margin-bottom: 0; }
.grade-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 1.1rem; margin-bottom: 1.1rem; }
.grade-2 > .card, .grade-2 > .painel { margin-bottom: 0; }
.grade-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.1rem; margin-bottom: 1.1rem; }
.grade-3 > .painel { margin-bottom: 0; }
.grade-lado { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 1.1rem; align-items: start; }
.grade-lado > * { min-width: 0; }
.grade > *, .grade-2 > *, .quadro > *, .grade-3 > * { min-width: 0; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.5fr); gap: 1rem; margin-bottom: 1.1rem; }
.kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi {
  position: relative; overflow: hidden; background: var(--card); border: 1px solid var(--borda); border-radius: var(--raio);
  padding: 1rem 1.15rem; box-shadow: var(--sombra); display: grid; grid-template-columns: auto 1fr; column-gap: .9rem; align-items: center;
  color: var(--ink); transition: transform var(--t), border-color var(--t);
}
a.kpi:hover { transform: translateY(-2px); border-color: var(--borda-hover); text-decoration: none; }
.kpi .kpi-ic { grid-row: 1 / 4; width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: rgba(255,255,255,.04); border: 1px solid var(--borda); color: var(--accent-text); }
.kpi span { color: var(--ink-2); font-size: .8rem; font-weight: 560; order: -1; }
.kpi b { font-size: clamp(1.5rem, 1.1rem + 1vw, 2.1rem); line-height: 1.1; letter-spacing: -.02em; font-weight: 750; white-space: nowrap; }
.kpi small { color: var(--ink-3); font-size: .74rem; display: flex; align-items: center; gap: .3rem; margin-top: .1rem; }
.kpi small.sobe { color: var(--ok); } .kpi small.desce { color: var(--err); }
.kpi.destaque { background: var(--card-hi); border-color: rgba(255,138,0,.35); box-shadow: var(--sombra), var(--glow); }
.kpi.destaque .kpi-ic { background: rgba(255,138,0,.12); border-color: rgba(255,138,0,.4); }
.kpi.destaque b { color: var(--accent-3); }
[data-theme="light"] .kpi.destaque b { color: var(--accent-text); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; background: var(--grad-accent); color: var(--accent-ink);
  font: inherit; font-weight: 750; border: 1px solid transparent; border-radius: var(--raio-sm); padding: .62rem 1.15rem; cursor: pointer;
  font-size: .9rem; line-height: 1.2; transition: transform var(--t), box-shadow var(--t), filter var(--t), border-color var(--t); text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--glow); filter: brightness(1.06); }
.btn:active { transform: translateY(0); }
.btn .ic { width: 18px; height: 18px; }
.btn-sec { background: var(--surface-2); color: var(--ink); border-color: var(--line-ctrl); font-weight: 600; }
.btn-sec:hover { border-color: var(--accent); box-shadow: none; filter: none; color: var(--accent-text); }
.btn-peq { padding: .34rem .75rem; font-size: .8rem; border-radius: 8px; }
.btn-perigo { background: transparent; color: var(--err); border-color: color-mix(in srgb, var(--err) 60%, transparent); font-weight: 650; }
.btn-perigo:hover { background: color-mix(in srgb, var(--err) 14%, transparent); box-shadow: none; filter: none; }
.btn[disabled], .btn.off { opacity: .5; pointer-events: none; }

/* ---------- Formulários ---------- */
label { display: block; font-size: .78rem; font-weight: 600; color: var(--ink-2); margin: .85rem 0 .3rem; letter-spacing: .02em; }
input, select, textarea {
  width: 100%; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line-ctrl); border-radius: var(--raio-sm);
  padding: .62rem .8rem; font: inherit; min-height: 42px; transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
textarea { min-height: 96px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
input[type="file"] { padding: .45rem .6rem; }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 0 1.1rem; }
.inteira { grid-column: 1 / -1; }
label.check { display: flex; align-items: center; gap: .5rem; font-size: .88rem; color: var(--ink); margin: .9rem 0; cursor: pointer; font-weight: 500; }
.filtros { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: .9rem; }
.filtros .busca-lista { position: relative; flex: 1 1 220px; max-width: 360px; }
.filtros .busca-lista .ic { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ink-2); pointer-events: none; }
.filtros .busca-lista input { padding-left: 2.4rem; }
.filtros select { width: auto; min-width: 160px; }

/* ---------- Tabelas ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .72rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--ink-3); font-size: .66rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 700; white-space: nowrap; }
table tr:last-child td { border-bottom: 0; }
tr:hover td { background: var(--accent-soft); }
tr:has(> th):hover td { background: transparent; }
tr.sel td { background: var(--accent-soft); }
tr.sel td:first-child { box-shadow: inset 2px 0 0 var(--borda-sel); }
.tabela-scroll { overflow-x: auto; padding: .4rem .6rem; }
.tabela-scroll td:first-child, .tabela-scroll th:first-child { white-space: nowrap; }
.td-trunc { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.paginacao { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem .4rem .2rem; color: var(--ink-2); font-size: .82rem; }

/* ---------- Selos de status ---------- */
.selo {
  display: inline-flex; align-items: center; gap: .4rem; padding: .17rem .65rem .17rem .55rem; border-radius: 99px;
  font-size: .68rem; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2);
  background: var(--surface-3); border: 1px solid var(--line-ctrl); white-space: nowrap;
}
.selo::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.selo-RASCUNHO, .selo-FILA, .selo-OCIOSA, .selo-ABERTO { color: var(--ink-2); }
.selo-ENVIADO, .selo-LIBERADA, .selo-EM_TESTE, .selo-IMPRIMINDO { color: var(--info); border-color: color-mix(in srgb, var(--info) 55%, transparent); background: color-mix(in srgb, var(--info) 11%, transparent); }
.selo-IMPRIMINDO::before { animation: pulsa 1.4s ease-in-out infinite; }
.selo-CONVERTIDO, .selo-EM_PRODUCAO { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-soft); }
.selo-APROVADO, .selo-CONCLUIDA, .selo-PRONTO, .selo-PRONTA, .selo-ENTREGUE, .selo-ATIVA { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.selo-REJEITADO, .selo-CANCELADO, .selo-CANCELADA, .selo-FALHOU, .selo-ERRO, .selo-OFFLINE, .selo-SUSPENSA, .selo-INATIVA { color: var(--err); border-color: color-mix(in srgb, var(--err) 55%, transparent); background: color-mix(in srgb, var(--err) 10%, transparent); }
.selo-EXPIRADO, .selo-PAUSADO, .selo-VENCIDO, .selo-MANUTENCAO { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 55%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
@keyframes pulsa { 50% { opacity: .25; } }

/* ---------- Alertas ---------- */
.alerta { padding: .8rem 1.05rem; border-radius: 12px; margin-bottom: 1rem; border: 1px solid var(--line-ctrl); background: var(--surface-2); font-weight: 500; }
.alerta-erro { border-color: var(--err); background: color-mix(in srgb, var(--err) 12%, var(--surface)); }
.alerta-ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.alerta-aviso { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, var(--surface)); }
.alerta-item { display: flex; align-items: center; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.alerta-item:last-child { border-bottom: 0; }
.alerta-item:hover { text-decoration: none; }
.alerta-item .ai-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--warn); }
.alerta-item.erro .ai-ic { background: color-mix(in srgb, var(--err) 14%, transparent); color: var(--err); }
.alerta-item.info .ai-ic { background: color-mix(in srgb, var(--info) 14%, transparent); color: var(--info); }
.alerta-item b { display: block; font-size: .88rem; }
.alerta-item span.sub { display: block; font-size: .78rem; color: var(--ink-2); }

/* ---------- Barras de progresso ---------- */
progress { appearance: none; -webkit-appearance: none; border: 0; background: var(--surface-3); border-radius: 99px; overflow: hidden; height: 9px; width: 100%; display: block; accent-color: var(--accent); }
progress::-webkit-progress-bar { background: var(--surface-3); border-radius: 99px; }
progress::-webkit-progress-value { background: var(--grad-accent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--grad-accent); border-radius: 99px; }
progress.nivel { width: 120px; display: inline-block; vertical-align: middle; }
progress.nivel.p-ok::-webkit-progress-value { background: var(--ok); } progress.nivel.p-ok::-moz-progress-bar { background: var(--ok); }
progress.nivel.p-aviso::-webkit-progress-value { background: var(--warn); } progress.nivel.p-aviso::-moz-progress-bar { background: var(--warn); }
progress.nivel.p-erro::-webkit-progress-value { background: var(--err); } progress.nivel.p-erro::-moz-progress-bar { background: var(--err); }
.prog-l { display: flex; align-items: center; gap: .7rem; font-size: .82rem; color: var(--ink-2); }
.prog-l progress { flex: 1; }
.prog-l b { color: var(--ink); min-width: 3ch; text-align: right; font-variant-numeric: tabular-nums; }
.uso-l { display: grid; grid-template-columns: 1fr auto; gap: .25rem .8rem; align-items: center; padding: .55rem 0; font-size: .86rem; }
.uso-l progress { grid-column: 1 / -1; height: 7px; }
.badge-online { color: var(--ok); } .badge-offline { color: var(--err); }

/* ---------- Listas compactas (painel) ---------- */
.lista { list-style: none; margin: 0; padding: 0; }
.lista li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.lista li:last-child { border-bottom: 0; }
.lista .l-t { min-width: 0; } .lista .l-t b { display: block; font-size: .9rem; } .lista .l-t > span { color: var(--ink-2); font-size: .8rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lista .l-t b .selo { margin-left: .4rem; vertical-align: middle; }
.lista .l-t .prog-l { margin-top: .4rem; }
.vazio { color: var(--ink-2); padding: .6rem 0; }
.vazio.bloco { text-align: center; padding: 2.2rem 1rem; border: 1px dashed var(--line-ctrl); border-radius: var(--raio); margin-bottom: 1.1rem; background: var(--surface); }
.vazio.bloco .ic { width: 34px; height: 34px; color: var(--accent-text); margin-bottom: .4rem; }
.vazio.bloco p { margin: 0 0 .9rem; }
.coluna .vazio { text-align: center; padding: 1rem .4rem; font-size: .84rem; border: 1px dashed var(--line); border-radius: var(--raio-sm); }

/* ---------- Cartões (OP, impressora, bobina) ---------- */
.cartao { background: var(--card); border: 1px solid var(--borda); border-radius: var(--raio); padding: 1rem 1.1rem; box-shadow: var(--sombra); display: flex; flex-direction: column; gap: .7rem; min-width: 0; transition: border-color var(--t), transform var(--t); }
.cartao:hover { border-color: var(--borda-hover); }
.cartao.inativa { opacity: .6; }
.cartao.imprimindo { border-color: rgba(255,138,0,.38); box-shadow: var(--sombra), var(--glow); }
.cartao-topo { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; }
.cartao-topo h3 { overflow-wrap: anywhere; }
.cartao-topo code { white-space: nowrap; font-weight: 650; color: var(--ink); }
.cartao-id { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.cartao-id .ci { width: 38px; height: 38px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; flex: none; border: 1px solid var(--accent-line); }
.cartao-meta { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .25rem .8rem; font-size: .84rem; }
.cartao-meta dt { color: var(--ink-3); }
.cartao-meta dd { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.cartao .acoes { margin: 0; margin-top: auto; }
.estado-ponto { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.estado-ponto::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.estado-ponto.ok { color: var(--ok); } .estado-ponto.fila { color: var(--warn); } .estado-ponto.off { color: var(--err); } .estado-ponto.neutro { color: var(--ink-3); }
.arquivo-atual { font-family: var(--f-mono); font-size: .78rem; color: var(--ink-2); overflow-wrap: anywhere; }

.quadro { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.coluna { background: rgba(9,12,16,.7); border: 1px solid var(--borda); border-top: 2px solid var(--line-ctrl); border-radius: var(--raio); padding: .75rem; display: flex; flex-direction: column; gap: .7rem; min-width: 0; }
.coluna.c-fila { border-top-color: var(--ink-3); } .coluna.c-liberada { border-top-color: var(--warn); }
.coluna.c-imprimindo { border-top-color: var(--accent); } .coluna.c-concluida { border-top-color: var(--ok); }
.coluna-t { display: flex; align-items: center; justify-content: space-between; padding: .2rem .3rem; }
.coluna-t h2 { margin: 0; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.coluna-n { font-variant-numeric: tabular-nums; font-size: .8rem; font-weight: 700; color: var(--ink); background: var(--surface-3); border-radius: 99px; padding: .05rem .6rem; }
.op-forms { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.op-forms select { flex: 1 1 140px; min-width: 0; width: auto; }
.resumo { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; color: var(--ink-2); font-size: .9rem; margin-bottom: 1.1rem; }
.resumo b { color: var(--ink); font-variant-numeric: tabular-nums; }

.bobina-topo { display: flex; align-items: center; gap: .6rem; }
.bobina-topo b { font-size: .98rem; }
.bobina-nivel { display: flex; align-items: center; gap: .6rem; font-size: .84rem; color: var(--ink-2); }
.bobina-nivel progress.nivel { flex: 1; width: auto; }
.bobina-ajuste { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.bobina-ajuste input { flex: 1 1 80px; min-width: 0; width: auto; }
.bobina-ajuste select { flex: 1 1 100px; min-width: 0; width: auto; }
.rolo { width: 38px; height: 38px; flex: none; }
.rolo circle.cor { stroke: none; }

/* ---------- Abas, detalhes, drawer ---------- */
.abas { display: flex; flex-wrap: wrap; gap: .3rem; padding: .3rem; background: var(--card); border: 1px solid var(--borda); border-radius: 13px; margin-bottom: 1.1rem; width: fit-content; max-width: 100%; }
.aba { display: inline-flex; align-items: center; gap: .5rem; padding: .55rem 1.1rem; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: .9rem; transition: background var(--t), color var(--t); }
.aba:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.aba.ativa { background: var(--grad-accent); color: var(--accent-ink); font-weight: 750; }
.aba .ic { width: 18px; height: 18px; }
.barra-acoes { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; }
.barra-acoes .acoes { margin: 0; }
.detalhe-id { display: flex; align-items: center; gap: .9rem; margin-bottom: 1rem; }
.detalhe-id .di { width: 54px; height: 54px; border-radius: 14px; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-text); display: grid; place-items: center; flex: none; font-family: var(--f-titulo); font-weight: 800; font-size: 1.2rem; }
.detalhe-id h3 { font-size: 1.12rem; }
.dados { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .45rem 1.2rem; font-size: .88rem; }
.dados dt { color: var(--ink-3); }
.dados dd { margin: 0; text-align: right; color: var(--ink); overflow-wrap: anywhere; }
.divisor { height: 1px; background: var(--line); margin: 1rem 0; border: 0; }
.sel-linha { cursor: pointer; }

dialog.drawer {
  position: fixed; inset: 0 0 0 auto; margin: 0; height: 100%; max-height: none; width: min(560px, 100%); max-width: 100%;
  padding: 0; border: 0; border-left: 1px solid var(--line-ctrl); background: var(--surface); color: var(--ink); box-shadow: -30px 0 60px -20px rgba(0,0,0,.7);
}
dialog.drawer::backdrop { background: rgba(3,5,8,.62); backdrop-filter: blur(2px); }
.drawer-in { display: flex; flex-direction: column; height: 100%; }
.drawer-t { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--line); }
.drawer-t h2 { margin: 0; font-size: 1.15rem; }
.drawer-c { padding: 0 1.4rem 1rem; overflow-y: auto; flex: 1; }
.drawer-c h3 { margin: 1.2rem 0 .2rem; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); font-weight: 750; }
.drawer-r { padding: .9rem 1.4rem; border-top: 1px solid var(--line); display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; background: var(--surface-2); }

/* ---------- Utilitárias (sem inline — CSP) ---------- */
.mt0 { margin-top: 0; } .grande-mb { margin-bottom: 1.2rem; }
.w-420 { max-width: 420px; } .w-460 { max-width: 460px; } .w-520 { max-width: 520px; }
.w-640 { max-width: 640px; } .w-680 { max-width: 680px; } .w-720 { max-width: 720px; } .w-760 { max-width: 760px; }
.acoes { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; margin: .6rem 0; }
.acoes.espalha { justify-content: space-between; }
.acoes input, .acoes select { width: auto; }
.in-num { width: 90px !important; } .in-valor { width: 140px !important; } .in-busca { width: 280px !important; max-width: 100%; }
.inline-form { display: inline; }
.auto-w { width: auto; }
.titulo-registro { font-size: 1.2rem; font-weight: 750; }
.total-grande { font-size: 1.35rem; font-weight: 750; }
.swatch { width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Instalador ---------- */
.titulo-instalador { color: var(--accent-text); margin-top: 0; }
.log-instalador { color: var(--ink); white-space: pre-wrap; word-break: break-word; font-family: var(--f-mono); font-size: .8rem; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .9rem; max-height: 60vh; overflow: auto; }

/* ---------- Área pública (login) ---------- */
.area-publico { background-image: none; }
.pub { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.pub-hero {
  position: relative; overflow: hidden; padding: 2.6rem 3.2rem; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem;
  background: var(--bg-3); border-right: 1px solid var(--line);
  background-image: radial-gradient(640px 460px at 70% 62%, rgba(255,138,0,.2), transparent 68%), linear-gradient(180deg, transparent 60%, rgba(255,138,0,.06));
}
.pub-hero .logo { padding: 0; }
.pub-hero .logo-img { width: 64px; }
.pub-hero h2 { font-size: clamp(2.2rem, 1.4rem + 3vw, 3.8rem); line-height: 1.02; margin: 0 0 1rem; font-weight: 800; letter-spacing: -.03em; max-width: 12ch; }
.pub-hero h2 em { font-style: normal; color: var(--accent-text); }
.pub-hero p { color: var(--ink-2); max-width: 44ch; font-size: 1.02rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.2rem; }
.chip { font-size: .7rem; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; padding: .35rem .75rem; border: 1px solid var(--line-ctrl); border-radius: 99px; color: var(--ink-2); background: var(--surface); }
.pub-main { display: flex; flex-direction: column; justify-content: center; width: 100%; max-width: 460px; margin: 0 auto; padding: 3rem 1.5rem; }
.pub-main h1 { font-size: 2rem; }
.card.login { max-width: 460px; width: 100%; }
.pub-topo { display: flex; justify-content: flex-end; margin-bottom: 1rem; }

/* ---------- Responsivo ---------- */
@media (max-width: 1360px) { .grade-lado { grid-template-columns: 1fr; } }
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi.destaque { grid-column: span 2; }
  .kpis.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quadro { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grade-lado, .grade-3 { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .pub { grid-template-columns: 1fr; }
  .pub-hero { padding: 1.5rem 1.4rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .pub-hero   .pub-hero h2 { font-size: 1.8rem; margin: 0; }
  .pub-main { padding: 2rem 1.2rem 3rem; }
  .quadro { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .side { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-102%); transition: transform .22s ease; width: min(86vw, 300px); box-shadow: 0 0 60px rgba(0,0,0,.6); }
  .menu-aberto .side { transform: none; }
  .menu-aberto .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 35; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: .6rem 1rem; gap: .6rem; }
  .conteudo { padding: 0 1rem 2rem; }
  .ola, .crumb, .avatar-sm, .topo-dir .inline-form { display: none; }
  .side-sair { display: block; }
  .busca { max-width: none; }
  .busca kbd { display: none; }
  .busca input { padding-right: .8rem; }
  .kpis, .kpis.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
  .kpi { grid-template-columns: 1fr; row-gap: .3rem; }
  .kpi .kpi-ic { grid-row: auto; }
  .grade-2 { grid-template-columns: 1fr; }
  .hero { padding: 1.3rem 1.2rem; min-height: 0; }
  .hero h1 { max-width: none; }
}
@media (max-width: 480px) {
  .abas { width: 100%; } .aba { flex: 1; justify-content: center; padding: .55rem .6rem; }
  .kpi { padding: .8rem .9rem; } .kpi .kpi-ic { width: 36px; height: 36px; border-radius: 10px; }
  .kpi.destaque { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print {
  body { background: #fff; color: #000; }
  .side, .topbar, .rodape, .acoes, .scrim,   .conteudo { padding: 0; max-width: none; }
  .card, .painel { box-shadow: none; border-color: #bbb; background: #fff; color: #000; }
}

.lista .l-t b a, table b a, .alerta-item b { color: var(--ink); }
.lista .l-t b a:hover, table b a:hover { color: var(--accent-text); }
.painel-t h2 .ic, .card-t h2 .ic { color: var(--ink-2); }
.vazio.bloco { background: var(--card); border-color: var(--borda); }
.vazio.bloco::before { content: ""; display: block; width: 84px; height: 84px; margin: 0 auto .5rem; opacity: .85;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 84 84' fill='none' stroke='%23ff8a00' stroke-opacity='.55' stroke-width='1'%3E%3Cpath d='M42 6l30 17v38L42 78 12 61V23z'/%3E%3Cpath d='M42 6v34M12 23l30 17 30-17M42 40v38' stroke-opacity='.3'/%3E%3C/svg%3E") center / contain no-repeat; }
.vazio.bloco .ic { display: none; }

/* ---------- Fundo industrial (EL3DBackground) ----------
   Camada 1 do app: imagem tratada + overlays + grid técnico quase invisível + glow ambiente.
   Variantes: dashboard | machine | page | subtle | none  (ui_fundo() em includes/ui.php). */
.main { position: relative; isolation: isolate; }
.topbar, .conteudo, .rodape { position: relative; z-index: 1; }
.topbar { position: sticky; }
.el3d-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; background: var(--bg); }
.el3d-bg::before { /* grid técnico: se der para ver a olho nu, está forte demais */
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.017) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.017) 1px, transparent 1px);
  background-size: 44px 44px; -webkit-mask-image: linear-gradient(180deg, #000 0, #000 55%, transparent 100%); mask-image: linear-gradient(180deg, #000 0, #000 55%, transparent 100%);
}
.el3d-bg::after { /* glow ambiente + linhas CAD sutis */
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 92% -6%, rgba(255,138,0,.10), transparent 55%),
    linear-gradient(90deg, transparent 52%, rgba(255,138,0,.28) 74%, transparent 76%) 0 108px / 100% 1px no-repeat,
    linear-gradient(90deg, transparent 70%, rgba(255,255,255,.05) 71%, rgba(255,255,255,.05) 96%, transparent 97%) 0 124px / 100% 1px no-repeat;
}
.el3d-bg__img { position: absolute; left: 0; top: 0; right: 0; height: 640px; background: url("../img/bg-el3d.webp") 0 55% / 135% auto no-repeat; }
.el3d-bg__img::after { /* overlay: integra a imagem ao app e protege a leitura */
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(7,9,12,0) 0%, rgba(7,9,12,.42) 45%, #07090c 100%),
    linear-gradient(90deg, transparent 55%, rgba(7,9,12,.55) 100%);
}
.el3d-bg__img { animation: bg-in .7s ease-out both; }
@keyframes bg-in { from { opacity: 0; } }
.el3d-bg--machine .el3d-bg__img { height: 480px; opacity: .62; }
.el3d-bg--subtle::after, .el3d-bg--page::after { background: radial-gradient(circle at 92% -6%, rgba(255,138,0,.08), transparent 52%); }
.el3d-bg--page::after { background: radial-gradient(circle at 92% -6%, rgba(255,138,0,.09), transparent 52%), linear-gradient(90deg, transparent 58%, rgba(255,138,0,.22) 80%, transparent 82%) 0 96px / 100% 1px no-repeat; }
[data-theme="light"] .el3d-bg { background: var(--bg); }
[data-theme="light"] .el3d-bg__img { display: none; }
[data-theme="light"] .el3d-bg::before { background-image: linear-gradient(rgba(20,22,26,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(20,22,26,.035) 1px, transparent 1px); }

/* Com imagem: o texto do hero fica na área escura central, nunca sobre a impressora */
.fundo-dashboard .hero { min-height: 360px; padding-left: clamp(0px, 38%, 470px); }
.fundo-machine .hero { min-height: 250px; padding-left: clamp(0px, 38%, 470px); }
[data-theme="light"] .hero { padding-left: 0 !important; min-height: 0 !important; }
@media (max-width: 1360px) { .fundo-dashboard .hero, .fundo-machine .hero { padding-left: clamp(0px, 31%, 400px); } }
@media (max-width: 1180px) { .fundo-dashboard .hero, .fundo-machine .hero { padding-left: clamp(0px, 30%, 300px); } .el3d-bg__img { height: 520px; background-size: 170% auto; } }
@media (max-width: 860px) {
  .el3d-bg__img { display: none; }
  .fundo-dashboard .hero, .fundo-machine .hero { min-height: 0; padding-left: 0; }
  .el3d-bg--dashboard::after, .el3d-bg--machine::after { background: radial-gradient(circle at 80% -4%, rgba(255,138,0,.14), transparent 55%); }
}

/* Login: a imagem oficial na metade da marca; o texto fica na área escura */
.pub-hero { background-color: var(--bg); background-image: linear-gradient(180deg, rgba(7,9,12,.05), rgba(7,9,12,.6) 70%, #07090c), url("../img/bg-el3d.webp"); background-size: cover; background-position: left bottom; }
.pub-hero > div:nth-child(2) { margin-left: clamp(0px, 40%, 340px); }
@media (max-width: 960px) { .pub-hero { background-image: radial-gradient(500px 240px at 80% 0, rgba(255,138,0,.12), transparent 60%); } .pub-hero > div:nth-child(2) { margin-left: 0; } }
[data-theme="light"] .pub-hero { background-image: radial-gradient(500px 300px at 30% 90%, rgba(255,138,0,.16), transparent 65%); }

/* Painel master: senha provisória por usuário + resetar */
.lista li.usr-l { flex-wrap: wrap; align-items: flex-start; }
.usr-a { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; justify-content: flex-end; }
.usr-a form { margin: 0; }
.senha-prov { margin-top: .35rem; padding: .35rem .6rem; border: 1px dashed var(--accent-line); border-radius: var(--raio-sm); background: var(--accent-soft); color: var(--ink) !important; font-size: .82rem !important; overflow-wrap: anywhere; }
.senha-prov code { font-weight: 700; font-size: .95rem; color: var(--accent-text); user-select: all; }
.senha-prov em { font-style: normal; color: var(--ink-2); }
.senha-prov.sem { border-style: solid; border-color: var(--line); background: transparent; color: var(--ink-2) !important; }
