/* =====================================================================
   ConectFinance — design system
   Tema claro/escuro por variáveis, mobile-first, sem frameworks
   ===================================================================== */

:root {
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --radius-sm: 8px; --radius: 12px; --radius-lg: 18px; --radius-xl: 24px;
  --sb-w: 264px; --tb-h: 64px; --bn-h: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  --brand: #1f6fd6;
  --brand-2: #3d8bff;
  --brand-ink: #ffffff;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5fa;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(31,111,214,.07), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f8;
  --border: #e3e8f1;
  --border-strong: #d3dbe8;
  --text: #0f1b2d;
  --text-2: #43526b;
  --muted: #7586a0;
  --track: #edf1f7;
  --shadow-sm: 0 1px 2px rgba(16,30,54,.06);
  --shadow: 0 1px 2px rgba(16,30,54,.05), 0 6px 20px -6px rgba(16,30,54,.10);
  --shadow-lg: 0 24px 60px -12px rgba(16,30,54,.28);
  --sidebar: #0d1726;
  --sidebar-text: #b8c4d9;
  --sidebar-muted: #6b7c97;
  --sidebar-active: rgba(61,139,255,.16);
  --overlay: rgba(10,18,32,.45);

  --primary: #1f6fd6; --primary-soft: #e8f1fd;
  --success: #12a36b; --success-soft: #e3f6ee;
  --danger: #e0475b; --danger-soft: #fdecee;
  --warning: #d98a06; --warning-soft: #fdf3df;
  --info: #0c8fb3; --info-soft: #e2f4f9;
  --violet: #7058e6; --violet-soft: #eeebfd;

  --c1: #1f6fd6; --c2: #12a36b; --c3: #f29d0c; --c4: #7058e6; --c5: #e0475b;
  --c6: #0c8fb3; --c7: #c4519b; --c8: #6e8a1f; --c9: #8a6a4b; --c10: #5b6b84;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a111e;
  --bg-grad: radial-gradient(1000px 600px at 110% -10%, rgba(61,139,255,.12), transparent 60%), radial-gradient(800px 500px at -10% 110%, rgba(18,163,107,.06), transparent 60%);
  --surface: #101a2b;
  --surface-2: #142033;
  --surface-3: #1a283e;
  --border: #1f2d44;
  --border-strong: #2a3b57;
  --text: #e8eef9;
  --text-2: #b3c0d6;
  --muted: #7b8ba6;
  --track: #1b293f;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 1px 2px rgba(0,0,0,.25), 0 8px 24px -8px rgba(0,0,0,.45);
  --shadow-lg: 0 30px 70px -12px rgba(0,0,0,.65);
  --sidebar: #0b1424;
  --sidebar-text: #b0bdd3;
  --sidebar-muted: #61728f;
  --sidebar-active: rgba(61,139,255,.18);
  --overlay: rgba(2,6,14,.62);

  --primary: #4b93ff; --primary-soft: rgba(75,147,255,.14);
  --success: #2fc98b; --success-soft: rgba(47,201,139,.13);
  --danger: #ff6b7d; --danger-soft: rgba(255,107,125,.13);
  --warning: #f5b23d; --warning-soft: rgba(245,178,61,.14);
  --info: #3cc3e6; --info-soft: rgba(60,195,230,.13);
  --violet: #9b88ff; --violet-soft: rgba(155,136,255,.14);

  --c1: #4b93ff; --c2: #2fc98b; --c3: #f5b23d; --c4: #9b88ff; --c5: #ff6b7d;
  --c6: #3cc3e6; --c7: #ec7ac2; --c8: #a5c94a; --c9: #c8a27c; --c10: #8394b1;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font: 14px/1.5 var(--font); color: var(--text);
  background: var(--bg-grad), var(--bg); background-attachment: fixed;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.ic { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--primary) 30%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ------------------------------------------------------------------ splash / loader / progresso */
#splash {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  background: radial-gradient(520px 420px at 50% 42%, rgba(92,70,255,.26), transparent 70%), linear-gradient(160deg, #050a1c, #0a1030 55%, #070b20);
  color: #fff; transition: opacity .5s ease, visibility .5s, transform .5s var(--ease);
}
#splash.hide { opacity: 0; visibility: hidden; transform: scale(1.03); }
.splash-inner { display: flex; flex-direction: column; align-items: center; }
.splash-logo { width: 168px; height: auto; margin-bottom: 26px; overflow: visible; filter: drop-shadow(0 0 22px rgba(112,92,255,.55)); }
.splash-logo path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: splash-draw .75s var(--ease) forwards; }
.splash-logo .d2 { animation-delay: .3s; }
.splash-logo .d3 { animation-delay: .42s; }
.splash-logo .d4 { animation-delay: .5s; }
.splash-name { font-size: 30px; font-weight: 700; letter-spacing: -.025em; opacity: 0; animation: rise .6s var(--ease) .7s forwards; }
.splash-name em { font-style: normal; background: linear-gradient(95deg, #9ec2ff, #c4a6ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.splash-by { margin-top: 6px; color: #a3aed0; font-size: 11px; font-weight: 500; letter-spacing: .22em; text-transform: uppercase; opacity: 0; animation: rise .6s var(--ease) .85s forwards; }
.splash-bar { width: 120px; height: 2px; border-radius: 2px; background: rgba(255,255,255,.1); overflow: hidden; margin-top: 30px; }
.splash-bar i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #4f86ff, #a57bff); width: 0; animation: splash-fill 1.5s ease-in-out forwards; }
@keyframes splash-draw { to { stroke-dashoffset: 0; } }
@keyframes splash-fill { to { width: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .splash-logo path { stroke-dashoffset: 0; animation: none; }
  .splash-name, .splash-by { opacity: 1; animation: none; }
}

#top-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 999; pointer-events: none; opacity: 0; transition: opacity .3s; }
#top-progress.active { opacity: 1; }
#top-progress i { position: absolute; inset: 0 auto 0 0; width: 35%; background: linear-gradient(90deg, transparent, var(--brand-2), var(--brand)); animation: slide 1.1s ease-in-out infinite; }

#app-loader { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; background: var(--overlay);
  backdrop-filter: blur(3px); opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; }
#app-loader.show { opacity: 1; visibility: visible; }
.loader-card { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 26px 34px; border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.loader-msg { font-weight: 600; color: var(--text-2); }
.spinner { position: relative; width: 42px; height: 42px; }
.spinner i { position: absolute; inset: 0; border-radius: 50%; border: 3px solid transparent; border-top-color: var(--primary); animation: spin .9s linear infinite; }
.spinner i:last-child { inset: 7px; border-top-color: var(--success); animation-duration: 1.4s; animation-direction: reverse; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { 100% { transform: translateX(100%); } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ shell */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sb-w); z-index: 60; display: flex; flex-direction: column;
  background: var(--sidebar); color: var(--sidebar-text); border-right: 1px solid rgba(255,255,255,.04);
  transition: transform .3s var(--ease);
}
.sb-brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px 14px; }
.sb-logo { width: 40px; height: 40px; padding: 5px; object-fit: contain; border-radius: 11px; background: #fff; box-shadow: 0 8px 20px -6px rgba(112,92,255,.7); }
.sb-brand strong { display: block; color: #fff; font-size: 16px; letter-spacing: -.01em; }
.sb-brand small { color: var(--sidebar-muted); font-size: 12px; }
.sidebar .sb-close { margin-left: auto; display: none; color: var(--sidebar-text); }
.sb-nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; }
.sb-group { margin-top: 14px; }
.sb-group-title { display: block; padding: 0 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sidebar-muted); }
.sb-link { position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 10px; margin: 1px 0; border-radius: 10px; color: var(--sidebar-text); font-weight: 500; transition: background .15s, color .15s; }
.sb-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.sb-link.active { background: var(--sidebar-active); color: #fff; }
.sb-link.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-2); }
.sb-link.active .ic { color: var(--brand-2); }
.sb-company { margin: 10px 12px 16px; display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.07); background: rgba(255,255,255,.03); color: var(--sidebar-text); text-align: left; transition: background .15s; }
.sb-company:hover { background: rgba(255,255,255,.07); }
.sb-company-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: rgba(61,139,255,.15); color: var(--brand-2); }
.sb-company-txt { flex: 1; min-width: 0; }
.sb-company-txt small { display: block; font-size: 11px; color: var(--sidebar-muted); }
.sb-company-txt strong { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-overlay { display: none; }

.main { margin-left: var(--sb-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--tb-h); display: flex; align-items: center; gap: 10px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .tb-menu { display: none; }
.tb-crumb { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.tb-crumb span { font-size: 12px; color: var(--muted); }
.tb-crumb strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-spacer { flex: 1; }
.tb-emp { max-width: 260px; }
.tb-emp span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-user { position: relative; }
.avatar-btn { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
.avatar-btn:hover { border-color: var(--border-strong); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--brand), var(--violet)); flex: none; }
.avatar.lg { width: 42px; height: 42px; font-size: 14px; }
.tb-user-name { font-weight: 600; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); width: 250px; padding: 8px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: pop .15s var(--ease); z-index: 70; }
.dd-head { display: flex; gap: 10px; align-items: center; padding: 8px 8px 12px; }
.dd-head strong { display: block; }
.dd-head small { color: var(--muted); }
.dd-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: 8px; text-align: left; color: var(--text-2); font-weight: 500; }
.dd-item:hover { background: var(--surface-3); color: var(--text); }
.dd-item.danger { color: var(--danger); }

