/* ══════════════════════════════════════════════════════════════
   REQUISIÇÕES DIGITAL — DESIGN SYSTEM v8.1 PREMIUM (11/05/2026)
   ══════════════════════════════════════════════════════════════
   Tema dark unico, paleta neutra sofisticada.
   Sem gradientes coloridos, glow neon, sombras coloridas,
   fundos saturados, ou cores Apple iOS antigas.
   Max border-radius: 12px · Max blur: 16px · Max anim: 200ms
   ══════════════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ── */
:root {
  /* Fundos */
  --bg:          #0c0e14;
  --surface-1:   #161922;
  --surface-2:   #1c2030;
  --surface-3:   #232738;
  --overlay:     #1a1e2a;

  /* Bordas */
  --border:        rgba(255, 255, 255, 0.06);
  --border-subtle: rgba(255, 255, 255, 0.04);

  /* Acento unico */
  --accent:      #6b8aad;
  --accent-soft: rgba(107, 138, 173, 0.12);
  --accent-mid:  rgba(107, 138, 173, 0.20);

  /* Semanticas */
  --success:      #5a9e6f;
  --success-soft: rgba(90, 158, 111, 0.12);
  --success-mid:  rgba(90, 158, 111, 0.20);
  --warning:      #b8935a;
  --warning-soft: rgba(184, 147, 90, 0.12);
  --warning-mid:  rgba(184, 147, 90, 0.20);
  --danger:       #b85a5a;
  --danger-soft:  rgba(184, 90, 90, 0.12);
  --danger-mid:   rgba(184, 90, 90, 0.20);
  --info:         #5a7eb8;
  --info-soft:    rgba(90, 126, 184, 0.12);
  --purple:       #8a6abf;
  --purple-soft:  rgba(138, 106, 191, 0.12);
  --purple-mid:   rgba(138, 106, 191, 0.20);
  --yellow:       #b8a85a;
  --orange:       #b8935a;
  --teal:         #5a9e8a;

  /* Texto */
  --text-primary:   #e2e4ea;
  --text-secondary: rgba(226, 228, 234, 0.60);
  --text-tertiary:  rgba(226, 228, 234, 0.35);

  /* Compat aliases */
  --text-0: var(--text-primary);
  --text-1: var(--text-primary);
  --text-2: var(--text-secondary);
  --text-3: var(--text-tertiary);
  --text-4: rgba(226, 228, 234, 0.25);
  --blue: var(--accent);
  --green: var(--success);
  --red: var(--danger);

  --bg-root: var(--bg);
  --bg-base: var(--surface-1);
  --bg-raised: var(--surface-2);
  --bg-overlay: var(--overlay);
  --bg-input: var(--surface-1);
  --bg-hover: var(--surface-3);
  --bg-active: rgba(255, 255, 255, 0.08);

  --accent-dim: var(--accent-soft);
  --accent-strong: var(--accent-mid);
  --accent-text: var(--accent);
  --success-dim: var(--success-soft);
  --success-text: var(--success);
  --warning-dim: var(--warning-soft);
  --warning-text: var(--warning);
  --danger-dim: var(--danger-soft);
  --danger-text: var(--danger);
  --purple-dim: var(--purple-soft);

  --border-accent: rgba(107, 138, 173, 0.18);

  /* Tipografia */
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', monospace;

  /* Radii — max 12px */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 12px;
  --r-full: 100px;

  /* Motion — max 200ms */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: .1s;
  --dur-md: .2s;
  --dur-slow: .2s;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-xl: 0 12px 32px rgba(0,0,0,0.5);
}

:root, body { color-scheme: dark !important; }

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  font-family: var(--font);
  color: var(--text-primary);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }
::selection { background: var(--accent-mid); color: #fff; }
input, select, textarea, button { font-family: var(--font); }

/* ══════════════ BACKGROUND — Clean, no orbs ══════════════ */
.bg-scene {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background: var(--bg);
}
.bg-scene::before { display: none; }
.bg-scene .orb { display: none; }

/* ══════════════ LOGIN ══════════════ */
#loginScreen {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
#loginScreen::before { display: none; }
#loginScreen.hidden { display: none; }

.login-card {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 40px 32px 36px;
  width: min(400px, 92vw);
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: loginReveal .2s var(--ease);
}
.login-card::before { display: none; }
@keyframes loginReveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-card .brand-icon {
  width: 56px; height: 56px; border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px;
  box-shadow: var(--shadow-sm);
  color: var(--accent);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.03em;
}
.login-card .brand-icon::after { display: none; }

.login-card h2 {
  font-size: 1.35rem; font-weight: 700; color: var(--text-primary);
  letter-spacing: -.03em; margin-bottom: 4px;
}
.login-card .sub {
  font-size: .68rem; color: var(--text-tertiary);
  margin-bottom: 28px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
}

.login-field {
  width: 100%; padding: 12px 14px; margin-bottom: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-primary);
  font-size: .85rem; font-weight: 500; outline: none;
  transition: border-color .2s var(--ease);
}
.login-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.login-field::placeholder { color: var(--text-tertiary); }
select.login-field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6' fill='none' stroke='%236b8aad' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
select.login-field option { background: var(--surface-1); }
textarea.login-field { resize: vertical; min-height: 80px; line-height: 1.5; }

