/* ==========================================================================
   Daki Net Telecom - Painel de Gestão ISP (Admin)
   Design System: Clean, Sober, Professional Operational Console
   Conforms to design-taste-frontend: app-screens principles (No Neon / No AI Slop)
   ========================================================================== */

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* SOBER CORPORATE COLOR PALETTE (Daki Net Brand) */
  --brand-primary: #004733;       /* Deep Forest Spruce Green */
  --brand-primary-hover: #0c5c44; /* Clean dark accent */
  --brand-primary-active: #094734;
  --brand-light: #e6f4ef;        /* Very subtle pale sage */

  /* SURFACES & NEUTRALS */
  --bg-canvas: #f8fafc;          /* Slate 50 clean light gray */
  --bg-surface: #ffffff;         /* Pure white cards */
  --bg-subtle: #f1f5f9;          /* Slate 100 table header/hover */
  --border-color: #e2e8f0;       /* Slate 200 crisp divider */
  --border-hover: #cbd5e1;       /* Slate 300 */
  --border-focus: #004733;

  /* INK / TEXT */
  --text-main: #0f172a;          /* Slate 900 */
  --text-body: #334155;          /* Slate 700 */
  --text-muted: #64748b;         /* Slate 500 */
  --text-subtle: #94a3b8;        /* Slate 400 */

  /* DATA STATUS COLORS (Restrained, Muted, Flat) */
  --status-online-text: #15803d;
  --status-online-bg: #f0fdf4;
  --status-online-border: #bbf7d0;

  --status-warning-text: #b45309;
  --status-warning-bg: #fffbeb;
  --status-warning-border: #fde68a;

  --status-danger-text: #b91c1c;
  --status-danger-bg: #fef2f2;
  --status-danger-border: #fecaca;

  --status-neutral-text: #475569;
  --status-neutral-bg: #f1f5f9;
  --status-neutral-border: #cbd5e1;

  /* GEOMETRY & ELEVATION */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-full: 9999px;
  --shadow-flat: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-card: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-body);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   GATE / AUTH MODAL
   ========================================================================== */
.gate-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 999;
}

.gate-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  padding: 32px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

.gate-header {
  text-align: center;
  margin-bottom: 24px;
}

.gate-logo {
  height: 48px;
  max-width: 180px;
  object-fit: contain;
  margin-bottom: 16px;
}

.gate-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.gate-header p {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gate-error {
  padding: 10px 12px;
  background-color: var(--status-danger-bg);
  border: 1px solid var(--status-danger-border);
  color: var(--status-danger-text);
  border-radius: var(--radius-md);
  font-size: 13px;
}

.gate-footer {
  text-align: center;
  margin-top: 20px;
}

.gate-back-link {
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
  transition: color 0.15s ease;
}

.gate-back-link:hover {
  color: var(--brand-primary);
}

/* ==========================================================================
   APP LAYOUT & HEADER
   ========================================================================== */
.admin-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.brand-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.brand-meta {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-primary);
}

.header-operator {
  display: flex;
  align-items: center;
  gap: 16px;
}

.operator-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.operator-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--brand-primary);
}

.operator-cpf {
  color: var(--text-main);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
}

/* ==========================================================================
   NAVIGATION TABS (Clean Pill Strip)
   ========================================================================== */
.admin-nav {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
}

