:root {
  --bg: #050a15;
  --bg-elev: #0a1326;
  --card: rgba(14, 24, 46, 0.86);
  --card-solid: #0f1b33;
  --card-2: #162544;
  --card-hover: #1b2d52;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.26);
  --border-glow: rgba(96, 165, 250, 0.35);
  --text: #f4f7fc;
  --text-soft: #cbd5e1;
  --muted: #8fa3bf;
  --blue: #3b82f6;
  --blue-bright: #60a5fa;
  --blue-soft: rgba(59, 130, 246, 0.15);
  --emerald: #10b981;
  --emerald-bright: #34d399;
  --emerald-soft: rgba(16, 185, 129, 0.14);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.15);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.15);
  --violet: #8b5cf6;
  --cyan: #06b6d4;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow-card: 0 10px 30px -12px rgba(2, 6, 23, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --shadow-elev: 0 20px 45px -16px rgba(2, 6, 23, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --sidebar-w: 276px;
  --rail-w: 84px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  min-height: 100vh;
}

/* Brilho ambiente em camada GPU isolada (zero repintura ao rolar no tablet!) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse 75% 55% at 10% -10%, rgba(37, 99, 235, 0.16), transparent 60%),
    radial-gradient(ellipse 60% 45% at 95% 5%, rgba(16, 185, 129, 0.10), transparent 55%),
    radial-gradient(ellipse 50% 40% at 50% 105%, rgba(59, 130, 246, 0.07), transparent 60%);
  transform: translateZ(0);
  backface-visibility: hidden;
}

h1, h2, h3, h4, .display-font {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.22);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.38);
}

/* ==================== APP SHELL & SIDEBAR ==================== */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0a1326 0%, #070d1b 100%);
  border-right: 1px solid var(--border);
  padding: 20px 14px calc(18px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 45;
  transform: translateZ(0);
  backface-visibility: hidden;
  transition: width 0.2s cubic-bezier(0.22, 1, 0.36, 1), padding 0.2s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px;
  min-width: 0;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 52%, #10b981 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.6px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 10px 24px -6px rgba(37, 99, 235, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.brand-meta {
  min-width: 0;
}

.brand-meta h1 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-meta span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.rail-toggle-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 13px;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13.8px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.16s ease;
  position: relative;
  white-space: nowrap;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
}

.nav-btn.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(16, 185, 129, 0.13));
  border-color: rgba(96, 165, 250, 0.36);
  color: #fff;
  box-shadow: 0 8px 20px -10px rgba(37, 99, 235, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.nav-btn.active::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #60a5fa, #34d399);
}

.nav-btn .nav-icon {
  font-size: 19px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-widgets {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mini-widget {
  background: rgba(17, 29, 54, 0.72);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 11px 12px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.mini-widget:hover {
  border-color: var(--border-strong);
}

.mini-widget-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.65px;
  color: var(--muted);
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mini-dots {
  display: flex;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
}

.sig-sidebar-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(96, 165, 250, 0.42);
  background: rgba(37, 99, 235, 0.1);
  color: #dbeafe;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
}

.sig-sidebar-btn:hover {
  background: rgba(37, 99, 235, 0.2);
  border-color: #60a5fa;
}

.sig-sidebar-btn.saved {
  border-style: solid;
  border-color: rgba(16, 185, 129, 0.42);
  background: rgba(16, 185, 129, 0.11);
  color: #a7f3d0;
}

/* ==================== MOBILE TOPBAR & BOTTOM BAR ==================== */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(58px + var(--safe-top));
  padding: var(--safe-top) 14px 0;
  background: #080f1e;
  border-bottom: 1px solid var(--border);
  z-index: 50;
  align-items: center;
  justify-content: space-between;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.mobile-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(68px + var(--safe-bottom));
  padding: 6px 4px calc(6px + var(--safe-bottom));
  background: #080f1e;
  border-top: 1px solid var(--border);
  z-index: 50;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.bottom-nav-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  min-height: 50px;
  transition: all 0.15s ease;
}

.bottom-nav-btn .nav-icon {
  font-size: 19px;
}

.bottom-nav-btn.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.24), rgba(16, 185, 129, 0.16));
}

/* ==================== MAIN CONTENT ==================== */
.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  padding: 26px 30px 48px;
  max-width: 1480px;
  width: 100%;
  transition: margin-left 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.tab-panel {
  display: none;
  animation: panelFade 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.tab-panel.active {
  display: block;
}

@keyframes panelFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 22px;
}

.page-header h2 {
  margin: 0;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.page-header p {
  margin: 5px 0 0;
  font-size: 13.5px;
  color: var(--muted);
  max-width: 680px;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ==================== SMART ALERTS ==================== */
.alerts-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.alerts-bar:empty {
  display: none;
  margin-bottom: 0;
}

.alert-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 13px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.14), rgba(245, 158, 11, 0.06));
  color: #fde68a;
  box-shadow: 0 6px 18px -10px rgba(245, 158, 11, 0.4);
}

.alert-banner.danger {
  border-color: rgba(239, 68, 68, 0.42);
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.16), rgba(239, 68, 68, 0.06));
  color: #fecaca;
}

/* ==================== GRIDS & CARDS ==================== */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.card {
  background: linear-gradient(180deg, rgba(13, 23, 45, 0.96) 0%, rgba(10, 18, 36, 0.96) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.55);
  min-width: 0;
  max-width: 100%;
  contain: layout style;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.card-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-gap {
  margin-top: 20px;
}

/* ==================== HERO CARTÃO BLACK EXECUTIVO (TAB 1) ==================== */
.ks-hero-grid {
  display: grid;
  grid-template-columns: 1.52fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}

.ks-exec-card {
  position: relative;
  border-radius: 22px;
  padding: 24px 26px;
  background:
    radial-gradient(circle at 88% 18%, rgba(16, 185, 129, 0.24), transparent 42%),
    radial-gradient(circle at 12% 90%, rgba(59, 130, 246, 0.28), transparent 48%),
    linear-gradient(135deg, #0b162d 0%, #102347 46%, #071124 100%);
  border: 1px solid rgba(147, 197, 253, 0.24);
  box-shadow: var(--shadow-elev), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}

.ks-exec-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.045) 48%, transparent 62%);
  pointer-events: none;
}

