/* Nexus App — design system. Identidade do site nexusag.net.br: preto profundo, vermelho #e2352a, Manrope, Plex Mono. */

@font-face { font-family: 'Manrope'; src: url('../fonts/manrope.woff2') format('woff2'); font-weight: 400 800; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('../fonts/plexmono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  --font: 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --accent: #e2352a;
  --accent-hi: #ff5546;
  --accent-ink: #ffffff;
  --ok: #2fbf71;
  --warn: #f0a531;
  --bad: #ff4d40;
  --info: #5b9dff;
  --r-xl: 26px; --r-lg: 20px; --r-md: 14px; --r-sm: 10px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --side: 264px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* tema escuro (padrão, igual ao site) */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070708;
  --bg-2: #0e0c0f;
  --text: #f5f2f0;
  --muted: #a39a9e;
  --dim: #6d666a;
  --glass: rgba(24, 21, 25, .52);
  --glass-strong: rgba(18, 16, 19, .72);
  --glass-hi: rgba(255, 255, 255, .055);
  --fill: rgba(255, 255, 255, .045);
  --fill-2: rgba(255, 255, 255, .08);
  --stroke: rgba(255, 255, 255, .085);
  --stroke-2: rgba(255, 255, 255, .15);
  --edge: rgba(255, 255, 255, .11);
  --shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 24px 60px -24px rgba(0, 0, 0, .75), 0 2px 6px rgba(0, 0, 0, .25);
  --shadow-pop: 0 1px 0 rgba(255, 255, 255, .07) inset, 0 40px 90px -20px rgba(0, 0, 0, .85);
  --orb-1: rgba(226, 53, 42, .34);
  --orb-2: rgba(122, 32, 25, .42);
  --orb-3: rgba(255, 255, 255, .05);
  --grid: rgba(255, 255, 255, .025);
  --chart-in: #e2352a;
  --chart-out: rgba(255, 255, 255, .26);
  --input: rgba(0, 0, 0, .28);
  --logo-light: block; --logo-dark: none;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f2efed;
  --bg-2: #e9e5e2;
  --text: #151214;
  --muted: #625b5f;
  --dim: #948c90;
  --glass: rgba(255, 255, 255, .58);
  --glass-strong: rgba(255, 255, 255, .8);
  --glass-hi: rgba(255, 255, 255, .7);
  --fill: rgba(20, 16, 18, .04);
  --fill-2: rgba(20, 16, 18, .075);
  --stroke: rgba(20, 16, 18, .08);
  --stroke-2: rgba(20, 16, 18, .14);
  --edge: rgba(255, 255, 255, .9);
  --shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 20px 50px -26px rgba(60, 20, 20, .28), 0 2px 6px rgba(30, 10, 10, .05);
  --shadow-pop: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 40px 90px -24px rgba(60, 20, 20, .35);
  --orb-1: rgba(226, 53, 42, .2);
  --orb-2: rgba(255, 170, 150, .35);
  --orb-3: rgba(255, 255, 255, .8);
  --grid: rgba(20, 16, 18, .035);
  --chart-in: #e2352a;
  --chart-out: rgba(20, 16, 18, .2);
  --input: rgba(255, 255, 255, .65);
  --bad: #e0332a;
  --ok: #1f9d5c;
  --warn: #c98110;
  --logo-light: none; --logo-dark: block;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 500 15px/1.5 var(--font); letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; flex: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.025em; text-wrap: balance; }
p { margin: 0; }
.num, .tnum { font-variant-numeric: tabular-nums; }
::selection { background: rgba(226, 53, 42, .35); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

/* ---------- fundo vivo ---------- */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: radial-gradient(120% 80% at 50% -10%, var(--bg-2), var(--bg) 60%); }
.backdrop::before {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 56px 56px; mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
}
.orb { position: absolute; border-radius: 50%; filter: blur(80px); will-change: transform; }
.orb.o1 { width: 46vmax; height: 46vmax; left: -12vmax; top: -18vmax; background: var(--orb-1); animation: drift1 28s var(--ease) infinite alternate; }
.orb.o2 { width: 40vmax; height: 40vmax; right: -14vmax; top: 18vh; background: var(--orb-2); animation: drift2 34s var(--ease) infinite alternate; }
.orb.o3 { width: 30vmax; height: 30vmax; left: 30vw; bottom: -16vmax; background: var(--orb-3); animation: drift1 40s var(--ease) infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate3d(8vmax, 6vmax, 0) scale(1.08); } }
@keyframes drift2 { to { transform: translate3d(-6vmax, 10vmax, 0) scale(.92); } }

/* ---------- vidro ---------- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  backdrop-filter: blur(28px) saturate(170%);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-strong); }
}

/* ---------- estrutura ---------- */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100dvh; }
.side {
  position: sticky; top: 0; height: 100dvh; padding: 14px 0 14px 14px;
}
.side-inner {
  height: 100%; border-radius: var(--r-xl); display: flex; flex-direction: column; padding: 18px 12px 12px; gap: 6px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 18px; }
