/* UPS SYSTEM — tema escuro tecnológico (slate-blue) com variante clara para uso ao sol */
:root {
  --bg: #0a1020; --bg2: #0d1528; --panel: #111b31; --panel2: #16223d; --line: #22314f; --line2: #2c3e63;
  --text: #e7edf8; --muted: #8e9fbf; --dim: #5d6f91;
  --accent: #5b8cff; --accent2: #22d3ee; --accent-soft: rgba(91,140,255,.14);
  --ok: #22c55e; --warn: #f08a3c; --risk: #ef4444; --none: #2a3654;
  --ok-soft: rgba(34,197,94,.14); --warn-soft: rgba(240,138,60,.15); --risk-soft: rgba(239,68,68,.15);
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --r: 14px; --r2: 10px;
  --nav: #0b1326;
  --glow: 0 0 0 1px rgba(91,140,255,.35), 0 0 24px rgba(91,140,255,.18);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef2f9; --bg2: #e6ecf6; --panel: #ffffff; --panel2: #f4f7fc; --line: #dbe3f0; --line2: #c8d4e8;
    --text: #0f1b33; --muted: #52627f; --dim: #8795ae; --accent: #2f63e0; --accent-soft: rgba(47,99,224,.1);
    --none: #e3e9f3; --shadow: 0 8px 24px rgba(20,40,80,.1); --nav: #0f1b33; color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #eef2f9; --bg2: #e6ecf6; --panel: #ffffff; --panel2: #f4f7fc; --line: #dbe3f0; --line2: #c8d4e8;
  --text: #0f1b33; --muted: #52627f; --dim: #8795ae; --accent: #2f63e0; --accent-soft: rgba(47,99,224,.1);
  --none: #e3e9f3; --shadow: 0 8px 24px rgba(20,40,80,.1); --nav: #0f1b33; color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14.5px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
body::before { /* malha sutil de fundo */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background: radial-gradient(1200px 600px at 85% -10%, rgba(91,140,255,.12), transparent 60%),
              radial-gradient(900px 500px at -10% 110%, rgba(34,211,238,.07), transparent 60%);
}
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 12.5px; } .tiny { font-size: 11.5px; }
.mono { font-family: "JetBrains Mono", ui-monospace, Consolas, monospace; font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; } .wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.col { display: flex; flex-direction: column; gap: 10px; }
.sp { justify-content: space-between; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; background: var(--nav); color: #dfe7f7;
  border-right: 1px solid rgba(255,255,255,.06); display: flex; flex-direction: column; padding: 18px 12px;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, #5b8cff, #22d3ee); box-shadow: 0 6px 18px rgba(91,140,255,.4);
}
.brand b { display: block; font-size: 15px; letter-spacing: .06em; }
.brand span { font-size: 11px; color: #8ea2c8; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: #b6c4e0;
  font-weight: 520; transition: .15s;
}
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.on { background: linear-gradient(90deg, rgba(91,140,255,.22), rgba(91,140,255,.05)); color: #fff; box-shadow: inset 2px 0 0 #5b8cff; }
.nav svg { width: 19px; height: 19px; flex: none; }
.side .foot { margin-top: auto; padding: 10px; font-size: 12px; color: #8ea2c8; display: flex; flex-direction: column; gap: 8px; }
.side .foot .me { display: flex; gap: 9px; align-items: center; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #1f2d4f; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #cfe0ff; flex: none; }

.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: 14px 26px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.top .title { flex: 1; min-width: 0; }
.top .title small { display: block; color: var(--muted); font-size: 12px; }
.content { padding: 22px 26px 110px; max-width: 1360px; width: 100%; margin: 0 auto; }

.sync { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); padding: 5px 10px; border: 1px solid var(--line); border-radius: 99px; background: var(--panel); white-space: nowrap; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.sync.pend i { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.sync.off i { background: var(--risk); box-shadow: 0 0 8px var(--risk); }

.tabbar { display: none; }
.demo-banner { background: repeating-linear-gradient(45deg, #5b3b00, #5b3b00 10px, #6b4600 10px, #6b4600 20px); color: #ffd79a; text-align: center; font-size: 12px; padding: 4px; font-weight: 600; }

/* ---------- componentes ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card h2 .sub { font-weight: 450; color: var(--muted); font-size: 12.5px; margin-left: auto; }
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; font-weight: 600;
  transition: .15s; white-space: nowrap; user-select: none;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.pri { background: linear-gradient(135deg, #4f7dff, #3b67e8); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(79,125,255,.35); }
.btn.pri:hover { filter: brightness(1.08); }
.btn.ok { background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel2); }
.btn.danger { color: var(--risk); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 40px; padding: 0; }
.btn.sm.icon { width: 32px; }
.btn svg { width: 18px; height: 18px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.inp, select.inp, textarea.inp {
  width: 100%; min-height: 40px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line2);
  background: var(--bg2); outline: none; transition: .15s;
}
textarea.inp { resize: vertical; min-height: 64px; line-height: 1.45; }
.inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.s0 { color: var(--ok); background: var(--ok-soft); }
.pill.s1 { color: var(--warn); background: var(--warn-soft); }
.pill.s2 { color: var(--risk); background: var(--risk-soft); }
.pill.sn { color: var(--muted); background: var(--panel2); }
.pill.info { color: var(--accent); background: var(--accent-soft); }
.pill.plain::before { display: none; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }

.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 7px; font-size: 12.5px; font-weight: 650; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.seg button.on.v0 { background: var(--ok); color: #fff; }
.seg button.on.v1 { background: var(--warn); color: #fff; }
.seg button.on.v2 { background: var(--risk); color: #fff; }
.seg button.on.vi { background: var(--accent); color: #fff; }

.toast-box { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #111b31; color: #fff; border: 1px solid var(--line2); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 550; animation: up .25s ease; max-width: 90vw; }
.toast.err { border-color: var(--risk); } .toast.ok { border-color: var(--ok); }
@keyframes up { from { opacity: 0; transform: translateY(10px); } }

.modal-bg { position: fixed; inset: 0; background: rgba(3,8,20,.66); backdrop-filter: blur(4px); z-index: 80; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 18px; width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow); }
.modal.wide { width: min(1000px, 100%); }
.modal header { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; }
.modal header h2 { flex: 1; }
.modal .body { padding: 18px; }
.modal footer { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--panel); }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty svg { width: 44px; height: 44px; opacity: .5; margin-bottom: 8px; }
.skeleton { background: linear-gradient(90deg, var(--panel2), var(--line), var(--panel2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- KPIs ---------- */
.kpi { position: relative; overflow: hidden; padding: 16px 16px 14px; }
.kpi .lbl { font-size: 11.5px; color: var(--muted); font-weight: 650; letter-spacing: .05em; text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 28px; font-weight: 750; letter-spacing: -.02em; margin-top: 6px; line-height: 1.1; }
.kpi .val small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.kpi .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: var(--accent-soft); filter: blur(2px); }
.kpi.t0::after { background: var(--ok-soft); } .kpi.t1::after { background: var(--warn-soft); } .kpi.t2::after { background: var(--risk-soft); }
.kpi .val.c0 { color: var(--ok); } .kpi .val.c1 { color: var(--warn); } .kpi .val.c2 { color: var(--risk); }

.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; }
.status-hero { display: flex; gap: 18px; align-items: center; }
.status-orb { width: 92px; height: 92px; border-radius: 50%; flex: none; display: grid; place-items: center; position: relative; }
.status-orb::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: currentColor; opacity: .14; animation: pulse 2.4s infinite; }
.status-orb::after { content: ""; position: absolute; inset: 16px; border-radius: 50%; background: currentColor; box-shadow: 0 0 30px currentColor; }
@keyframes pulse { 50% { transform: scale(1.12); opacity: .05; } }
.status-orb.c0 { color: var(--ok); } .status-orb.c1 { color: var(--warn); } .status-orb.c2 { color: var(--risk); } .status-orb.cn { color: var(--dim); }

.area-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 14px; }
.area-chip { padding: 10px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); font-size: 12px; }
.area-chip b { display: block; font-size: 12.5px; margin-bottom: 6px; line-height: 1.25; }

/* mapa de calor */
.heat { display: grid; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.heat .hr { display: grid; grid-template-columns: 170px 1fr; gap: 8px; align-items: center; }
.heat .hl { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heat .cells { display: grid; gap: 3px; }
.heat .c { height: 22px; border-radius: 4px; background: var(--none); transition: transform .1s; cursor: default; }
.heat .c:hover { transform: scale(1.15); outline: 2px solid var(--text); }
.heat .c.s0 { background: var(--ok); } .heat .c.s1 { background: var(--warn); } .heat .c.s2 { background: var(--risk); }
.heat .c.wk { opacity: .55; }
.heat .axis { display: grid; gap: 3px; font-size: 10px; color: var(--dim); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.bars .b { display: grid; grid-template-columns: 150px 1fr 40px; gap: 10px; align-items: center; font-size: 12.5px; margin: 7px 0; }
.bars .track { height: 12px; border-radius: 99px; background: var(--panel2); overflow: hidden; display: flex; }
.bars .track i { height: 100%; }

.insight { display: flex; gap: 11px; padding: 11px 12px; border-radius: 11px; background: var(--panel2); border: 1px solid var(--line); margin-bottom: 8px; font-size: 13px; }
.insight .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.insight .ic svg { width: 17px; height: 17px; }
.insight.n0 .ic { background: var(--ok-soft); color: var(--ok); }
.insight.n1 .ic { background: var(--warn-soft); color: var(--warn); }
.insight.n2 .ic { background: var(--risk-soft); color: var(--risk); }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11.5px; color: var(--muted); font-weight: 650; letter-spacing: .04em; text-transform: uppercase; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: var(--panel2); }
.scroll-x { overflow-x: auto; }

/* ---------- lista de inspeções ---------- */
.insp-list { display: flex; flex-direction: column; gap: 10px; }
.insp { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; cursor: pointer; transition: .15s; }
.insp:hover { border-color: var(--accent); box-shadow: var(--glow); }
.insp .date { text-align: center; border-radius: 12px; background: var(--panel2); padding: 6px 0; border: 1px solid var(--line); }
.insp .date b { display: block; font-size: 22px; line-height: 1; }
.insp .date span { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.dots { display: flex; gap: 4px; margin-top: 6px; }
.dots i { width: 22px; height: 6px; border-radius: 99px; background: var(--none); }
.dots i.s0 { background: var(--ok); } .dots i.s1 { background: var(--warn); } .dots i.s2 { background: var(--risk); }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal .h { font-size: 11px; color: var(--dim); text-align: center; font-weight: 700; }
.cal .d { aspect-ratio: 1.3; border-radius: 9px; background: var(--panel2); border: 1px solid var(--line); font-size: 12px; padding: 5px 7px; position: relative; cursor: default; }
.cal .d.has { cursor: pointer; } .cal .d.has:hover { border-color: var(--accent); }
.cal .d.out { opacity: .3; }
.cal .d.today { border-color: var(--accent); box-shadow: var(--glow); }
.cal .d i { position: absolute; left: 7px; right: 7px; bottom: 6px; height: 5px; border-radius: 99px; }
.cal .d i.s0 { background: var(--ok); } .cal .d i.s1 { background: var(--warn); } .cal .d i.s2 { background: var(--risk); }

/* ---------- editor ---------- */
.ed-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stepper { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; position: sticky; top: 69px; z-index: 15; background: var(--bg); margin: 0 -4px; }
.stepper::-webkit-scrollbar { display: none; }
.step { flex: none; display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; font-size: 13px; font-weight: 600; transition: .15s; }
.step.on { border-color: var(--accent); box-shadow: var(--glow); }
.step .n { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 11.5px; font-weight: 800; background: var(--panel2); }
.step.s0 .n { background: var(--ok); color: #fff; } .step.s1 .n { background: var(--warn); color: #fff; } .step.s2 .n { background: var(--risk); color: #fff; }
.section-card { padding: 0; overflow: hidden; }
.section-card > .sh { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: linear-gradient(180deg, var(--panel2), var(--panel)); }
.section-card > .sb { padding: 16px 18px; display: flex; flex-direction: column; gap: 18px; }
.blk-t { font-size: 11.5px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.blk-t .line { flex: 1; height: 1px; background: var(--line); }

.item { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 10px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); margin-bottom: 8px; border-left: 3px solid var(--line2); }
.item.n0 { border-left-color: var(--ok); } .item.n1 { border-left-color: var(--warn); } .item.n2 { border-left-color: var(--risk); } .item.ni { border-left-color: var(--accent); }
.item .ord { font-weight: 800; color: var(--muted); font-size: 13px; padding-top: 8px; text-align: center; }
.item textarea { background: transparent; border: 0; min-height: 44px; padding: 6px 0; resize: none; overflow: hidden; }
.item textarea:focus { box-shadow: none; }
.item .tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.link-p { font-size: 11.5px; color: var(--accent); background: var(--accent-soft); padding: 3px 8px; border-radius: 6px; cursor: pointer; }

.verifs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.verif { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); font-size: 13px; }
.verif span { flex: 1; }
.yn { display: flex; gap: 4px; }
.yn button { width: 38px; height: 30px; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel); cursor: pointer; font-weight: 700; font-size: 12px; color: var(--muted); }
.yn button.on.S { background: var(--ok); color: #fff; border-color: var(--ok); }
.yn button.on.N { background: var(--risk); color: #fff; border-color: var(--risk); }
.yn button.on.NA { background: var(--dim); color: #fff; border-color: var(--dim); }

.oil { display: grid; grid-template-columns: 110px 1fr; gap: 18px; align-items: center; }
.tank { width: 100%; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.ph { position: relative; border-radius: 12px; overflow: hidden; background: var(--bg2); border: 1px solid var(--line); aspect-ratio: 3/4; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.ph .bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 4px; padding: 6px; background: linear-gradient(transparent, rgba(0,0,0,.75)); justify-content: flex-end; }
.ph .bar button { width: 30px; height: 30px; border-radius: 8px; border: 0; background: rgba(255,255,255,.16); color: #fff; cursor: pointer; display: grid; place-items: center; backdrop-filter: blur(6px); }
.ph .bar button svg { width: 16px; height: 16px; }
.ph .badge { position: absolute; top: 6px; left: 6px; font-size: 10.5px; padding: 2px 7px; border-radius: 6px; background: rgba(0,0,0,.6); color: #fff; font-weight: 600; }
.ph.off img { opacity: .35; }
.addph { display: grid; place-items: center; gap: 6px; aspect-ratio: 3/4; border-radius: 12px; border: 2px dashed var(--line2); color: var(--muted); cursor: pointer; font-weight: 600; font-size: 13px; text-align: center; padding: 8px; transition: .15s; background: transparent; }
.addph:hover { border-color: var(--accent); color: var(--accent); }
.addph svg { width: 28px; height: 28px; }

.pend-mini { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 11px; border: 1px dashed var(--line2); margin-bottom: 8px; font-size: 13px; }
.pend-mini.done { opacity: .55; }

.actionbar { position: fixed; left: 236px; right: 0; bottom: 0; z-index: 30; display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding: 12px 26px; background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }

/* anotação */
.annot-wrap { display: flex; flex-direction: column; gap: 10px; }
.annot-wrap canvas { width: 100%; max-height: 64vh; object-fit: contain; border-radius: 10px; background: #000; touch-action: none; }

/* kanban */
.kanban { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.kcol { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; min-height: 200px; }
.kcol h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.kcol h3 .count { margin-left: auto; font-size: 12px; color: var(--muted); background: var(--panel); padding: 2px 9px; border-radius: 99px; }
.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 9px; cursor: pointer; transition: .15s; border-left: 3px solid var(--warn); }
.pcard.sev2 { border-left-color: var(--risk); }
.pcard:hover { border-color: var(--accent); box-shadow: var(--glow); }
.pcard .t { font-weight: 600; font-size: 13.5px; margin: 6px 0; }
.pcard .meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.age { font-weight: 700; }
.timeline { border-left: 2px solid var(--line2); margin-left: 6px; padding-left: 16px; }
.timeline .ev { position: relative; margin-bottom: 12px; font-size: 13px; }
.timeline .ev::before { content: ""; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--panel); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .box { width: min(400px, 100%); padding: 28px; }
.login .brand { justify-content: center; padding-bottom: 8px; }
.login .brand b { font-size: 20px; }

.chart svg { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 10px; }
.tip { position: fixed; z-index: 120; pointer-events: none; background: #0b1326; color: #fff; border: 1px solid #2c3e63; padding: 6px 9px; border-radius: 8px; font-size: 12px; box-shadow: var(--shadow); }

/* ---------- responsivo ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .top { padding: 12px 16px; }
  .content { padding: 16px 16px 120px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: color-mix(in srgb, var(--nav) 94%, transparent); backdrop-filter: blur(14px);
    border-top: 1px solid rgba(255,255,255,.08); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: #93a5c9; padding: 4px 0; font-weight: 600; }
  .tabbar a.on { color: #fff; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.fab span.f { width: 48px; height: 48px; margin-top: -22px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, #5b8cff, #22d3ee); color: #fff; box-shadow: 0 8px 20px rgba(91,140,255,.5); }
  .actionbar { left: 0; bottom: calc(64px + env(safe-area-inset-bottom)); padding: 10px 16px; }
  .g3, .g2 { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: auto; }
  .kanban { grid-template-columns: 1fr; }
  .area-strip { grid-template-columns: repeat(2, 1fr); }
  .stepper { top: 61px; }
  .heat .hr { grid-template-columns: 96px 1fr; }
  .bars .b { grid-template-columns: 100px 1fr 34px; }
}
@media (max-width: 520px) {
  .g4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi .val { font-size: 23px; }
  .kpi { padding: 13px; }
  h1 { font-size: 18px; }
  .photos { grid-template-columns: repeat(2, 1fr); }
  .oil { grid-template-columns: 84px 1fr; gap: 12px; }
  .insp { grid-template-columns: 52px 1fr; }
  .insp > :last-child { grid-column: 1 / -1; }
  .status-orb { width: 70px; height: 70px; }
  .actionbar .btn { flex: 1; padding: 0 8px; }
  .actionbar .hide-sm { display: none; }
  .top .hide-sm { display: none; }
}
@media print { .side, .tabbar, .top, .actionbar { display: none !important; } }

/* ícones dentro de títulos e rótulos */
.card h2 > svg, .blk-t svg, .link-p svg, .tag svg, .step svg, .kcol h3 svg, .sub svg { width: 17px; height: 17px; flex: none; }
.card h2 > svg { color: var(--accent); }
.avatar svg { width: 16px; height: 16px; }
@media (max-width: 520px) {
  .sync { padding: 6px; } .sync span { display: none; }
  .top h1 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top .title small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* assinatura */
.sigpad { position: relative; border-radius: 12px; overflow: hidden; border: 1px dashed var(--line2); background: #fff; }
.sigpad canvas { display: block; width: 100%; height: 190px; touch-action: none; cursor: crosshair; }
.sigpad .base { position: absolute; left: 7%; right: 7%; bottom: 42px; border-bottom: 1.5px solid #b8c3d6; pointer-events: none; }
.sigpad .dica { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; font-size: 12px; color: #8c98ae; pointer-events: none; }
.sigpad .x { position: absolute; left: 7%; bottom: 46px; color: #8c98ae; font-weight: 700; pointer-events: none; }
.sig-img { background: #fff; border-radius: 10px; padding: 8px; max-width: 320px; border: 1px solid var(--line); }
.sig-img img { width: 100%; display: block; }

/* responsividade: nenhum item de grade/flex estoura a largura da tela */
.grid > *, .row > .grow, .col > * { min-width: 0; }
img, svg, canvas, video { max-width: 100%; }
.heat .cells, .heat .axis { gap: 2px; }
@media (max-width: 520px) {
  .heat .c { height: 18px; border-radius: 3px; }
  .heat .axis span { font-size: 9px; }
  .content { padding: 12px 12px 130px; }
  .card { padding: 13px; }
  .section-card > .sh, .section-card > .sb { padding: 13px; }
  .modal-bg { padding: 0; align-items: end; }
  .modal { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .seg button { padding: 6px 9px; font-size: 12px; }
  .tbl th, .tbl td { padding: 8px 6px; }
}
@media (min-width: 1600px) { .content { max-width: 1560px; } }
.cal { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal .d { min-width: 0; overflow: hidden; }
@media (max-width: 1280px) { .cal { gap: 3px; } .cal .d { padding: 3px 5px; font-size: 11px; border-radius: 7px; } .cal .d i { left: 4px; right: 4px; bottom: 4px; } }

/* interatividade corporativa: estados claros, sem efeitos decorativos */
.status-orb::before { animation: none; opacity: .16; }
.click { cursor: pointer; transition: border-color .12s, background-color .12s; }
.card.click:hover, .kpi.click:hover { border-color: var(--accent); }
.click:focus-visible, .tbl th.ord:focus-visible, button:focus-visible, a:focus-visible, .heat .c:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.area-chip { text-align: left; font: inherit; color: inherit; cursor: pointer; }
button.area-chip:hover { border-color: var(--accent); }
.tbl th.ord { cursor: pointer; user-select: none; white-space: nowrap; }
.tbl th.ord:hover { color: var(--text); }
.tbl th.ord::after { content: ' ↕'; opacity: .35; font-size: 10px; }
.tbl th.ord[data-dir=asc]::after { content: ' ▲'; opacity: .9; }
.tbl th.ord[data-dir=desc]::after { content: ' ▼'; opacity: .9; }
.heat .c.click { cursor: pointer; }
.heat .c:hover { transform: none; outline: 2px solid var(--text); outline-offset: -1px; }
/* metas (semáforo) */
.metas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.meta { display: flex; gap: 11px; align-items: center; padding: 11px 12px; border-radius: 11px; background: var(--panel2); border: 1px solid var(--line);
  text-align: left; font: inherit; color: inherit; cursor: pointer; min-width: 0; }
.meta:hover { border-color: var(--accent); }
.meta .farol { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--dim); }
.meta.s0 .farol { background: var(--ok); } .meta.s1 .farol { background: var(--warn); } .meta.s2 .farol { background: var(--risk); }
.delta { font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.delta.up { color: var(--ok); } .delta.down { color: var(--risk); }
.mini { padding: 9px 11px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--line2); min-width: 0; }
.mini b { display: block; font-size: 15px; margin: 2px 0; }
.mini.s0 { border-left-color: var(--ok); } .mini.s1 { border-left-color: var(--warn); } .mini.s2 { border-left-color: var(--risk); }
.medgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.med { padding: 11px 12px; border-radius: 11px; background: var(--panel2); border: 1px solid var(--line); border-top: 3px solid var(--line2); min-width: 0; }
.med.s0 { border-top-color: var(--ok); } .med.s1 { border-top-color: var(--warn); } .med.s2 { border-top-color: var(--risk); }
.ia-texto p { margin: 0 0 6px; font-size: 13.5px; line-height: 1.5; }
.ia-texto p.tt { font-weight: 700; margin-top: 10px; }
.ia-texto p.li { padding-left: 14px; position: relative; }
.ia-texto p.li::before { content: ''; position: absolute; left: 2px; top: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
@media (max-width: 520px) { .metas { grid-template-columns: 1fr; } }
/* modo TV / NOC */
body.tv .side, body.tv .tabbar, body.tv .top, body.tv .demo-banner { display: none !important; }
body.tv .app { grid-template-columns: 1fr; }
body.tv .content { max-width: none; padding: 20px 24px; }
.tv-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.tv-hora { font-size: 15px; font-weight: 600; text-transform: capitalize; }
.tv-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 14px; }
.tv-wide { grid-column: 1 / -1; }
.tv-status { border-top: 5px solid var(--dim); }
.tv-status.s0 { border-top-color: var(--ok); } .tv-status.s1 { border-top-color: var(--warn); } .tv-status.s2 { border-top-color: var(--risk); }
.tv-big { font-size: clamp(34px, 5vw, 64px); font-weight: 800; letter-spacing: -.02em; margin: 6px 0; }
.tv-status.s0 .tv-big { color: var(--ok); } .tv-status.s1 .tv-big { color: var(--warn); } .tv-status.s2 .tv-big { color: var(--risk); }
.tv-areas { display: grid; gap: 8px; margin-top: 16px; }
.tv-area { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--panel2); border-left: 4px solid var(--dim); font-weight: 600; }
.tv-area.s0 { border-left-color: var(--ok); } .tv-area.s1 { border-left-color: var(--warn); } .tv-area.s2 { border-left-color: var(--risk); }
.tv-kpi { border-left: 4px solid var(--dim); }
.tv-kpi.s0 { border-left-color: var(--ok); } .tv-kpi.s1 { border-left-color: var(--warn); } .tv-kpi.s2 { border-left-color: var(--risk); }
.tv-val { font-size: clamp(22px, 2.6vw, 34px); font-weight: 800; margin: 4px 0; }
.tv-pend { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.tv-p { display: flex; flex-direction: column; gap: 4px; padding: 11px 13px; border-radius: 10px; background: var(--panel2); border-left: 4px solid var(--warn); }
.tv-p.s2 { border-left-color: var(--risk); }
@media (max-width: 900px) { .tv-grid { grid-template-columns: 1fr; } }

/* ---------- painel: grade única de 4 colunas, linhas de mesma altura ---------- */
.kpi::after { display: none; }
.dash { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.dash > .c1 { grid-column: span 1; } .dash > .c2 { grid-column: span 2; } .dash > .c4 { grid-column: 1 / -1; }
.dash > .card { display: flex; flex-direction: column; min-width: 0; margin: 0; }
.dash-titulo { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 8px 2px -4px;
  font-size: 11.5px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.dash-titulo .dim { font-weight: 500; letter-spacing: 0; text-transform: none; }
.dash .rodape-card { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.dash .legend.rodape-card { flex-direction: row; flex-wrap: wrap; gap: 14px; }
.dash .status-hero { margin-bottom: 4px; }
.dash .area-strip { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.dash .area-chip { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; min-height: 64px; }
.dash .area-chip b { margin: 0; }
/* lista com rolagem própria: não define a altura da linha, acompanha o cartão ao lado */
.dash .rolagem { flex: 1 1 0; min-height: 0; overflow-y: auto; padding-right: 4px; }
.dash .kpi .val { min-height: 32px; }
.meta-card .lbl { display: flex; align-items: center; gap: 7px; }
.meta-card .farol { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--dim); }
.meta-card.s0 .farol { background: var(--ok); } .meta-card.s1 .farol { background: var(--warn); } .meta-card.s2 .farol { background: var(--risk); }
.meta-card { border-top: 3px solid var(--line2); }
.meta-card.s0 { border-top-color: var(--ok); } .meta-card.s1 { border-top-color: var(--warn); } .meta-card.s2 { border-top-color: var(--risk); }
.resumo-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.resumo-col { min-width: 0; }
@media (max-width: 1100px) {
  .dash { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash > .c2, .dash > .c4 { grid-column: 1 / -1; }
  .dash .rolagem { flex: none; max-height: 340px; }
  .resumo-3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .dash .area-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* largura: conteúdo ocupa toda a área ao lado do menu (sem faixa vazia em monitores largos) */
.content { max-width: none; margin: 0; width: 100%; }
@media (min-width: 1600px) { .content { max-width: none; } }
@media (min-width: 2600px) { .content { max-width: 2360px; } }
/* formulários: campos se distribuem em colunas conforme a largura, em vez de esticar */
.grid.gauto { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
