/* ============================================================
   ADAPTA — Redesign Layer  v2026042800
   Light-mode default + sidebar shell. Loaded AFTER style.css
   to override the dark theme. Dark mode opt-in via
   <html data-theme="dark">.
   ============================================================ */

:root {
  /* Off-white palette — Notion/Linear-inspired warm neutrals */
  --bg:            #f7f8fa;   /* body — warm off-white */
  --bg-subtle:     #f7f8fa;
  --panel:         #ffffff;   /* cards stay pure white for contrast */
  --panel-bg:      #ffffff;
  --surface-0:     #ffffff;
  --surface-1:     #f3f4f7;   /* hover row */
  --surface-2:     #eceef2;   /* table head / btn bg */
  --input-bg:      #ffffff;
  --row-bg:        #fafbfc;
  --border:        #e8eaed;   /* unified border tone */
  --border-hover:  #d4d7dc;
  --border-strong: #c8ccd2;
  --text:          #1f2328;   /* WCAG AA on white: 13.8:1 */
  --text-2:        #57606a;   /* secondary, 4.7:1 on white */
  --text-secondary:#57606a;
  --text-tertiary: #6e7781;
  --text-muted:    #818b98;
  --muted:         #57606a;
  --accent:        #0d9488;
  --accent-hover:  #0f766e;
  --accent-2:      #0d9488;
  --accent-dim:    rgba(13,148,136,0.10);
  --accent-glow:   0 0 0 3px rgba(13,148,136,0.15);
  --accent-rgb:    13,148,136;
  --danger:        #dc2626;
  --warning:       #f59e0b;
  --info:          #2563eb;
  --success:       #10b981;
  --orange:        #f59e0b;
  --shadow-sm:     0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:     0 2px 8px rgba(0,0,0,0.05);
  --shadow-lg:     0 8px 24px rgba(0,0,0,0.08);
  --duration:      140ms;
  --duration-lg:   220ms;
}

html[data-theme="dark"] {
  --bg:            #0f1219;
  --bg-subtle:     #0f1219;
  --panel:         #1a2133;
  --panel-bg:      #1a2133;
  --surface-0:     #1a2133;
  --surface-1:     #202840;
  --surface-2:     #28334e;
  --input-bg:      rgba(255,255,255,0.07);
  --row-bg:        rgba(255,255,255,0.05);
  --border:        rgba(255,255,255,0.11);
  --border-hover:  rgba(255,255,255,0.20);
  --text:          #dce8f8;
  --text-2:        #8a9bb4;
  --text-muted:    #556880;
  --muted:         #8a9bb4;
  --accent:        #00e5c3;
  --accent-hover:  #00ccaf;
  --accent-dim:    rgba(0,229,195,0.12);
  --accent-glow:   0 0 0 3px rgba(0,229,195,0.20);
  --accent-rgb:    0,229,195;
}

/* Body — kill the ambient glow / dark gradient */
body {
  background-color: var(--bg-subtle) !important;
  background-image: none !important;
  color: var(--text) !important;
  letter-spacing: -0.005em;
}