.nav-container {
  display: flex;
  gap: 8px;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab:hover {
  color: var(--text-main);
}

.nav-tab.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

.tab-badge {
  background: var(--bg-subtle);
  color: var(--text-body);
  border: 1px solid var(--border-color);
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: 10px;
}

.nav-tab.active .tab-badge {
  background: var(--brand-light);
  color: var(--brand-primary);
  border-color: #bbf0de;
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.admin-main {
  flex: 1;
  padding: 24px 28px 48px;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
}

.tab-content {
  display: none;
}

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

/* Alerts */
.alert-banner {
  padding: 12px 16px;
  margin-bottom: 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.alert-success {
  background-color: var(--status-online-bg);
  border: 1px solid var(--status-online-border);
  color: var(--status-online-text);
}

.alert-error {
  background-color: var(--status-danger-bg);
  border: 1px solid var(--status-danger-border);
  color: var(--status-danger-text);
}

/* ==========================================================================
   KPI TILES (Restrained, Type-based)
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-card);
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  margin: 6px 0 2px;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-subtle);
}

.kpi-online .kpi-value {
  color: var(--status-online-text);
}

.kpi-warning .kpi-value {
  color: var(--status-warning-text);
}

.kpi-danger .kpi-value {
  color: var(--status-danger-text);
}

/* ==========================================================================
   PANEL BOXES & CARDS
   ========================================================================== */
.panel-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.panel-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==========================================================================
   TOOLBARS & SEARCH
   ========================================================================== */
.table-toolbar {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background-color: #fafbfc;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 420px;
}

.search-box input {
  width: 100%;
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font-sans);
  background: var(--bg-surface);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s;
}

.search-box input:focus {
  border-color: var(--border-focus);
}

.btn-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-subtle);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 4px;
}

.btn-clear:hover {
  color: var(--text-main);
}

.filter-pills {
  display: flex;
  gap: 6px;
}

.filter-pill {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  border-color: var(--border-hover);
  color: var(--text-main);
}

.filter-pill.active {
  background: var(--text-main);
  color: #ffffff;
  border-color: var(--text-main);
}

.toolbar-actions {
  margin-left: auto;
}

/* ==========================================================================
   TABLES (High Craft, Rules & Alignment, Tabular Numbers)
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  padding: 10px 16px;
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-body);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background-color: #f8fafc;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.table-footer {
  padding: 12px 20px;
  background-color: #fafbfc;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
}

/* Monospace data cells */
.mono-cell {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.num-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge-online {
  background-color: var(--status-online-bg);
  border: 1px solid var(--status-online-border);
  color: var(--status-online-text);
}
.badge-online .badge-dot { background-color: var(--status-online-text); }

.badge-warning {
  background-color: var(--status-warning-bg);
  border: 1px solid var(--status-warning-border);
  color: var(--status-warning-text);
}
.badge-warning .badge-dot { background-color: var(--status-warning-text); }

.badge-danger {
  background-color: var(--status-danger-bg);
  border: 1px solid var(--status-danger-border);
  color: var(--status-danger-text);
}
.badge-danger .badge-dot { background-color: var(--status-danger-text); }

.badge-neutral {
  background-color: var(--status-neutral-bg);
  border: 1px solid var(--status-neutral-border);
  color: var(--status-neutral-text);
}
.badge-neutral .badge-dot { background-color: var(--status-neutral-text); }

/* ==========================================================================
   BUTTONS (Sober, Functional, Non-Neon)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
}
.btn-primary:hover {
  background-color: var(--brand-primary-hover);
  border-color: var(--brand-primary-hover);
}
.btn-primary:active {
  background-color: var(--brand-primary-active);
}

.btn-secondary {
  background-color: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background-color: #e2e8f0;
}

.btn-outline {
  background-color: var(--bg-surface);
  color: var(--text-body);
  border-color: var(--border-color);
}
.btn-outline:hover {
  background-color: var(--bg-subtle);
  color: var(--text-main);
}

.btn-danger-outline {
  background-color: var(--bg-surface);
  color: var(--status-danger-text);
  border-color: var(--status-danger-border);
}
.btn-danger-outline:hover {
  background-color: var(--status-danger-bg);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==========================================================================
   TAB 2: GESTÃO DE ASSINANTES
   ========================================================================== */
.subscriber-search-bar {
  display: flex;
  gap: 10px;
  padding: 20px 24px;
}

.subscriber-search-bar input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: var(--font-sans);
  background: var(--bg-surface);
}

.subscriber-search-bar input:focus {
  border-color: var(--border-focus);
  outline: none;
}

.sub-search-results {
  margin: 0 24px 20px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  max-height: 280px;
  overflow-y: auto;
}

.sub-search-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background-color 0.1s;
}

.sub-search-item:last-child {
  border-bottom: none;
}

.sub-search-item:hover {
  background-color: var(--bg-subtle);
}

.sub-item-name {
  font-weight: 600;
  color: var(--text-main);
}