.page { flex: 1; width: 100%; max-width: 1480px; margin: 0 auto; padding: 24px 24px 48px; transition: opacity .25s, transform .25s var(--ease); }
.page.page-enter { opacity: 0; transform: translateY(6px); }
.bottom-nav { display: none; }

/* ------------------------------------------------------------------ página */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.ph-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ph-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); flex: none; }
.ph-icon .ic { width: 22px; height: 22px; }
.page-head h1 { font-size: 22px; }
.page-head p { color: var(--muted); margin-top: 2px; }
.ph-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; }
.fchip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 12px; }
.fchip .ic { width: 14px; height: 14px; color: var(--muted); }
.fchip small { color: var(--muted); }

/* ------------------------------------------------------------------ botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s, box-shadow .15s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--primary) 70%, transparent); }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-2); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2); flex: none; }
.btn-icon:disabled { opacity: .35; cursor: not-allowed; background: transparent; }
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn .badge-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--primary); color: #fff; font-size: 11px; display: inline-grid; place-items: center; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; white-space: nowrap; flex: none; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 500; font-size: 13px; transition: all .15s; }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip .count { font-size: 11px; padding: 1px 7px; border-radius: 9px; background: var(--surface-3); color: var(--text-2); }
.chip.active .count { background: rgba(255,255,255,.22); color: #fff; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }

/* ------------------------------------------------------------------ cards */
.grid { display: grid; gap: 16px; }
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 18px; }
.kpis.kpis-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpis-6 .kpi-value { font-size: 21px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; flex-wrap: wrap; }
.card-head h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card-head h3 .ic { color: var(--muted); }
.card-head p { color: var(--muted); font-size: 12px; }
.card-body { padding: 16px 18px 18px; }
.card-body.flush { padding: 8px 0 0; }
.card-link { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.card-link .ic { width: 15px; height: 15px; }

.kpi { position: relative; overflow: hidden; padding: 16px 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); animation: rise .4s var(--ease) both; }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: var(--tone-soft); opacity: .7; pointer-events: none; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; position: relative; z-index: 1; }
.kpi-label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.kpi-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--tone-soft); color: var(--tone); }
.kpi-value { position: relative; z-index: 1; font-size: 24px; font-weight: 750; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-foot { position: relative; z-index: 1; font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; min-height: 18px; }
.kpi.is-loading .kpi-value, .kpi.is-loading .kpi-foot { color: transparent; }
.kpi.is-loading .kpi-value::before, .kpi.is-loading .kpi-foot::before { content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%); height: 60%; width: 60%; border-radius: 6px; background: var(--surface-3); animation: pulse 1.2s ease-in-out infinite; }
.kpi.is-loading .kpi-foot::before { width: 40%; }
@keyframes pulse { 50% { opacity: .45; } }
.tone-primary { --tone: var(--primary); --tone-soft: var(--primary-soft); }
.tone-success { --tone: var(--success); --tone-soft: var(--success-soft); }
.tone-danger { --tone: var(--danger); --tone-soft: var(--danger-soft); }
.tone-warning { --tone: var(--warning); --tone-soft: var(--warning-soft); }
.tone-info { --tone: var(--info); --tone-soft: var(--info-soft); }
.tone-violet { --tone: var(--violet); --tone-soft: var(--violet-soft); }