.login-btn {
  width: 100%; padding: 12px; margin-top: 6px;
  border: none; border-radius: var(--r-md);
  color: #fff; font-weight: 700; font-size: .85rem;
  cursor: pointer;
  background: var(--accent);
  transition: all .2s var(--ease);
  letter-spacing: .01em;
}
.login-btn::after { display: none; }
.login-btn:hover { filter: brightness(1.08); }
.login-btn:active { transform: scale(.98); filter: brightness(.95); }
.login-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; filter: none; }
.login-error { color: var(--danger); font-size: .75rem; font-weight: 600; min-height: 18px; margin-top: 10px; }
.shake { animation: loginShake .2s ease; }
@keyframes loginShake {
  0%, 100% { transform: translateX(0); }
  25%, 75% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
}

/* ══════════════ LOADER ══════════════ */
#ldScreen {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 14px; background: var(--bg);
  transition: opacity .2s ease;
}
#ldScreen.hidden { opacity: 0; pointer-events: none; }
.ld-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ld-text { color: var(--text-tertiary); font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
#ldBarTop {
  position: fixed; top: 0; left: 0; height: 2px; z-index: 9998;
  background: var(--accent);
  width: 0; transition: width .2s ease;
}

/* ══════════════ TOP BAR ══════════════ */
.top-bar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(12, 14, 20, .92);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px 10px;
}
.top-bar-row1 {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.top-bar .brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.top-bar .brand-dot {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  background: var(--surface-1);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.03em;
  flex-shrink: 0;
}
.top-bar .brand-text { min-width: 0; }
.top-bar .brand-text h1 {
  font-size: .9rem; font-weight: 700; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -.02em;
}
.top-bar .brand-text span {
  font-size: .55rem; color: var(--text-tertiary);
  text-transform: uppercase; font-weight: 700; letter-spacing: .1em;
}

.top-bar-row2 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.badge {
  padding: 3px 8px; border-radius: var(--r-full);
  font-size: .58rem; font-weight: 700;
  text-transform: uppercase; border: none;
  letter-spacing: .04em;
}
.badge-online { background: var(--success-soft); color: var(--success); border: 1px solid var(--success-mid); }
.badge-offline { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-mid); animation: pulseOff 2s ease infinite; }
@keyframes pulseOff { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.badge-gestor { background: var(--purple-soft); color: var(--purple); border: 1px solid var(--purple-mid); }
.user-badge {
  padding: 3px 8px; border-radius: var(--r-full);
  font-size: .6rem; font-weight: 700;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-mid);
}

.menu-trigger {
  width: 36px; height: 36px; border: 1px solid var(--border);
  background: var(--surface-1);
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  gap: 4px; flex-shrink: 0;
  transition: all .2s ease;
}
.menu-trigger:hover { background: var(--surface-3); border-color: var(--border-accent); }
.menu-trigger:active { transform: scale(.92); }
.menu-trigger span {
  display: block; width: 14px; height: 1.5px;
  background: var(--text-secondary); border-radius: 1px;
  transition: background .2s;
}
.menu-trigger:hover span { background: var(--accent); }

/* ══════════════ MENU LATERAL (DRAWER) ══════════════ */
.menu-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 4998;
  opacity: 0; pointer-events: none;
  transition: opacity .2s var(--ease);
}
.menu-overlay.show { opacity: 1; pointer-events: auto; }

.menu-lateral {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(300px, 82vw);
  background: var(--surface-1);
  border-left: 1px solid var(--border);
  z-index: 4999;
  transform: translateX(100%);
  transition: transform .2s var(--ease);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.menu-lateral.show { transform: translateX(0); }

.menu-header {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
}
.menu-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--accent-mid);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.menu-avatar svg { width: 18px; height: 18px; color: var(--accent); }
.menu-userinfo { flex: 1; min-width: 0; }
.menu-username {
  font-size: .85rem; font-weight: 700; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.menu-userrole { font-size: .62rem; color: var(--text-tertiary); margin-top: 1px; font-weight: 600; letter-spacing: .04em; }
.menu-close {
  width: 30px; height: 30px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-secondary);
  border-radius: var(--r-sm); cursor: pointer;
  font-size: .8rem; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  transition: all .1s ease; flex-shrink: 0;
}
.menu-close:hover { background: var(--surface-3); color: var(--text-primary); border-color: var(--border-accent); }

.menu-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.menu-section-label {
  font-size: .58rem; font-weight: 700; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: .1em;
  padding: 8px 10px 6px;
}
.menu-item {
  width: 100%; background: transparent; border: none;
  padding: 10px 12px; display: flex; align-items: center;
  gap: 10px; cursor: pointer; border-radius: var(--r-md);
  transition: all .1s ease;
  text-align: left; font-family: var(--font);
  position: relative;
}
.menu-item::before { display: none; }
.menu-item:hover { background: var(--surface-3); }
.menu-item:active { background: var(--bg-active); }

