/* ============================================================
   MailAdmin — Design System (Light theme + Dark sidebar)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

:root {
  --sidebar-bg:    #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active:#2563eb;
  --sidebar-text:  #94a3b8;
  --sidebar-text-active: #fff;
  --sidebar-w:     230px;

  --bg:            #f1f5f9;
  --surface:       #ffffff;
  --surface-dim:   #f8fafc;
  --border:        #e2e8f0;
  --border2:       #cbd5e1;

  --text:          #0f172a;
  --text2:         #475569;
  --text3:         #94a3b8;

  --primary:       #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;

  --success:       #16a34a;
  --success-bg:    #f0fdf4;
  --success-border:#bbf7d0;

  --danger:        #dc2626;
  --danger-bg:     #fef2f2;
  --danger-border: #fecaca;

  --warning:       #d97706;
  --warning-bg:    #fffbeb;
  --warning-border:#fde68a;

  --info:          #0891b2;
  --info-bg:       #ecfeff;
  --info-border:   #a5f3fc;

  --radius:        8px;
  --radius-lg:     12px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:        0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --shadow-lg:     0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  --topbar-h:      64px;
  --font:          'Inter', sans-serif;
}

html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--font); min-height: 100vh; display: flex; font-size: 14px; line-height: 1.5; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ============================================================ SIDEBAR */
.sidebar {
  width: var(--sidebar-w); min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 100;
  transition: transform .3s ease;
}

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-logo-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-logo-icon svg { width: 18px; height: 18px; fill: white; }
.sidebar-logo-name { font-size: 16px; font-weight: 700; color: #fff; }

nav { flex: 1; padding: 12px 12px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius);
  color: var(--sidebar-text); font-size: 13.5px; font-weight: 500;
  text-decoration: none; margin-bottom: 2px;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .7; transition: opacity .15s; }
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item:hover svg { opacity: 1; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 14px 12px 18px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-collapse-btn {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; width: 100%;
  background: none; border: none; color: var(--sidebar-text);
  font-size: 12px; font-family: var(--font); cursor: pointer;
  padding: 6px; border-radius: var(--radius);
  transition: color .15s;
}
.sidebar-collapse-btn:hover { color: #fff; }

/* ============================================================ MAIN */
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  height: var(--topbar-h); background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 28px; gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 20px; font-weight: 700; color: var(--text); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.topbar-server {
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius);
  padding: 6px 12px; font-size: 13px; font-family: var(--font);
  outline: none; cursor: pointer; transition: border-color .15s;
}
.topbar-server:focus { border-color: var(--primary); }

.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: var(--radius);
  cursor: default;
}
.topbar-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.topbar-username { font-size: 13px; font-weight: 600; }

#menu-toggle { display: none; background: none; border: none; cursor: pointer; color: var(--text); padding: 4px; }

.content { flex: 1; padding: 28px; }

/* ============================================================ ALERTS */
.alert {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 16px; border-radius: var(--radius);
  border: 1px solid; border-left-width: 4px;
  font-size: 13.5px; line-height: 1.5; margin-bottom: 20px;
  animation: alertIn .25s ease;
}
@keyframes alertIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
.alert-success { background: var(--success-bg); border-color: var(--success-border); border-left-color: var(--success); color: var(--success); }
.alert-error   { background: var(--danger-bg);  border-color: var(--danger-border);  border-left-color: var(--danger);  color: var(--danger); }
.alert-info    { background: var(--info-bg);    border-color: var(--info-border);    border-left-color: var(--info);    color: var(--info); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning-border); border-left-color: var(--warning); color: var(--warning); }
.alert-icon    { flex-shrink: 0; width: 17px; height: 17px; margin-top: 2px; }
.alert-icon svg { width: 17px; height: 17px; display: block; }
.alert-body    { flex: 1; }
.alert-body a  { color: inherit; font-weight: 600; text-decoration: underline; }
.alert-close   { flex-shrink: 0; background: none; border: none; cursor: pointer; color: inherit; opacity: .45; padding: 1px; margin-top: 1px; line-height: 0; border-radius: 3px; transition: opacity .15s, background .15s; }
.alert-close:hover { opacity: 1; background: rgba(0,0,0,.07); }
.alert-close svg { width: 15px; height: 15px; display: block; }