.trend { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px 1px 5px; border-radius: 999px; font-weight: 700; font-size: 11.5px; }
.trend .ic { width: 13px; height: 13px; }
.trend.up { color: var(--success); background: var(--success-soft); }
.trend.down { color: var(--danger); background: var(--danger-soft); }
.trend.neutral { color: var(--muted); background: var(--surface-3); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }
.badge-neutral { background: var(--surface-3); color: var(--text-2); }

/* destaque (hero) */
.hero-card { position: relative; overflow: hidden; padding: 22px; border-radius: var(--radius-lg); color: #fff;
  background: radial-gradient(circle at 100% 0%, rgba(255,255,255,.18), transparent 45%), linear-gradient(135deg, #1a5fc0, #3d8bff 60%, #7058e6);
  box-shadow: 0 18px 40px -16px rgba(31,111,214,.7); }
.hero-card .hero-ic { position: absolute; right: -10px; bottom: -20px; opacity: .14; }
.hero-card .hero-ic .ic { width: 150px; height: 150px; }
.hero-card small { opacity: .85; font-weight: 600; }
.hero-card h2 { font-size: 20px; margin: 4px 0 10px; }
.hero-card .hero-value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.hero-card .btn { margin-top: 14px; background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.25); }
.hero-card .btn:hover { background: rgba(255,255,255,.28); }