.menu-icon {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.menu-icon svg { width: 18px; height: 18px; }
.menu-item:hover .menu-icon { transform: none; }
.menu-icon.ia { background: var(--purple-soft); border: 1px solid var(--purple-mid); color: var(--purple); }
.menu-icon.importar { background: var(--success-soft); border: 1px solid var(--success-mid); color: var(--success); }
.menu-icon.catalogo { background: var(--accent-soft); border: 1px solid var(--accent-mid); color: var(--accent); }
.menu-icon.sair { background: var(--danger-soft); border: 1px solid var(--danger-mid); color: var(--danger); }

.menu-text { flex: 1; min-width: 0; }
.menu-title { font-size: .82rem; font-weight: 600; color: var(--text-primary); margin-bottom: 1px; }
.menu-sub { font-size: .65rem; color: var(--text-tertiary); font-weight: 500; }
.menu-chevron {
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: color .2s;
}
.menu-chevron svg { width: 14px; height: 14px; }
.menu-item:hover .menu-chevron { color: var(--accent); transform: none; }
.menu-divider { height: 1px; background: var(--border); margin: 6px 8px; }
.menu-logout .menu-title { color: var(--danger); }

.menu-footer {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.menu-version { font-size: .58rem; color: var(--text-tertiary); font-family: var(--mono); font-weight: 500; }

/* ══════════════ CONTAINER ══════════════ */
.container {
  max-width: 640px; margin: 0 auto;
  padding: 16px 14px 60px;
  position: relative; z-index: 1;
}
.section-label {
  font-size: .6rem; font-weight: 700; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: .08em;
  margin: 24px 0 10px 2px;
  display: flex; align-items: center; gap: 8px;
}
.section-label::before {
  content: '';
  width: 3px; height: 10px; border-radius: 2px;
  background: var(--accent);
  flex-shrink: 0;
}

/* ══════════════ STAT CARDS ══════════════ */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }

.stat-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 14px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s ease;
  position: relative; overflow: hidden;
}
.stat-card::before { display: none; }
.stat-card:hover { border-color: var(--accent-mid); }
.stat-card .s-icon { display: none; }
.stat-card .s-label {
  font-size: .55rem; color: var(--text-tertiary);
  text-transform: uppercase; font-weight: 700;
  margin-bottom: 8px; letter-spacing: .08em;
  position: relative; padding-left: 12px;
}
.stat-card .s-label::before {
  content: '';
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}
.stat-card.blue .s-label::before { background: var(--accent); }
.stat-card .s-value {
  font-size: 1.5rem; font-weight: 800; line-height: 1;
  letter-spacing: -.02em; color: var(--text-primary);
}
.stat-card .s-value.blue { color: var(--accent); }

/* ══════════════ CITY CARDS ══════════════ */
.cidade-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 14px;
  margin-bottom: 6px;
  transition: all .2s ease;
  cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-sm);
  animation: cardSlide .2s var(--ease) both;
  position: relative;
}
.cidade-card::after {
  content: '';
  position: absolute; right: 12px; top: 50%;
  width: 5px; height: 5px;
  border-right: 1.5px solid var(--text-tertiary);
  border-bottom: 1.5px solid var(--text-tertiary);
  transform: translateY(-50%) rotate(-45deg);
  transition: all .2s;
}
.cidade-card:hover {
  border-color: var(--accent-mid);
  background: var(--surface-2);
}
.cidade-card:hover::after {
  border-color: var(--accent);
}
.cidade-card:active { transform: scale(.99); }
.cidade-card:nth-child(1) { animation-delay: .02s; }
.cidade-card:nth-child(2) { animation-delay: .04s; }
.cidade-card:nth-child(3) { animation-delay: .06s; }
.cidade-card:nth-child(4) { animation-delay: .08s; }
.cidade-card:nth-child(5) { animation-delay: .10s; }
@keyframes cardSlide {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.cidade-icon {
  width: 38px; height: 38px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-mid);
}
.cidade-icon svg { width: 18px; height: 18px; }
.cidade-info { flex: 1; min-width: 0; padding-right: 20px; }
.cidade-nome { font-size: .84rem; font-weight: 700; color: var(--text-primary); }
.cidade-meta { font-size: .65rem; color: var(--text-tertiary); margin-top: 2px; font-weight: 500; }
.cidade-valor {
  font-size: .9rem; font-weight: 700;
  color: var(--success); flex-shrink: 0; margin-right: 14px;
  font-variant-numeric: tabular-nums;
}

/* ══════════════ SWITCH ══════════════ */
.relatorio-switch-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 16px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.relatorio-switch-row:hover { border-color: var(--accent-mid); }
.relatorio-switch-label { font-size: .8rem; font-weight: 600; color: var(--text-primary); }
.apple-switch { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.apple-switch-track {
  width: 44px; height: 26px; border-radius: 13px;
  background: rgba(255,255,255,0.12);
  position: relative;
  transition: background .2s ease;
}
.apple-switch.on .apple-switch-track { background: var(--success); }
.apple-switch-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform .2s var(--ease);
}
.apple-switch.on .apple-switch-thumb { transform: translateX(18px); }