/* ============================================================ STAT CARDS */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px 24px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-sm);
}
.stat-icon {
  width: 46px; height: 46px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon-blue   { background: #eff6ff; } .stat-icon-blue svg   { color: #2563eb; }
.stat-icon-green  { background: #f0fdf4; } .stat-icon-green svg  { color: #16a34a; }
.stat-icon-orange { background: #fff7ed; } .stat-icon-orange svg { color: #ea580c; }
.stat-icon-purple { background: #faf5ff; } .stat-icon-purple svg { color: #7c3aed; }
.stat-label { font-size: 12.5px; color: var(--text2); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1; color: var(--text); }
.stat-sub   { font-size: 12px; color: var(--text3); margin-top: 3px; }

/* ============================================================ CARDS */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 0;
  margin-bottom: 20px; box-shadow: var(--shadow-sm); overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text); }
.card-sub   { font-size: 12px; color: var(--text3); margin-top: 2px; }
.card-body  { padding: 20px 24px; }

/* ============================================================ TABLES */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 11px 20px;
  text-align: left;
  font-size: 12px; font-weight: 600; color: var(--text2);
  border-bottom: 1px solid var(--border);
  background: var(--surface-dim); white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-dim); }
tbody td { padding: 13px 20px; font-size: 13.5px; vertical-align: middle; text-align: left; }
/* Colunas que ficam centralizadas (todas exceto a primeira) */
tbody td:not(:first-child) { text-align: center; }
thead th:not(:first-child) { text-align: center; }
.td-actions { display: inline-flex; gap: 6px; align-items: center; }

/* ============================================================ BADGES */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600; border: 1px solid; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-online,
.badge-active  { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.badge-offline,
.badge-inactive{ background: var(--danger-bg);  border-color: var(--danger-border);  color: var(--danger); }
.badge-master  { background: #eff6ff; border-color: #bfdbfe; color: var(--primary); }
.badge-user    { background: var(--surface-dim); border-color: var(--border); color: var(--text2); }
.badge-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }

/* ============================================================ BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-family: var(--font); font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, opacity .15s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 15px; height: 15px; }

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

.btn-secondary { background: var(--surface); color: var(--text2); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--border2); color: var(--text); background: var(--surface-dim); }

.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.btn-danger:hover { background: #fee2e2; }

.btn-icon {
  padding: 6px 8px; background: transparent; border: 1px solid transparent;
  border-radius: var(--radius); cursor: pointer; transition: background .15s, color .15s;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-icon svg { width: 16px; height: 16px; }
.btn-icon-edit  { color: var(--text2); }
.btn-icon-edit:hover  { background: var(--primary-light); color: var(--primary); border-color: #bfdbfe; }
.btn-icon-trash { color: var(--text3); }
.btn-icon-trash:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }

.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }

/* ============================================================ FORMS */
.form-row { display: grid; gap: 16px; margin-bottom: 16px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 500; color: var(--text); }
.form-label span { color: var(--danger); margin-left: 2px; }

.form-control {
  background: var(--surface); border: 1px solid var(--border2);
  color: var(--text); border-radius: var(--radius);
  padding: 9px 13px; font-family: var(--font); font-size: 13.5px;
  outline: none; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-control::placeholder { color: var(--text3); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; appearance: none; }
.form-hint { font-size: 12px; color: var(--text3); }

.form-section { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.form-section-label {
  font-size: 11px; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: .8px; margin-bottom: 14px; display: block;
}

/* Password toggle wrapper */
.pw-wrap { position: relative; }
.pw-wrap .form-control { padding-right: 42px; }
.pw-toggle {
  position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--text3); padding: 2px;
  display: flex; align-items: center;
}
.pw-toggle:hover { color: var(--text2); }
.pw-toggle svg { width: 16px; height: 16px; }

/* Checkbox list */
.checkbox-list {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px; max-height: 200px; overflow-y: auto;
  background: var(--bg);
}
.checkbox-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px; cursor: pointer; transition: background .1s; }
.checkbox-item:hover { background: var(--surface); }
.checkbox-item input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.checkbox-item label { font-size: 13.5px; color: var(--text); cursor: pointer; }

/* ============================================================ MODAL */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15,23,42,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s cubic-bezier(.16,1,.3,1);
}
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--text); }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text3); padding: 4px; border-radius: 6px;
  display: flex; align-items: center; transition: background .15s, color .15s;
}
.modal-close:hover { background: var(--bg); color: var(--text2); }
.modal-close svg { width: 18px; height: 18px; }
.modal-body { padding: 20px 24px; }
.modal-footer {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 10px; padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ============================================================ ACTIVITY LOG */
.activity-list { }
.activity-item {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 24px; border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.activity-icon svg { width: 15px; height: 15px; color: var(--text2); }
.activity-title { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.activity-desc  { font-size: 12.5px; color: var(--text2); }
.activity-meta  { font-size: 12px; color: var(--text3); margin-top: 2px; }

/* ============================================================ TOOLBAR (filters row) */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar .form-control { max-width: 260px; }
.toolbar .search-wrap { position: relative; }
.toolbar .search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text3); pointer-events: none; }
.toolbar .search-input { padding-left: 34px; }

/* ============================================================ EMPTY STATE */
.empty-state { text-align: center; padding: 52px 24px; }
.empty-state svg { width: 48px; height: 48px; color: var(--text3); margin: 0 auto 14px; display: block; }
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.empty-state-sub   { font-size: 13px; color: var(--text3); }

/* ============================================================ PAGE HEADER */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 12px; flex-wrap: wrap; }
.page-header-left { }
.page-count { font-size: 13px; color: var(--text2); }