/* ------------------------------------------------------------------ tabelas / listas */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { position: sticky; top: 0; text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
.table .c { text-align: center; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border-strong); }
.table .t-main { font-weight: 600; color: var(--text); }
.table .t-sub { color: var(--muted); font-size: 12px; }
.cell-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-title .avatar { width: 34px; height: 34px; border-radius: 10px; font-size: 11px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.list-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; flex-wrap: wrap; }

/* agrupamento por dia (semanal) */
.day-group { margin-bottom: 14px; }
.day-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.day-dot { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; color: var(--primary); background: var(--primary-soft); font-size: 13px; }
.day-head h3 { font-size: 15px; }
.day-head .day-sums { margin-left: auto; display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.day-head .day-sums b { color: var(--text); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ estados */
.state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 46px 20px; color: var(--muted); }
.state-icon { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); margin-bottom: 4px; }
.state-icon .ic { width: 26px; height: 26px; }
.state h4 { color: var(--text); font-size: 15px; }
.state p { max-width: 380px; }
.state .btn { margin-top: 8px; }
.state-error .state-icon { background: var(--danger-soft); color: var(--danger); }
.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: 10px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 55%, transparent), transparent); animation: shimmer 1.3s infinite; }
.sk-row { height: 52px; margin: 10px 18px; }
.sk-card { height: 120px; }
.sk-chart { height: 240px; margin: 4px 0; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--info-soft); color: var(--text-2); font-size: 13px; margin-bottom: 14px; }
.notice .ic { color: var(--info); margin-top: 1px; }
.notice.warning { background: var(--warning-soft); }
.notice.warning .ic { color: var(--warning); }
.notice code { font-family: var(--mono); font-size: 12px; background: var(--surface); padding: 1px 6px; border-radius: 5px; }