.ks-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.ks-card-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ks-card-chip {
  width: 46px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #fde68a 0%, #d97706 55%, #fef3c7 100%);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 0 0 1px rgba(120, 53, 15, 0.25), 0 4px 10px rgba(0, 0, 0, 0.35);
  position: relative;
  flex-shrink: 0;
}

.ks-card-chip::before {
  content: '';
  position: absolute;
  inset: 7px 10px;
  border: 1px solid rgba(120, 53, 15, 0.35);
  border-radius: 3px;
}

.ks-status-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 99px;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.38);
  color: #6ee7b7;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.ks-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 10px #34d399;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(1.25); }
}

.ks-cnpj-hero {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(5, 10, 21, 0.52);
  border: 1px solid rgba(148, 163, 184, 0.18);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.ks-cnpj-hero:hover {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(5, 10, 21, 0.72);
}

.ks-cnpj-num {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
  line-height: 1.15;
}

.ks-card-meta-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ks-card-meta-item {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 11px;
  padding: 9px 11px;
}

.ks-card-meta-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}

.ks-card-meta-val {
  font-size: 11.4px;
  font-weight: 700;
  color: #f1f5f9;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ks-action-dock {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Quick Status Panel beside Hero Card */
.ks-pulse-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.pulse-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
  box-shadow: var(--shadow-card);
}

.pulse-tile:hover {
  transform: translateY(-2px);
  border-color: var(--border-glow);
  background: rgba(22, 37, 68, 0.88);
}

.pulse-tile-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.45px;
}

.pulse-tile-val {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.4px;
}

.pulse-tile-sub {
  font-size: 11.5px;
  color: var(--muted);
}

/* ==================== COLA RÁPIDA NFS-e (TABLET) ==================== */
.nfse-cheat-card {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.24) 0%, rgba(14, 24, 46, 0.92) 55%, rgba(30, 58, 138, 0.22) 100%);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.nfse-steps-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.nfse-step-box {
  background: rgba(5, 10, 21, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 13px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.nfse-step-num {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6ee7b7;
}

.nfse-step-val {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
}

.nfse-step-desc {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.35;
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(22, 37, 68, 0.85);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--blue-bright);
  background: var(--card-hover);
  transform: translateY(-1px);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-color: rgba(96, 165, 250, 0.6);
  color: #fff;
  box-shadow: 0 8px 20px -8px rgba(37, 99, 235, 0.75);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  filter: brightness(1.06);
}

.btn-emerald {
  background: linear-gradient(135deg, #059669, #047857);
  border-color: rgba(52, 211, 153, 0.55);
  color: #fff;
  box-shadow: 0 8px 20px -8px rgba(16, 185, 129, 0.65);
}

.btn-emerald:hover {
  background: linear-gradient(135deg, #10b981, #059669);
  filter: brightness(1.06);
}

.btn-amber {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.45);
  color: #fde68a;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.36);
  color: #fca5a5;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #f87171;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 9px;
}

.btn-icon-copy {
  min-height: 38px;
  padding: 6px 13px;
  border-radius: 9px;
  border: 1px solid rgba(96, 165, 250, 0.35);
  background: var(--blue-soft);
  color: #93c5fd;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.btn-icon-copy:hover {
  background: var(--blue);
  color: #fff;
}

.btn-icon-copy.copied {
  background: var(--emerald);
  border-color: #34d399;
  color: #fff;
}

/* ==================== COPY ROWS & SHORTCUTS & CNAES ==================== */
.copy-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.copy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  background: rgba(6, 12, 26, 0.62);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.copy-row:hover {
  border-color: var(--border-strong);
  background: rgba(11, 20, 40, 0.8);
}

.copy-row-info {
  min-width: 0;
  flex: 1;
}

.copy-row-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.55px;
  color: var(--muted);
  font-weight: 600;
}

.copy-row-val {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-top: 2px;
  word-break: break-word;
}

.shortcut-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  border-radius: 14px;
  background: rgba(6, 12, 26, 0.65);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: all 0.16s ease;
  min-height: 70px;
  position: relative;
  overflow: hidden;
}

.shortcut-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--sc-accent, var(--blue));
}

.shortcut-card:hover {
  border-color: var(--sc-accent, var(--blue));
  transform: translateY(-2px);
  background: rgba(20, 34, 64, 0.88);
}

.shortcut-title {
  font-size: 14.5px;
  font-weight: 700;
}

.shortcut-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.shortcut-arrow {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.14);
  color: #93c5fd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex-shrink: 0;
}

.cnae-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 12px;
  background: rgba(6, 12, 26, 0.58);
  border: 1px solid var(--border);
  transition: border-color 0.15s ease;
}

.cnae-item:hover {
  border-color: var(--border-strong);
}

.cnae-code {
  font-size: 13.5px;
  font-weight: 700;
  color: #60a5fa;
}

.cnae-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 700;
  margin-left: 6px;
}

.cnae-badge-principal {
  background: var(--emerald-soft);
  color: #34d399;
}

.cnae-badge-cat {
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
}