/* ============================================================ LOGIN */
.login-wrap {
  min-height: 100vh; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 40px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-logo-icon { width: 36px; height: 36px; background: var(--primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.login-logo-icon svg { width: 18px; height: 18px; fill: white; }
.login-logo-name { font-size: 18px; font-weight: 700; }
.login-sub { font-size: 13px; color: var(--text3); margin-bottom: 28px; }
.login-footer { font-size: 12px; color: var(--text3); text-align: center; margin-top: 20px; }

/* ============================================================ UTILITIES */
.flex   { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-8  { gap: 8px;  } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; } .flex-1 { flex: 1; } .ml-auto { margin-left: auto; }
.font-mono { font-family: 'Courier New', monospace; font-size: 12.5px; }
.text-muted { color: var(--text2); }
.text-small { font-size: 12.5px; }
.fw-600 { font-weight: 600; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-16 { margin-bottom: 16px; }

/* ============================================================ RESPONSIVE */

/* ─── Tablet ≤1024px ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 210px; }
  .stats-grid { grid-template-columns: repeat(2,1fr); gap:16px; }
}

/* ─── Mobile ≤768px ───────────────────────────────────────────── */
@media (max-width: 768px) {

  /* Sidebar: off-canvas */
  .sidebar {
    transform: translateX(-100%);
    width: 72vw; max-width: 280px;
    z-index: 400;
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: none;
  }
  .sidebar.open { transform: translateX(0); }
  /* Dark overlay when sidebar open */
  .sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.45); z-index: 399;
  }
  .sidebar-overlay.show { display: block; }

  /* Main layout */
  .main { margin-left: 0 !important; }

  /* Topbar */
  .topbar { padding: 0 14px; gap: 10px; height: 56px; }
  .topbar-title { font-size: 17px; }
  .topbar-username { display: none; }
  #menu-toggle {
    display: flex !important; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 8px;
    color: var(--text); transition: background .15s;
  }
  #menu-toggle:hover { background: var(--bg); }

  /* Content — extra bottom padding for bottom-nav */
  .content { padding: 14px 12px 76px !important; }

  /* Stat cards */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
  .stat-card  { padding: 14px 12px; gap: 10px; }
  .stat-icon  { width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0; }
  .stat-icon svg { width: 17px; height: 17px; }
  .stat-label { font-size: 11.5px; }
  .stat-value { font-size: 22px; }
  .stat-sub   { font-size: 11px; }

  /* Cards */
  .card { margin-bottom: 14px; border-radius: 10px; }
  .card-header { padding: 12px 14px; }
  .card-body   { padding: 12px 14px; }

  /* ── TABELAS RESPONSIVAS ─────────────────────────────────────
     Em mobile, a tabela vira um stack de "cards" por linha     */
  .table-wrap { overflow-x: visible !important; }
  table { display: block; }
  thead { display: none; }           /* Esconde cabeçalho */
  tbody { display: block; }
  tbody tr {
    display: flex;
    flex-direction: column;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    gap: 6px;
  }
  tbody tr:last-child { border-bottom: none; }
  tbody tr:hover { background: var(--surface-dim); }
  tbody td {
    display: flex; align-items: center;
    padding: 0 !important;
    font-size: 13px !important;
    text-align: left !important;
    border: none !important;
    gap: 6px;
  }
  /* Label antes do valor via data-label */
  tbody td[data-label]::before {
    content: attr(data-label);
    font-size: 10.5px; font-weight: 600;
    color: var(--text3); text-transform: uppercase;
    letter-spacing: .4px; min-width: 70px; flex-shrink: 0;
  }
  /* Ações: linha própria no final do card, sem sobreposição */
  tbody td.td-actions-cell {
    position: static;
    flex-direction: row; gap: 6px;
    flex-wrap: wrap;
    padding-top: 6px !important;
    margin-top: 2px;
    border-top: 1px solid var(--border) !important;
  }
  tbody td.td-actions-cell::before { display: none; }
  tbody td.td-actions-cell .btn-icon { width: 32px; height: 32px; }
  tbody td.td-actions-cell .btn-icon svg { width: 16px; height: 16px; }
  /* Primeira coluna: destaque (nome/email) sem padding extra */
  tbody td:first-child {
    font-size: 14px !important; font-weight: 600;
  }
  tbody td:first-child::before { display: none; }

  /* Forms */
  .form-row-2, .form-row-3 { grid-template-columns: 1fr !important; }

  /* Modals: bottom-sheet */
  .modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  .modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    border-radius: 16px 16px 0 0 !important;
    animation: mobileSheetUp .28s cubic-bezier(.16,1,.3,1) !important;
  }
  @keyframes mobileSheetUp {
    from { transform: translateY(100%); opacity: .6; }
    to   { transform: translateY(0);   opacity: 1; }
  }
  .modal-body   { padding: 14px 16px !important; }
  .modal-header { padding: 16px 16px 12px !important; }
  .modal-footer { padding: 12px 16px 78px !important; } /* 60px nav + 18px gap */

  /* Login */
  .login-box { padding: 28px 20px; margin: 16px; }

  /* Botões em toolbar */
  .btn-sm { padding: 6px 10px; font-size: 12px; }
  .btn    { font-size: 13px; }
  .card-header { flex-wrap: wrap; gap: 8px; }

  /* Activity log */
  .activity-item { padding: 12px 14px; gap: 10px; }
}