/* ------------------------------------------------------------------ gráficos */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--border); stroke-dasharray: 3 4; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .crosshair { stroke: var(--border-strong); stroke-dasharray: 4 4; }
.chart .bar-hover { fill: color-mix(in srgb, var(--text) 4%, transparent); }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i, .chart-tip i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-tip { position: absolute; pointer-events: none; z-index: 5; min-width: 150px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 12px; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; }
.chart-tip.show { opacity: 1; transform: none; }
.chart-tip b { display: block; margin-bottom: 6px; }
.chart-tip div { display: flex; align-items: center; gap: 7px; color: var(--text-2); }
.chart-tip div strong { margin-left: auto; padding-left: 12px; color: var(--text); font-variant-numeric: tabular-nums; }
.chart-donut { display: flex; align-items: center; justify-content: center; }
.donut-wrap { position: relative; }
.donut-seg { cursor: pointer; transition: opacity .15s; }
.donut-seg:hover { opacity: .85; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
.donut-center span { font-size: 12px; color: var(--muted); }
.donut-center strong { font-size: 17px; letter-spacing: -.01em; }
.donut-layout { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; }
.legend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.legend-list li { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.legend-list i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-list span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.legend-list b { font-variant-numeric: tabular-nums; }
.legend-list small { color: var(--muted); width: 48px; text-align: right; }

.hbar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.hbar-list li { display: flex; gap: 12px; align-items: flex-start; animation: rise .4s var(--ease) both; animation-delay: var(--d); }
.hbar-rank { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--surface-3); color: var(--text-2); flex: none; }
.hbar-list li:nth-child(1) .hbar-rank { background: #f5b23d; color: #3d2a00; }
.hbar-list li:nth-child(2) .hbar-rank { background: #c7d1e0; color: #263247; }
.hbar-list li:nth-child(3) .hbar-rank { background: #d99a6c; color: #3a1e08; }
.hbar-main { flex: 1; min-width: 0; }
.hbar-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.hbar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.hbar-top strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar-track { height: 7px; margin-top: 6px; border-radius: 4px; background: var(--track); overflow: hidden; }
.hbar-track i { display: block; height: 100%; width: var(--w); border-radius: 4px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); animation: grow .8s var(--ease) both; animation-delay: var(--d); transform-origin: left; }
.hbar-main small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes grow { from { transform: scaleX(0); } }

.status-bars { display: grid; gap: 12px; }
.sbar { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 12px; font-size: 13px; }
.sbar-track { height: 10px; border-radius: 5px; background: var(--track); overflow: hidden; }
.sbar-track i { display: block; height: 100%; border-radius: 5px; animation: grow .8s var(--ease) both; transform-origin: left; }
.sbar b { font-variant-numeric: tabular-nums; }

.meter { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; min-width: 70px; }
.meter i { display: block; height: 100%; border-radius: 3px; }

/* pódio */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 14px; align-items: end; margin-bottom: 18px; }
.pod { position: relative; text-align: center; padding: 22px 16px 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); animation: rise .5s var(--ease) both; min-width: 0; }
.pod.first { padding-top: 30px; border-color: color-mix(in srgb, #f5b23d 55%, var(--border)); background: linear-gradient(180deg, color-mix(in srgb, #f5b23d 12%, var(--surface)), var(--surface)); }
.pod-medal { width: 46px; height: 46px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 16px; }
.pod.first .pod-medal { width: 56px; height: 56px; background: linear-gradient(135deg, #ffd36b, #f2a20c); color: #3d2a00; box-shadow: 0 10px 24px -8px rgba(242,162,12,.7); }
.pod.second .pod-medal { background: linear-gradient(135deg, #e6ebf3, #aeb9cb); color: #263247; }
.pod.third .pod-medal { background: linear-gradient(135deg, #f0c09b, #c07a48); color: #3a1e08; }
.pod h4 { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pod .pod-value { font-size: 19px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.pod .pod-sub { color: var(--muted); font-size: 12px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* detalhes (modal) */
.dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.dl div { padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.dl dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.dl dd { margin: 3px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.dl .full { grid-column: 1 / -1; }
.dl .big dd { font-size: 20px; font-weight: 800; }
.detail-hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; margin-bottom: 14px; border-radius: var(--radius); background: var(--tone-soft, var(--primary-soft)); flex-wrap: wrap; }
.detail-hero small { color: var(--text-2); font-weight: 600; }
.detail-hero strong { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.section-title { font-size: 13px; font-weight: 700; color: var(--text-2); margin: 18px 0 10px; display: flex; align-items: center; gap: 8px; }

/* ------------------------------------------------------------------ formulários */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.col-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field.is-disabled { opacity: .55; }
.field input[type="text"], .field input[type="number"], .field input[type="date"], .field input[type="password"], .field input[type="month"], .select select, .input {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .select select:focus, .input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.field input::placeholder, .input::placeholder { color: var(--muted); }
.select { position: relative; }
.select select { appearance: none; padding-right: 36px; cursor: pointer; }
.select .ic { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 13px; }
.segmented { display: flex; padding: 3px; border-radius: 11px; background: var(--surface-3); gap: 3px; }
.segmented label { flex: 1; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; text-align: center; padding: 8px 6px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: all .15s; white-space: nowrap; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented input:disabled + span { cursor: not-allowed; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; }
.switch i { position: relative; width: 40px; height: 23px; border-radius: 12px; background: var(--border-strong); transition: background .2s; flex: none; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s var(--ease); }
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(17px); }
.switch input:focus-visible + i { outline: 2px solid var(--primary); outline-offset: 2px; }
.searchbox { position: relative; display: flex; align-items: center; min-width: 220px; flex: 1; max-width: 420px; }
.searchbox .ic { position: absolute; left: 12px; color: var(--muted); }
.searchbox input { width: 100%; height: 40px; padding: 0 12px 0 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); outline: none; }
.searchbox input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }

/* ------------------------------------------------------------------ toast */
#toast-host { position: fixed; top: 16px; right: 16px; z-index: 1100; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { position: relative; overflow: hidden; display: flex; gap: 12px; align-items: flex-start; padding: 14px 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); pointer-events: auto; opacity: 0; transform: translateX(24px); transition: opacity .25s, transform .3s var(--ease); }
.toast.show { opacity: 1; transform: none; }
.toast.hide { opacity: 0; transform: translateX(24px); }
.toast-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--tone-soft); color: var(--tone); }
.toast-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.toast-body strong { font-size: 13.5px; }
.toast-body span { color: var(--text-2); font-size: 13px; overflow-wrap: anywhere; }
.toast-close { border: 0; background: none; color: var(--muted); padding: 2px; border-radius: 6px; }
.toast-close:hover { color: var(--text); background: var(--surface-3); }
.toast-close .ic { width: 16px; height: 16px; }
.toast-timer { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--tone); transform-origin: left; animation: timer linear forwards; }
.toast.paused .toast-timer { animation-play-state: paused; }
@keyframes timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.toast-success { --tone: var(--success); --tone-soft: var(--success-soft); }
.toast-error { --tone: var(--danger); --tone-soft: var(--danger-soft); }
.toast-warning { --tone: var(--warning); --tone-soft: var(--warning-soft); }
.toast-info { --tone: var(--primary); --tone-soft: var(--primary-soft); }

/* ------------------------------------------------------------------ modal / drawer */
.layer { position: fixed; inset: 0; z-index: 800; display: flex; align-items: center; justify-content: center; padding: 20px; }
.layer-backdrop { position: absolute; inset: 0; background: var(--overlay); backdrop-filter: blur(2px); opacity: 0; transition: opacity .25s; }
.layer.open .layer-backdrop { opacity: 1; }
.layer-panel { position: relative; width: 100%; max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(14px) scale(.98); transition: opacity .25s, transform .3s var(--ease); }
.layer.open .layer-panel { opacity: 1; transform: none; }
.size-sm { max-width: 440px; } .size-md { max-width: 620px; } .size-lg { max-width: 860px; } .size-xl { max-width: 1100px; }
.layer-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.layer-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.layer-titles { flex: 1; min-width: 0; }
.layer-titles h3 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-titles p { color: var(--muted); font-size: 12.5px; }
.layer-body { padding: 20px; overflow-y: auto; }
.layer-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
.layer-drawer { justify-content: flex-end; padding: 0; }
.layer-drawer .layer-panel { height: 100%; max-height: none; border-radius: var(--radius-xl) 0 0 var(--radius-xl); transform: translateX(40px); }
.layer-drawer .layer-panel.size-sm { max-width: 460px; }
.layer-drawer .layer-body { flex: 1; }
.layer-drawer .layer-foot { border-radius: 0 0 0 var(--radius-xl); }
.layer-drawer .layer-foot .btn { flex: 1; }

/* ------------------------------------------------------------------ telas sem menu (login / empresa) */
.blank { min-height: 100vh; }
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { position: relative; overflow: hidden; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; color: #fff;
  background: radial-gradient(circle at 15% 15%, rgba(75,147,255,.35), transparent 45%), radial-gradient(circle at 90% 90%, rgba(112,88,230,.35), transparent 45%), linear-gradient(150deg, #081224, #0f2141 60%, #11234a); }
.auth-hero::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 42px 42px; mask-image: radial-gradient(circle at 30% 40%, #000, transparent 75%); }
.auth-hero > * { position: relative; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand img { width: 46px; height: 46px; padding: 6px; object-fit: contain; border-radius: 14px; background: #fff; }
.auth-brand strong { font-size: 18px; display: block; }
.auth-brand small { color: #9fb0cc; }
.auth-hero h1 { font-size: clamp(30px, 3.6vw, 48px); line-height: 1.08; letter-spacing: -.03em; max-width: 560px; }
.auth-hero h1 span { background: linear-gradient(135deg, #fff, #8ec5ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero p { color: #b9c7de; font-size: 16px; max-width: 480px; margin-top: 16px; line-height: 1.7; }
.auth-feats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 600px; }
.auth-feat { padding: 16px; border-radius: 16px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.09); backdrop-filter: blur(6px); }
.auth-feat .ic { color: #8ec5ff; width: 22px; height: 22px; margin-bottom: 8px; }
.auth-feat strong { display: block; font-size: 14px; }
.auth-feat span { color: #9fb0cc; font-size: 12.5px; }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-box { width: 100%; max-width: 400px; animation: rise .5s var(--ease); }
.auth-mobile-brand { display: none; align-items: center; gap: 12px; margin-bottom: 28px; }
.auth-mobile-brand img { width: 44px; height: 44px; padding: 5px; object-fit: contain; border-radius: 13px; background: #fff; box-shadow: 0 0 0 1px rgba(16,30,54,.08), 0 10px 24px -8px rgba(112,92,255,.7); }
.auth-mobile-brand strong { display: block; font-size: 17px; }
.auth-mobile-brand small { color: var(--muted); }
.table.fixed { table-layout: fixed; }
.auth-box h2 { font-size: 26px; letter-spacing: -.02em; }
.auth-box > p { color: var(--muted); margin: 6px 0 26px; }
.auth-form { display: grid; gap: 16px; }
.input-ic { position: relative; }
.input-ic > .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-ic input { padding-left: 40px !important; height: 48px !important; border-radius: 12px !important; font-size: 15px; }
.input-ic .pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.auth-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
.auth-form .btn-primary { height: 48px; border-radius: 12px; font-size: 15px; }
.auth-foot { margin-top: 26px; text-align: center; color: var(--muted); font-size: 12px; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.emp-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 18px; }
.emp-box { width: 100%; max-width: 760px; animation: rise .45s var(--ease); }
.emp-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.emp-head img { width: 46px; height: 46px; padding: 6px; object-fit: contain; border-radius: 14px; background: #fff; box-shadow: 0 0 0 1px rgba(16,30,54,.08); }
.emp-head h2 { font-size: 22px; }
.emp-head p { color: var(--muted); }
.emp-head .btn { margin-left: auto; }
.emp-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 14px; }
.emp-item { position: relative; display: flex; gap: 12px; align-items: center; text-align: left; padding: 16px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); transition: border-color .15s, transform .15s, box-shadow .15s; animation: rise .4s var(--ease) both; min-width: 0; }
.emp-item:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.emp-item.active { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.emp-item .avatar { width: 44px; height: 44px; border-radius: 13px; font-size: 14px; }
.emp-item-txt { min-width: 0; flex: 1; }
.emp-item-txt strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emp-item-txt small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emp-item .emp-check { position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; }
.emp-item .emp-check .ic { width: 13px; height: 13px; }

/* ------------------------------------------------------------------ responsivo */
@media (max-width: 1560px) {
  .kpis.kpis-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1200px) {
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sidebar .sb-close { display: inline-grid; }
  body.sb-open .sb-overlay { display: block; position: fixed; inset: 0; z-index: 55; background: var(--overlay); }
  .main { margin-left: 0; }
  .topbar .tb-menu { display: inline-grid; }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-mobile-brand { display: flex; }
}
@media (max-width: 720px) {
  :root { --tb-h: 58px; }
  .topbar { padding: 0 12px; gap: 6px; }
  .tb-emp, .tb-user-name, .avatar-btn > .ic { display: none; }
  .avatar-btn { padding: 2px; }
  .page { padding: 16px 14px calc(var(--bn-h) + 28px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 14px; align-items: flex-start; }
  .page-head h1 { font-size: 19px; }
  .ph-icon { width: 40px; height: 40px; border-radius: 12px; }
  .ph-actions { width: 100%; }
  .ph-actions .btn { flex: 1; }
  .kpis, .kpis.kpis-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpis-6 .kpi-value { font-size: 18px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 18px; }
  .kpi-ic { width: 30px; height: 30px; }
  .kpi-ic .ic { width: 16px; height: 16px; }
  .kpi-label { font-size: 12px; }
  .searchbox { max-width: none; min-width: 0; flex-basis: 100%; }
  .podium { grid-template-columns: 1fr; }
  .pod.first { order: -1; }
  .donut-layout { grid-template-columns: 1fr; justify-items: center; }
  .donut-layout .legend-list { width: 100%; }
  .form-grid, .dl { grid-template-columns: 1fr; }
  .sbar { grid-template-columns: 90px 1fr auto; }

  /* tabela vira lista de cartões */
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { padding: 12px 16px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
  .table.responsive td { padding: 0; border: 0; text-align: left !important; }
  .table.responsive td[data-m="main"] { grid-column: 1 / 2; }
  .table.responsive td[data-m="value"] { grid-column: 2; grid-row: 1; text-align: right !important; font-weight: 700; }
  .table.responsive td[data-m="status"] { grid-column: 2; grid-row: 2; text-align: right !important; }
  .table.responsive td[data-m="meta"] { grid-column: 1 / 2; color: var(--muted); font-size: 12.5px; }
  .table.responsive td[data-m="hide"] { display: none; }
  .table.responsive td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
  .table.responsive tfoot tr { background: var(--surface-2); }

  .bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--bn-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--border); }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none; color: var(--muted); font-size: 10.5px; font-weight: 600; }
  .bottom-nav .ic { width: 21px; height: 21px; }
  .bottom-nav a.active { color: var(--primary); }
  .bottom-nav a.active .ic { transform: translateY(-1px); }

  .layer { padding: 0; align-items: flex-end; }
  .layer-panel, .layer-drawer .layer-panel { max-width: none !important; max-height: 92vh; height: auto; border-radius: var(--radius-xl) var(--radius-xl) 0 0; transform: translateY(40px); }
  .layer-foot, .layer-drawer .layer-foot { border-radius: 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .layer-foot .btn { flex: 1; }
  #toast-host { top: auto; bottom: calc(var(--bn-h) + 12px + env(safe-area-inset-bottom)); right: 12px; left: 12px; width: auto; }
  .toast { transform: translateY(16px); }
  .toast.hide { transform: translateY(16px); }
  .emp-head .btn span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media print {
  .sidebar, .topbar, .bottom-nav, .ph-actions, .toolbar { display: none !important; }
  .main { margin: 0; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
}
