/* ============ Tokens ============ */
:root {
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* marca (tirada do Instagram @araraazulrededepostos) */
  --brand-yellow: #FFD60A;
  --brand-yellow-2: #F5C400;
  --brand-navy: #0B1A44;
  --brand-blue: #1F4FB8;
  --brand-green: #00A85A;
  --radius: 18px;
  --radius-sm: 12px;
}
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --page: #060E26;
  --surface: #0E1A3D;
  --surface-2: #13234F;
  --surface-3: #1A2C60;
  --hair: rgba(255,255,255,0.08);
  --hair-2: rgba(255,255,255,0.14);
  --text: #EEF2FF;
  --text-2: #B3BDDB;
  --muted: #7F8BB0;
  --grid: #1C2A55;
  --axis: #2C3C6E;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
  --seq-0: #13234F; --seq-1: #1c5cab; --seq-2: #2a78d6; --seq-3: #5598e7; --seq-4: #9ec5f4;
  --pos: #3987e5; --neg: #e66767; --mid: #383835;
  --good: #0ca30c; --warn: #fab219; --crit: #d03b3b; --good-text: #3fd13f;
  --shadow: 0 20px 50px -24px rgba(0,0,0,0.6);
  --glow: radial-gradient(1200px 500px at 85% -10%, rgba(31,79,184,0.35), transparent 60%), radial-gradient(800px 400px at -10% 110%, rgba(255,214,10,0.07), transparent 60%);
}
:root[data-theme="light"] {
  color-scheme: light;
  --page: #F2F5FB;
  --surface: #FFFFFF;
  --surface-2: #F5F7FC;
  --surface-3: #E9EEF8;
  --hair: rgba(11,26,68,0.08);
  --hair-2: rgba(11,26,68,0.14);
  --text: #0B1A44;
  --text-2: #46527A;
  --muted: #7782A3;
  --grid: #E7EBF4;
  --axis: #CBD2E3;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4;
  --seq-0: #EEF4FD; --seq-1: #b7d3f6; --seq-2: #6da7ec; --seq-3: #2a78d6; --seq-4: #184f95;
  --pos: #2a78d6; --neg: #e34948; --mid: #f0efec;
  --good: #0ca30c; --warn: #fab219; --crit: #d03b3b; --good-text: #006300;
  --shadow: 0 18px 40px -28px rgba(11,26,68,0.35);
  --glow: radial-gradient(1200px 500px at 85% -10%, rgba(31,79,184,0.10), transparent 60%), radial-gradient(800px 400px at -10% 110%, rgba(255,214,10,0.10), transparent 60%);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--page); color: var(--text); -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0; background: var(--glow); pointer-events: none; z-index: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
button, select, input { font-family: inherit; }