.sub-item-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* Selected Subscriber Dossier */
.sub-detail-container {
  padding: 20px 24px;
  border-top: 1px solid var(--border-color);
}

.sub-profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.sub-profile-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sub-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background-color: var(--brand-light);
  color: var(--brand-primary);
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #bbf0de;
}

.sub-nome {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.sub-meta-tags {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.meta-tag {
  font-size: 12px;
  color: var(--text-muted);
}

.section-subtitle {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

/* Contract Cards in Admin */
.contracts-accordion {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-contract-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #fafbfc;
  padding: 18px;
}

.contract-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.contract-info-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.contract-address {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Operator Action Toolbar for Contract */
.contract-actions-toolbar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.promessa-group {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.promessa-input {
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-mono);
  width: 110px;
}

.promessa-input:focus {
  border-color: var(--border-focus);
  outline: none;
}

/* Sub Table of Invoices (Tab 2: Gestão de Assinantes) */
.contract-invoices-box {
  margin-top: 14px;
  width: 100%;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  position: relative;
}

.table-scroll-hint {
  display: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-primary);
  background: var(--brand-light);
  padding: 6px 12px;
  border-bottom: 1px solid #bbf0de;
  text-align: right;
  letter-spacing: 0.01em;
}

.invoices-table-mobile {
  min-width: 480px;
  width: 100%;
}

/* ==========================================================================
   TAB 3: FINANCEIRO
   ========================================================================== */
.finance-header-grid {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  background-color: #fafbfc;
}

.finance-filter-toggle {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.toggle-btn {
  padding: 8px 16px;
  background: var(--bg-surface);
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.toggle-btn:hover {
  color: var(--text-main);
}

.toggle-btn.active {
  background: var(--brand-primary);
  color: #ffffff;
}

.finance-kpis {
  display: flex;
  align-items: center;
  gap: 20px;
}

.fin-kpi-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
}

.fin-kpi-label {
  color: var(--text-muted);
}

.fin-kpi-num {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
}

.text-success {
  color: var(--status-online-text);
}

/* ==========================================================================
   TAB 4: ADMINISTRADORES & SENHAS
   ========================================================================== */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrapper input {
  width: 100%;
  padding-right: 42px !important;
}

.btn-toggle-pwd {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-toggle-pwd:hover {
  color: var(--text-main);
}

.admin-action-box {
  background: var(--bg-canvas);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}

.box-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
}

.add-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) auto;
  gap: 14px;
  align-items: flex-end;
}

.form-action-btn {
  display: flex;
  align-items: flex-end;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

.form-group input {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font-mono);
  background: #ffffff;
}

.form-group input:focus {
  border-color: var(--border-focus);
  outline: none;
}

.flex-1 {
  flex: 1;
}

/* ==========================================================================
   PIX MODAL
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.btn-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
}

.btn-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 24px 20px;
}

.modal-lead {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.pix-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px;
}

.loading-pulse-logo {
  height: 48px;
  animation: pulse-slow 1.6s infinite ease-in-out;
}

@keyframes pulse-slow {
  0%, 100% { opacity: 0.35; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.02); }
}

.pix-qr-img {
  width: 220px;
  height: 220px;
  margin: 0 auto 16px;
  display: block;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px;
  background: #ffffff;
}

.pix-copy-box {
  text-align: left;
}

.pix-copy-box label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.pix-input-group {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.pix-input-group input {
  flex: 1;
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-main);
}

/* Finance Period Filter Bar */
.finance-period-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.period-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.period-input {
  width: 105px;
  padding: 5px 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-main);
}

.period-input:focus {
  border-color: var(--border-focus);
  outline: none;
}

.period-sep {
  font-size: 11px;
  color: var(--text-muted);
}

/* Utilities */
.text-center { text-align: center; }
.py-4 { padding-top: 24px !important; padding-bottom: 24px !important; }

/* Utilities */
.text-center { text-align: center; }
.py-4 { padding-top: 24px !important; padding-bottom: 24px !important; }

/* ==========================================================================
   RESPONSIVE DESIGN SYSTEM (Desktop -> Tablet -> Mobile)
   ========================================================================== */

/* Tablet & Intermediate screens (<= 1024px) */
@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .admin-main {
    padding: 20px;
  }
}