/* ── App shell: sidebar + main ─────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.app-sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 18px 14px 14px;
  z-index: 50;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.sidebar-brand-logo {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: #fff;
}
.sidebar-brand-logo svg { width: 18px; height: 18px; }
.sidebar-brand-text { display: flex; flex-direction: column; min-width: 0; }
.sidebar-brand-name {
  font-size: 13px; font-weight: 700; letter-spacing: 0.4px;
  color: var(--text); line-height: 1.2;
}
.sidebar-brand-sub {
  font-size: 10px; font-weight: 500; letter-spacing: 1.2px;
  color: var(--text-2); text-transform: uppercase; line-height: 1.4;
}

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 14px; }

.sidebar-section { display: flex; flex-direction: column; gap: 2px; }
.sidebar-section-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 4px 10px 6px;
}

.sidebar-item {
  all: unset;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--duration), color var(--duration);
}
.sidebar-item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.sidebar-item.active {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}
html[data-theme="dark"] .sidebar-item.active,
html[data-theme="dark"] .sidebar-item:hover {
  background: rgba(255,255,255,0.06);
}
.sidebar-item svg {
  width: 16px; height: 16px;
  stroke: currentColor; stroke-width: 1.6; fill: none;
  flex-shrink: 0;
}

.sidebar-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 4px;
}
.sidebar-user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px;
  flex-shrink: 0;
}
.sidebar-user-meta { min-width: 0; flex: 1; }
.sidebar-user-name {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 10.5px; color: var(--text-2);
}
.sidebar-footer .sidebar-item.danger { color: var(--danger); }
.sidebar-footer .sidebar-item.danger:hover {
  background: rgba(220,38,38,0.07); color: var(--danger);
}

/* ── Main area ─────────────────────────────────────────────── */
.app-main {
  flex: 1;
  min-width: 0;
  padding: 28px 36px 60px;
  background: var(--bg-subtle);
}
.main-header { margin-bottom: 22px; }
.main-header h1 {
  margin: 0 0 4px;
  font-size: 24px; font-weight: 700;
  color: var(--text); letter-spacing: -0.02em;
}
.main-header p { margin: 0; color: var(--text-2); font-size: 13.5px; }

/* Hide the legacy topbar — sidebar replaces it */
body > header.topbar { display: none !important; }

/* Container becomes flush inside main */
.app-main .container {
  max-width: 1100px;
  margin: 0;
  padding: 0;
  gap: 18px;
}

/* Hide the old horizontal tabs nav (we use sidebar instead) */
.app-main .tabs-nav { display: none !important; }

/* ── Panel / Card overrides ────────────────────────────────── */
.panel, section.panel {
  background: var(--panel) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  box-shadow: none !important;
  padding: 22px 24px !important;
  color: var(--text);
}
.panel::before, .panel::after { display: none !important; }

.panel h2, section.panel h2 {
  font-size: 17px; font-weight: 600;
  color: var(--text); margin: 0 0 14px;
  letter-spacing: -0.01em;
}
.panel h3 {
  font-size: 14px; font-weight: 600; color: var(--text);
}

.muted { color: var(--text-2) !important; }