/* ==================== SIGNATURE WIDGET & MODAL (TABLET STYLUS) ==================== */
.sig-box-inline {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(16, 185, 129, 0.08));
  border: 1px solid rgba(96, 165, 250, 0.28);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sig-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.sig-box-title {
  font-size: 13px;
  font-weight: 700;
  color: #dbeafe;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sig-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.sig-thumb-paper {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 6px 10px;
  height: 54px;
  min-width: 150px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sig-thumb-paper img {
  max-height: 42px;
  max-width: 170px;
  object-fit: contain;
}

.sig-modal {
  max-width: 780px !important;
  padding: 20px 22px !important;
}

.sig-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.sig-pen-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sig-color-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sig-color-btn.active {
  transform: scale(1.12);
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

.sig-canvas-wrap {
  position: relative;
  width: 100%;
  height: 300px;
  background: #ffffff;
  border-radius: 16px;
  border: 2px solid rgba(59, 130, 246, 0.45);
  box-shadow: inset 0 2px 10px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.sig-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

.sig-guide-line {
  position: absolute;
  left: 36px;
  right: 36px;
  bottom: 54px;
  border-bottom: 1.5px dashed #cbd5e1;
  pointer-events: none;
}

.sig-guide-text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 24px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  pointer-events: none;
}

.sig-input-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  padding: 4px 10px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.08);
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  pointer-events: none;
}

/* ==================== PIX KIOSK / FULLSCREEN MODAL ==================== */
.modal.pix-kiosk {
  max-width: 560px !important;
  text-align: center;
  background: linear-gradient(160deg, #071226 0%, #0a1f36 100%) !important;
  border-color: rgba(52, 211, 153, 0.5) !important;
}

.modal.pix-kiosk #pixQrImg {
  width: 300px !important;
  height: 300px !important;
}

/* ==================== KPIs, COFRE, CAIXA, JOBS, CHAT ==================== */
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 15px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-card);
}

.kpi-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-green { background: var(--emerald); box-shadow: 0 0 12px rgba(16, 185, 129, 0.7); }
.dot-yellow { background: var(--amber); box-shadow: 0 0 12px rgba(245, 158, 11, 0.7); }
.dot-red { background: var(--red); box-shadow: 0 0 12px rgba(239, 68, 68, 0.7); }
.dot-gray { background: #64748b; }

.kpi-num {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.05;
}

.kpi-lbl {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* ==================== COFRE / DOCUMENTOS & CERTIDÕES PRO ==================== */
.cofre-hero-card {
  position: relative;
  border-radius: 22px;
  padding: 22px 24px;
  background:
    radial-gradient(circle at 90% 15%, rgba(16, 185, 129, 0.22), transparent 44%),
    radial-gradient(circle at 10% 90%, rgba(59, 130, 246, 0.24), transparent 48%),
    linear-gradient(135deg, #0b162d 0%, #102446 50%, #071225 100%);
  border: 1px solid rgba(52, 211, 153, 0.28);
  box-shadow: var(--shadow-elev), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cofre-hero-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.cofre-ready-pct {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
  color: #34d399;
}

.cofre-semaforo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.semaforo-tile {
  background: rgba(5, 10, 21, 0.56);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: all 0.15s ease;
}

.semaforo-tile:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  background: rgba(12, 22, 44, 0.8);
}

.semaforo-tile.active {
  border-color: var(--blue-bright);
  background: rgba(37, 99, 235, 0.18);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.35);
}

.cert-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.cert-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.cert-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
}

.cert-icon-box {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(96, 165, 250, 0.22);
}

.cert-green .cert-icon-box { background: rgba(16, 185, 129, 0.14); border-color: rgba(52, 211, 153, 0.3); }
.cert-yellow .cert-icon-box { background: rgba(245, 158, 11, 0.15); border-color: rgba(251, 191, 36, 0.32); }
.cert-red .cert-icon-box { background: rgba(239, 68, 68, 0.15); border-color: rgba(248, 113, 113, 0.32); }
.cert-gray .cert-icon-box { background: rgba(148, 163, 184, 0.12); border-color: rgba(148, 163, 184, 0.24); }

.cert-life-track {
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: rgba(5, 10, 21, 0.72);
  overflow: hidden;
}

.cert-life-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.3s ease;
}

.cert-code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(5, 10, 21, 0.58);
  border: 1px solid var(--border);
  font-size: 12px;
}