/* Mobile & Small Tablets (<= 768px) */
@media (max-width: 768px) {
  /* Admin Header */
  .admin-header {
    padding-top: max(16px, env(safe-area-inset-top));
    padding-left: 14px;
    padding-right: 14px;
    padding-bottom: 12px;
    gap: 10px;
    flex-direction: column;
    align-items: stretch;
  }

  .header-brand {
    width: 100%;
  }

  .brand-logo {
    height: 32px;
  }

  .brand-title {
    font-size: 14px;
  }

  .brand-subtitle {
    font-size: 10px;
  }

  .header-operator {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
  }

  .operator-badge {
    font-size: 11px;
    padding: 4px 10px;
  }

  .header-operator .btn {
    padding: 5px 10px;
    font-size: 11.5px;
  }

  /* Navigation Tabs (Smooth Horizontal Swipe Strip) */
  .admin-nav {
    padding: 0 6px;
    background: #ffffff;
  }

  .nav-container {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
    padding: 0 4px;
  }

  .nav-container::-webkit-scrollbar {
    display: none;
  }

  .nav-tab {
    flex-shrink: 0;
    padding: 10px 12px;
    font-size: 12.5px;
    white-space: nowrap;
    gap: 6px;
  }

  .tab-badge {
    font-size: 10px;
    padding: 1px 5px;
  }

  /* Main Workspace */
  .admin-main {
    padding: 14px 10px 40px;
  }

  /* KPI Grid (Compact 2x2 on Mobile) */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 14px;
  }

  .kpi-card {
    padding: 12px 10px;
    border-radius: var(--radius-md);
  }

  .kpi-label {
    font-size: 10px;
    letter-spacing: 0.02em;
  }

  .kpi-value {
    font-size: 20px;
    margin: 4px 0 2px;
  }

  .kpi-sub {
    font-size: 9.5px;
    line-height: 1.25;
  }

  /* Tab 1: Logins Toolbar */
  .table-toolbar {
    padding: 10px 12px;
    gap: 10px;
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    min-width: 100%;
    max-width: 100%;
  }

  .search-box input {
    height: 40px;
    font-size: 14px;
  }

  /* Filter Pills Horizontal Scroll Strip */
  .filter-pills {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 4px;
    width: 100%;
  }

  .filter-pills::-webkit-scrollbar {
    display: none;
  }

  .filter-pill {
    flex-shrink: 0;
    padding: 5px 11px;
    font-size: 11.5px;
    white-space: nowrap;
  }

  .toolbar-actions {
    width: 100%;
    margin-left: 0;
  }

  #refreshLoginsBtn {
    width: 100%;
    justify-content: center;
    height: 38px;
    font-size: 12.5px;
  }

  /* Data Tables Mobile Scrolling */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    border-bottom: 1px solid var(--border-color);
  }

  .data-table {
    min-width: 680px;
    font-size: 12px;
  }

  .data-table th {
    padding: 8px 10px;
    font-size: 10.5px;
  }

  .data-table td {
    padding: 9px 10px;
  }

  .table-footer {
    padding: 10px 14px;
    font-size: 11.5px;
  }

  /* Tab 2: Gestão de Assinantes */
  .panel-header {
    padding: 14px 16px;
  }

  .panel-title {
    font-size: 15px;
  }

  .panel-desc {
    font-size: 12px;
  }

  .subscriber-search-bar {
    padding: 12px 14px;
    flex-direction: column;
    gap: 8px;
  }

  .subscriber-search-bar input {
    height: 42px;
    font-size: 14px;
    width: 100%;
  }

  #subSearchBtn {
    width: 100%;
    height: 42px;
    font-size: 14px;
  }

  .sub-search-results {
    margin: 0 14px 14px;
  }

  .sub-detail-container {
    padding: 14px;
  }

  .sub-profile-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 14px;
  }

  .sub-profile-main {
    gap: 12px;
  }

  .sub-avatar {
    width: 38px;
    height: 38px;
    font-size: 16px;
    flex-shrink: 0;
  }

  .sub-nome {
    font-size: 16px;
    word-break: break-word;
  }

  .sub-meta-tags {
    flex-wrap: wrap;
    gap: 6px;
  }

  #subClearBtn {
    width: 100%;
    height: 36px;
    justify-content: center;
  }

  .admin-contract-card {
    padding: 14px 12px;
  }

  .contract-top-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
  }

  .contract-info-title {
    font-size: 14px;
    word-break: break-word;
  }

  .contract-address {
    font-size: 12px;
  }

  .contract-actions-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px;
    margin-bottom: 12px;
  }

  .contract-actions-toolbar .btn {
    width: 100%;
    height: 40px;
    font-size: 13px;
  }

  .promessa-group {
    width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
    gap: 6px;
  }

  .promessa-group label {
    width: 100%;
    font-size: 10px;
  }

  .promessa-input {
    flex: 1;
    height: 36px;
    font-size: 12.5px;
    min-width: 100px;
  }

  .promessa-group .btn {
    height: 36px;
  }

  /* Contract Invoices Table Mobile Scrolling (Pure natural scroll like Conexões & Logins) */
  .contract-invoices-box {
    margin-top: 10px;
    border-radius: var(--radius-sm);
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100%;
  }

  .invoices-table-mobile {
    min-width: 520px;
    font-size: 12px;
  }

  .invoices-table-mobile th,
  .invoices-table-mobile td {
    padding: 8px 10px;
  }

  /* Tab 3: Financeiro */
  .finance-header-grid {
    padding: 12px 14px;
    gap: 12px;
    flex-direction: column;
    align-items: stretch;
  }

  .finance-filter-toggle {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .toggle-btn {
    padding: 8px 6px;
    font-size: 11.5px;
    text-align: center;
  }

  .finance-period-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    width: 100%;
  }

  .period-inputs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
    align-items: center;
  }

  .period-input {
    flex: 1;
    min-width: 85px;
    height: 36px;
    font-size: 12px;
  }

  #btnFiltrarPeriodo {
    height: 36px;
    padding: 0 12px;
    font-size: 12px;
  }

  #btnLimparPeriodo {
    height: 36px;
  }

  .finance-kpis {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 8px 10px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
  }

  .fin-kpi-item {
    flex-direction: column;
    gap: 2px;
  }

  .fin-kpi-label {
    font-size: 10.5px;
  }

  .fin-kpi-num {
    font-size: 14px;
  }

  /* Tab 4: Administradores */
  .admin-action-box {
    padding: 14px;
  }

  .add-admin-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .form-group input {
    height: 40px;
    font-size: 14px;
  }

  .form-action-btn {
    width: 100%;
  }

  .form-action-btn button {
    width: 100%;
    height: 42px;
  }

  /* Gate / Auth Modal */
  .gate-overlay {
    padding: 12px;
  }

  .gate-card {
    padding: 22px 16px;
    border-radius: var(--radius-lg);
    width: 100%;
  }

  .gate-header {
    margin-bottom: 18px;
  }

  .gate-logo {
    height: 38px;
    margin-bottom: 10px;
  }

  .gate-header h2 {
    font-size: 18px;
  }

  .gate-header p {
    font-size: 12px;
  }

  .gate-form input {
    font-size: 16px; /* Prevents auto-zoom on iOS */
    padding: 10px 12px;
  }

  #gateSubmitBtn {
    height: 46px;
    font-size: 14px;
  }

  /* Admin PIX Modal */
  .modal-overlay {
    padding: 12px;
  }

  .modal-card {
    width: 100%;
    max-width: 100%;
    max-height: 94vh;
    border-radius: var(--radius-lg);
  }

  .modal-body {
    padding: 16px 14px;
  }

  .pix-qr-img {
    width: 160px;
    height: 160px;
    margin-bottom: 12px;
  }

  .pix-input-group {
    flex-direction: column;
    gap: 6px;
  }

  .pix-input-group input {
    height: 40px;
    font-size: 12px;
  }

  #modalPixCopyBtn {
    height: 42px;
    width: 100%;
  }
}