/* Inputs */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], select, textarea {
  background: var(--input-bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  border-radius: 8px !important;
  padding: 9px 12px !important;
  font-size: 13.5px !important;
  transition: border-color var(--duration), box-shadow var(--duration);
  box-shadow: none !important;
}
input:focus, select:focus, textarea:focus {
  outline: none !important;
  border-color: var(--accent) !important;
  box-shadow: var(--accent-glow) !important;
}
label {
  font-size: 11.5px !important;
  font-weight: 500 !important;
  color: var(--text-2) !important;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Buttons */
.btn {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  padding: 8px 14px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  height: auto !important;
  box-shadow: none !important;
  transition: background var(--duration), border-color var(--duration);
  cursor: pointer;
}
.btn:hover { background: var(--surface-1) !important; border-color: var(--border-hover) !important; }
.btn-primary {
  background: var(--accent) !important;
  color: #ffffff !important;
  border-color: var(--accent) !important;
}
.btn-primary:hover { background: var(--accent-hover) !important; border-color: var(--accent-hover) !important; }
.btn-ghost {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--text-2) !important;
}
.btn-ghost:hover { background: var(--surface-2) !important; color: var(--text) !important; }

/* ── BRAND-LOCKED green simulator card — keep dark green ──── */
/* Untouched: .simulador / .sim-header / .sim-footer / .sim-body
   already use #0f5c36 → #0a4428 inline + class styles */

/* Result panel green-tint blocks need light-friendly tweak */
#buscaResult { background: #f0fdf4 !important; border-color: #86efac !important; }

/* Workspace alert — agora usa .alert.alert-warn; mantém layout interno */
.workspace-alert .workspace-alert-top { display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; }

/* Lote table */
.lote-table thead th {
  background: var(--surface-2) !important;
  color: var(--text-2) !important;
  border-bottom: 1px solid var(--border) !important;
}
.lote-table td { border-bottom: 1px solid var(--border) !important; color: var(--text) !important; }
.lote-table tr:hover td { background: var(--surface-1) !important; }

.lote-counter { background: var(--panel) !important; border: 1px solid var(--border) !important; }

/* Code / pre */
pre, code {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
}

/* ── Login overlay — light, clean ──────────────────────────── */
.login-overlay {
  background: var(--bg-subtle) !important;
  background-image: none !important;
}
.login-overlay::before, .login-overlay::after { display: none !important; }
.login-card {
  background: #ffffff !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06) !important;
  border-radius: 14px !important;
}
.login-logo {
  background: var(--accent) !important;
  border: none !important;
  box-shadow: none !important;
}
.login-logo svg path[stroke="#00e5c3"],
.login-logo svg circle[fill="#00e5c3"] {
  stroke: #ffffff !important; fill: #ffffff !important;
}
.login-title { color: var(--text) !important; }
.login-title span { color: var(--text-2) !important; }
.login-sub { color: var(--text-2) !important; }
.login-hint { color: var(--text-muted) !important; }
.login-field input {
  background: #ffffff !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}

/* Hide the legacy user indicator (replaced by sidebar user block) */
.user-indicator { display: none !important; }

/* Settings sub-tabs in light mode */
.settings-tab-btn {
  background: transparent !important;
  border: 1px solid transparent !important;
  color: var(--text-2) !important;
}
.settings-tab-btn.active {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

/* User modal */
.user-modal-card {
  background: var(--panel) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}

/* Status pills / badges */
.status.ok    { background: rgba(16,185,129,0.10) !important; color: #047857 !important; border: 1px solid rgba(16,185,129,0.25) !important; }
.status.err   { background: rgba(220,38,38,0.10) !important; color: #b91c1c !important; border: 1px solid rgba(220,38,38,0.25) !important; }
.status.warn  { background: rgba(245,158,11,0.10) !important; color: #92400e !important; border: 1px solid rgba(245,158,11,0.25) !important; }

/* ============================================================
   v2026042801 — Contrast pass + animations + splash + skeletons
   ============================================================ */

/* ── Dark mode contrast fixes ─────────────────────────────── */
html[data-theme="dark"] {
  --text-secondary: #a3b3cc;
  --text-tertiary:  #8a9bb4;
}

/* ── Sweep: classes that referenced hardcoded colors ─────── */
.muted, .text-secondary,
.text-muted, code.muted,
#trocoHint, #loginStatus, #nvcStatus,
#loteContagem, #higContagem,
#loteProgressText, #higProgressText,
#wsCurrentVal, #copyStatus,
.connections-placeholder,
.user-perm-desc, .users-cell-perms,
.lote-status-badge.pending, .lote-status-badge.loading {
  color: var(--text-2) !important;
}
.muted code, code {
  color: var(--text) !important;
  background: var(--surface-2) !important;
  border-color: var(--border) !important;
}

/* tab-btn (legacy horizontal — hidden by sidebar but kept theme-safe) */
.tab-btn { color: var(--text-2) !important; }
.tab-btn.active { color: var(--text) !important; }

/* btn-sm small chips */
.btn-sm {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  padding: 4px 10px !important;
  font-size: 12px !important;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}
.btn-sm:hover { background: var(--surface-1) !important; border-color: var(--border-hover) !important; }
.btn-sm.primary { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; }

/* Lote status badges — use vars in both themes */
.lote-status-badge.ok      { background: rgba(13,148,136,0.10) !important; color: #047857 !important; }
.lote-status-badge.err     { background: rgba(220,38,38,0.10) !important;  color: #b91c1c !important; }
.lote-status-badge.loading { background: var(--surface-2) !important;       color: var(--text-2) !important; }
.lote-status-badge.pending { background: var(--surface-1) !important;       color: var(--text-2) !important; }
html[data-theme="dark"] .lote-status-badge.ok  { color: #00e5c3 !important; }
html[data-theme="dark"] .lote-status-badge.err { color: #ff8a9b !important; }

/* Counters — readable in both themes */
.lote-counter        { background: var(--panel) !important; border: 1px solid var(--border) !important; color: var(--text) !important; }
.lote-counter small  { color: var(--text-2) !important; }
.lote-counter.found  { color: #047857 !important; }
.lote-counter.notfound { color: var(--text) !important; }
.lote-counter.err    { color: #b91c1c !important; }
.lote-counter.troco  { color: var(--accent) !important; }
.lote-counter.multiplo { color: var(--info) !important; }
.lote-counter.pending { color: var(--text-2) !important; }
html[data-theme="dark"] .lote-counter.found,
html[data-theme="dark"] .lote-counter.troco { color: var(--accent) !important; }
html[data-theme="dark"] .lote-counter.err   { color: #ff8a9b !important; }

/* qb-chip / rota-chip / user-tag-me — generic chip safety */
.qb-chip, .rota-chip, .user-tag-me {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}

/* loan-input-pagas */
.loan-input-pagas { color: var(--text) !important; background: var(--input-bg) !important; }

/* cpftelNome was hardcoded #111827 inline — handled via attribute selector */
#cpftelNome { color: var(--text) !important; }

/* buscaResult tweaked for both themes */
#buscaResult {
  background: rgba(13,148,136,0.06) !important;
  border-color: rgba(13,148,136,0.30) !important;
  color: var(--text) !important;
}
#buscaResult input[readonly] {
  background: var(--surface-1) !important;
  color: var(--text) !important;
}
html[data-theme="dark"] #buscaResult {
  background: rgba(0,229,195,0.06) !important;
  border-color: rgba(0,229,195,0.28) !important;
}

/* Panel hover — subtle border lift */
.panel {
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

/* Inputs — explicit transition */
input, select, textarea {
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease !important;
}

/* ── Tab transition (fade + translateY) ──────────────────── */
.tab-content {
  animation: tabFadeIn 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
.tab-content.hidden { display: none !important; }
@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Sidebar item active — animated pill */
.sidebar-item {
  transition: background-color 200ms ease, color 160ms ease, transform 160ms ease;
}
.sidebar-item.active svg { transform: scale(1.05); color: var(--accent); }
.sidebar-item.active     { color: var(--text); }

/* ── App entry stagger after login ───────────────────────── */
.app-shell.app-entered .app-sidebar { animation: appFadeUp 320ms cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: 0ms; }
.app-shell.app-entered .app-main    { animation: appFadeUp 360ms cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: 100ms; }
.app-shell.app-entered .app-main .panel { animation: appFadeUp 380ms cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: 200ms; }
@keyframes appFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Splash screen ───────────────────────────────────────── */
#appSplash {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px; z-index: 9999;
  transition: opacity 260ms ease;
}
#appSplash.hidden-fade { opacity: 0; pointer-events: none; }
.splash-logo {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  animation: splashFadeIn 420ms cubic-bezier(0.16, 1, 0.3, 1);
}
.splash-logo svg { width: 28px; height: 28px; }
.splash-dots { display: flex; gap: 6px; }
.splash-dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  opacity: 0.4;
  animation: splashDot 1.2s ease-in-out infinite;
}
.splash-dots span:nth-child(2) { animation-delay: 0.18s; }
.splash-dots span:nth-child(3) { animation-delay: 0.36s; }
@keyframes splashDot {
  0%,80%,100% { opacity: 0.3; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}
@keyframes splashFadeIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Skeleton rows ───────────────────────────────────────── */
.skeleton-row {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.skeleton-line {
  height: 12px; border-radius: 6px;
  background: linear-gradient(90deg,
    var(--surface-1) 0%,
    var(--surface-2) 50%,
    var(--surface-1) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}
.skeleton-line.short { width: 38%; }
.skeleton-line.mid   { width: 64%; }
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
html[data-theme="dark"] .skeleton-line {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 0%,
    rgba(255,255,255,0.10) 50%,
    rgba(255,255,255,0.04) 100%);
  background-size: 200% 100%;
}

/* ============================================================
   v2026042802 — Polish round: depth, motion, components
   ============================================================ */

:root {
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-card:       0 1px 2px rgba(15,20,30,0.04), 0 1px 1px rgba(15,20,30,0.02);
  --shadow-card-hover: 0 4px 12px rgba(15,20,30,0.06), 0 2px 4px rgba(15,20,30,0.04);
}
html[data-theme="dark"] {
  --shadow-card:       0 1px 2px rgba(0,0,0,0.30), 0 1px 1px rgba(0,0,0,0.20);
  --shadow-card-hover: 0 6px 18px rgba(0,0,0,0.40), 0 2px 6px rgba(0,0,0,0.25);
}

/* Body warm gradient */
body {
  background-image: linear-gradient(180deg, #f7f8fa 0%, #f4f5f8 100%) !important;
}
html[data-theme="dark"] body {
  background-image: linear-gradient(180deg, #0f1219 0%, #0c1018 100%) !important;
}

/* Sidebar slightly different surface */
.app-sidebar { background: #fbfcfd !important; }
html[data-theme="dark"] .app-sidebar { background: #131826 !important; }

/* Panels — depth */
.panel, section.panel {
  box-shadow: var(--shadow-card) !important;
  transition: box-shadow 200ms var(--ease), border-color 200ms var(--ease), transform 200ms var(--ease) !important;
}
.panel:hover { box-shadow: var(--shadow-card-hover) !important; }

/* Panel headings — separator under */
.panel h2, section.panel h2 {
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
  margin-bottom: 18px !important;
}
.panel h2 svg, section.panel h2 svg {
  width: 18px; height: 18px;
  stroke: var(--accent); stroke-width: 1.7; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}
.panel h3 svg {
  width: 15px; height: 15px;
  stroke: var(--text-2); stroke-width: 1.7; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -2px; margin-right: 6px;
}

/* Buttons with inline icons */
.btn svg, .btn-sm svg {
  width: 14px; height: 14px;
  stroke: currentColor; stroke-width: 1.8; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -2px;
  margin-right: 6px;
  flex-shrink: 0;
}
.btn-primary svg { stroke: #fff; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0; }

/* Spin */
@keyframes adaptaSpin { to { transform: rotate(360deg); } }
.spin, .btn-spin svg, svg.spin { animation: adaptaSpin 0.9s linear infinite; transform-origin: center; }
.btn-loading { opacity: 0.85; cursor: progress; }
.btn-spin { display: inline-flex; margin-right: 6px; }

/* Click ripple */
.btn, .btn-sm { position: relative; overflow: hidden; }
.ripple {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,0.45);
  transform: scale(0); pointer-events: none;
  animation: rippleAnim 480ms var(--ease);
}
.btn:not(.btn-primary) .ripple { background: rgba(13,148,136,0.18); }
@keyframes rippleAnim {
  to { transform: scale(2.2); opacity: 0; }
}

/* Custom select wrapper */
.adapta-select {
  position: relative; display: inline-flex; align-items: center;
  width: 100%;
}
.adapta-select select {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  padding-right: 34px !important;
  width: 100%;
  cursor: pointer;
}
.adapta-select-chev {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-2);
  display: inline-flex;
  transition: transform 200ms var(--ease), color 160ms var(--ease);
}
.adapta-select select:focus + .adapta-select-chev { color: var(--accent); }
.adapta-select select:focus ~ .adapta-select-chev,
.adapta-select select[data-open="1"] + .adapta-select-chev {
  transform: translateY(-50%) rotate(180deg);
}
.adapta-select-chev svg { stroke: currentColor; stroke-width: 1.7; fill: none; }

/* Top progress bar */
.top-progress {
  position: fixed; top: 0; left: 0; height: 2px;
  background: var(--accent);
  width: 0%;
  z-index: 10000;
  opacity: 0;
  box-shadow: 0 0 8px rgba(13,148,136,0.5);
  transition: width 320ms var(--ease), opacity 240ms var(--ease);
}
.top-progress.active { opacity: 1; }
.top-progress.done { transition: width 200ms var(--ease), opacity 320ms ease 120ms; opacity: 0; }

/* Toast */
.toast-host {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 10001; pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card-hover);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  min-width: 220px; max-width: 360px;
  transform: translateX(20px); opacity: 0;
  transition: transform 280ms var(--ease), opacity 200ms var(--ease);
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast-icon { display: inline-flex; flex-shrink: 0; }
.toast-icon svg { stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.toast-success .toast-icon { color: var(--success); }
.toast-success .toast-icon svg { stroke: var(--success); }
.toast-error   .toast-icon { color: var(--danger); }
.toast-error   .toast-icon svg { stroke: var(--danger); }
.toast-warn    .toast-icon { color: var(--warning); }
.toast-warn    .toast-icon svg { stroke: var(--warning); }
.toast-info    .toast-icon svg { stroke: var(--accent); }

/* Empty state */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  padding: 36px 20px;
  color: var(--text-2);
}
.empty-state-icon {
  width: 48px; height: 48px;
  opacity: 0.4;
  margin-bottom: 12px;
  color: var(--text-2);
}
.empty-state-icon svg {
  width: 100%; height: 100%;
  stroke: currentColor; stroke-width: 1.4; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}
.empty-state-title {
  font-size: 14px; font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}
.empty-state-sub {
  font-size: 12.5px; color: var(--text-2);
  margin-bottom: 12px;
  max-width: 320px;
}

/* Sidebar item icon translateX on hover */
.sidebar-item { transition: background-color 180ms var(--ease), color 160ms var(--ease); }
.sidebar-item .icon { display: inline-flex; transition: transform 200ms var(--ease); }
.sidebar-item:hover .icon { transform: translateX(2px); }
.sidebar-item.active .icon { transform: translateX(0); }

/* Tooltip via data-tooltip */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #1f2328; color: #fff;
  font-size: 11.5px; font-weight: 500;
  padding: 5px 9px; border-radius: 6px;
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 160ms var(--ease), transform 200ms var(--ease);
  z-index: 100;
}
[data-tooltip]:hover::after { opacity: 1; transform: translateX(-50%) translateY(0); }
html[data-theme="dark"] [data-tooltip]::after { background: #2a3346; }

/* Modal/overlay backdrop blur */
.user-modal-backdrop, .modal-backdrop, .login-overlay::before {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.user-modal-card, .modal-card {
  animation: modalIn 240ms var(--ease);
  box-shadow: var(--shadow-card-hover) !important;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* Tab content child stagger */
.tab-content > * { animation: childFadeIn 280ms var(--ease) both; }
.tab-content > *:nth-child(1) { animation-delay: 0ms; }
.tab-content > *:nth-child(2) { animation-delay: 30ms; }
.tab-content > *:nth-child(3) { animation-delay: 60ms; }
.tab-content > *:nth-child(4) { animation-delay: 90ms; }
.tab-content > *:nth-child(5) { animation-delay: 120ms; }
@keyframes childFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Headings + section dividers within forms */
.panel h3 {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.panel h3:first-child,
.panel > h3:nth-child(-n+2) { border-top: none; padding-top: 0; margin-top: 0; }

/* Status messages with icon */
.status { display: inline-flex; align-items: center; gap: 6px; }
.status svg {
  width: 14px; height: 14px;
  stroke: currentColor; stroke-width: 1.8; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}

/* Skeleton table row */
.skeleton-table-row td {
  padding: 12px 10px !important;
}
.skeleton-cell {
  height: 12px; border-radius: 6px;
  background: linear-gradient(90deg,
    var(--surface-1) 0%,
    var(--surface-2) 50%,
    var(--surface-1) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}

/* Card-interactive hover lift */
.lote-counter {
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease) !important;
  box-shadow: var(--shadow-card) !important;
}
.lote-counter:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover) !important;
}

/* Number ticker (transitions on text update via class) */
.num-tick { transition: color 220ms var(--ease); }

/* Responsive — collapse sidebar to top bar on narrow screens */
@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .app-sidebar {
    width: 100%; height: auto; position: relative;
    border-right: none; border-bottom: 1px solid var(--border);
    flex-direction: row; flex-wrap: wrap; align-items: center;
    padding: 10px 12px;
  }
  .sidebar-brand { border-bottom: none; margin: 0; padding: 0 8px 0 0; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; gap: 4px; flex: 1; }
  .sidebar-section { flex-direction: row; align-items: center; gap: 2px; }
  .sidebar-section-label { display: none; }
  .sidebar-footer {
    flex-direction: row; border-top: none; margin: 0; padding: 0 0 0 8px;
    border-left: 1px solid var(--border);
  }
  .sidebar-user { display: none; }
  .app-main { padding: 18px; }
}

/* ============================================================
   DESIGN SYSTEM CONSOLIDATION  v2026042901
   Aplicado a todas as 6 telas. Override agressivo, backward-compat.
   ============================================================ */

/* Tokens (confirma/adiciona) */
:root{
  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-5:24px; --sp-6:32px; --sp-8:48px;
  --r-sm:6px; --r-md:8px; --r-lg:12px; --r-pill:999px;
  --h1:28px; --h2:18px; --h3:15px; --body:14px; --label:12px; --caption:11px;
  --w-regular:400; --w-medium:500; --w-semibold:600; --w-bold:700;
}

/* 1. Inputs/selects/textareas — padroniza altura 36, raio var(--r-md) */
.tab-content input:not([type=file]):not([type=checkbox]):not([type=radio]),
.tab-content select,
.tab-content textarea,
#tokenPanel input, #nvcPanel input, #nvcPanel select,
.user-modal input:not([type=hidden]), .user-modal select{
  height:36px; padding:0 12px;
  border-radius:var(--r-md);
  border:1px solid var(--border);
  background:var(--input-bg); color:var(--text);
  font-size:var(--body); font-weight:var(--w-regular);
  transition:border-color 150ms, box-shadow 150ms;
}
.tab-content textarea{ height:auto; min-height:88px; padding:10px 12px; line-height:1.5; }
.tab-content input:focus, .tab-content select:focus, .tab-content textarea:focus,
#tokenPanel input:focus, #nvcPanel input:focus,
.user-modal input:focus, .user-modal select:focus{
  outline:none;
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(var(--accent-rgb),0.12);
}

/* 2. Botões — height 36 / sm 28, raio var(--r-md), pesos consistentes */
.btn, .btn-primary, .btn-ghost, .btn-danger{
  height:36px; padding:0 14px;
  border-radius:var(--r-md);
  font-size:var(--body); font-weight:var(--w-medium);
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  transition:background 150ms, border-color 150ms, opacity 150ms, transform 80ms;
  border:1px solid transparent; cursor:pointer; white-space:nowrap;
}
.btn-primary{ font-weight:var(--w-semibold); }
.btn-sm{
  height:28px; padding:0 10px;
  border-radius:var(--r-sm);
  font-size:12px; font-weight:var(--w-medium);
  display:inline-flex; align-items:center; justify-content:center; gap:4px;
  border:1px solid var(--border); background:var(--surface-2); color:var(--text);
  cursor:pointer; transition:background 150ms, border-color 150ms;
}
.btn-sm:hover{ border-color:var(--border-hover); background:var(--surface-1); }
.btn-sm.btn-danger{ color:var(--danger); border-color:rgba(220,38,38,0.25); background:rgba(220,38,38,0.06); }
.btn-sm.btn-danger:hover{ background:rgba(220,38,38,0.12); }
label.btn{ display:inline-flex; align-items:center; height:36px; padding:0 14px; cursor:pointer; }

/* gated buttons */
.btn[data-perm-gated="off"], .btn-sm[data-perm-gated="off"], label.btn[data-perm-gated="off"]{
  pointer-events:none; opacity:0.4 !important;
}

/* 3. Painéis/cards */
.panel{
  background:var(--panel); border:1px solid var(--border);
  border-radius:var(--r-lg); padding:var(--sp-5);
  box-shadow:var(--shadow-sm);
}

/* 4. Modais — radius alinhado ao token */
.user-modal-card{ border-radius:var(--r-lg) !important; max-width:480px; }
.user-modal-head{ border-bottom:1px solid var(--border); }
.user-modal-actions{ border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:var(--sp-3); padding-top:var(--sp-3); margin-top:var(--sp-4); }

/* 5. Empty state já existente — garante reutilização */
.empty-state{ text-align:center; padding:var(--sp-6) var(--sp-4); color:var(--text-2); }
.empty-state-title{ font-size:var(--h3); font-weight:var(--w-semibold); color:var(--text); margin-bottom:var(--sp-2); }
.empty-state-sub{ font-size:13px; color:var(--text-2); }

/* 6. Tabelas / users-table */
.users-table-row{ min-height:44px; transition:background 120ms; }
.users-table-row:hover{ background:var(--surface-1); }
.users-table-head{ font-weight:var(--w-semibold); font-size:var(--label); text-transform:uppercase; letter-spacing:0.04em; color:var(--text-2); }

/* 7. Alerts padronizados */
.alert{ display:flex; gap:var(--sp-2); align-items:flex-start; padding:10px 12px; border-radius:var(--r-md); font-size:13px; line-height:1.45; border:1px solid transparent; }
.alert-success{ background:rgba(16,185,129,0.08); border-color:rgba(16,185,129,0.25); color:#065f46; }
.alert-error  { background:rgba(220,38,38,0.08);  border-color:rgba(220,38,38,0.25);  color:#991b1b; }
.alert-warn   { background:rgba(245,158,11,0.10); border-color:rgba(245,158,11,0.30); color:#92400e; }
.alert-info   { background:rgba(37,99,235,0.08);  border-color:rgba(37,99,235,0.25);  color:#1e40af; }
html[data-theme="dark"] .alert-success{ color:#6ee7b7; }
html[data-theme="dark"] .alert-error  { color:#fca5a5; }
html[data-theme="dark"] .alert-warn   { color:#fcd34d; }
html[data-theme="dark"] .alert-info   { color:#93c5fd; }

/* 8. Screen header padrão (injetado runtime) */
.screen-header{
  display:flex; align-items:flex-start; justify-content:space-between; gap:var(--sp-4);
  padding:0 0 var(--sp-4) 0; margin-bottom:var(--sp-5);
  border-bottom:1px solid var(--border);
}
.screen-header-text{ flex:1; min-width:0; }
.screen-header h1{
  font-size:var(--h1); font-weight:var(--w-bold);
  margin:0 0 4px 0; color:var(--text); letter-spacing:-0.015em;
}
.screen-header .screen-sub{
  font-size:13px; color:var(--text-2); margin:0; font-weight:var(--w-regular);
}
.screen-header .screen-actions{ display:flex; gap:var(--sp-2); flex-shrink:0; }