.cert-green::before { background: var(--emerald); }
.cert-yellow::before { background: var(--amber); }
.cert-red::before { background: var(--red); }
.cert-gray::before { background: #475569; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.pill-green { background: var(--emerald-soft); color: #34d399; }
.pill-yellow { background: var(--amber-soft); color: #fcd34d; }
.pill-red { background: var(--red-soft); color: #fca5a5; }
.pill-gray { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }
.pill-blue { background: var(--blue-soft); color: #93c5fd; }

.cert-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 12.5px;
  color: var(--muted);
}

.cert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.mov-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 13px;
  background: rgba(6, 12, 26, 0.68);
  border: 1px solid var(--border);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.mov-row:hover {
  border-color: var(--border-strong);
  background: rgba(11, 20, 40, 0.85);
}

.mov-row.entrada { border-left: 3px solid #10b981; }
.mov-row.saida { border-left: 3px solid #ef4444; }

.mov-cat-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(96, 165, 250, 0.22);
}

.mov-row.entrada .mov-cat-icon {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(52, 211, 153, 0.28);
}

.mov-row.saida .mov-cat-icon {
  background: rgba(239, 68, 68, 0.13);
  border-color: rgba(248, 113, 113, 0.26);
}

/* ==================== CAIXA CORA & PARCEIROS PRO ==================== */
.cora-hero-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.cora-bank-card {
  position: relative;
  border-radius: 22px;
  padding: 24px 26px;
  background:
    radial-gradient(circle at 92% 14%, rgba(254, 62, 109, 0.22), transparent 44%),
    radial-gradient(circle at 8% 92%, rgba(16, 185, 129, 0.22), transparent 46%),
    linear-gradient(135deg, #0b152b 0%, #111f3e 52%, #081224 100%);
  border: 1px solid rgba(254, 62, 109, 0.26);
  box-shadow: var(--shadow-elev), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.cora-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 99px;
  background: rgba(254, 62, 109, 0.16);
  border: 1px solid rgba(254, 62, 109, 0.38);
  color: #fda4af;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.cora-balances-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.cora-bal-box {
  background: rgba(5, 10, 21, 0.56);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  padding: 14px 16px;
}

.cora-bal-box.primary-livre {
  border-color: rgba(52, 211, 153, 0.35);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(5, 10, 21, 0.62));
}

.cora-bal-lbl {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.65px;
  color: var(--muted);
  font-weight: 700;
}

.cora-bal-val {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.6px;
  margin-top: 4px;
  line-height: 1.1;
}

.cora-split-wrap {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.cora-split-bar {
  width: 100%;
  height: 10px;
  border-radius: 99px;
  background: rgba(5, 10, 21, 0.72);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
}

.cora-seg-livre { background: linear-gradient(90deg, #10b981, #34d399); transition: width 0.3s ease; }
.cora-seg-comp { background: linear-gradient(90deg, #f59e0b, #fbbf24); transition: width 0.3s ease; }
.cora-seg-res { background: linear-gradient(90deg, #8b5cf6, #a78bfa); transition: width 0.3s ease; }

.cora-split-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 11.5px;
  color: var(--text-soft);
}

.cora-radar-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.radar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 13px;
  background: rgba(5, 10, 21, 0.58);
  border: 1px solid var(--border);
}

.radar-row.highlight-blue { border-left: 3px solid #3b82f6; }
.radar-row.highlight-amber { border-left: 3px solid #f59e0b; }
.radar-row.highlight-red { border-left: 3px solid #ef4444; }

.das-months-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.das-month-pill {
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(5, 10, 21, 0.58);
  color: var(--text-soft);
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.das-month-pill:hover {
  transform: translateY(-2px);
  border-color: var(--blue-bright);
}

.das-month-pill.pago {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(52, 211, 153, 0.48);
  color: #6ee7b7;
}

.das-month-pill.atrasado {
  background: rgba(239, 68, 68, 0.13);
  border-color: rgba(248, 113, 113, 0.38);
  color: #fecaca;
}

.das-month-pill.aberto {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(251, 191, 36, 0.38);
  color: #fde68a;
}

.extrato-summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.extrato-mini-stat {
  background: rgba(5, 10, 21, 0.56);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 9px 11px;
}

.parceiro-card {
  padding: 14px;
  border-radius: 15px;
  background: rgba(6, 12, 26, 0.68);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.parceiro-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.parceiro-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  color: #fff;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 14px -6px rgba(37, 99, 235, 0.65);
}

.parceiro-pix-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.chk-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 11px;
  background: rgba(6, 12, 26, 0.65);
  border: 1px solid var(--border);
  cursor: pointer;
}

.chk-row.done {
  border-color: rgba(16, 185, 129, 0.42);
  background: rgba(16, 185, 129, 0.11);
}

.chk-row.done span {
  text-decoration: line-through;
  color: var(--muted);
}

.cost-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.15);
}

.cost-line:last-child {
  border-bottom: none;
}

/* Forms & Inputs */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

input, select, textarea {
  width: 100%;
  background: rgba(5, 10, 21, 0.78);
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  padding: 10px 13px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  min-height: 46px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--blue-bright);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

textarea {
  min-height: 92px;
  resize: vertical;
}

/* Chips */
.chips-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.chips-scroll::-webkit-scrollbar {
  display: none;
}

.chip {
  padding: 8px 15px;
  min-height: 40px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  background: rgba(14, 24, 46, 0.85);
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.chip:hover {
  border-color: var(--blue-bright);
  color: #fff;
}

.chip.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-color: #60a5fa;
  color: #fff;
  box-shadow: 0 6px 16px -8px rgba(37, 99, 235, 0.8);
}

/* ==================== GERADOR DE PDFs & REFERÊNCIA DE PREÇOS ==================== */
.gen-selector-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.gen-sel-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: all 0.16s ease;
  box-shadow: var(--shadow-card);
}

.gen-sel-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  background: rgba(20, 34, 64, 0.88);
}

.gen-sel-card.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.24), rgba(16, 185, 129, 0.14));
  border-color: rgba(96, 165, 250, 0.58);
  box-shadow: 0 10px 26px -12px rgba(37, 99, 235, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.gen-sel-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.gen-sel-title {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

.gen-sel-sub {
  font-size: 11.5px;
  color: var(--muted);
}

/* Modelos rápidos em grade completa (zero corte horizontal!) */
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tpl-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(6, 12, 26, 0.68);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tpl-card:hover {
  border-color: var(--blue-bright);
  background: rgba(24, 41, 76, 0.9);
  transform: translateY(-1px);
}

.tpl-card-name {
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.25;
}

.tpl-card-price {
  font-size: 11px;
  color: #34d399;
  font-weight: 700;
  white-space: nowrap;
}

/* Catálogo de Referência de Valores */
.price-ref-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(5, 10, 21, 0.64);
  border: 1px solid var(--border);
  transition: border-color 0.15s ease;
}

.price-ref-item:hover {
  border-color: rgba(52, 211, 153, 0.4);
}

/* Line Items */
.item-row {
  display: grid;
  grid-template-columns: 1fr 78px 130px 44px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

/* ==================== TAB 4: JOBS & TERMÔMETRO MEI (v2 EXECUTIVE) ==================== */
.mei-hero-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(520px 260px at 94% -10%, rgba(59, 130, 246, 0.24), transparent 65%),
    radial-gradient(380px 240px at 6% 108%, rgba(16, 185, 129, 0.16), transparent 65%),
    linear-gradient(145deg, rgba(13, 24, 48, 0.96), rgba(9, 17, 36, 0.96));
  border: 1px solid rgba(96, 165, 250, 0.34);
  border-radius: 22px;
  padding: 24px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.mei-hero-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.mei-eyebrow {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  font-weight: 800;
  color: #93c5fd;
}

.mei-hero-title {
  margin: 5px 0 0;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: #f8fafc;
}

.mei-hero-sub {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: #94a3b8;
  max-width: 640px;
}

.mei-year-switch {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  border-radius: 14px;
  background: rgba(5, 10, 21, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.mei-year-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  min-height: 46px;
  padding: 6px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.16s ease;
}

.mei-year-btn span {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.1;
}

.mei-year-btn small {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.85;
  margin-top: 2px;
}

.mei-year-btn:hover {
  color: #e2e8f0;
  background: rgba(59, 130, 246, 0.1);
}

.mei-year-btn.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.92), rgba(59, 130, 246, 0.88));
  border-color: rgba(147, 197, 253, 0.55);
  color: #fff;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
}

.mei-meter-wrap {
  background: rgba(5, 10, 21, 0.56);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 16px;
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mei-meter-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.mei-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 99px;
}

.mei-status-pill.ok {
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(52, 211, 153, 0.32);
  color: #6ee7b7;
}

.mei-status-pill.warn {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.38);
  color: #fcd34d;
}

.mei-status-pill.danger {
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(248, 113, 113, 0.42);
  color: #fca5a5;
}

.mei-pct-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.mei-pct-main {
  font-size: 16px;
  font-weight: 800;
  color: #f8fafc;
}

.mei-pct-proj {
  font-size: 12px;
  font-weight: 700;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(96, 165, 250, 0.28);
  padding: 3px 9px;
  border-radius: 99px;
}

.mei-progress-track {
  position: relative;
  width: 100%;
  height: 18px;
  background: rgba(15, 23, 42, 0.92);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.mei-progress-proj {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  border-radius: 99px;
  background: repeating-linear-gradient(
    -45deg,
    rgba(96, 165, 250, 0.34),
    rgba(96, 165, 250, 0.34) 7px,
    rgba(59, 130, 246, 0.16) 7px,
    rgba(59, 130, 246, 0.16) 14px
  );
  transition: width 0.38s ease;
}

.mei-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  border-radius: 99px;
  transition: width 0.38s ease;
  background: linear-gradient(90deg, #10b981, #34d399);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.45);
}

.mei-progress-fill.warn {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.45);
}

.mei-progress-fill.danger {
  background: linear-gradient(90deg, #ef4444, #f87171);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.45);
}

.mei-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(251, 191, 36, 0.7);
  z-index: 2;
}

.mei-tick.danger {
  background: rgba(248, 113, 113, 0.85);
}

.mei-meter-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 11.5px;
  color: #94a3b8;
}

.mei-meter-legend .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.mei-meter-legend .dot-official {
  background: #34d399;
}

.mei-meter-legend .dot-proj {
  background: #60a5fa;
}

.mei-ticks-hint {
  margin-left: auto;
  color: #64748b;
  font-size: 11px;
}

.mei-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.mei-kpi-tile {
  background: rgba(5, 10, 21, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 15px;
  padding: 14px 15px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.mei-kpi-tile.accent-green { border-color: rgba(52, 211, 153, 0.28); }
.mei-kpi-tile.accent-blue { border-color: rgba(96, 165, 250, 0.28); }
.mei-kpi-tile.accent-amber { border-color: rgba(251, 191, 36, 0.28); }
.mei-kpi-tile.accent-emerald {
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.12), rgba(5, 10, 21, 0.7));
  border-color: rgba(52, 211, 153, 0.35);
}

.mei-kpi-lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.45px;
  color: #94a3b8;
  font-weight: 700;
}

.mei-kpi-val {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mei-kpi-sub {
  font-size: 11.5px;
  color: #94a3b8;
}

.progress-track {
  width: 100%;
  height: 18px;
  background: rgba(5, 10, 21, 0.78);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin: 14px 0 10px;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.35s ease;
  background: linear-gradient(90deg, #10b981, #34d399);
}

.progress-fill.warn { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.progress-fill.danger { background: linear-gradient(90deg, #ef4444, #f87171); }

/* Toolbar de Jobs */
.jobs-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.jobs-search-wrap {
  flex: 1 1 260px;
  max-width: 380px;
}

.jobs-search-wrap input {
  width: 100%;
  min-height: 44px;
}

.jobs-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.jobs-filter-row .chip {
  min-height: 40px;
  padding: 6px 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(148, 163, 184, 0.18);
  color: inherit;
}

.jobs-filter-row .chip.active .chip-count {
  background: rgba(255, 255, 255, 0.22);
}

/* Grid & Cards de Job v2 */
.jobs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.job-card-v2 {
  background: linear-gradient(165deg, rgba(14, 24, 46, 0.94), rgba(9, 16, 32, 0.94));
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-left: 4px solid #64748b;
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 13px;
  box-shadow: var(--shadow-card);
  min-width: 0;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.job-card-v2:hover {
  border-color: rgba(96, 165, 250, 0.36);
}

.job-card-v2.status-orc { border-left-color: #94a3b8; }
.job-card-v2.status-fechado { border-left-color: #f59e0b; }
.job-card-v2.status-nota { border-left-color: #3b82f6; }
.job-card-v2.status-pago { border-left-color: #10b981; }

.job-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.job-head-left {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  min-width: 0;
}

.job-type-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(96, 165, 250, 0.26);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.job-title {
  font-weight: 800;
  font-size: 15.5px;
  line-height: 1.28;
  color: #f8fafc;
}

.job-meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-size: 12px;
  color: #94a3b8;
  margin-top: 4px;
}

.job-countdown {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.28);
}

.job-countdown.urgent {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  border-color: rgba(251, 191, 36, 0.4);
}

.job-countdown.past {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.2);
}

/* Bloco Financeiro & Custos */
.cost-box {
  background: rgba(5, 10, 21, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cost-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.cost-metric-box {
  background: rgba(15, 23, 42, 0.58);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 10px;
  padding: 8px 9px;
  min-width: 0;
}

.cost-metric-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  color: var(--muted);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.cost-metric-val {
  font-size: clamp(12.5px, 1.08vw, 15px);
  font-weight: 800;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-split-bar {
  width: 100%;
  height: 7px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.9);
  overflow: hidden;
  display: flex;
}

.job-split-net {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
}

.job-split-cost {
  height: 100%;
  background: linear-gradient(90deg, #d97706, #fbbf24);
}

.job-costs-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: #94a3b8;
  font-weight: 700;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  padding-top: 8px;
}

.job-cost-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.job-cost-item.paid {
  opacity: 0.78;
  border-color: rgba(52, 211, 153, 0.22);
}

.job-cost-left {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: #e2e8f0;
  min-width: 0;
}

.job-cost-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.job-chk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 11px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.14);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
  width: 100%;
  text-align: left;
  color: inherit;
}

.job-chk-bar:hover {
  border-color: rgba(96, 165, 250, 0.42);
  background: rgba(30, 41, 59, 0.65);
}

.job-chk-mini-track {
  flex: 1;
  max-width: 140px;
  height: 7px;
  border-radius: 99px;
  background: rgba(5, 10, 21, 0.85);
  overflow: hidden;
}

.job-chk-mini-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #3b82f6, #34d399);
  transition: width 0.25s ease;
}

.job-obs-note {
  font-size: 12.5px;
  color: #cbd5e1;
  line-height: 1.45;
  background: rgba(15, 23, 42, 0.42);
  border-left: 2px solid rgba(96, 165, 250, 0.45);
  padding: 7px 10px;
  border-radius: 0 8px 8px 0;
}

/* Stepper de Status (4 etapas) */
.job-status-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.status-step {
  padding: 7px 6px;
  min-height: 38px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(5, 10, 21, 0.56);
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-step:hover {
  border-color: rgba(96, 165, 250, 0.45);
  color: #e2e8f0;
}

.status-step.done-step {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(96, 165, 250, 0.28);
  color: #93c5fd;
}

.status-step.active {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border-color: #93c5fd;
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.status-step.active-paid {
  background: linear-gradient(135deg, #059669, #10b981);
  border-color: #6ee7b7;
  color: #fff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.job-actions-dock {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-top: 4px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.job-actions-dock .btn {
  min-height: 38px;
  padding: 6px 11px;
  font-size: 12px;
}

.job-actions-dock .btn-del-job {
  margin-left: auto;
}

.job-modal-net-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.32);
  border-radius: 12px;
}

.cost-row {
  display: grid;
  grid-template-columns: 1fr 110px 158px 40px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

/* ==================== TAB 5: ASSISTENTE IA & CENTRAL WHATSAPP (v2 STUDIO) ==================== */
.ia-workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.ia-studio-card,
.wa-studio-card {
  display: flex;
  flex-direction: column;
  gap: 13px;
  min-width: 0;
}

.ia-studio-card {
  background:
    radial-gradient(420px 200px at 0% 0%, rgba(59, 130, 246, 0.14), transparent 65%),
    linear-gradient(165deg, rgba(14, 24, 46, 0.96), rgba(9, 16, 32, 0.96));
  border-color: rgba(96, 165, 250, 0.28);
}

.wa-studio-card {
  background:
    radial-gradient(420px 200px at 100% 0%, rgba(16, 185, 129, 0.12), transparent 65%),
    linear-gradient(165deg, rgba(14, 24, 46, 0.96), rgba(9, 16, 32, 0.96));
  border-color: rgba(52, 211, 153, 0.24);
}

.ia-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
}

.ia-card-head > .btn,
.ia-card-head > .pill {
  flex-shrink: 0;
  white-space: nowrap;
}

.ia-brand-left {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 1;
  min-width: 0;
}

.ia-avatar-badge,
.wa-avatar-badge {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  flex-shrink: 0;
}

.ia-avatar-badge {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.35), rgba(139, 92, 246, 0.28));
  border: 1px solid rgba(96, 165, 250, 0.45);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.24);
}

.wa-avatar-badge {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(5, 150, 105, 0.24));
  border: 1px solid rgba(52, 211, 153, 0.42);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.2);
}

.ia-subtitle {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}

.ia-thread-bar {
  background: rgba(5, 10, 21, 0.58);
  border: 1px solid rgba(96, 165, 250, 0.22);
  border-radius: 13px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ia-thread-bar label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 800;
  color: #93c5fd;
  margin: 0;
}

.ia-quick-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.ia-quick-pill {
  padding: 7px 11px;
  min-height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}

.ia-quick-pill:hover {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(37, 99, 235, 0.2);
  color: #fff;
  transform: translateY(-1px);
}

.chat-box {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 340px);
  min-height: 460px;
  max-height: 760px;
  background: rgba(5, 10, 21, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-msg {
  max-width: 92%;
  padding: 12px 15px;
  border-radius: 15px;
  font-size: 13.5px;
  line-height: 1.52;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  opacity: 0.72;
  margin-bottom: 5px;
}

.chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.25);
}

.chat-msg.bot {
  align-self: flex-start;
  background: rgba(18, 30, 56, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #93c5fd;
  font-weight: 600;
}

.chat-typing-dots {
  display: inline-flex;
  gap: 4px;
}

.chat-typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #60a5fa;
  animation: typingBounce 1.1s infinite ease-in-out;
}

.chat-typing-dots i:nth-child(2) { animation-delay: 0.18s; }
.chat-typing-dots i:nth-child(3) { animation-delay: 0.36s; }

@keyframes typingBounce {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 11px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(11, 20, 38, 0.95);
  align-items: center;
}

.chat-input-row input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
}

.ia-send-btn {
  min-height: 48px;
  padding: 0 18px;
  white-space: nowrap;
}

.btn-mic {
  min-width: 50px;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(96, 165, 250, 0.32);
  background: rgba(37, 99, 235, 0.14);
  color: #e2e8f0;
  font-size: 19px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.16s ease;
}

.btn-mic:hover {
  background: rgba(37, 99, 235, 0.26);
  border-color: rgba(96, 165, 250, 0.6);
}

.btn-mic.recording {
  background: #dc2626;
  border-color: #f87171;
  color: #fff;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.28);
  animation: pulseMic 1.1s infinite;
}

@keyframes pulseMic {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.ai-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

/* Central de Mensagens WhatsApp */
.wa-controls-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  background: rgba(5, 10, 21, 0.56);
  border: 1px solid rgba(52, 211, 153, 0.18);
  border-radius: 13px;
  padding: 11px 12px;
}

.ia-thread-bar select,
.wa-controls-grid select,
.wa-controls-grid input {
  width: 100%;
  min-width: 0;
  height: 46px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-controls-grid label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.45px;
  font-weight: 800;
  color: #6ee7b7;
}

.wa-cat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wa-cat-pills .chip {
  min-height: 36px;
  padding: 5px 10px;
  font-size: 11.5px;
}

.wa-templates-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
  max-height: calc(100vh - 340px);
  min-height: 460px;
  overflow-y: auto;
  padding-right: 3px;
}

.msg-template-card {
  background: rgba(5, 10, 21, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-left: 3px solid #10b981;
  border-radius: 14px;
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: border-color 0.18s ease;
}

.msg-template-card:hover {
  border-color: rgba(52, 211, 153, 0.4);
}

.wa-tpl-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.wa-tpl-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #f1f5f9;
  line-height: 1.3;
}

.wa-tpl-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.msg-template-text {
  font-size: 12.5px;
  color: #cbd5e1;
  line-height: 1.5;
  white-space: pre-wrap;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(52, 211, 153, 0.16);
  border-radius: 10px;
  padding: 10px 12px;
}

.msg-template-editor {
  width: 100%;
  min-height: 145px;
  font-size: 12.5px;
  line-height: 1.5;
  font-family: inherit;
  background: rgba(5, 10, 21, 0.9);
  border: 1px solid rgba(96, 165, 250, 0.45);
  border-radius: 10px;
  padding: 10px 12px;
  color: #f8fafc;
  resize: vertical;
}

.wa-tpl-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #64748b;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.86);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 95;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: linear-gradient(180deg, #0d182f 0%, #091224 100%);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  width: 100%;
  max-width: 600px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 22px;
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.75);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}