/* ══════════════ RANKINGS ══════════════ */
.ranking-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.ranking-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background .1s;
}
.ranking-item:last-child { border-bottom: none; }
.ranking-item:hover { background: var(--surface-3); }
.r-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.r-pos {
  font-size: .9rem; font-weight: 800;
  color: var(--text-tertiary); width: 20px;
  text-align: center; flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.ranking-item:first-child .r-pos { color: var(--warning); }
.r-info { display: flex; flex-direction: column; min-width: 0; }
.r-nome { font-size: .8rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-meta { font-size: .6rem; color: var(--text-tertiary); margin-top: 1px; font-weight: 500; }
.r-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.r-valor { font-size: .84rem; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.r-bar-bg { width: 72px; height: 3px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.r-bar-fill { height: 100%; border-radius: 2px; transition: width .2s var(--ease); }
.r-bar-fill.blue { background: var(--accent); }
.r-bar-fill.purple { background: var(--purple); }

/* ══════════════ MODALS ══════════════ */
.modal-full {
  display: none; position: fixed; inset: 0; z-index: 5000;
  background: var(--bg);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal-full.show { display: block; animation: modalSlideUp .2s var(--ease); }
@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal-bar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(12, 14, 20, .94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-bar h2 {
  font-size: .85rem; font-weight: 700; color: var(--text-primary);
  letter-spacing: -.01em;
  display: flex; align-items: center; gap: 8px;
}
.modal-bar h2 svg { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; }
.modal-close {
  background: var(--surface-1); color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 5px 12px; font-weight: 600; cursor: pointer;
  transition: all .1s ease;
  font-family: var(--font); font-size: .75rem;
}
.modal-close:hover { background: var(--surface-3); color: var(--text-primary); border-color: var(--border-accent); }
.modal-close:active { transform: scale(.95); }
.modal-body { max-width: 640px; margin: 0 auto; padding: 16px 14px 36px; }

/* ── City detail modal ── */
.cidade-header {
  text-align: center; margin-bottom: 20px; padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.cidade-header .ch-total {
  font-size: 1.8rem; font-weight: 800;
  color: var(--success); margin-top: 8px;
  letter-spacing: -.03em;
}

.setor-block {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 10px; overflow: hidden;
  box-shadow: var(--shadow-sm);
  animation: cardSlide .2s var(--ease) both;
}
.setor-header {
  padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer;
  transition: background .1s ease;
}
.setor-header:active { background: var(--surface-3); }
.setor-header .sh-left { display: flex; align-items: center; gap: 10px; }
.setor-header .sh-badge {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700; flex-shrink: 0;
}
.setor-header .sh-badge svg { width: 14px; height: 14px; }
.sh-badge.edu { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-mid); }
.sh-badge.sau { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger-mid); }
.sh-badge.ass { background: var(--purple-soft); color: var(--purple); border: 1px solid var(--purple-mid); }
.sh-badge.adm { background: var(--warning-soft); color: var(--warning); border: 1px solid var(--warning-mid); }
.sh-badge.inf { background: var(--success-soft); color: var(--success); border: 1px solid var(--success-mid); }
.setor-header .sh-nome { font-size: .8rem; font-weight: 700; color: var(--text-primary); }
.setor-header .sh-total {
  font-size: .84rem; font-weight: 700; color: var(--success);
  font-variant-numeric: tabular-nums;
}

.setor-items { padding: 0 10px 10px; }
.item-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background .1s;
}
.item-row:last-child { border-bottom: none; }
.item-row:hover { background: var(--surface-3); border-radius: var(--r-sm); }
.item-id {
  font-family: var(--mono); font-size: .6rem; font-weight: 600;
  color: var(--text-tertiary); width: 54px; flex-shrink: 0;
}
.item-desc {
  flex: 1; font-size: .78rem; font-weight: 500; color: var(--text-primary);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item-valor {
  font-size: .75rem; font-weight: 700; font-family: var(--mono);
  color: var(--accent); flex-shrink: 0; text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ══════════════ OVERLAYS ══════════════ */
.success-overlay {
  display: none; position: fixed; inset: 0; z-index: 8000;
  background: rgba(12, 14, 20, .92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  align-items: center; justify-content: center;
  flex-direction: column; gap: 12px;
}
.success-overlay.show { display: flex; animation: successFade .2s ease; }
@keyframes successFade { from { opacity: 0; } to { opacity: 1; } }
.success-icon { font-size: 2.8rem; animation: successScale .2s var(--ease) .05s both; }
@keyframes successScale { from { transform: scale(0); } to { transform: scale(1); } }
.success-msg { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.success-detail { font-size: .75rem; color: var(--text-tertiary); font-family: var(--mono); }

.toast {
  position: fixed; bottom: 32px; left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 10px 20px;
  color: var(--text-primary);
  font-size: .78rem; font-weight: 600;
  z-index: 11000; opacity: 0;
  transition: all .2s var(--ease);
  box-shadow: var(--shadow-md);
  max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.sync-time {
  text-align: center; font-size: .6rem; color: var(--text-tertiary);
  margin-top: 16px; font-family: var(--mono); font-weight: 500;
  letter-spacing: .04em;
}
.empty-state { text-align: center; padding: 36px 20px; }
.empty-state .empty-text { font-size: .8rem; color: var(--text-tertiary); font-weight: 500; }

/* ══════════════ RESPONSIVE ══════════════ */
@media (max-width: 480px) {
  .container { padding: 12px 10px 50px; }
  .top-bar { padding: 10px 12px 8px; }
  .login-card { padding: 28px 20px 24px; }
  .modal-body { padding: 14px 10px 32px; }
  .cidade-card { padding: 10px 12px; }
  #cidadesGrid { grid-template-columns: 1fr; }
  .relatorio-switch-row { padding: 10px 12px; }
  .stat-card .s-value { font-size: 1.2rem; }
}
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body { background: var(--bg) !important; }
  .bg-scene, .top-bar, .menu-trigger, .badge, .relatorio-switch-row { display: none !important; }
}

/* ══════════════ CATALOGO ══════════════ */
.cat-meta {
  color: var(--text-tertiary); font-size: .6rem;
  margin-bottom: 12px; text-align: center;
  font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.cat-search {
  width: 100%; padding: 10px 14px; margin-bottom: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-primary); font-size: .85rem; outline: none;
  transition: all .2s ease;
}
.cat-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.cat-search::placeholder { color: var(--text-tertiary); }

.cat-item {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px; margin-bottom: 5px;
  display: flex; align-items: center; gap: 12px;
  transition: all .1s ease;
}
.cat-item:hover { border-color: var(--accent-mid); background: var(--surface-2); }
.cat-info {
  flex: 1; min-width: 0; border-right: 1px solid var(--border-subtle);
  padding-right: 12px; display: flex; align-items: center;
  gap: 8px; flex-wrap: nowrap; overflow: hidden;
}
.cat-cod {
  font-family: var(--mono); font-size: .6rem; font-weight: 700;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--accent-mid);
  padding: 2px 6px; border-radius: var(--r-sm);
  white-space: nowrap; flex-shrink: 0;
}
.cat-sep { color: var(--text-tertiary); font-weight: 400; flex-shrink: 0; }
.cat-desc { font-size: .82rem; font-weight: 600; color: var(--text-primary); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
@media (max-width: 480px) {
  .cat-info { padding-right: 8px; gap: 6px; }
  .cat-cod { font-size: .56rem; padding: 2px 5px; }
  .cat-desc { font-size: .78rem; }
}
.cat-action-wrap { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.cat-valor-wrap {
  flex-shrink: 0; display: flex; align-items: center; gap: 4px;
  background: var(--success-soft);
  border: 1px solid var(--success-mid);
  border-radius: var(--r-sm);
  padding: 4px 7px;
  transition: all .2s ease;
}
.cat-valor-wrap:focus-within { border-color: var(--success); box-shadow: 0 0 0 2px var(--success-soft); }
.cat-prefix { font-size: .65rem; font-weight: 700; color: var(--success); opacity: .7; }
.cat-input {
  width: 80px; text-align: right; background: transparent;
  color: var(--success); border: none;
  font-size: .88rem; font-weight: 700;
  outline: none; padding: 2px 0;
  font-variant-numeric: tabular-nums;
}
.cat-input:disabled { opacity: .4; cursor: not-allowed; }
@media (max-width: 480px) {
  .cat-item { padding: 10px 10px; gap: 8px; }
  .cat-input { width: 65px; font-size: .82rem; }
  .cat-prefix { font-size: .6rem; }
}
.cat-save-btn {
  background: var(--success); color: var(--bg);
  border: none; border-radius: var(--r-sm);
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .85rem; cursor: pointer;
  transition: all .1s ease;
}
.cat-save-btn:hover { filter: brightness(1.1); }
.cat-save-btn:active { transform: scale(.9); }
.cat-save-btn:disabled { background: rgba(255,255,255,0.1); color: var(--text-tertiary); cursor: not-allowed; transform: none; filter: none; }

.skeleton-card {
  height: 60px;
  background: var(--surface-1);
  border-radius: var(--r-lg); border: 1px solid var(--border);
  margin-bottom: 6px; animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer { 0%, 100% { opacity: .6; } 50% { opacity: 1; } }

/* ══════════════ IMPORTACAO IA ══════════════ */
.imp-label {
  display: block; font-size: .6rem; font-weight: 700;
  color: var(--text-tertiary); text-transform: uppercase;
  margin: 12px 0 4px 2px; letter-spacing: .08em;
}
.imp-select-row { display: flex; align-items: center; gap: 5px; }
.imp-add-btn, .imp-del-btn {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  border: 1px solid var(--border); font-size: .9rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all .1s ease;
  background: var(--surface-1);
}
.imp-add-btn { color: var(--success); }
.imp-add-btn:hover { background: var(--success-soft); border-color: var(--success-mid); }
.imp-add-btn:active { transform: scale(.9); }
.imp-del-btn { color: var(--danger); }
.imp-del-btn:hover { background: var(--danger-soft); border-color: var(--danger-mid); }
.imp-del-btn:active { transform: scale(.9); }

.imp-meta-box {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 12px;
  font-size: .78rem; line-height: 1.6;
}
.imp-meta-box div { margin-bottom: 2px; }
.imp-legenda {
  display: flex; flex-wrap: wrap; gap: 10px;
  font-size: .65rem; color: var(--text-secondary);
  margin-bottom: 10px; padding: 7px 10px;
  background: var(--surface-1); border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle);
}
.leg-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 3px; vertical-align: middle; }
.leg-dot.leg-ok { background: var(--success); }
.leg-dot.leg-novo { background: var(--accent); }
.leg-dot.leg-div { background: var(--warning); }
.leg-dot.leg-baixa { background: var(--danger); }

.imp-row {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-tertiary);
  border-radius: var(--r-md);
  padding: 10px 12px; margin-bottom: 6px;
  transition: border-color .2s, background .2s;
}
.imp-row.ok { border-left-color: var(--success); }
.imp-row.novo { border-left-color: var(--accent); background: rgba(107,138,173,.03); }
.imp-row.div { border-left-color: var(--warning); background: rgba(184,147,90,.03); }
.imp-row.baixa { border-left-color: var(--danger); background: rgba(184,90,90,.03); }
.imp-row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.imp-num { font-size: .65rem; font-weight: 800; color: var(--text-tertiary); width: 20px; text-align: center; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.imp-desc {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  color: var(--text-primary); font-size: .78rem; font-weight: 600;
  outline: none; font-family: var(--font);
  transition: border-color .2s;
}
.imp-desc:focus { border-color: var(--accent); }
.imp-row-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-bottom: 5px; }
.imp-row-grid label {
  display: flex; flex-direction: column;
  font-size: .52rem; color: var(--text-tertiary);
  text-transform: uppercase; gap: 2px; font-weight: 700; letter-spacing: .04em;
}
.imp-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 5px 6px; color: var(--text-primary);
  font-size: .72rem; font-weight: 600;
  outline: none; font-family: var(--mono);
  transition: border-color .2s;
  font-variant-numeric: tabular-nums;
}
.imp-input:focus { border-color: var(--accent); }
.imp-unit { color: var(--success) !important; }
.imp-dest-row { padding: 0 0 4px 0; }
.imp-dest-row label { display: flex; align-items: center; gap: 6px; font-size: .65rem; color: var(--accent); font-weight: 600; }
.imp-dest { flex: 1; background: rgba(107,138,173,0.10); border: 1px dashed var(--accent) !important; color: var(--accent) !important; font-weight: 600 !important; font-size: .72rem !important; }
.imp-status-msg { font-size: .65rem; color: var(--text-secondary); padding: 3px 0; font-weight: 500; line-height: 1.4; }
.imp-remove {
  background: var(--danger-soft); color: var(--danger);
  border: 1px solid var(--danger-mid); border-radius: var(--r-sm);
  padding: 4px 10px; font-size: .65rem; font-weight: 700;
  cursor: pointer; margin-top: 2px;
  transition: all .1s;
}
.imp-remove:hover { background: var(--danger-mid); }
.imp-remove:active { transform: scale(.95); }
.imp-total-box {
  background: var(--surface-1); border: 1px solid var(--success-mid);
  color: var(--text-primary); padding: 14px; border-radius: var(--r-lg);
  text-align: center; font-size: .85rem; margin: 14px 0;
  font-weight: 600;
}
.imp-total-box::before { display: none; }
.imp-actions { display: flex; gap: 6px; margin-top: 14px; }
.imp-btn-cancel, .imp-btn-confirm {
  flex: 1; padding: 11px; border-radius: var(--r-md);
  border: none; font-weight: 700; font-size: .8rem;
  cursor: pointer; font-family: var(--font);
  transition: all .2s ease;
}
.imp-btn-cancel {
  background: var(--surface-1); color: var(--text-secondary);
  border: 1px solid var(--border);
}
.imp-btn-cancel:hover { background: var(--surface-3); color: var(--text-primary); }
.imp-btn-cancel:active { transform: scale(.98); }
.imp-btn-confirm {
  background: var(--accent); color: #fff;
  border: 1px solid transparent;
}
.imp-btn-confirm:hover { filter: brightness(1.08); }
.imp-btn-confirm:active { transform: scale(.98); }
.imp-btn-confirm:disabled { opacity: .35; cursor: not-allowed; transform: none; filter: none; }
@media (max-width: 480px) { .imp-row-grid { grid-template-columns: repeat(2, 1fr); } }

/* ══════════════ ASSISTENTE IA ══════════════ */
.ia-intro {
  background: var(--surface-1);
  border: 1px solid var(--purple-mid);
  border-radius: var(--r-lg);
  padding: 12px 14px; margin-bottom: 12px;
  font-size: .78rem; color: var(--text-secondary); line-height: 1.6;
}
.ia-intro::before { display: none; }

.ia-cmd-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px; margin-bottom: 6px;
  cursor: pointer;
  transition: all .2s ease;
  position: relative; overflow: hidden;
}
.ia-cmd-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--purple);
  border-radius: 0 2px 2px 0;
  transition: background .2s;
}
.ia-cmd-card::after {
  content: '';
  position: absolute; right: 12px; top: 50%;
  width: 5px; height: 5px;
  border-right: 1.5px solid var(--text-tertiary);
  border-bottom: 1.5px solid var(--text-tertiary);
  transform: translateY(-50%) rotate(-45deg);
  transition: all .2s;
}
.ia-cmd-card:hover {
  border-color: var(--accent-mid);
  background: var(--surface-2);
}
.ia-cmd-card:hover::before { background: var(--accent); }
.ia-cmd-card:hover::after { border-color: var(--accent); }
.ia-cmd-card:active { transform: scale(.99); }
.ia-cmd-nome { font-size: .84rem; font-weight: 700; color: var(--text-primary); margin-bottom: 3px; }
.ia-cmd-desc { font-size: .72rem; color: var(--text-secondary); line-height: 1.4; margin-bottom: 5px; padding-right: 18px; }
.ia-cmd-meta { font-size: .6rem; color: var(--text-tertiary); font-family: var(--mono); font-weight: 600; }

.ia-resp-header {
  background: var(--surface-1);
  border: 1px solid var(--purple-mid);
  border-radius: var(--r-lg);
  padding: 10px 12px; margin-bottom: 12px;
}
.ia-resp-header::before { display: none; }
.ia-resp-cmd { font-size: .78rem; font-weight: 700; color: var(--purple); font-family: var(--mono); margin-bottom: 2px; }
.ia-resp-custo { font-size: .6rem; color: var(--text-tertiary); font-family: var(--mono); }
.ia-resp-texto {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  font-size: .8rem; line-height: 1.7;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%; box-sizing: border-box;
  max-height: 60vh; overflow-y: auto;
}
.ia-code-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px; margin: 8px 0;
  overflow-x: auto;
  font-size: .68rem; font-family: var(--mono);
  line-height: 1.5; color: var(--success);
  white-space: pre;
}
.ia-code-block code { font-family: inherit; }
.ia-resp-texto strong { color: var(--accent); font-weight: 700; }
.ia-resp-actions { display: flex; gap: 6px; margin-top: 14px; }
.ia-resp-actions .imp-btn-cancel, .ia-resp-actions .imp-btn-confirm { flex: 1; }

/* ══════════════ POVOAR CATALOGO ══════════════ */
.ia-pov-intro {
  background: var(--surface-1);
  border: 1px solid var(--success-mid);
  border-radius: var(--r-lg);
  padding: 12px 14px; margin-bottom: 12px;
  font-size: .78rem; color: var(--text-secondary); line-height: 1.6;
}
.ia-pov-intro::before { display: none; }
.ia-pov-intro strong { color: var(--success); }

.pov-resumo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 14px; }
.pov-stat {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 12px 8px; text-align: center;
}
.pov-stat.novo { border-color: var(--accent-mid); }
.pov-stat.ja { border-color: var(--warning-mid); }
.pov-stat-num { font-size: 1.3rem; font-weight: 800; color: var(--text-primary); line-height: 1; font-variant-numeric: tabular-nums; }
.pov-stat.novo .pov-stat-num { color: var(--accent); }
.pov-stat.ja .pov-stat-num { color: var(--warning); }
.pov-stat-lbl {
  font-size: .55rem; color: var(--text-tertiary);
  text-transform: uppercase; font-weight: 700;
  letter-spacing: .08em; margin-top: 4px;
}

.pov-aviso {
  background: var(--warning-soft);
  border: 1px solid var(--warning-mid);
  border-radius: var(--r-sm);
  padding: 8px 12px; font-size: .72rem;
  color: var(--text-secondary); margin-bottom: 12px; line-height: 1.5;
}

.pov-row {
  background: var(--surface-1); border: 1px solid var(--border);
  border-left: 3px solid var(--text-tertiary);
  border-radius: var(--r-md); padding: 10px 12px; margin-bottom: 6px;
  transition: border-color .2s, background .2s;
}
.pov-row.alta { border-left-color: var(--success); }
.pov-row.media { border-left-color: var(--warning); background: rgba(184,147,90,.02); }
.pov-row.baixa { border-left-color: var(--danger); background: rgba(184,90,90,.02); }
.pov-row.ja-existe { border-left-color: var(--text-tertiary); opacity: .45; background: var(--surface-2); }

.pov-row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pov-check { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.pov-check:disabled { cursor: not-allowed; opacity: .4; }
.pov-desc {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 8px; color: var(--text-primary);
  font-size: .78rem; font-weight: 600;
  outline: none; font-family: var(--font);
  transition: border-color .2s;
}
.pov-desc:focus { border-color: var(--accent); }
.pov-row.ja-existe .pov-desc { background: var(--surface-3); }

.pov-remove-btn {
  width: 28px; height: 28px; border-radius: var(--r-sm);
  border: 1px solid var(--danger-mid); background: var(--danger-soft); color: var(--danger);
  font-size: .72rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all .1s ease;
}
.pov-remove-btn:hover { background: var(--danger-mid); }
.pov-remove-btn:active { transform: scale(.88); }

.pov-row-grid { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 4px; margin-bottom: 5px; }
.pov-row-grid label {
  display: flex; flex-direction: column;
  font-size: .52rem; color: var(--text-tertiary);
  text-transform: uppercase; gap: 2px; font-weight: 700; letter-spacing: .04em;
}
.pov-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 5px 6px; color: var(--text-primary);
  font-size: .75rem; font-weight: 600;
  outline: none; font-family: var(--mono);
  transition: border-color .2s;
  font-variant-numeric: tabular-nums;
}
.pov-input:focus { border-color: var(--accent); }
.pov-preco { color: var(--success) !important; font-size: .82rem !important; }
.pov-status { font-size: .65rem; color: var(--text-secondary); padding: 2px 0; font-weight: 500; line-height: 1.4; }

@media (max-width: 480px) {
  .pov-resumo { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .pov-stat-num { font-size: 1.1rem; }
  .pov-stat-lbl { font-size: .5rem; }
}

/* ══════════════ FOCUS ACCESSIBILITY ══════════════ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:focus-visible, .menu-item:focus-visible, .ia-cmd-card:focus-visible, .cidade-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ══════════════ REQUISIÇÃO GROUP BLOCK ══════════════ */
.req-group-block {
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-1);
}
.req-group-block + .req-group-block {
  margin-top: 16px;
}
.req-group-block .item-row {
  border-left: 3px solid var(--accent-mid);
  margin: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
}
.req-group-block .item-row:last-child {
  border-bottom: none;
}
.req-group-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  margin: 0;
  background: var(--surface-2);
  border-bottom: 2px solid var(--accent-mid);
  border-radius: 0;
  cursor: pointer;
  transition: all .2s var(--ease);
}
.req-group-header:hover {
  background: var(--surface-3);
}
.req-group-header:active { transform: scale(0.99); }
.req-group-left { display: flex; align-items: center; gap: 10px; }
.req-group-id {
  font-family: var(--mono); font-size: .72rem; font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-mid);
  padding: 2px 8px; border-radius: var(--r-sm);
}
.req-group-count { font-size: .68rem; color: var(--text-tertiary); font-weight: 500; }
.req-group-right { display: flex; align-items: center; gap: 10px; }
.req-group-total {
  font-size: .82rem; font-weight: 700; color: var(--success);
  font-variant-numeric: tabular-nums;
}
.req-group-edit {
  font-size: .62rem; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: .06em;
  opacity: .7; transition: opacity .2s;
  background: var(--accent-soft); padding: 2px 6px; border-radius: var(--r-sm);
}
.req-group-header:hover .req-group-edit { opacity: 1; }

