:root {
      --bg: #0b141a;
      --panel: #1f2c34;
      --panel-strong: #222e35;
      --border: #2a3942;
      --text: #e9edef;
      --muted: #8696a0;
      --accent: #00a884;
      --accent-soft: rgba(0, 168, 132, 0.16);
      --success: #00a884;
      --warning: #f5b041;
      --danger: #f15c5c;
      --radius: 12px;
      --shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
    }

    * {
      box-sizing: border-box;
    }

    html {
      height: 100%;
    }

    body {
      margin: 0;
      font-family: "Inter", system-ui, -apple-system, sans-serif;
      background: var(--bg);
      color: var(--text);
      min-height: 100vh;
      position: relative;
      overflow-x: hidden;
      display: flex;
      flex-direction: column;
    }

    body.login-mode {
      background:
        radial-gradient(circle at 18% 18%, rgba(92, 142, 255, 0.18), transparent 32%),
        radial-gradient(circle at 80% 8%, rgba(129, 92, 255, 0.20), transparent 34%),
        radial-gradient(circle at 30% 80%, rgba(92, 255, 230, 0.12), transparent 38%),
        linear-gradient(180deg, #310a8f 0%, #0a1023 50%, #761ee6 100%);
      color: var(--text);
    }

    body.login-mode::before,
    body.login-mode::after {
      content: "";
      position: absolute;
      width: 520px;
      height: 520px;
      filter: blur(90px);
      opacity: 0.35;
      z-index: 0;
      animation: float 16s ease-in-out infinite alternate;
    }

    body.login-mode::before {
      background: #3b82f6;
      top: -120px;
      left: -180px;
    }

    body.login-mode::after {
      background: #7c3aed;
      bottom: -160px;
      right: -140px;
      animation-duration: 18s;
    }

    @keyframes float {
      from {
        transform: translateY(0px) translateX(0px);
      }

      to {
        transform: translateY(30px) translateX(20px) scale(1.05);
      }
    }

    a {
      text-decoration: none;
      color: inherit;
    }

    .hidden {
      display: none !important;
    }

    /* Login */
    #login-screen {
      min-height: 100vh;
      display: grid;
      place-items: center;
      padding: 32px 16px;
      position: relative;
      z-index: 1;
    }

    .login-card {
      background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 22px;
      box-shadow: 0 20px 60px rgba(8, 12, 32, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
      max-width: 520px;
      width: 100%;
      padding: 38px 34px;
      backdrop-filter: blur(16px);
      position: relative;
      overflow: hidden;
    }

    .login-card::after {
      content: "";
      position: absolute;
      inset: 0;
      background: radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.18), transparent 40%),
        radial-gradient(circle at 80% 0%, rgba(124, 58, 237, 0.16), transparent 38%);
      pointer-events: none;
    }

    .login-logo {
      width: 120px;
      height: 120px;
      border-radius: 12px;
      background: transparent;
      box-shadow: none;
      display: grid;
      place-items: center;
      overflow: visible;
    }

    .login-title {
      font-weight: 800;
      letter-spacing: -0.3px;
      color: #e8eeff;
    }

    .login-sub {
      color: #9fb4ff;
    }

    .login-card .form-control {
      background: rgba(255, 255, 255, 0.06);
      border: 1px solid rgba(255, 255, 255, 0.14);
      color: #e8eeff;
      border-radius: 26px;
    }

    .login-card .form-control:focus {
      border-color: #60a5fa;
      box-shadow: 0 0 0 0.2rem rgba(96, 165, 250, 0.25);
      background: rgba(255, 255, 255, 0.1);
    }

    .btn-neon {
      background: linear-gradient(120deg, #ffffff, #a78bfa);
      border: none;
      color: #0c1120;
      font-weight: 800;
      letter-spacing: 0.3px;
      box-shadow: 0 14px 40px rgba(96, 165, 250, 0.35);
      position: relative;
      overflow: hidden;
      border-radius: 26px;
    }

    .btn-neon::after {
      content: "";
      position: absolute;
      top: -60%;
      left: -20%;
      width: 60%;
      height: 220%;
      background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
      transform: rotate(18deg);
      opacity: 0;
      transition: opacity 0.3s ease;
    }

    .btn-neon:hover::after {
      opacity: 1;
    }

    /* Layout */
    #app-screen {
      min-height: 100vh;
      height: 100vh;
      background:
        radial-gradient(circle at 20% 15%, rgba(0, 168, 132, 0.12), transparent 40%),
        radial-gradient(circle at 78% 10%, rgba(0, 168, 132, 0.08), transparent 42%),
        linear-gradient(180deg, #0b141a 0%, #111b21 60%, #0b141a 100%);
      display: flex;
      flex-direction: column;
      flex: 1;
    }

    .dashboard-shell {
      min-height: 100vh;
      display: grid;
      grid-template-columns: 74px minmax(0, 1fr);
      gap: 16px;
      padding: 14px;
      overflow: hidden;
    }

    .dashboard-toolbar {
      background: linear-gradient(180deg, #1a2328 0%, #161f24 100%);
      border: 1px solid var(--border);
      border-radius: 16px;
      box-shadow: var(--shadow);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 14px;
      padding: 14px 0 16px;
      min-height: calc(100vh - 28px);
    }

    .toolbar-section {
      width: 100%;
      display: grid;
      justify-items: center;
      gap: 10px;
    }

    .toolbar-divider {
      width: calc(100% - 24px);
      height: 1px;
      background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
    }

    .toolbar-spacer {
      flex: 1 1 auto;
    }

    .toolbar-brand,
    .toolbar-icon-btn,
    .toolbar-profile-btn {
      width: 44px;
      height: 44px;
      border-radius: 14px;
      border: 1px solid transparent;
      background: transparent;
      color: #aebbc4;
      display: grid;
      place-items: center;
      position: relative;
      transition: 0.18s ease;
    }

    .toolbar-brand img,
    .toolbar-profile-btn img {
      width: 32px;
      height: 32px;
      object-fit: cover;
      border-radius: 50%;
      display: block;
    }

    .toolbar-brand {
      background: rgba(255, 255, 255, 0.06);
      border-color: rgba(255, 255, 255, 0.06);
    }

    .toolbar-icon-btn i {
      font-size: 21px;
      line-height: 1;
    }

    .toolbar-profile-btn {
      background: rgba(255, 255, 255, 0.04);
      border-color: rgba(255, 255, 255, 0.06);
      cursor: pointer;
    }

    .toolbar-icon-btn:hover,
    .toolbar-icon-btn:focus-visible,
    .toolbar-profile-btn:hover,
    .toolbar-profile-btn:focus-visible,
    .toolbar-brand:hover,
    .toolbar-brand:focus-visible {
      background: rgba(0, 168, 132, 0.12);
      border-color: rgba(0, 168, 132, 0.22);
      color: #e9edef;
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    }

    .toolbar-icon-btn.active,
    .toolbar-brand.active {
      background: rgba(255, 255, 255, 0.1);
      color: #ffffff;
    }

    .toolbar-icon-btn.accent {
      background: linear-gradient(180deg, #2ad96b, #18c655);
      color: #ffffff;
      box-shadow: 0 12px 24px rgba(42, 217, 107, 0.24);
    }

    .toolbar-icon-btn.accent:hover,
    .toolbar-icon-btn.accent:focus-visible {
      background: linear-gradient(180deg, #39e579, #20cf5d);
      border-color: transparent;
    }

    .dashboard-main {
      min-width: 0;
      min-height: calc(100vh - 28px);
      overflow-y: auto;
      background: rgba(17, 27, 33, 0.55);
      border: 1px solid var(--border);
      border-radius: 16px;
      box-shadow: var(--shadow);
    }

    .pill-online {
      background: rgba(0, 168, 132, 0.12);
      color: #00a884;
      padding: 6px 10px;
      border-radius: 999px;
      font-weight: 700;
      font-size: 12px;
      text-align: center;
    }

    .card-panel {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      padding: 18px 20px;
      position: relative;
      overflow: hidden;
    }

    .card-panel::before {
      content: "";
      position: absolute;
      inset: -40% auto auto -40%;
      width: 60%;
      height: 140%;
      background: radial-gradient(circle at center, rgba(0, 128, 105, 0.06), transparent 55%);
      transform: rotate(-8deg);
      pointer-events: none;
    }

    .stats-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 14px;
      position: relative;
      z-index: 1;
    }

    .stats-note {
      color: var(--muted);
      font-size: 12px;
    }

    .stats-filters {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      position: relative;
      z-index: 1;
    }

    .stats-filters .btn.active {
      background: var(--accent-soft);
      border-color: rgba(0, 168, 132, 0.35);
      color: var(--accent);
    }

    .stats-grid {
      display: grid;
      grid-template-columns: repeat(6, minmax(0, 1fr));
      gap: 14px;
      position: relative;
      z-index: 1;
    }

    .stat-card {
      background: linear-gradient(180deg, rgba(17, 27, 33, 0.95), rgba(31, 44, 52, 0.98));
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 16px 18px;
      min-height: 122px;
      position: relative;
      overflow: hidden;
    }

    .stat-card::after {
      content: "";
      position: absolute;
      inset: auto -18% -55% auto;
      width: 92px;
      height: 92px;
      border-radius: 50%;
      background: rgba(0, 168, 132, 0.08);
    }

    .stat-label {
      color: var(--muted);
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      position: relative;
      z-index: 1;
    }

    .stat-value {
      font-size: 34px;
      line-height: 1;
      font-weight: 800;
      color: var(--text);
      margin-top: 8px;
      position: relative;
      z-index: 1;
    }

    .stat-meta {
      margin-top: 10px;
      color: #c7d3d9;
      font-size: 12px;
      position: relative;
      z-index: 1;
    }

    .stat-success .stat-value { color: #52e39c; }
    .stat-warning .stat-value { color: #ffd166; }
    .stat-danger .stat-value { color: #ff7b7b; }
    .stat-info .stat-value { color: #82cfff; }

    .stats-table-wrap {
      position: relative;
      z-index: 1;
    }

    .status-badge {
      padding: 6px 12px;
      border-radius: 999px;
      font-weight: 700;
      font-size: 12px;
      color: #fff;
      letter-spacing: 0.1px;
    }

    .status-connected { background: #25d366; color: #0b3a2e; }
    .status-waiting { background: #ffd166; color: #3f2e00; }
    .status-disconnected { background: #ff6b6b; color: #4a0d0d; }

    .table thead th {
      color: #8696a0;
      font-weight: 700;
      font-size: 13px;
      border-color: #2a3942;
      background: #111b21;
    }

    .table td {
      vertical-align: middle;
      font-weight: 600;
      color: #e9edef;
      border-color: #2a3942;
      background: #0b141a;
    }

    .avatar {
      width: 42px;
      height: 42px;
      border-radius: 50%;
      object-fit: cover;
      border: 2px solid #d7e5ff;
    }

    .btn-ghost {
      background: #1f2c34;
      border: 1px solid #2a3942;
      color: #e9edef;
      transition: all 0.15s ease;
    }

    .btn-ghost:hover {
      background: #23343d;
      border-color: #34505c;
    }

    /* Botões padrão WhatsApp */
    .btn, button {
      border-radius: 999px;
      transition: all 0.15s ease;
      font-weight: 700;
      letter-spacing: 0.1px;
    }

    .btn-primary {
      background: #00a884;
      border-color: #00a884;
      color: #0b141a;
      box-shadow: 0 10px 20px rgba(0, 168, 132, 0.18);
    }

    .btn-primary:hover,
    .btn-primary:focus {
      background: #06c097;
      border-color: #06c097;
      color: #0b141a;
      box-shadow: 0 12px 24px rgba(0, 168, 132, 0.25);
    }

    .btn-outline-secondary {
      border-color: #2a3942;
      color: #e9edef;
      background: transparent;
    }

    .btn-outline-secondary:hover,
    .btn-outline-secondary:focus {
      background: #23343d;
      border-color: #34505c;
      color: #e9edef;
      box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
    }

    .btn-light,
    .btn-secondary {
      background: #23343d;
      border-color: #2a3942;
      color: #e9edef;
    }

    .btn-light:hover,
    .btn-secondary:hover {
      background: #2a3942;
      border-color: #34505c;
    }

    .log-box {
      background: #111b21;
      color: #d1d7db;
      border-radius: 10px;
      padding: 12px;
      border: 1px solid #2a3942;
      font-family: "JetBrains Mono", monospace;
      min-height: 180px;
      max-height: 300px;
      overflow-y: auto;
      font-size: 12px;
      box-shadow: inset 0 1px 0 #0f191f;
    }

    .qr-preview {
      width: 140px;
      height: 140px;
      border: 1px solid #2a3942;
      border-radius: 12px;
      display: none;
      box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
      background: #0b141a;
    }

    @keyframes shimmer {
      0% { background-position: 200% 0; }
      100% { background-position: -200% 0; }
    }

    @media (max-width: 992px) {
      .stats-header {
        flex-direction: column;
        align-items: flex-start;
      }

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

      .dashboard-shell {
        grid-template-columns: 1fr;
      }

      .dashboard-toolbar {
        min-height: auto;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        padding: 10px 12px;
        gap: 12px;
        overflow-x: auto;
      }

      .toolbar-section {
        width: auto;
        display: flex;
        align-items: center;
        gap: 10px;
      }

      .toolbar-divider {
        width: 1px;
        height: 32px;
        flex: 0 0 auto;
        background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.12), transparent);
      }

      .toolbar-spacer {
        display: none;
      }
    }

    @media (max-width: 576px) {
      .stats-grid {
        grid-template-columns: 1fr;
      }

      .dashboard-shell {
        padding: 8px;
        gap: 10px;
      }

      .dashboard-toolbar,
      .dashboard-main,
      .footer-area {
        border-radius: 14px;
      }

      .dashboard-toolbar {
        padding: 8px 10px;
      }

      .toolbar-brand,
      .toolbar-icon-btn,
      .toolbar-profile-btn {
        width: 40px;
        height: 40px;
        border-radius: 12px;
      }

      .toolbar-brand img,
      .toolbar-profile-btn img {
        width: 28px;
        height: 28px;
      }
    }

    /* Loader overlay */
    .app-loader {
      position: fixed;
      inset: 0;
      background: rgba(11, 20, 26, 0.65);
      backdrop-filter: blur(6px);
      display: grid;
      place-items: center;
      z-index: 1050;
    }

    .app-loader.hidden { display: none; }

    .spinner-dot {
      width: 68px;
      height: 68px;
      border-radius: 50%;
      border: 6px solid rgba(0, 168, 132, 0.12);
      border-top-color: var(--accent);
      animation: spin 1s linear infinite;
      box-shadow: 0 0 24px rgba(0, 168, 132, 0.35);
    }

    /* Animations */
    .animate {
      opacity: 0;
      transform: translateY(14px);
      transition: opacity 0.5s ease, transform 0.5s ease, box-shadow 0.4s ease;
    }

    .animate.in-view {
      opacity: 1;
      transform: translateY(0);
    }

    .card-panel.animate:hover {
      box-shadow: 0 16px 38px rgba(17, 27, 33, 0.12);
      transform: translateY(-2px);
    }

    .footer-area {
      background: var(--panel-strong);
      border-color: var(--border) !important;
      color: var(--muted);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
    }

    .footer-area a {
      color: var(--text);
    }

.footer-area a:hover {
      color: var(--accent);
    }

/* Modal alinhado ao tema */
.themed-modal {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.themed-modal .modal-header,
.themed-modal .modal-footer {
  border-color: var(--border);
}

.themed-modal .modal-title {
  color: var(--text);
}

.themed-modal .btn-close {
  filter: invert(1) brightness(1.1);
  opacity: 0.85;
}

.themed-modal .btn-close:hover {
  opacity: 1;
}

/* Shell principal */
#app-screen .dashboard-shell {
  min-height: 100%;
  height: 100%;
  flex: 1;
}

main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 100vh;
}

footer.footer-area {
  margin-top: auto;
}
    @keyframes spin {
      to {
        transform: rotate(360deg);
      }
    }