.modal-head h3 {
  margin: 0;
  font-size: 17.5px;
  font-weight: 800;
}

.btn-close {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-soft);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-close:hover {
  border-color: var(--border-strong);
  color: #fff;
}

/* ==================== GLOBAL UTILITY BAR (SOM + SINO + TRAVA) ==================== */
.global-utility-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(11, 20, 40, 0.94);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.util-left-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.util-dot-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.75);
  flex-shrink: 0;
}

.util-right-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.util-pill-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 5px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.78);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s ease;
}

.util-pill-btn:hover {
  border-color: rgba(96, 165, 250, 0.52);
  background: rgba(37, 99, 235, 0.18);
}

.util-pill-btn.sfx-muted {
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.45);
}

.util-pill-lock {
  border-color: rgba(248, 113, 113, 0.34);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

.util-pill-lock:hover {
  border-color: rgba(248, 113, 113, 0.65);
  background: rgba(239, 68, 68, 0.2);
}

.util-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 38px;
  padding: 0 8px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.8);
  color: #e2e8f0;
  font-size: 16px;
  cursor: pointer;
}

.util-icon-btn.sfx-muted {
  opacity: 0.62;
}

.notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 99px;
  background: #ef4444;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.55);
}

.util-icon-btn .notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  font-size: 10px;
}