/* ══════════════ SAFE AREA (NOTCH) ══════════════ */
@supports (padding: env(safe-area-inset-top)) {
  .top-bar { padding-top: calc(12px + env(safe-area-inset-top)); }
  .toast { bottom: calc(32px + env(safe-area-inset-bottom)); }
  .container { padding-bottom: calc(50px + env(safe-area-inset-bottom)); }
}

/* ═══════════════════════════════════════════════════
   v8.3 — Cabeçalho de Requisição (limpo e profissional)
   ═══════════════════════════════════════════════════ */
.req-group-header-pro {
  background: linear-gradient(135deg, rgba(30, 58, 95, 0.18), rgba(44, 82, 130, 0.10));
  border: 1px solid rgba(107, 138, 173, 0.18);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all .2s ease;
}
.req-group-header-pro:hover {
  border-color: rgba(107, 138, 173, 0.35);
  background: linear-gradient(135deg, rgba(30, 58, 95, 0.25), rgba(44, 82, 130, 0.15));
}

/* Linha 1: ID + Total + Ações */
.rgh-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.rgh-top-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.rgh-id {
  background: rgba(107, 138, 173, 0.22);
  color: var(--text-primary, #e8edf4);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.rgh-count {
  color: var(--text-tertiary, #8a96a8);
  font-size: 0.7rem;
  font-weight: 500;
}
.rgh-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.rgh-total {
  color: #6bcf7f;
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
}
.rgh-btn {
  background: rgba(107, 138, 173, 0.12);
  border: 1px solid rgba(107, 138, 173, 0.25);
  color: var(--text-secondary, #b8c2d1);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  font-family: var(--font, 'Inter', sans-serif);
  line-height: 1;
}
.rgh-btn:hover {
  background: rgba(107, 138, 173, 0.25);
  color: #fff;
  transform: translateY(-1px);
}
.rgh-btn-edit {
  background: rgba(107, 138, 173, 0.15);
}
.rgh-btn-print {
  padding: 5px 8px;
  font-size: 0.85rem;
}

/* Linha 2: Chips de meta (obs + data) */
.rgh-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(107, 138, 173, 0.12);
}
.rgh-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(12, 14, 20, 0.4);
  border: 1px solid rgba(107, 138, 173, 0.18);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-secondary, #b8c2d1);
  line-height: 1.3;
}
.rgh-chip-ico {
  font-size: 0.72rem;
  opacity: 0.85;
}
.rgh-chip-obs {
  color: #8ab4f8;
  border-color: rgba(138, 180, 248, 0.25);
  background: rgba(138, 180, 248, 0.08);
}
.rgh-chip-data {
  color: #b8c2d1;
}

/* Responsivo — celular pequeno */
@media (max-width: 380px) {
  .rgh-top { flex-wrap: wrap; }
  .rgh-top-right { width: 100%; justify-content: flex-end; }
  .rgh-id { font-size: 0.68rem; }
  .rgh-total { font-size: 0.88rem; }
}

/* ═══════════════════════════════════════════════════
   v8.3 — Botão Adicionar Item Manual (premium)
   ═══════════════════════════════════════════════════ */
.imp-add-item-btn {
  width: 100%;
  background: linear-gradient(135deg, rgba(30, 58, 95, 0.25), rgba(44, 82, 130, 0.15));
  border: 1.5px dashed rgba(107, 138, 173, 0.4);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 14px 0 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all .25s ease;
  font-family: var(--font, 'Inter', sans-serif);
  color: var(--text-secondary, #b8c2d1);
  text-align: left;
}
.imp-add-item-btn:hover {
  background: linear-gradient(135deg, rgba(30, 58, 95, 0.4), rgba(44, 82, 130, 0.25));
  border-color: rgba(138, 180, 248, 0.55);
  border-style: solid;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(30, 58, 95, 0.35);
}
.imp-add-item-btn:active {
  transform: translateY(0);
}
.imp-add-item-btn .iaim-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #2c5282, #1e3a5f);
  color: #fff;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 300;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(30, 58, 95, 0.4);
}
.imp-add-item-btn .iaim-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.imp-add-item-btn .iaim-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary, #e8edf4);
  letter-spacing: 0.2px;
}
.imp-add-item-btn .iaim-sub {
  font-size: 0.7rem;
  color: var(--text-tertiary, #8a96a8);
  font-weight: 400;
}