/* ─── Pequeno ≤480px ──────────────────────────────────────────── */
@media (max-width: 480px) {
  .stats-grid   { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card    { padding: 11px 10px; gap: 8px; }
  .stat-icon    { width: 32px; height: 32px; }
  .stat-icon svg{ width: 15px; height: 15px; }
  .stat-value   { font-size: 20px; }
  .stat-sub     { display: none; }
  .content      { padding: 10px 10px 76px !important; }
  .login-box    { padding: 24px 16px; margin: 10px; }
  .topbar       { padding: 0 10px; }
  .topbar-title { font-size: 15px; }
}

/* ─── Bottom nav bar ──────────────────────────────────────────── */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  z-index: 300;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -1px 0 var(--border), 0 -4px 16px rgba(0,0,0,.06);
  height: 60px;
}
@media (max-width: 768px) { .mobile-nav { display: flex; } }

.mobile-nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  padding: 6px 2px;
  color: var(--text3); text-decoration: none;
  font-size: 10px; font-weight: 600; letter-spacing: .15px;
  border: none; background: none; cursor: pointer;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-item svg { width: 22px; height: 22px; }
.mobile-nav-item.active { color: var(--primary); }
.mobile-nav-item:active { opacity: .7; }

/* ── Shared pagination controls ─────────────────────────────────────────── */
.pg-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; gap: 10px; flex-wrap: wrap;
}
.pg-perpage {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text2);
}
.pg-info {
  font-size: 12px; color: var(--text3); white-space: nowrap;
  padding-right: 10px; border-right: 1px solid var(--border); margin-right: 2px;
}
.pg-pp-label { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text2); cursor: default; }
.pg-pp-sel {
  height: 28px; padding: 0 6px; border: 1px solid var(--border2);
  border-radius: 6px; font-size: 13px; color: var(--text);
  background: var(--surface); cursor: pointer; outline: none;
}
.pg-pp-sel:focus { border-color: var(--primary); }
.pg-wrap { display: flex; align-items: center; gap: 2px; }
.pg-btn {
  min-width: 30px; height: 30px; padding: 0 6px;
  border-radius: 6px; border: 1px solid transparent;
  background: transparent; color: var(--text2);
  font-size: 13px; font-weight: 500; cursor: pointer; transition: background .12s, color .12s, border-color .12s;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.pg-btn:hover:not(.pg-btn-active):not(.pg-btn-disabled) {
  background: var(--primary-light, rgba(99,102,241,.09));
  color: var(--primary); border-color: var(--primary);
}
.pg-btn-active {
  background: var(--primary); color: #fff;
  border-color: var(--primary); pointer-events: none;
}
.pg-btn-disabled { opacity: .35; cursor: default; pointer-events: none; }
.pg-dots { padding: 0 3px; color: var(--text3); font-size: 14px; line-height: 30px; }

/* ============================================================ DARK MODE */
html.dark {
  --bg:            #0f172a;
  --surface:       #1e293b;
  --surface-dim:   #162032;
  --border:        #334155;
  --border2:       #475569;
  --text:          #f1f5f9;
  --text2:         #94a3b8;
  --text3:         #64748b;
  --primary-light: #1e3a5f;
  --success-bg:    #052e16;
  --success-border:#166534;
  --danger-bg:     #450a0a;
  --danger-border: #991b1b;
  --warning-bg:    #431407;
  --warning-border:#92400e;
  --info-bg:       #0c4a6e;
  --info-border:   #075985;
}

html.dark .stat-icon-primary { background: #1e3a5f; }
html.dark .stat-icon-success  { background: #052e16; }
html.dark .stat-icon-warning  { background: #431407; }
html.dark .stat-icon-info     { background: #0c4a6e; }

html.dark code {
  background: #1e293b; color: #94a3b8;
}

html.dark input,
html.dark select,
html.dark textarea {
  background: #1e293b; color: var(--text);
  border-color: var(--border);
}

html.dark input:focus,
html.dark select:focus,
html.dark textarea:focus {
  border-color: var(--primary);
}

html.dark .confirm-modal-box {
  background: var(--surface); color: var(--text);
}