.notif-modal-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(5, 10, 21, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.16);
  margin-bottom: 12px;
}

.notif-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: 48vh;
  overflow-y: auto;
}

.notif-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  border-radius: 13px;
  background: rgba(5, 10, 21, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-left: 4px solid #60a5fa;
}

.notif-item.danger { border-left-color: #ef4444; background: rgba(239, 68, 68, 0.08); }
.notif-item.warn { border-left-color: #f59e0b; background: rgba(245, 158, 11, 0.08); }
.notif-item.ok { border-left-color: #10b981; background: rgba(16, 185, 129, 0.08); }

.notif-item-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #f8fafc;
}

.notif-item-desc {
  font-size: 12px;
  color: #cbd5e1;
  margin-top: 3px;
  line-height: 1.4;
}

.notif-cora-roadmap {
  margin-top: 14px;
  padding: 11px 13px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px dashed rgba(96, 165, 250, 0.35);
  font-size: 12px;
  color: #bfdbfe;
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.45;
}

@media (max-width: 768px) {
  .global-utility-bar {
    display: none;
  }
}

/* ==================== PIN LOCK OVERLAY ==================== */
body.pin-locked .app-shell,
body.pin-locked .mobile-topbar,
body.pin-locked .mobile-bottom-bar {
  visibility: hidden;
  pointer-events: none;
  user-select: none;
}

.pin-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background:
    radial-gradient(520px 320px at 20% 10%, rgba(37, 99, 235, 0.22), transparent 65%),
    radial-gradient(460px 300px at 85% 90%, rgba(16, 185, 129, 0.16), transparent 65%),
    #040812;
}

.pin-lock-overlay.open {
  display: flex;
}

.pin-card {
  width: 100%;
  max-width: 370px;
  background: linear-gradient(165deg, rgba(14, 24, 46, 0.98), rgba(8, 15, 30, 0.98));
  border: 1px solid rgba(96, 165, 250, 0.34);
  border-radius: 24px;
  padding: 26px 24px 22px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.72);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.pin-brand-head {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  justify-content: center;
}

.pin-brand-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  color: #f8fafc;
}