/* ============ Marca ============ */
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 42px; height: 42px; border-radius: 12px; object-fit: cover; box-shadow: 0 0 0 2px var(--brand-yellow); }
.brand strong { display: block; font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.brand span { display: block; font-size: 12px; color: var(--muted); }
.brand-lg img { width: 56px; height: 56px; border-radius: 16px; }
.brand-lg strong { font-size: 20px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--hair); white-space: nowrap; }
.chip-brand { background: var(--brand-yellow); color: #0B1A44; border: none; }
.chip-flu { background: rgba(0,168,90,0.14); color: #34d17f; border-color: rgba(0,168,90,0.3); }
:root[data-theme="light"] .chip-flu { color: #00713d; }
.chip-ara { background: rgba(57,135,229,0.14); color: #7fb2f0; border-color: rgba(57,135,229,0.3); }
:root[data-theme="light"] .chip-ara { color: #1c5cab; }

/* ============ Login ============ */
.login { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { position: relative; background: var(--brand-yellow); overflow: hidden; display: flex; align-items: flex-end; }
.login-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 100%; transform: scale(1.45); transform-origin: 46% 92%; }
.login-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(6,14,38,0.85)); }
.login-art-caption { position: relative; z-index: 1; padding: 48px; color: #fff; }
.login-art-caption h2 { font-size: clamp(26px, 3vw, 40px); line-height: 1.1; margin: 14px 0 0; letter-spacing: -0.02em; }
.login-form { display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: clamp(24px, 6vw, 88px); max-width: 560px; }
.login-form h1 { font-size: 34px; margin: 28px 0 0; letter-spacing: -0.02em; }
.login-form p { margin: 0; line-height: 1.5; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.field input { height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--hair-2); background: var(--surface); color: var(--text); font-size: 15px; }
.field input:focus { outline: 2px solid var(--brand-yellow); outline-offset: 1px; }
.btn { height: 48px; border-radius: 12px; border: none; font-weight: 700; font-size: 15px; cursor: pointer; padding: 0 18px; }
.btn-primary { background: var(--brand-yellow); color: #0B1A44; box-shadow: 0 10px 30px -10px rgba(255,214,10,0.6); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--hair); height: 36px; font-size: 13px; }

/* ============ Layout do app ============ */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 16px; display: flex; flex-direction: column; gap: 26px; background: linear-gradient(180deg, var(--brand-navy), #071233); border-right: 1px solid rgba(255,255,255,0.06); color: #EEF2FF; }
.sidebar .brand span { color: #8F9BC2; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: #B8C2E3; text-decoration: none; font-weight: 600; font-size: 14px; position: relative; transition: background .15s; }
.nav a svg { width: 20px; height: 20px; flex: none; }
.nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav a.active { background: rgba(255,214,10,0.12); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -16px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand-yellow); }
.nav a.active svg { color: var(--brand-yellow); }
.nav a .lock { margin-left: auto; font-size: 11px; color: #8F9BC2; }
.nav .nav-sep { height: 1px; background: rgba(255,255,255,0.07); margin: 10px 4px; }
.sidebar-foot { margin-top: auto; }
.sync { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 12px; background: rgba(255,255,255,0.05); font-size: 12px; }
.sync strong { display: block; font-size: 13px; }
.sync span { color: #8F9BC2; }
.sync .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand-green); box-shadow: 0 0 0 4px rgba(0,168,90,0.2); }

.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px 32px 10px; flex-wrap: wrap; }
.topbar h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; }
.topbar p { margin: 4px 0 0; font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.select-wrap select { height: 40px; border-radius: 12px; padding: 0 34px 0 14px; background: var(--surface); color: var(--text); border: 1px solid var(--hair-2); font-weight: 600; font-size: 14px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 17px, calc(100% - 13px) 17px; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--hair-2); background: var(--surface); color: var(--text); cursor: pointer; display: grid; place-items: center; }
.icon-btn svg { width: 18px; height: 18px; }
.user { position: relative; display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px; border-radius: 14px; border: 1px solid var(--hair-2); background: var(--surface); cursor: pointer; }
.avatar { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; background: var(--brand-yellow); color: #0B1A44; }
.user-meta strong { display: block; font-size: 13px; }
.user-meta span { display: block; font-size: 11px; color: var(--muted); }
.user-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 300px; background: var(--surface); border: 1px solid var(--hair-2); border-radius: 14px; box-shadow: var(--shadow); padding: 8px; display: none; z-index: 20; }
.user.open .user-menu { display: block; }
.user-menu h4 { margin: 6px 8px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.user-menu button { width: 100%; text-align: left; display: flex; gap: 10px; align-items: center; padding: 8px; border: none; border-radius: 10px; background: none; color: var(--text); cursor: pointer; }
.user-menu button:hover, .user-menu button.on { background: var(--surface-2); }
.user-menu button small { display: block; color: var(--muted); font-size: 11px; }
.user-menu .avatar { width: 28px; height: 28px; font-size: 12px; }
.user-menu hr { border: none; border-top: 1px solid var(--hair); margin: 6px 0; }

.filters { display: flex; flex-direction: column; gap: 8px; padding: 6px 32px 14px; }
/* cabeçalho congelado: ao rolar, fica compacto (título menor, sem subtítulo) e com fundo translúcido */
.sticky-head { position: sticky; top: 0; z-index: 15; background: color-mix(in srgb, var(--page) 88%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); margin-bottom: 4px; }
.topbar, .topbar h1 { transition: padding .2s ease, font-size .2s ease; }
body.rolou .sticky-head { box-shadow: 0 12px 24px -20px rgba(0,0,0,0.55); border-bottom: 1px solid var(--hair); }
body.rolou .topbar { padding-top: 10px; padding-bottom: 4px; }
body.rolou .topbar h1 { font-size: 19px; }
body.rolou .topbar p { display: none; }
body.rolou .filters { padding-bottom: 10px; }
.frow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; min-width: 0; }
.filters .lbl { min-width: 52px; }
.fsep { width: 1px; height: 22px; background: var(--hair-2); margin: 0 8px; }
.frow-off .fchip { opacity: .45; cursor: not-allowed; }
.filters .lbl { font-size: 12px; color: var(--muted); font-weight: 600; margin-right: 4px; }
.fchip { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--hair-2); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.fchip.on { background: var(--text); color: var(--page); border-color: var(--text); }
.fchip .sw { width: 10px; height: 10px; border-radius: 3px; }
.fchip:focus-visible, .nav a:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--brand-yellow); outline-offset: 2px; }

.main { padding: 0 32px 40px; display: grid; gap: 18px; min-width: 0; }
.grid { display: grid; gap: 18px; min-width: 0; }
.g-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; } .span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }

