:root {
      --bg: #070a12;
      --sidebar-bg: #0b0f19;
      --card-bg: rgba(17, 24, 39, 0.7);
      --card-border: rgba(255, 255, 255, 0.08);
      --card-hover: rgba(255, 255, 255, 0.03);
      --accent: #3b82f6;
      --accent-hover: #2563eb;
      --accent-purple: #8b5cf6;
      --success: #10b981;
      --warning: #f59e0b;
      --danger: #ef4444;
      --text: #f8fafc;
      --text-muted: #94a3b8;
      --text-dim: #64748b;
      --border: #1e293b;
    }

    * { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif; }
    body { background-color: var(--bg); color: var(--text); min-height: 100vh; overflow: hidden; }

    /* Custom Scrollbars: strictly styled with Zeus dark palette globally */
    *, html, body {
      scrollbar-width: thin;
      scrollbar-color: rgba(59, 130, 246, 0.28) #070a12;
    }

    ::-webkit-scrollbar {
      width: 5px;
      height: 5px;
    }

    ::-webkit-scrollbar-track {
      background: #070a12;
    }

    ::-webkit-scrollbar-thumb {
      background: rgba(59, 130, 246, 0.25);
      border-radius: 4px;
      border: 1px solid rgba(255, 255, 255, 0.05);
    }

    ::-webkit-scrollbar-thumb:hover {
      background: rgba(59, 130, 246, 0.55);
    }

    ::-webkit-scrollbar-corner {
      background: #070a12;
    }

    /* Lucide Icons Base */
    [data-lucide] {
      width: 1em;
      height: 1em;
      stroke-width: 2;
      vertical-align: -0.15em;
      display: inline-block;
    }

    /* App Shell */
    .app-shell { display: flex; width: 100vw; height: 100vh; overflow: hidden; }

    /* Sidebar: Sleek & Compact (230px) */
    .sidebar {
      width: 230px;
      min-width: 230px;
      background: var(--sidebar-bg);
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      height: 100%;
      z-index: 50;
      user-select: none;
    }

    .sidebar-top { display: flex; flex-direction: column; overflow-y: auto; flex: 1; }

    .sidebar-brand {
      padding: 0.75rem 0.95rem;
      display: flex;
      align-items: center;
      gap: 0.65rem;
      border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    .brand-logo-img {
      height: 26px;
      width: auto;
      object-fit: contain;
      filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.45));
    }
    .brand-text { font-size: 0.98rem; font-weight: 800; letter-spacing: -0.02em; color: #fff; }
    .brand-text span { color: var(--accent); }
    .brand-badge {
      font-size: 0.55rem;
      font-weight: 700;
      padding: 0.08rem 0.35rem;
      background: rgba(59, 130, 246, 0.12);
      color: var(--accent);
      border: 1px solid rgba(59, 130, 246, 0.25);
      border-radius: 4px;
      letter-spacing: 0.05em;
      margin-top: 0.1rem;
      display: inline-block;
    }

    .sidebar-status-box {
      margin: 0.4rem 0.7rem 0.2rem;
      padding: 0.35rem 0.65rem;
      background: rgba(16, 185, 129, 0.08);
      border: 1px solid rgba(16, 185, 129, 0.25);
      border-radius: 6px;
      display: flex;
      align-items: center;
      gap: 0.45rem;
    }
    .status-dot-pulse {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--success);
      box-shadow: 0 0 6px var(--success);
    }
    .status-text-live { font-size: 0.68rem; font-weight: 700; color: #34d399; font-family: 'JetBrains Mono', monospace; }

    .sidebar-nav { padding: 0.35rem 0.6rem; display: flex; flex-direction: column; gap: 0.12rem; }
    .nav-group-title {
      font-size: 0.56rem;
      font-weight: 800;
      letter-spacing: 0.08em;
      color: var(--text-dim);
      padding: 0.45rem 0.45rem 0.12rem;
      text-transform: uppercase;
    }

    .nav-btn {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      padding: 0.36rem 0.55rem;
      background: transparent;
      border: 1px solid transparent;
      border-radius: 6px;
      color: var(--text-muted);
      font-size: 0.78rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.12s ease;
      text-align: left;
    }
    .nav-btn-left { display: flex; align-items: center; gap: 0.45rem; }
    .nav-btn:hover { background: rgba(255, 255, 255, 0.04); color: #fff; }
    .nav-btn.active {
      background: rgba(59, 130, 246, 0.15);
      color: #93c5fd;
      border-color: rgba(59, 130, 246, 0.35);
    }
    .nav-pill {
      font-size: 0.56rem;
      font-weight: 700;
      padding: 0.08rem 0.32rem;
      border-radius: 9999px;
      background: rgba(255, 255, 255, 0.06);
      color: #cbd5e1;
    }
    .nav-pill.green { background: rgba(16, 185, 129, 0.18); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
    .nav-pill.blue { background: rgba(59, 130, 246, 0.18); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
    .nav-pill.warning { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }

    .sidebar-footer {
      padding: 0.55rem 0.75rem;
      border-top: 1px solid rgba(255, 255, 255, 0.05);
      background: rgba(3, 7, 18, 0.5);
    }
    .admin-profile { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.45rem; }
    .admin-avatar {
      width: 26px;
      height: 26px;
      border-radius: 6px;
      background: linear-gradient(135deg, #2563eb, #7c3aed);
      display: flex;
      align-items: center;
      justify-content: center;
      color: #fff;
      font-weight: 700;
      font-size: 0.72rem;
    }
    .admin-info { overflow: hidden; }
    .admin-name { font-size: 0.76rem; font-weight: 700; color: #fff; }
    .admin-email { font-size: 0.66rem; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }

    .sidebar-actions-row { display: flex; gap: 0.25rem; }
    .icon-action-btn {
      flex: 1;
      padding: 0.32rem 0;
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid rgba(255, 255, 255, 0.06);
      border-radius: 5px;
      color: var(--text-muted);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.12s;
      text-decoration: none;
    }
    .icon-action-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
    .icon-action-btn.danger:hover { background: rgba(239, 68, 68, 0.2); color: #f87171; border-color: rgba(239, 68, 68, 0.3); }

    /* Main Viewport */
    .main-viewport { flex: 1; display: flex; flex-direction: column; height: 100%; overflow: hidden; background: #070a12; }

    /* Topbar: Compact 44px */
    .topbar {
      height: 44px;
      min-height: 44px;
      background: rgba(11, 15, 25, 0.9);
      backdrop-filter: blur(14px);
      border-bottom: 1px solid var(--border);
      padding: 0 1.25rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      z-index: 40;
    }
    .breadcrumb { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--text-muted); }
    .breadcrumb strong { color: #fff; font-weight: 700; }
    .breadcrumb .sep { color: var(--text-dim); }

    .topbar-right { display: flex; align-items: center; gap: 0.55rem; }
    .sync-text { font-size: 0.72rem; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; }

    /* Content Area: Sleek 0.85rem 1.25rem */
    .content-area { flex: 1; overflow-y: auto; padding: 0.85rem 1.25rem; }

    /* Buttons: Compact & Modern */
    .btn {
      background: var(--accent);
      color: #fff;
      border: 1px solid rgba(255, 255, 255, 0.1);
      padding: 0.32rem 0.65rem;
      border-radius: 5px;
      font-size: 0.76rem;
      font-weight: 600;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      transition: all 0.12s;
      text-decoration: none;
    }
    .btn:hover { background: var(--accent-hover); }
    .btn-secondary { background: rgba(255, 255, 255, 0.05); color: #cbd5e1; border-color: rgba(255, 255, 255, 0.1); }
    .btn-secondary:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
    .btn-success { background: rgba(16, 185, 129, 0.2); color: #34d399; border-color: rgba(16, 185, 129, 0.35); }
    .btn-success:hover { background: rgba(16, 185, 129, 0.3); }
    .btn-danger { background: rgba(239, 68, 68, 0.2); color: #f87171; border-color: rgba(239, 68, 68, 0.35); }
    .btn-danger:hover { background: rgba(239, 68, 68, 0.3); }
    .btn-warning { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border-color: rgba(245, 158, 11, 0.35); }
    .btn-warning:hover { background: rgba(245, 158, 11, 0.3); }
    .btn-sm { padding: 0.2rem 0.48rem; font-size: 0.7rem; }

    /* Page Titles: Tight Header */
    .page-title-box { margin-bottom: 0.65rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.4rem; }
    .page-title-box h1 { font-size: 1.08rem; font-weight: 700; color: #fff; letter-spacing: -0.02em; }
    .page-title-box p { font-size: 0.74rem; color: var(--text-muted); margin-top: 0.1rem; }

    /* Stats Grid: High Density */
    .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.65rem; margin-bottom: 0.75rem; }
    .stat-card {
      background: var(--card-bg);
      border: 1px solid var(--card-border);
      border-radius: 8px;
      padding: 0.65rem 0.85rem;
      position: relative;
      overflow: hidden;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    }
    .stat-card::before {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0; height: 2px;
      background: linear-gradient(90deg, var(--accent), transparent);
    }
    .stat-card.purple::before { background: linear-gradient(90deg, var(--accent-purple), transparent); }
    .stat-card.success::before { background: linear-gradient(90deg, var(--success), transparent); }
    .stat-card.warning::before { background: linear-gradient(90deg, var(--warning), transparent); }
    .stat-label { font-size: 0.65rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
    .stat-value { font-size: 1.28rem; font-weight: 800; color: #fff; margin: 0.15rem 0 0.05rem; font-family: 'JetBrains Mono', monospace; }
    .stat-sub { font-size: 0.68rem; color: var(--text-muted); }

    /* Panels & Tables: High Density */
    .panel-card {
      background: var(--card-bg);
      border: 1px solid var(--card-border);
      border-radius: 8px;
      padding: 0.75rem 0.95rem;
      margin-bottom: 0.75rem;
      box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    }
    .panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.55rem; flex-wrap: wrap; gap: 0.4rem; }
    .panel-title { font-size: 0.86rem; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 0.4rem; }

    .table-container { overflow-x: auto; border: 1px solid rgba(255, 255, 255, 0.06); border-radius: 6px; }
    table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.76rem; }
    th {
      background: rgba(255, 255, 255, 0.03);
      color: var(--text-muted);
      font-weight: 700;
      padding: 0.4rem 0.65rem;
      border-bottom: 1px solid var(--card-border);
      text-transform: uppercase;
      font-size: 0.66rem;
      letter-spacing: 0.05em;
    }
    td {
      padding: 0.42rem 0.65rem;
      border-bottom: 1px solid rgba(255, 255, 255, 0.04);
      color: #e2e8f0;
      vertical-align: middle;
    }
    tr:hover td { background: rgba(255, 255, 255, 0.02); }

    /* Badges */
    .badge {
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      padding: 0.1rem 0.42rem;
      border-radius: 4px;
      font-size: 0.66rem;
      font-weight: 700;
      letter-spacing: 0.03em;
    }
    .badge-success { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
    .badge-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
    .badge-danger { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
    .badge-blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
    .badge-purple { background: rgba(139, 92, 246, 0.15); color: #c084fc; border: 1px solid rgba(139, 92, 246, 0.3); }

    /* Form Inputs */
    .form-group { margin-bottom: 0.55rem; }
    .form-group label { display: block; font-size: 0.68rem; font-weight: 700; color: var(--text-muted); margin-bottom: 0.25rem; text-transform: uppercase; letter-spacing: 0.03em; }
    .form-group input, .form-group select, .form-group textarea {
      width: 100%;
      padding: 0.38rem 0.6rem;
      background: rgba(11, 15, 25, 0.9);
      border: 1px solid var(--border);
      border-radius: 5px;
      color: #fff;
      font-size: 0.78rem;
      font-family: inherit;
    }
    .form-group input:focus, .form-group select:focus, .form-group textarea:focus {
      outline: none;
      border-color: var(--accent);
      box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
    }
    .form-group .help-text { font-size: 0.68rem; color: var(--text-dim); margin-top: 0.2rem; }

    /* Filter Bar */
    .filter-bar {
      display: flex;
      align-items: center;
      gap: 0.4rem;
      margin-bottom: 0.65rem;
      flex-wrap: wrap;
    }
    .filter-input {
      background: rgba(11, 15, 25, 0.9);
      border: 1px solid var(--border);
      border-radius: 5px;
      padding: 0.32rem 0.65rem;
      color: #fff;
      font-size: 0.76rem;
      min-width: 200px;
    }
    .filter-btn {
      padding: 0.28rem 0.58rem;
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 5px;
      color: var(--text-muted);
      font-size: 0.72rem;
      font-weight: 600;
      cursor: pointer;
    }
    .filter-btn.active {
      background: rgba(59, 130, 246, 0.15);
      color: #93c5fd;
      border-color: rgba(59, 130, 246, 0.35);
    }

    /* Tab Pages */
    .tab-page { display: none; }
    .tab-page.active { display: block; animation: fadeIn 0.15s ease; }

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

    /* Modal / Drawer */
    .modal-overlay {
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0, 0, 0, 0.75);
      backdrop-filter: blur(6px);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 1000;
      padding: 1rem;
    }
    .modal-overlay.active { display: flex; }
    .modal-card {
      background: #0d121f;
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 10px;
      width: 100%;
      max-width: 580px;
      max-height: 85vh;
      overflow-y: auto;
      padding: 1.25rem;
      box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
      position: relative;
    }
    .modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.85rem; border-bottom: 1px solid rgba(255, 255, 255, 0.07); padding-bottom: 0.65rem; }
    .modal-title { font-size: 0.98rem; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 0.45rem; }
    .modal-close { background: transparent; border: none; color: var(--text-dim); cursor: pointer; font-size: 1.15rem; }
    .modal-close:hover { color: #fff; }

    /* Toast Notification */
    .toast-container {
      position: fixed;
      bottom: 1.5rem;
      right: 1.5rem;
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      z-index: 9999;
    }
    .toast {
      padding: 0.65rem 0.95rem;
      background: #0d121f;
      border: 1px solid var(--accent);
      border-radius: 7px;
      color: #fff;
      font-size: 0.78rem;
      font-weight: 600;
      display: flex;
      align-items: center;
      gap: 0.5rem;
      box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
      animation: slideIn 0.2s ease;
    }
    @keyframes slideIn {
      from { transform: translateX(100%); opacity: 0; }
      to { transform: translateX(0); opacity: 1; }
    }

    /* Auth Overlay */
    .auth-overlay {
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      background: #070a12;
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 10000;
    }
    .auth-box {
      background: #0b0f19;
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 12px;
      padding: 1.8rem;
      width: 100%;
      max-width: 380px;
      text-align: center;
      box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    }
    .auth-box h2 { font-size: 1.2rem; font-weight: 800; color: #fff; margin-top: 0.75rem; }
    .auth-box p { font-size: 0.78rem; color: var(--text-muted); margin: 0.25rem 0 1.2rem; }

    /* Clientes: toolbar do painel, skeleton, estados, selo Admin e paginação */
    .clients-toolbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 0.6rem;
      padding: 0.7rem 0.9rem;
      border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }
    .clients-toolbar-info { display: flex; align-items: baseline; gap: 0.6rem; min-width: 0; }
    .clients-toolbar-info strong { font-size: 0.82rem; color: #fff; }
    .clients-updated { font-size: 0.68rem; color: var(--text-dim); }
    #clients-reload-btn i { transition: transform 0.4s ease; }
    #clients-reload-btn:active i { transform: rotate(-360deg); }

    .clients-state-cell { padding: 0 !important; }
    .clients-state {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.9rem;
      flex-wrap: wrap;
      padding: 2.2rem 1rem;
      text-align: left;
      font-size: 0.8rem;
      color: var(--text-muted);
    }
    .clients-state-icon { width: 1.6rem; height: 1.6rem; color: var(--text-dim); }
    .clients-state-detail { font-size: 0.72rem; color: var(--text-dim); margin-top: 0.2rem; max-width: 34rem; }

    .clients-skeleton-row td { padding: 0.85rem 0.9rem; }
    .clients-skeleton {
      display: block;
      height: 12px;
      border-radius: 4px;
      background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.10) 50%, rgba(255,255,255,0.04) 75%);
      background-size: 200% 100%;
      animation: clientsShimmer 1.2s ease-in-out infinite;
    }
    @keyframes clientsShimmer {
      from { background-position: 200% 0; }
      to { background-position: -200% 0; }
    }

    .plan-admin-note {
      display: inline-flex;
      align-items: center;
      gap: 0.28rem;
      margin-top: 0.3rem;
      font-size: 0.64rem;
      font-weight: 700;
      letter-spacing: 0.02em;
      text-transform: uppercase;
      color: #a78bfa;
      background: rgba(139, 92, 246, 0.12);
      border: 1px solid rgba(139, 92, 246, 0.35);
      border-radius: 4px;
      padding: 0.1rem 0.4rem;
    }

    .row-actions { display: flex; gap: 0.3rem; align-items: center; }

    .filter-select {
      background: rgba(15, 23, 42, 0.6);
      border: 1px solid rgba(255, 255, 255, 0.08);
      color: var(--text-muted);
      border-radius: 6px;
      padding: 0.45rem 0.6rem;
      font-size: 0.74rem;
      outline: none;
      cursor: pointer;
    }
    .filter-select:focus { border-color: rgba(59, 130, 246, 0.5); color: #fff; }

    .table-pagination {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 0.8rem;
      flex-wrap: wrap;
      padding: 0.7rem 0.9rem;
      border-top: 1px solid rgba(255, 255, 255, 0.06);
    }
    .table-pagination:empty { display: none; }
    .pager-info { font-size: 0.72rem; color: var(--text-muted); }
    .pager-info strong { color: #fff; }
    .pager-controls { display: flex; align-items: center; gap: 0.3rem; }
    .pager-size { font-size: 0.68rem; color: var(--text-dim); display: inline-flex; align-items: center; gap: 0.35rem; margin-right: 0.5rem; }
    .pager-select {
      background: rgba(15, 23, 42, 0.6);
      border: 1px solid rgba(255, 255, 255, 0.08);
      color: var(--text-muted);
      border-radius: 5px;
      padding: 0.2rem 0.35rem;
      font-size: 0.7rem;
      outline: none;
    }
    .pager-btn {
      min-width: 26px;
      height: 26px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: transparent;
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 5px;
      color: var(--text-muted);
      font-size: 0.72rem;
      font-weight: 600;
      cursor: pointer;
      transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
    }
    .pager-btn:hover:not(:disabled):not(.active) { background: rgba(255, 255, 255, 0.05); color: #fff; }
    .pager-btn.active { background: rgba(59, 130, 246, 0.18); border-color: rgba(59, 130, 246, 0.5); color: #60a5fa; }
    .pager-btn:disabled { opacity: 0.35; cursor: not-allowed; }