.pin-brand-head p {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: #93c5fd;
  font-weight: 600;
}

.pin-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 28px;
  padding: 4px 0;
}

.pin-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.7);
  transition: all 0.14s ease;
}

.pin-dot.filled {
  background: #3b82f6;
  border-color: #93c5fd;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.6);
  transform: scale(1.1);
}

.pin-dot.err {
  border-color: #f87171;
  background: rgba(239, 68, 68, 0.4);
}

.pin-error-msg {
  min-height: 18px;
  font-size: 12.5px;
  font-weight: 700;
  color: #fca5a5;
  text-align: center;
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.pin-key {
  min-height: 58px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.78);
  color: #f8fafc;
  font-family: 'JetBrains Mono', monospace;
  font-size: 21px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.pin-key:hover {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(37, 99, 235, 0.22);
}

.pin-key:active {
  transform: scale(0.95);
  background: rgba(37, 99, 235, 0.42);
}

.pin-key-sec {
  font-size: 17px;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.45);
}

.pin-submit-btn {
  width: 100%;
  min-height: 50px;
  font-size: 15px;
}

.pin-hint {
  font-size: 11px;
  color: #64748b;
  text-align: center;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0b162c;
  color: #fff;
  border: 1px solid rgba(52, 211, 153, 0.65);
  padding: 13px 18px;
  border-radius: 13px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translate3d(0, 14px, 0);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 130;
}