.card { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; position: relative; }
.card-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.card-h h3 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.card-h p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.chart { width: 100%; height: 300px; }
.chart-sm { height: 230px; }
.chart-lg { height: 360px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ============ Hero ============ */
.hero { position: relative; overflow: hidden; border-radius: 24px; padding: 28px; color: #fff; background: #0B1A44; min-height: 230px; display: grid; grid-template-columns: 1.3fr 2fr; gap: 24px; align-items: end; box-shadow: var(--shadow); }
.hero-bg { position: absolute; top: 0; bottom: 0; right: 0; width: 58%; background-size: cover; background-position: 78% 40%; opacity: .42; -webkit-mask-image: linear-gradient(90deg, transparent, #000 45%); mask-image: linear-gradient(90deg, transparent, #000 45%); }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, rgba(8,18,52,0.96) 30%, rgba(11,26,68,0.72) 60%, rgba(31,79,184,0.35)); }
.hero > *:not(.hero-bg) { position: relative; z-index: 1; }
.hero-kicker { display: flex; gap: 8px; align-items: center; font-size: 13px; color: #C7D2F2; font-weight: 600; }
.hero-big { font-size: clamp(40px, 5vw, 64px); font-weight: 800; letter-spacing: -0.035em; line-height: 1; margin: 12px 0 6px; }
.hero-big small { font-size: .45em; font-weight: 700; color: var(--brand-yellow); margin-left: 6px; letter-spacing: -0.01em; }
.hero-sub { font-size: 14px; color: #C7D2F2; }
.hero-line { height: 4px; width: 64px; border-radius: 4px; background: var(--brand-yellow); margin-top: 14px; }
.hero-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile { background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.10); backdrop-filter: blur(10px); border-radius: 16px; padding: 14px; min-width: 0; }
.tile .t-l { font-size: 12px; color: #C7D2F2; font-weight: 600; }
.tile .t-v { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 6px 0 2px; white-space: nowrap; }
.tile svg.spark { width: 100%; height: 34px; display: block; margin-top: 6px; }
.tile .t-sub { font-size: 12px; color: #C7D2F2; margin-top: 4px; line-height: 1.45; }
.tile .t-sub b { color: #fff; }
.gnv-line { display: flex; gap: 12px; align-items: center; margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--hair); }
.gnv-line i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.gnv-line span { display: block; font-size: 11px; color: var(--muted); }
.gnv-line b { display: block; font-size: 16px; margin-top: 2px; white-space: nowrap; }
.sub-h { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; margin: 14px 0 2px; color: var(--text-2); }
.sub-h i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sub-h .muted { font-weight: 500; font-size: 11px; }
.chart-xs { height: 200px; }
.posto-kpis em { display: block; font-style: normal; font-size: 11px; color: var(--muted); margin-top: 4px; }
.kg { margin-top: 12px; }
.kg-h { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); margin: 0 0 6px 2px; }
.kg-h span { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.kg-h i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.posto-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.posto-kpis.total > div { grid-column: 1 / -1; }
.posto { container-type: inline-size; }
/* 3 quadros sempre na mesma linha; a fonte do valor acompanha a largura do cartão */
.posto-kpis.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.posto-kpis.k3 > div { padding: 8px 9px; }
.posto-kpis.k3 span { font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.posto-kpis b { font-size: clamp(13px, 5cqi, 17px); letter-spacing: -0.01em; }
.posto-kpis b small { font-size: .62em; font-weight: 700; color: var(--text-2); }
.posto-kpis b small:first-child { margin-right: 2px; }
.posto-kpis .delta { font-size: 11px; }
.posto-kpis.total > div { display: flex; align-items: baseline; gap: 10px; padding: 9px 10px; }
.posto-kpis.total span { flex: 1; }
.posto-kpis.total b { margin-top: 0; }
.kpi-empty { grid-column: 1 / -1; display: grid; place-items: center; min-height: 60px; border-radius: 12px; border: 1px dashed var(--hair-2); color: var(--muted); font-size: 12px; font-weight: 600; }
.posto-kpis .kpi-empty { background: none; }
.seg-sm { height: 18px; border-radius: 6px; }
.seg-sm div { font-size: 10px; font-weight: 700; }
.seg-small { display: flex; justify-content: flex-end; gap: 10px; margin-top: 5px; font-size: 10px; color: var(--muted); font-weight: 600; }
.seg-small i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.mt .mt-v { display: block; font-size: 10px; color: var(--text-2); font-weight: 700; }
.delta { font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; }
.delta.up { color: #4ee38a; } .delta.down { color: #ff8a8a; } .delta.flat { color: #C7D2F2; }
.card .delta.up { color: var(--good-text); } .card .delta.down { color: var(--neg); } .card .delta.flat { color: var(--muted); }

/* barra segmentada (mix) */
.segbar { display: flex; gap: 2px; height: 44px; border-radius: 10px; overflow: hidden; }
.segbar div { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 700; min-width: 0; white-space: nowrap; overflow: hidden; }
.seglegend { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px 10px; margin-top: 16px; }
.seglegend span { display: block; font-size: 11px; }
.seglegend div { font-size: 12px; color: var(--text-2); }
.seglegend b { display: block; font-size: 16px; color: var(--text); margin-top: 2px; }
.seglegend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }

/* ============ Postos ============ */
.postos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(310px, 100%), 1fr)); gap: 18px; }
.posto { cursor: pointer; transition: transform .15s, border-color .15s; }
.posto:hover { transform: translateY(-2px); border-color: var(--hair-2); }
.posto-h { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.posto-h h3 { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.posto-h .rank { font-size: 12px; color: var(--muted); font-weight: 700; }
.posto-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.posto-kpis div { background: var(--surface-2); border-radius: 12px; padding: 10px; }
.posto-kpis span { font-size: 11px; color: var(--muted); font-weight: 600; display: block; }
.posto-kpis b { font-size: clamp(13px, 5cqi, 17px); display: block; margin-top: 3px; white-space: nowrap; }
.minitanks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.mt { text-align: center; font-size: 10px; color: var(--muted); font-weight: 600; }
.mt .bar { height: 46px; border-radius: 8px; background: var(--surface-2); position: relative; overflow: hidden; margin-bottom: 4px; border: 1px solid var(--hair); }
.mt .fill { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 0 0 7px 7px; }
.mt .min { position: absolute; left: 0; right: 0; height: 2px; background: var(--text); opacity: .5; }

/* ============ Tanques ============ */
.tank-row { display: grid; grid-template-columns: 170px repeat(var(--n, 4), minmax(0, 1fr)); gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--hair); }
.tank-row:first-of-type { border-top: none; }
.tank-row .pn { font-weight: 700; font-size: 14px; }
.tank-row .pn small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; margin-top: 2px; }
.tank { display: flex; gap: 10px; align-items: center; min-width: 0; cursor: pointer; border-radius: 12px; padding: 4px; }
.tank:hover { background: var(--surface-2); }
.tank svg { width: 46px; height: 64px; flex: none; }
.tank .ti { min-width: 0; overflow: hidden; }
.tank .ti span { overflow: hidden; text-overflow: ellipsis; }
.tank-head { padding: 4px 0 8px; font-size: 12px; font-weight: 700; color: var(--text-2); border-top: none; }
.tank-head i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tank-head + .tank-row { border-top: 1px solid var(--hair); }
.tank .ti b { display: block; font-size: 14px; white-space: nowrap; }
.tank .ti span { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; }
.status { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; margin-top: 3px; white-space: nowrap; }
.status .ic { width: 14px; height: 14px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; color: #fff; }
.st-good { color: var(--good-text); } .st-good .ic { background: var(--good); }
.st-warn { color: var(--warn); } .st-warn .ic { background: var(--warn); color: #0b0b0b; }
.st-crit { color: var(--neg); } .st-crit .ic { background: var(--crit); }
.tank-empty { color: var(--muted); font-size: 12px; }

/* ============ Tabela ============ */
.table-wrap { overflow: auto; max-height: 520px; border-radius: 12px; border: 1px solid var(--hair); }
table.dt { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.dt th { position: sticky; top: 0; background: var(--surface-2); text-align: right; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 12px; white-space: nowrap; z-index: 1; }
table.dt td { text-align: right; padding: 9px 12px; border-top: 1px solid var(--hair); white-space: nowrap; }
table.dt th:first-child, table.dt td:first-child { text-align: left; }
table.dt tr:hover td { background: var(--surface-2); }
table.dt td.neg { color: var(--neg); } table.dt td.pos { color: var(--good-text); }
table.dt .wd { display: inline-block; min-width: 28px; margin-left: 8px; font-size: 11px; color: var(--muted); }
table.dt .wd.fds { color: var(--text-2); font-weight: 700; }
table.dt tr.buy td:first-child::after { content: "compra"; margin-left: 8px; font-size: 10px; font-weight: 700; color: #0B1A44; background: var(--brand-yellow); padding: 1px 6px; border-radius: 6px; }
table.dt tfoot td { font-weight: 800; background: var(--surface-2); position: sticky; bottom: 0; }
/* Relatório diário (13 colunas): cabeçalho em até 2 linhas e células mais justas para caber sem rolagem lateral */
table.dt.rd th { white-space: normal; line-height: 1.25; vertical-align: bottom; padding: 8px 8px; }
table.dt.rd td { padding: 8px 8px; font-size: 12.5px; }
table.dt.rd th:first-child, table.dt.rd td:first-child { padding-left: 12px; white-space: nowrap; }

/* ============ Metas ============ */
.bullet-row { display: grid; grid-template-columns: 190px 1fr 150px; gap: 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--hair); }
.bullet-row:first-of-type { border-top: none; }
.bullet-row .pn { font-weight: 700; font-size: 14px; }
.bullet-row .pn small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.bullet { position: relative; height: 30px; background: var(--surface-2); border-radius: 8px; }
.bullet .val { position: absolute; left: 0; top: 7px; height: 16px; border-radius: 0 4px 4px 0; background: var(--s2); }
.bullet .mk { position: absolute; top: 2px; bottom: 2px; width: 3px; border-radius: 2px; background: var(--text); }
.bullet .mk.desafio { background: var(--brand-yellow); }
.bullet .mk span { position: absolute; top: -18px; transform: translateX(-50%); font-size: 10px; color: var(--muted); white-space: nowrap; font-weight: 600; }
.bullet-axis { display: grid; grid-template-columns: 190px 1fr 150px; gap: 16px; font-size: 11px; color: var(--muted); }
.bullet-axis .ticks { display: flex; justify-content: space-between; }

/* ============ Usuários ============ */
.perm { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; font-size: 13px; font-weight: 800; }
.perm.yes { background: rgba(12,163,12,0.16); color: var(--good-text); }
.perm.no { background: var(--surface-2); color: var(--muted); }

.locked { display: grid; place-items: center; text-align: center; min-height: 360px; gap: 10px; }
.locked .big { font-size: 46px; }
.note { font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.tabs { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.tabs button { border: none; background: none; color: var(--text-2); font-weight: 600; font-size: 12px; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.2); }

/* ============ Matriz mês a mês (Comparativo mensal / Outros produtos) ============ */
.table-wrap.tall { max-height: 68vh; }
.dt.cmp th, .dt.cmp td { padding: 7px 9px; }
.dt.cmp td:first-child, .dt.cmp th:first-child { position: sticky; left: 0; background: var(--surface); z-index: 2; }
.dt.cmp thead th:first-child { z-index: 3; background: var(--surface-2); }
.dt.cmp tr.cab td { background: var(--surface-2); font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); text-align: left; }
.dt.cmp tr.n1 td:first-child { font-weight: 700; }
.dt.cmp tr.n2 td:first-child { padding-left: 26px; }
.dt.cmp td:first-child small { margin-left: 6px; color: var(--muted); font-size: 10px; font-weight: 500; }
.dt.cmp .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 7px; }
.dt.cmp svg.spark { width: 90px; height: 26px; display: block; margin-left: auto; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface-2); border-radius: 14px; padding: 14px; min-width: 0; }
.stat span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.stat b { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 2px; white-space: nowrap; }
.stat em { display: block; font-style: normal; font-size: 11px; color: var(--muted); margin-top: 3px; }
.banner { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--hair-2); }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ============ Login, cadastro e atualização ============ */
.login-step { display: flex; flex-direction: column; gap: 16px; }
.form-erro { margin: 0; padding: 10px 12px; border-radius: 10px; background: rgba(208,59,59,0.12); color: var(--neg); font-size: 13px; font-weight: 600; }
.btn-upd { height: 40px; padding: 0 14px; border-radius: 12px; border: 1px solid rgba(255,214,10,0.45); background: rgba(255,214,10,0.12); color: var(--text); font-weight: 700; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.btn-upd:hover { background: rgba(255,214,10,0.2); }
.btn-upd:disabled { cursor: progress; }
.btn-upd .upd-ic { font-size: 16px; color: var(--brand-yellow); display: inline-block; }
:root[data-theme="light"] .btn-upd .upd-ic { color: #b38f00; }
.btn-upd.rodando .upd-ic { animation: gira 1s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.dlg { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(4,9,26,0.55); backdrop-filter: blur(4px); padding: 16px; }
.dlg-box { width: min(420px, 100%); display: flex; flex-direction: column; gap: 14px; }
.dlg-box h3 { margin: 0; }
.dlg-acoes { display: flex; justify-content: flex-end; gap: 10px; }
.dlg-acoes .btn { height: 40px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; max-width: min(560px, calc(100% - 32px)); padding: 12px 16px; border-radius: 12px; background: var(--text); color: var(--page); font-size: 13px; font-weight: 600; box-shadow: var(--shadow); }
.cad { max-width: 980px; scroll-margin-top: 110px; }
.lst-acoes { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.busca { height: 38px; width: 240px; max-width: 100%; padding: 0 12px; border-radius: 10px; border: 1px solid var(--hair-2); background: var(--surface-2); color: var(--text); font-family: inherit; font-size: 13px; }
.busca:focus { outline: 2px solid var(--brand-yellow); outline-offset: 1px; }
.btn-sm { height: 38px; font-size: 13px; padding: 0 14px; }
table.dt.lst td { vertical-align: middle; }
.lst-acesso { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
table.dt.lst th, table.dt.lst td { padding-left: 8px; padding-right: 8px; }
table.dt.lst td:first-child { white-space: normal; min-width: 200px; }
table.dt.lst td.lst-txt { white-space: normal; text-align: left; min-width: 170px; max-width: 320px; font-size: 12px; line-height: 1.45; color: var(--text-2); }
table.dt.lst td.lst-postos { min-width: 105px; max-width: 220px; }
table.dt.lst tr.sel td { background: rgba(255,214,10,0.08); }
.lst-u { display: flex; gap: 10px; align-items: center; }
.lst-u .avatar { width: 30px; height: 30px; font-size: 12px; flex: none; }
.lst-u b { font-size: 13px; }
.lst-u small { display: block; color: var(--muted); font-size: 11px; }
.lst-u .chip { font-size: 10px; padding: 1px 7px; margin-left: 4px; }
td.lst-btns { text-align: right; }
.lst-btns .link { display: block; margin-left: auto; padding: 2px 0; }
.link-neg { color: var(--neg); }
.sit { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.sit-ok { background: rgba(12,163,12,0.15); color: var(--good-text); }
.sit-pend { background: rgba(250,178,25,0.16); color: var(--warn); }
:root[data-theme="light"] .sit-pend { color: #8a5a00; }
.sit-bloq { background: rgba(208,59,59,0.14); color: var(--neg); }
.cad form { display: flex; flex-direction: column; gap: 18px; }
.cad-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.cad-grid .field small { font-weight: 500; font-size: 11px; line-height: 1.4; }
.cad-aviso { margin: 0; padding: 10px 12px; border-radius: 10px; background: rgba(57,135,229,0.12); color: var(--text-2); font-size: 13px; }
.cad-box { border: 1px solid var(--hair-2); border-radius: 14px; padding: 12px 16px 16px; margin: 0; }
.cad-box legend { padding: 0 6px; font-size: 13px; font-weight: 800; color: var(--text); }
.cad-box legend .link { margin-left: 8px; }
.link { border: none; background: none; padding: 0; font: inherit; font-size: 12px; font-weight: 600; color: var(--s1); cursor: pointer; }
.link:hover { text-decoration: underline; }
.cad-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 14px; margin-top: 6px; }
.ck { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.ck:hover { background: var(--surface-2); }
.ck input { width: 18px; height: 18px; accent-color: var(--brand-yellow); }
.sw-row { display: flex; align-items: flex-start; gap: 12px; padding: 10px 4px; cursor: pointer; }
.sw-row + .sw-row { border-top: 1px solid var(--hair); }
.sw-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw-ui { flex: none; width: 42px; height: 24px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--hair-2); position: relative; transition: background .15s; margin-top: 1px; }
.sw-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.sw-row input:checked + .sw-ui { background: var(--brand-green); border-color: var(--brand-green); }
.sw-row input:checked + .sw-ui::after { transform: translateX(18px); }
.sw-row input:focus-visible + .sw-ui { outline: 2px solid var(--brand-yellow); outline-offset: 2px; }
.sw-row input:disabled + .sw-ui { opacity: .5; }
.sw-row b { display: block; font-size: 14px; }
.sw-row small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.cad-acoes { display: flex; justify-content: flex-end; gap: 10px; }
.cad-acoes .btn { height: 44px; }
@media (max-width: 860px) { .cad-grid { grid-template-columns: 1fr; } .btn-upd #upd-txt { display: none; } }

/* ============ Copiar imagem ============ */
.copy-btn { flex: none; border: none; background: none; padding: 2px 0; font: inherit; font-size: 12px; font-weight: 700; color: var(--brand-yellow); cursor: pointer; white-space: nowrap; margin-left: auto; }
:root[data-theme="light"] .copy-btn { color: var(--brand-blue); }
.copy-btn:hover { text-decoration: underline; }
.copy-btn:focus-visible { outline: 2px solid var(--brand-yellow); outline-offset: 2px; border-radius: 4px; }
.copy-btn[data-estado="copiada"], .copy-btn[data-estado="baixada"] { color: var(--good-text); }
.copy-btn[data-estado="erro"] { color: var(--neg); }
.copy-btn:disabled { opacity: .75; cursor: progress; }
.card-h { flex-wrap: wrap; }
.rank { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.hero .hero-copy { position: absolute; top: 14px; right: 20px; z-index: 2; }
.hero .hero-copy .copy-btn { color: #FFD60A; }
.copy-foot { margin: 12px 0 0; padding-top: 8px; border-top: 1px solid var(--hair); font-size: 11px; color: var(--muted); }
.hero .copy-foot { grid-column: 1 / -1; color: #C7D2F2; border-top-color: rgba(255,255,255,0.15); }
.capturando { box-shadow: none !important; animation: none !important; }
.capturando .table-wrap { max-height: none; overflow: visible; }

.fade-in { animation: fade .35s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ============ Responsivo ============ */
@media (max-width: 1180px) {
  .hero { grid-template-columns: 1fr; }
  .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 12; }
  .tank-row { grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); }
  .tank-row .pn { grid-column: 1 / -1; }
  .tank-head > div:first-child { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; flex-direction: row; padding: 8px 10px; z-index: 30; gap: 0; border-right: none; border-top: 1px solid rgba(255,255,255,0.08); }
  .sidebar .brand, .sidebar-foot, .nav .nav-sep, .nav a .lock { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; overflow-x: auto; }
  .nav a { flex-direction: column; gap: 2px; font-size: 10px; padding: 6px 8px; }
  .nav a.active::before { display: none; }
  .topbar, .filters, .main { padding-left: 16px; padding-right: 16px; }
  .main { padding-bottom: 96px; }
  .frow { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  body.rolou .topbar { display: none; } /* no celular, ao rolar ficam congelados só os filtros */
  .filters .fchip { flex: none; }
  .topbar h1 { font-size: 22px; }
  .hero-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-meta { display: none; }
  .login { grid-template-columns: 1fr; }
  .login-art { min-height: 280px; }
  .seglegend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bullet-row, .bullet-axis { grid-template-columns: 1fr; }
  .bullet-axis > :first-child, .bullet-axis > :last-child { display: none; }
  .tank-row { grid-template-columns: 1fr 1fr; }
}

/* carregando um mês antigo (dias vêm da API sob demanda) */
.carregando { padding: 56px 24px; text-align: center; color: var(--muted); font-weight: 600; }
.carregando .upd-ic { display: inline-block; margin-right: 6px; animation: gira 1s linear infinite; }