.brand img { height: 30px; width: auto; }
.brand .logo-l { display: var(--logo-light); }
.brand .logo-d { display: var(--logo-dark); }
.brand-txt { display: flex; flex-direction: column; line-height: 1.1; }
.brand-txt b { font-size: 15px; font-weight: 800; letter-spacing: -.02em; }
.eyebrow { font: 500 10.5px/1.2 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.brand-txt .eyebrow { margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font: 500 10px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--dim); padding: 16px 12px 8px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: var(--muted); font-weight: 600; font-size: 14px; transition: color .2s, background-color .2s;
}
.nav a svg { width: 19px; height: 19px; }
.nav a:hover { color: var(--text); background: var(--fill); }
.nav a.on { color: var(--text); background: var(--fill-2); box-shadow: inset 0 1px 0 var(--edge); }
.nav a.on::before { content: ''; position: absolute; left: -12px; top: 50%; width: 3px; height: 18px; margin-top: -9px; border-radius: 0 3px 3px 0; background: var(--accent); box-shadow: 0 0 14px var(--accent); }
.nav a .badge-n { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font: 700 11px/20px var(--font); text-align: center; }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--fill); border: 1px solid var(--stroke); }
.me-txt { min-width: 0; flex: 1; line-height: 1.2; }
.me-txt b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-txt span { font-size: 11.5px; color: var(--dim); }