/* Otimização 60fps para listas longas no tablet */
.cnae-item,
.cnd-card,
.msg-template-card,
.cat-ref-row {
  content-visibility: auto;
  contain-intrinsic-size: auto 110px;
}

.job-card-v2,
.parceiro-card,
.mov-row,
.doc-item {
  contain: layout style;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.empty-state {
  text-align: center;
  padding: 28px 14px;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: 13px;
  font-size: 13.5px;
}

/* ==================== TABLET OPTIMIZATION (768px - 1140px) ==================== */
@media (max-width: 1140px) and (min-width: 769px) {
  .sidebar {
    width: var(--rail-w);
    padding: 16px 10px;
    align-items: center;
  }

  .sidebar .brand-meta,
  .sidebar .nav-label,
  .sidebar .sidebar-widgets {
    display: none;
  }

  .sidebar .brand-row {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .sidebar .rail-toggle-btn {
    display: inline-flex;
  }

  .sidebar .nav-list {
    width: 100%;
    align-items: center;
  }

  .sidebar .nav-btn {
    justify-content: center;
    padding: 12px 0;
    width: 58px;
    height: 54px;
  }

  .sidebar .nav-btn .nav-icon {
    font-size: 22px;
  }

  /* Expanded overlay mode when user taps toggle on tablet */
  .sidebar.rail-expanded {
    width: 282px;
    padding: 20px 14px;
    align-items: stretch;
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.72);
  }

  .sidebar.rail-expanded .brand-meta h1 {
    font-size: 14.5px;
  }

  .sidebar.rail-expanded .brand-row {
    flex-direction: row;
  }

  .sidebar.rail-expanded .brand-meta,
  .sidebar.rail-expanded .nav-label,
  .sidebar.rail-expanded .sidebar-widgets {
    display: flex;
  }

  .sidebar.rail-expanded .brand-meta {
    display: block;
  }

  .sidebar.rail-expanded .nav-list {
    align-items: stretch;
  }

  .sidebar.rail-expanded .nav-btn {
    justify-content: flex-start;
    width: 100%;
    height: auto;
    padding: 12px 13px;
  }

  .main {
    margin-left: var(--rail-w);
    padding: 22px 22px 40px;
    width: calc(100% - var(--rail-w));
  }

  #tab-gerador .grid-2,
  .jobs-grid,
  .ia-workspace-grid {
    grid-template-columns: 1fr;
  }

  .wa-templates-list {
    max-height: none;
    min-height: 0;
  }

  .chat-box {
    height: 520px;
    min-height: 420px;
  }

  .mei-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ks-hero-grid,
  .cora-hero-grid {
    grid-template-columns: 1fr;
  }

  .das-months-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .ks-pulse-panel {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nfse-steps-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .btn, input, select {
    min-height: 48px;
  }
}

/* ==================== MOBILE OPTIMIZATION (<= 768px) ==================== */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .mobile-topbar {
    display: flex;
  }

  .mobile-bottom-bar {
    display: grid;
  }

  .main {
    margin-left: 0;
    padding: calc(70px + var(--safe-top)) 14px calc(86px + var(--safe-bottom));
  }

  .page-header h2 {
    font-size: 21px;
  }

  .ks-hero-grid,
  .cora-hero-grid,
  .cora-balances-row,
  .grid-2,
  .grid-3,
  .grid-4,
  .form-grid,
  .nfse-steps-grid {
    grid-template-columns: 1fr;
  }

  .das-months-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ks-card-meta-row {
    grid-template-columns: 1fr;
  }

  .ks-cnpj-num {
    font-size: 19px;
  }

  .grid-4.kpi-row,
  .ks-pulse-panel,
  .cofre-semaforo-grid,
  .gen-selector-grid,
  .mei-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .jobs-grid,
  .cost-metrics,
  .ia-workspace-grid,
  .wa-controls-grid {
    grid-template-columns: 1fr;
  }

  .wa-templates-list {
    max-height: none;
    min-height: 0;
  }

  .job-status-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mei-hero-card {
    padding: 18px 15px;
  }

  .mei-ticks-hint {
    margin-left: 0;
    width: 100%;
  }

  .tpl-grid {
    grid-template-columns: 1fr;
  }

  .btn, input, select {
    min-height: 48px;
  }

  .item-row {
    grid-template-columns: 1fr 70px 110px 44px;
  }

  .cost-row {
    grid-template-columns: 1fr 95px;
  }

  .chat-box {
    height: 62vh;
    min-height: 390px;
    max-height: none;
  }

  .sig-canvas-wrap {
    height: 240px;
  }

  .toast {
    left: 14px;
    right: 14px;
    bottom: calc(78px + var(--safe-bottom));
    text-align: center;
  }
}