.main { min-width: 0; padding: 14px clamp(14px, 2.6vw, 34px) 48px; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 14px 0 16px; margin-bottom: 6px;
}
.topbar::before { content: ''; position: absolute; inset: 0 calc(-1 * clamp(14px, 2.6vw, 34px)); z-index: -1; background: linear-gradient(var(--bg) 35%, transparent); opacity: .0; transition: opacity .3s; }
.topbar.scrolled::before { opacity: .92; }
.page-title { min-width: 0; flex: 1; }
.page-title h1 { font-size: clamp(22px, 2.6vw, 30px); line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-title .eyebrow { display: block; margin-bottom: 6px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.mobile-brand { display: none; }

.view { max-width: 1320px; margin: 0 auto; animation: viewIn .5s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- grade e cartões ---------- */
.grid { display: grid; gap: 16px; }
.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)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.span2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.mt { margin-top: 16px; }

.card {
  position: relative; border-radius: var(--r-lg); padding: 20px; overflow: hidden; isolation: isolate;
  animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms);
}
.card::after { /* luz que acompanha o ponteiro */
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(226, 53, 42, .10), transparent 45%);
}
.card:hover::after { opacity: 1; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; min-height: 32px; }
.card-h h3 { font-size: 15px; font-weight: 700; letter-spacing: -.015em; flex: 1; min-width: 0; }
.card-h .sub { font-size: 12.5px; color: var(--dim); font-weight: 500; }
.card.link { cursor: pointer; transition: transform .35s var(--ease), border-color .3s; }
.card.link:hover { transform: translateY(-3px); border-color: var(--stroke-2); }
.card.link:active { transform: translateY(-1px) scale(.995); }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: 10px; min-height: 148px; }
.kpi-top { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--fill-2); color: var(--text); box-shadow: inset 0 1px 0 var(--edge); }
.kpi-ic svg { width: 17px; height: 17px; }
.kpi-ic.red { background: linear-gradient(145deg, var(--accent-hi), var(--accent)); color: #fff; box-shadow: 0 8px 22px -8px rgba(226, 53, 42, .8), inset 0 1px 0 rgba(255, 255, 255, .3); }
.kpi-v { font-size: clamp(22px, 2.2vw, 30px); font-weight: 800; letter-spacing: -.035em; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-v small { font-size: .55em; font-weight: 700; color: var(--muted); margin-right: 3px; letter-spacing: 0; }
.kpi-foot { margin-top: auto; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: 12px; padding: 2px 7px; border-radius: 999px; }
.delta.up { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.delta.down { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.kpi.alert .kpi-v { color: var(--bad); }

.bar { height: 6px; border-radius: 6px; background: var(--fill-2); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-hi)); transition: width 1s var(--ease); box-shadow: 0 0 12px rgba(226, 53, 42, .5); }
.bar.ok > i { background: linear-gradient(90deg, #1f9d5c, var(--ok)); box-shadow: none; }
.bar.warn > i { background: var(--warn); box-shadow: none; }

/* ---------- botões ---------- */
.btn {
  --h: 40px; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--h); padding: 0 16px;
  border: 1px solid var(--stroke); border-radius: 12px; background: var(--fill); color: var(--text); font-weight: 650; font-size: 13.5px;
  cursor: pointer; white-space: nowrap; transition: transform .2s var(--ease), background-color .2s, border-color .2s, box-shadow .2s, opacity .2s;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: inset 0 1px 0 var(--edge);
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { background: var(--fill-2); border-color: var(--stroke-2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent)); border-color: rgba(255, 255, 255, .12); color: #fff;
  box-shadow: 0 10px 26px -10px rgba(226, 53, 42, .9), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 14px 32px -10px rgba(226, 53, 42, 1), inset 0 1px 0 rgba(255, 255, 255, .3); }
.btn.cut { clip-path: polygon(0 0, 100% 0, 100% 68%, calc(100% - 12px) 100%, 0 100%); border-radius: 10px 10px 0 10px; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.btn.ghost:hover { background: var(--fill); }
.btn.danger { color: var(--bad); }
.btn.sm { --h: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 10px; }
.btn.icon { width: var(--h); padding: 0; }
.btn.block { width: 100%; }
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn:not(.primary).loading::after { border-color: var(--stroke-2); border-top-color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }
.spin svg { animation: spin 1s linear infinite; }

/* segmentado estilo iOS */
.seg { position: relative; display: inline-flex; padding: 3px; border-radius: 12px; background: var(--fill); border: 1px solid var(--stroke); gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { position: relative; z-index: 1; border: 0; background: none; padding: 0 13px; height: 32px; border-radius: 9px; color: var(--muted); font-weight: 650; font-size: 13px; cursor: pointer; white-space: nowrap; transition: color .2s; }
.seg button:hover { color: var(--text); }
.seg button.on { color: var(--text); }
.seg .thumb { position: absolute; z-index: 0; top: 3px; bottom: 3px; border-radius: 9px; background: var(--glass-hi); box-shadow: 0 2px 8px rgba(0, 0, 0, .18), inset 0 1px 0 var(--edge); border: 1px solid var(--stroke); transition: left .35s var(--spring), width .35s var(--spring); }
:root[data-theme="light"] .seg .thumb { background: #fff; }

/* mês */
.month { display: inline-flex; align-items: center; gap: 2px; height: 40px; padding: 0 4px; border-radius: 12px; background: var(--fill); border: 1px solid var(--stroke); }
.month b { min-width: 128px; text-align: center; font-size: 13.5px; font-weight: 700; text-transform: capitalize; }
.month .btn { --h: 32px; }

/* ---------- formulários ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 650; color: var(--muted); }
.field small { font-size: 12px; color: var(--dim); }
.input, select.input, textarea.input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--stroke); background: var(--input); outline: none;
  font-weight: 550; transition: border-color .2s, box-shadow .2s, background-color .2s; appearance: none; -webkit-appearance: none;
}
textarea.input { height: auto; min-height: 90px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
select.input { padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.input:hover { border-color: var(--stroke-2); }
.input:focus { border-color: rgba(226, 53, 42, .7); box-shadow: 0 0 0 4px rgba(226, 53, 42, .16); }
.input::placeholder { color: var(--dim); }
.input.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 14px; }
.form .full { grid-column: 1 / -1; }
.search { position: relative; flex: 1; min-width: 180px; max-width: 360px; }
.search svg { position: absolute; left: 13px; top: 50%; width: 17px; height: 17px; margin-top: -8.5px; color: var(--dim); pointer-events: none; }
.search .input { height: 40px; padding-left: 40px; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }

/* ---------- pílulas, avatar ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--fill-2); color: var(--muted); }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.nodot::before { display: none; }
.pill.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.pill.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, transparent); }
.pill.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.pill.info { color: var(--info); background: color-mix(in srgb, var(--info) 14%, transparent); }
.pill.live::before { box-shadow: 0 0 0 0 currentColor; animation: ping 1.8s var(--ease) infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 70%, transparent); } 80%, 100% { box-shadow: 0 0 0 7px transparent; } }

.av {
  --s: 42px; width: var(--s); height: var(--s); flex: none; border-radius: calc(var(--s) * .32); display: grid; place-items: center;
  font-weight: 800; font-size: calc(var(--s) * .36); letter-spacing: -.02em; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(145deg, hsl(var(--h, 4) 70% 46%), hsl(calc(var(--h, 4) + 25) 70% 22%));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 8px 20px -10px hsl(var(--h, 4) 70% 40%);
}
.av.lg { --s: 64px; }
.av.sm { --s: 32px; }

/* ---------- listas ---------- */
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-top: 1px solid var(--stroke); min-width: 0; }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 650; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { font-size: 12.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .v { font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.row.click { cursor: pointer; border-radius: 12px; transition: background-color .2s; }
.row.click:hover { background: var(--fill); }
.v.in { color: var(--ok); }
.v.out { color: var(--text); }
.date-chip { width: 44px; flex: none; text-align: center; border-radius: 11px; padding: 5px 0; background: var(--fill); border: 1px solid var(--stroke); line-height: 1.05; }
.date-chip b { display: block; font-size: 16px; font-weight: 800; }
.date-chip span { font: 500 9.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }

.paybox { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 2px solid var(--stroke-2); display: grid; place-items: center; cursor: pointer; background: none; padding: 0; color: transparent; transition: all .25s var(--spring); }
.paybox svg { width: 14px; height: 14px; }
.paybox:hover { border-color: var(--ok); color: var(--ok); }
.paybox.on { background: var(--ok); border-color: var(--ok); color: #fff; transform: scale(1.04); }

/* tabela */
.table-wrap { overflow-x: auto; margin: 0 -20px -20px; padding: 0 20px 8px; scrollbar-width: thin; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
.tbl th { text-align: left; font: 500 10.5px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--dim); padding: 10px 10px; border-bottom: 1px solid var(--stroke); white-space: nowrap; }
.tbl td { padding: 13px 10px; border-bottom: 1px solid var(--stroke); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background-color .2s; }
.tbl tbody tr:hover { background: var(--fill); }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .name { font-weight: 650; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl .muted { color: var(--dim); font-size: 12.5px; }
.tbl tr.click { cursor: pointer; }

/* cliente */
.clients { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.cc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.cc-head .grow { flex: 1; min-width: 0; }
.cc-head h3 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-head p { font-size: 12.5px; color: var(--dim); }
.cc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cc-stat { padding: 11px 12px; border-radius: 13px; background: var(--fill); border: 1px solid var(--stroke); min-width: 0; }
.cc-stat span { display: block; font-size: 11.5px; color: var(--dim); font-weight: 600; margin-bottom: 2px; }
.cc-stat b { font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cc-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 12.5px; color: var(--muted); min-height: 24px; flex-wrap: wrap; }

.hero { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.hero .grow { flex: 1; min-width: 220px; }
.hero h2 { font-size: clamp(22px, 2.6vw, 30px); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: 10px; background: var(--fill); border: 1px solid var(--stroke); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.chip svg { width: 14px; height: 14px; }
a.chip:hover { color: var(--text); border-color: var(--stroke-2); }

/* banners e estados */
.banner { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px; margin-bottom: 16px; border: 1px solid rgba(226, 53, 42, .3); background: linear-gradient(100deg, rgba(226, 53, 42, .16), rgba(226, 53, 42, .04)); }
.banner .grow { flex: 1; min-width: 0; font-size: 14px; }
.banner .ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--accent); color: #fff; flex: none; }
.banner .ic svg { width: 18px; height: 18px; }
.empty { text-align: center; padding: 38px 16px; color: var(--muted); }
.empty .ic { width: 54px; height: 54px; border-radius: 17px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--fill-2); color: var(--muted); }
.empty .ic svg { width: 24px; height: 24px; }
.empty h4 { color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty p { font-size: 13.5px; max-width: 380px; margin: 0 auto; }
.empty .btn { margin-top: 16px; }
.sk { border-radius: 10px; background: linear-gradient(90deg, var(--fill) 25%, var(--fill-2) 50%, var(--fill) 75%); background-size: 200% 100%; animation: sh 1.3s linear infinite; }
@keyframes sh { to { background-position: -200% 0; } }

.steps { counter-reset: s; display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.steps li { counter-increment: s; position: relative; padding-left: 42px; font-size: 14px; color: var(--muted); line-height: 1.55; }
.steps li b { color: var(--text); }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -1px; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font: 700 13px/1 var(--font); color: #fff; background: var(--accent); }
code, .code { font: 500 12.5px/1.4 var(--mono); padding: 2px 6px; border-radius: 6px; background: var(--fill-2); color: var(--text); word-break: break-all; }

/* ---------- gráficos ---------- */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .gl { stroke: var(--stroke); stroke-width: 1; }
.chart .lbl { fill: var(--dim); font: 500 10.5px var(--mono); letter-spacing: .04em; }
.chart .b-in { fill: url(#gIn); }
.chart .b-out { fill: var(--chart-out); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chart .area { fill: url(#gArea); }
.chart .dot { fill: var(--bg); stroke: var(--accent); stroke-width: 2.4; }
.chart .net { fill: none; stroke: var(--text); stroke-width: 1.6; stroke-dasharray: 3 4; opacity: .55; }
.chart .hl { stroke: var(--stroke-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .bar-g rect { transition: opacity .2s; }
.chart:hover .bar-g rect { opacity: .55; }
.chart .bar-g.on rect { opacity: 1; }
.chart .grow-y { transform-box: fill-box; transform-origin: bottom; animation: growY .9s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes growY { from { transform: scaleY(0); } }
.chart .draw { stroke-dasharray: 2000; stroke-dashoffset: 2000; animation: draw 1.4s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.tip {
  position: absolute; z-index: 5; pointer-events: none; padding: 9px 12px; border-radius: 12px; font-size: 12.5px; min-width: 130px;
  transform: translate(-50%, calc(-100% - 12px)); opacity: 0; transition: opacity .15s; white-space: nowrap;
  background: var(--glass-strong); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border: 1px solid var(--stroke-2); box-shadow: var(--shadow-pop);
}
.tip.on { opacity: 1; }
.tip b { display: block; font-size: 11px; color: var(--dim); font-family: var(--mono); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }
.tip div { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; font-weight: 700; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-right: 6px; font-style: normal; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); font-weight: 600; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .li { background: var(--accent); }
.legend .lo { background: var(--chart-out); }
.legend .ln { border: 1.5px dashed var(--text); opacity: .6; border-radius: 50%; }

.hbars { display: flex; flex-direction: column; gap: 14px; }
.hbar-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 6px; }
.hbar-top span { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-top b { font-variant-numeric: tabular-nums; }

.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.mini-stats > div { padding: 12px; border-radius: 13px; background: var(--fill); border: 1px solid var(--stroke); min-width: 0; }
.mini-stats span { display: block; font-size: 11.5px; color: var(--dim); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-stats b { font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.sync-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--dim); }

/* ---------- modal / sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: 80; background: rgba(4, 3, 4, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 20px; animation: fade .25s var(--ease) both; }
:root[data-theme="light"] .scrim { background: rgba(40, 30, 32, .25); }
.scrim.out { animation: fadeOut .2s var(--ease) both; }
@keyframes fade { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: min(88dvh, 860px); display: flex; flex-direction: column; border-radius: var(--r-xl); background: var(--glass-strong); box-shadow: var(--shadow-pop); animation: pop .45s var(--spring) both; overflow: hidden; }
.modal.wide { width: min(720px, 100%); }
.scrim.out .modal { animation: popOut .2s var(--ease) both; }
@keyframes pop { from { opacity: 0; transform: translateY(18px) scale(.96); } }
@keyframes popOut { to { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 20px 22px 6px; }
.modal-h h3 { flex: 1; font-size: 19px; }
.modal-b { padding: 14px 22px 8px; overflow-y: auto; overscroll-behavior: contain; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px 20px; border-top: 1px solid var(--stroke); flex-wrap: wrap; }
.modal-f .left { margin-right: auto; }
.grabber { display: none; }
.kind-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kind-toggle button { height: 46px; border-radius: 12px; border: 1px solid var(--stroke); background: var(--fill); font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); transition: all .2s; }
.kind-toggle button svg { width: 17px; height: 17px; }
.kind-toggle button.on.in { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.kind-toggle button.on.out { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, transparent); background: color-mix(in srgb, var(--bad) 12%, transparent); }

/* menu contextual */
.menu { position: fixed; z-index: 90; min-width: 190px; padding: 6px; border-radius: 16px; background: var(--glass-strong); -webkit-backdrop-filter: blur(30px) saturate(170%); backdrop-filter: blur(30px) saturate(170%); border: 1px solid var(--stroke-2); box-shadow: var(--shadow-pop); animation: pop .3s var(--spring) both; transform-origin: top right; }
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 0; border-radius: 10px; background: none; cursor: pointer; font-weight: 600; font-size: 13.5px; text-align: left; }
.menu button svg { width: 16px; height: 16px; color: var(--muted); }
.menu button:hover { background: var(--fill-2); }
.menu button.danger, .menu button.danger svg { color: var(--bad); }

/* toast */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 16px; font-size: 13.5px; font-weight: 650; background: var(--glass-strong); -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%); border: 1px solid var(--stroke-2); box-shadow: var(--shadow-pop); animation: toastIn .45s var(--spring) both; pointer-events: auto; }
.toast svg { width: 18px; height: 18px; }
.toast.ok svg { color: var(--ok); }
.toast.err svg { color: var(--bad); }
.toast.out { animation: toastOut .25s var(--ease) both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.94); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.96); } }

/* ---------- login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(410px, 100%); border-radius: 30px; padding: 38px 32px 30px; animation: pop .7s var(--spring) both; }
.login-card .logo { display: flex; justify-content: center; margin-bottom: 26px; }
.login-card .logo img { height: 52px; }
.login-card .logo .logo-l { display: var(--logo-light); }
.login-card .logo .logo-d { display: var(--logo-dark); }
.login-card h1 { font-size: 26px; text-align: center; }
.login-card .lead { text-align: center; color: var(--muted); font-size: 14px; margin: 8px 0 26px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-card .btn { --h: 48px; margin-top: 6px; font-size: 15px; }
.login-err { color: var(--bad); font-size: 13px; font-weight: 650; text-align: center; min-height: 18px; }
.login-foot { text-align: center; font: 500 10px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin-top: 26px; }
.shake { animation: shake .45s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot img { height: 46px; animation: breathe 1.6s ease-in-out infinite; }
.boot .logo-l { display: var(--logo-light); }
.boot .logo-d { display: var(--logo-dark); }
@keyframes breathe { 50% { opacity: .4; transform: scale(.96); } }

/* ---------- tab bar (celular) ---------- */
.tabbar { display: none; }
.fab { display: none; }

/* ---------- responsivo ---------- */
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1360px) {
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 980px) {
  .g3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .main { padding: 0 16px calc(110px + var(--safe-b)); }
  .topbar { padding: calc(10px + var(--safe-t)) 0 12px; flex-wrap: wrap; row-gap: 10px; }
  .topbar::before { inset: 0 -16px; }
  .mobile-brand { display: flex; align-items: center; }
  .mobile-brand img { height: 22px; }
  .mobile-brand .logo-l { display: var(--logo-light); }
  .mobile-brand .logo-d { display: var(--logo-dark); }
  .page-title { order: 3; flex-basis: 100%; }
  .top-actions { margin-left: auto; }
  .top-actions .hide-m { display: none; }
  .tabbar {
    display: flex; position: fixed; z-index: 60; left: 12px; right: 12px; bottom: calc(10px + var(--safe-b)); height: 66px; padding: 6px; border-radius: 24px; justify-content: space-around;
  }
  .tabbar a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 18px; color: var(--dim); font-size: 10.5px; font-weight: 700; transition: color .25s; }
  .tabbar a svg { width: 22px; height: 22px; transition: transform .35s var(--spring); }
  .tabbar a.on { color: var(--text); background: var(--fill-2); box-shadow: inset 0 1px 0 var(--edge); }
  .tabbar a.on svg { color: var(--accent); transform: translateY(-1px) scale(1.06); }
  .tabbar a .dotn { position: absolute; top: 7px; right: calc(50% - 18px); width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }
  .fab { display: grid; place-items: center; position: fixed; z-index: 61; right: 18px; bottom: calc(88px + var(--safe-b)); width: 56px; height: 56px; border-radius: 19px; border: 0; color: #fff; cursor: pointer;
    background: linear-gradient(160deg, var(--accent-hi), var(--accent)); box-shadow: 0 16px 34px -10px rgba(226, 53, 42, .9), inset 0 1px 0 rgba(255, 255, 255, .3); transition: transform .3s var(--spring); }
  .fab svg { width: 24px; height: 24px; }
  .fab:active { transform: scale(.92); }
  .fab[hidden] { display: none; }
  .g3, .g2 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .card { padding: 16px; border-radius: 20px; }
  .table-wrap { margin: 0 -16px -16px; padding: 0 16px 8px; }
  .kpi { min-height: 128px; }
  .clients { grid-template-columns: minmax(0, 1fr); }
  .scrim { align-items: end; padding: 0; }
  .modal, .modal.wide { width: 100%; max-height: 92dvh; border-radius: 28px 28px 0 0; animation: sheet .5s var(--spring) both; padding-bottom: var(--safe-b); }
  .scrim.out .modal { animation: sheetOut .25s var(--ease) both; }
  @keyframes sheet { from { transform: translateY(100%); } }
  @keyframes sheetOut { to { transform: translateY(100%); } }
  .grabber { display: block; width: 40px; height: 5px; border-radius: 5px; background: var(--stroke-2); margin: 9px auto 0; }
  .modal-h { padding-top: 12px; }
  .toasts { bottom: calc(92px + var(--safe-b)); }
  .search { max-width: none; min-width: 0; flex-basis: 100%; }
  .toolbar .grow { display: none; }
}
@media (max-width: 560px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { min-height: 0; gap: 8px; }
  .kpi-top { font-size: 12px; }
  .kpi-ic { width: 28px; height: 28px; border-radius: 9px; }
  .kpi-ic svg { width: 14px; height: 14px; }

  .kpi-foot { font-size: 11.5px; }
  .form { grid-template-columns: minmax(0, 1fr); }
  .mini-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

  .month b { min-width: 104px; font-size: 13px; }
  .modal-f .btn { flex: 1; }
  .modal-f .left { flex: 0 0 auto; }
  .hide-xs { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .orb { animation: none; }
}
@media print {
  .side, .tabbar, .fab, .top-actions, .backdrop { display: none !important; }
  .app { display: block; }
  .glass { background: #fff; box-shadow: none; border: 1px solid #ddd; }
}

/* complementos */
.tip i.li { background: var(--accent); }
.tip i.lo { background: var(--chart-out); }
.muted-p { color: var(--muted); font-size: 14px; line-height: 1.6; }
.notes { color: var(--muted); font-size: 14px; line-height: 1.65; white-space: normal; overflow-wrap: anywhere; }
.grow-h { font-size: 15px; margin-right: 6px; }
.t-cli { display: flex; align-items: center; gap: 10px; }
.t-cli .name { max-width: 180px; }
.hbar { display: block; border-radius: 10px; transition: opacity .2s; }
.hbar:hover { opacity: .8; }
.modal-b .muted-p { margin-bottom: 6px; }
.topbar::before { background: color-mix(in srgb, var(--bg) 72%, transparent); -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%); border-bottom: 1px solid var(--stroke); }
.topbar.scrolled::before { opacity: 1; }
.card-h + .row { border-top: 0; }
.card-h { flex-wrap: wrap; row-gap: 8px; }
.card-h h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) { .card-h .legend { flex-basis: 100%; order: 3; } }
@media (max-width: 560px) {
  .hero { align-items: flex-start; gap: 14px; }
  .hero .av.lg { --s: 50px; }
  .hero .top-actions { width: 100%; justify-content: flex-start; margin-left: 0; }
  .hero .seg { width: 100%; }
  .hero .seg button { flex: 1; }
}
details.guide { border: 1px solid var(--stroke); border-radius: 14px; padding: 12px 14px; background: var(--fill); }
details.guide summary { cursor: pointer; font-weight: 650; font-size: 13.5px; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 8px; }
details.guide summary::-webkit-details-marker { display: none; }
details.guide summary::before { content: '+'; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--fill-2); font-weight: 800; }
details.guide[open] summary::before { content: '−'; }
p.muted-p svg { display: inline-block; width: 15px; height: 15px; vertical-align: -3px; margin-right: 4px; color: var(--ok); }
optgroup { font-weight: 700; }

/* ---------- valores que se adaptam ao tamanho do cartão (container queries) ---------- */
.card { container-type: inline-size; }
.kpi-v { font-size: clamp(18px, 10.5cqi, 30px); overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cc-stat b, .mini-stats b { display: block; overflow: hidden; text-overflow: ellipsis; }
.mini-stats > div { padding: 11px 10px 11px 12px; }
.mini-stats b { font-size: clamp(13px, 5cqi, 18px); letter-spacing: -.02em; }
.mini-stats b small { font-size: .62em; font-weight: 700; color: var(--muted); margin-right: 3px; letter-spacing: 0; }
@container (max-width: 330px) {
  .mini-stats { gap: 6px; }
  .mini-stats > div { padding: 10px 8px 10px 10px; }
  .mini-stats span { font-size: 11px; }
}
@container (max-width: 250px) { .cc-stat b { font-size: 13.5px; } }
.pw-row { display: flex; gap: 8px; }
.pw-row .input { flex: 1; min-width: 0; }
.pw-row .btn { --h: 44px; flex: none; }
.access { border: 1px solid var(--stroke); border-radius: 14px; background: var(--fill); overflow: hidden; }
.access > div { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 11px 14px; }
.access > div + div { border-top: 1px solid var(--stroke); }
.access span { font-size: 12.5px; color: var(--dim); font-weight: 600; flex: none; }
.access b { font-size: 14px; text-align: right; overflow-wrap: anywhere; user-select: all; }
.access b.mono { font-family: var(--mono); letter-spacing: .04em; color: var(--accent-hi); }
.cc-stat small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--dim); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- WhatsApp, alertas ---------- */
.btn.wa { color: var(--ok); }
.btn.wa.late { color: var(--bad); }
.btn.wa:hover { background: color-mix(in srgb, var(--ok) 12%, transparent); }
.s.warn-t { color: var(--warn); }
.banner.warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: linear-gradient(100deg, color-mix(in srgb, var(--warn) 16%, transparent), transparent); }
.banner.warn .ic { background: var(--warn); }
.banner.bad .ic { background: var(--bad); }
.banner.mt { margin-bottom: 0; }
.form-sec { font: 500 10.5px/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); padding-top: 6px; border-top: 1px solid var(--stroke); margin-top: 4px; }
.form-sec:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.form-sec small { display: block; margin-top: 6px; font-family: var(--font); letter-spacing: 0; text-transform: none; color: var(--dim); font-size: 12px; }
.form textarea.input { min-height: 120px; }

/* ---------- contratos ---------- */
.k-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.k-side { position: sticky; top: 92px; }
@media (max-width: 1100px) { .k-grid { grid-template-columns: minmax(0, 1fr); } .k-side { position: static; order: -1; } }
.k-actions { gap: 8px; }
.sig-steps { display: flex; flex-direction: column; gap: 8px; }
.sig-steps > div { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; color: var(--dim); }
.sig-steps svg { width: 18px; height: 18px; padding: 5px; box-sizing: content-box; border-radius: 9px; background: var(--fill-2); }
.sig-steps > div.on { color: var(--text); }
.sig-steps > div.on svg { background: var(--ok); color: #fff; }
.sig-dots { display: flex; gap: 6px; }
.sig-dots i { font-style: normal; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--fill-2); color: var(--dim); }
.sig-dots i.on { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.link-box { padding: 12px; border-radius: 13px; background: var(--fill); border: 1px dashed var(--stroke-2); }
.link-box span { display: block; font-size: 12px; color: var(--dim); font-weight: 600; margin-bottom: 6px; }
.link-box code { display: block; font-size: 11.5px; user-select: all; }
.var-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.var-list > span { font-size: 12.5px; color: var(--dim); font-weight: 600; margin-right: 4px; }
.var-list .chip { height: 26px; font-family: var(--mono); font-size: 11px; cursor: pointer; }
textarea.doc-edit { font: 500 13px/1.6 var(--mono); min-height: 360px; }

/* folha do contrato: sempre papel claro para leitura e impressão */
.paper { background: #fff; color: #1b1719; border-radius: 18px; padding: clamp(22px, 5vw, 56px); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .6); font-size: 14.5px; line-height: 1.7; animation: rise .6s var(--ease) both; }
.paper-head { display: flex; align-items: center; gap: 12px; padding-bottom: 18px; margin-bottom: 22px; border-bottom: 2px solid #e2352a; }
.paper-head img { height: 26px; }
.paper-head span { font: 500 10.5px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: #8a8286; }
.doc-body h3 { font-size: 15px; letter-spacing: 0; margin: 22px 0 8px; color: #111; }
.doc-body h3:first-child { margin-top: 0; text-align: center; font-size: 17px; }
.doc-body p { color: #2a2528; margin: 0 0 10px; text-align: justify; hyphens: auto; }
.doc-body b { color: #111; }
.sigs { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 40px; page-break-inside: avoid; }
.sig-col { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; font-size: 12.5px; color: #555; }
.sig-img { height: 80px; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.sig-img img { max-height: 80px; max-width: 100%; }
.sig-line { width: 100%; height: 1px; background: #1b1719; margin-bottom: 6px; }
.sig-col b { color: #111; font-size: 13.5px; }
.sig-at { font-size: 11.5px; color: #1f9d5c; }
.sig-at.pending { color: #b07a10; }
.audit { margin-top: 32px; padding: 16px 18px; border: 1px solid #e3dfdc; border-radius: 12px; background: #faf8f7; font-size: 12px; color: #555; page-break-inside: avoid; }
.audit h4 { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #111; margin-bottom: 10px; }
.audit > div { margin-bottom: 8px; }
.audit > div > span { display: block; font-weight: 700; color: #333; }
.audit p { margin: 0; }
.audit code { background: #efebe9; color: #333; font-size: 11px; }
.audit-note { font-size: 11.5px; color: var(--dim); line-height: 1.5; }
.audit .audit-note { color: #888; margin-top: 8px; }
@media (max-width: 560px) { .sigs { grid-template-columns: 1fr; } .paper { font-size: 14px; border-radius: 14px; } }

/* quadro de assinatura */
.sigpad { position: relative; height: 180px; border-radius: 14px; background: #fff; border: 1.5px dashed #c9c2c5; overflow: hidden; touch-action: none; }
.sigpad canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.sigpad .sig-hint { position: absolute; left: 0; right: 0; bottom: 34px; text-align: center; color: #a39a9e; font-size: 13px; pointer-events: none; transition: opacity .2s; }
.sigpad::after { content: ''; position: absolute; left: 24px; right: 24px; bottom: 30px; height: 1px; background: #d8d2d4; pointer-events: none; }
.sigpad.signed .sig-hint { opacity: 0; }
.sigpad .sig-clear { position: absolute; top: 8px; right: 8px; color: #555; background: #f3f0ee; z-index: 2; }

/* páginas públicas (assinatura e relatório) */
.pub { min-height: 100dvh; padding: calc(16px + var(--safe-t)) 16px 60px; }
.pub-h { display: flex; justify-content: center; padding: 10px 0 22px; }
.pub-h img { height: 34px; }
.pub-h .logo-l { display: var(--logo-light); }
.pub-h .logo-d { display: var(--logo-dark); }
.pub .view { max-width: 900px; }
.sign-view { display: flex; flex-direction: column; gap: 16px; }
.sign-intro h1 { font-size: clamp(22px, 4vw, 30px); margin: 6px 0; }
.sign-form h3 { font-size: 18px; }
.pub-actions { display: flex; justify-content: center; margin-top: 20px; }

/* relatório */
.rep-head .hero { align-items: center; }
.rep-logo { height: 30px; }
.rep-head .logo-l { display: var(--logo-light); }
.rep-head .logo-d { display: var(--logo-dark); }
.rep-month { width: auto; min-width: 180px; }
.rep-foot { text-align: center; font-size: 12px; color: var(--dim); margin-top: 18px; }

/* ---------- impressão / PDF ---------- */
@media print {
  @page { margin: 14mm; }
  :root, :root[data-theme] { --bg: #fff; --bg-2: #fff; --text: #111; --muted: #444; --dim: #666; --glass: #fff; --glass-strong: #fff; --fill: #f6f4f3; --fill-2: #eeeae8; --stroke: #e2dedc; --stroke-2: #d0cbc8; --shadow: none; --chart-out: #c9c4c1; --logo-light: none; --logo-dark: block; }
  html, body { background: #fff !important; }
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; left: 0; top: 0; width: 100%; }
  .paper { box-shadow: none; padding: 0; border-radius: 0; animation: none; }
  .card { animation: none !important; break-inside: avoid; }
  .glass { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; box-shadow: none !important; }
  .rep-month, .tip { display: none !important; }
  .table-wrap { overflow: visible; }
  table.tbl { min-width: 0; }
}
@media (max-width: 640px) { .doc-body p { text-align: left; hyphens: manual; } }
.kpi-foot .pill, .kpi-foot .delta { height: auto; min-height: 22px; white-space: normal; line-height: 1.3; padding-top: 3px; padding-bottom: 3px; max-width: 100%; }
@media (max-width: 900px) { .tabbar { padding: 6px 4px; } .tabbar a { font-size: 10px; letter-spacing: -.01em; min-width: 0; } .tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }

/* ---------- assinatura gov.br ---------- */
.method-pick { display: flex; flex-direction: column; gap: 10px; }
.method { display: flex; gap: 14px; align-items: flex-start; padding: 14px; border-radius: 16px; border: 1.5px solid var(--stroke); background: var(--fill); cursor: pointer; transition: border-color .2s, background-color .2s; }
.method:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.method input { margin-top: 4px; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.method .m-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--fill-2); flex: none; }
.method .m-ic svg { width: 18px; height: 18px; }
.method b { display: block; font-size: 14.5px; margin-bottom: 3px; }
.method small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.method-tag { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 650; color: var(--muted); margin: -4px 0 12px; }
.method-tag svg { width: 15px; height: 15px; color: var(--accent); }
.gov-steps li { font-size: 13.5px; }
.gov-steps a { color: var(--accent-hi); text-decoration: underline; }
.input.file { height: auto; padding: 12px; cursor: pointer; }
.input.file::file-selector-button { margin-right: 12px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--stroke-2); background: var(--fill-2); color: var(--text); font: inherit; font-weight: 650; cursor: pointer; }
.pub-actions.start { justify-content: flex-start; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.sig-img.gov { align-items: center; }
.gov-seal { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1.5px solid #1f9d5c; border-radius: 10px; color: #1f7a4a; font-size: 11.5px; font-weight: 700; line-height: 1.3; text-align: left; }
.gov-seal svg { width: 20px; height: 20px; flex: none; }
.sig-cert { margin-top: 4px; }

/* ---------- criativos ---------- */
.ads-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.ad-card { display: flex; flex-direction: column; text-align: left; padding: 0; border: 1px solid var(--stroke); border-radius: 18px; overflow: hidden; background: var(--fill); cursor: pointer; color: inherit; font: inherit;
  transition: transform .3s var(--ease), border-color .25s, box-shadow .3s; animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 35ms); min-width: 0; }
.ad-card:hover { transform: translateY(-3px); border-color: var(--stroke-2); box-shadow: 0 18px 40px -20px rgba(0, 0, 0, .6); }
.ad-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ad-thumb { position: relative; display: block; aspect-ratio: 1 / 1; background: #111; overflow: hidden; }
.ad-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s var(--ease); }
.ad-card:hover .ad-thumb img { transform: scale(1.04); }
.ad-noimg { display: grid; place-items: center; width: 100%; height: 100%; color: var(--dim); }
.ad-noimg svg { width: 28px; height: 28px; }
.ad-badges { position: absolute; left: 8px; right: 8px; top: 8px; display: flex; justify-content: space-between; gap: 6px; }
.ad-badges .pill { -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); background: rgba(10, 10, 11, .62); }
.ad-badges .pill.ok { color: #4fe08f; } .ad-badges .pill.bad { color: #ff7a6e; } .ad-badges .pill.info { color: #8bb9ff; }
.ad-badges .pill.nodot, .ad-badges .pill:not(.ok):not(.bad):not(.info):not(.warn) { color: #e8e3e1; }
.ad-info { display: flex; flex-direction: column; gap: 2px; padding: 11px 12px 12px; min-width: 0; }
.ad-info b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-info small { font-size: 11.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin-top: 8px; }
.ad-stats span { font-size: 12.5px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-stats i { display: block; font-style: normal; font-size: 10.5px; font-weight: 600; color: var(--dim); }
.ad-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.ad-big { border-radius: 16px; overflow: hidden; background: #111; display: grid; place-items: center; min-height: 240px; }
.ad-big img { width: 100%; height: auto; max-height: 62dvh; object-fit: contain; display: block; }
.ad-title { font-size: 16px; margin-bottom: 6px; }
.ad-body { white-space: pre-line; }
@media (max-width: 700px) { .ad-detail { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .ads-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .ad-info { padding: 9px 10px 10px; } .ad-stats span { font-size: 11.5px; } }
.ad-badges { flex-wrap: wrap; row-gap: 4px; }
@media (max-width: 560px) {
  .ad-badges { left: 6px; right: 6px; top: 6px; }
  .ad-badges .pill { height: 20px; padding: 0 7px; font-size: 10.5px; gap: 4px; }
  .ad-badges .pill::before { width: 5px; height: 5px; }
  .ad-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ad-stats span:nth-child(3) { display: none; }
}

/* ---------- revisão final ---------- */
.g3, .g2 { align-items: start; }                       /* cartões vizinhos não esticam com um cartão alto */
.row .s.wrap, .list .row .s { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } /* legendas em até 2 linhas */
.row.more .s { color: var(--accent-hi); font-weight: 650; }
@media (max-width: 560px) {
  .page-title h1 { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 21px; }
  .row .t { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 13.5px; }
  .row .v { font-size: 13px; }
  .row { gap: 8px; }
  .date-chip { width: 40px; }
}
.list .row .t { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
