/* ============================================================
   4M DASHBOARD — UI MINIMALISTA ESTILO APPLE (DARK)
   ============================================================ */

/* --- Variáveis -------------------------------------------- */
:root {
  /* Superfícies (paleta dark refinada estilo visionOS) */
  --bg:          #08080a;
  --surface-1:   #141416;
  --surface-2:   #1c1c1f;
  --surface-3:   #2a2a2e;
  --border:      rgba(255, 255, 255, 0.08);
  --border-light:rgba(255, 255, 255, 0.16);

  /* Vidro translúcido (glassmorphism visionOS) */
  --glass-1:     rgba(28, 28, 32, 0.66);
  --glass-2:     rgba(34, 34, 40, 0.55);
  --glass-blur:  saturate(180%) blur(22px);
  --hairline:    inset 0 1px 0 rgba(255, 255, 255, 0.06);

  /* Accent — vermelho profundo do logo 4M */
  --brand:       #7d0d0d;
  --accent:      #e04452;
  --accent-dim:  rgba(224, 68, 82, 0.14);
  --accent-hover:#eb5966;
  --accent-glow: rgba(224, 68, 82, 0.35);

  /* Semânticos (dessaturados, discretos) */
  --green:       #32d74b;
  --green-dim:   rgba(50, 215, 75, 0.14);
  --red:         #ff453a;
  --red-dim:     rgba(255, 69, 58, 0.14);
  --yellow:      #ffd60a;
  --yellow-dim:  rgba(255, 214, 10, 0.14);

  /* Texto (off-white Apple + cinzas) */
  --text-1:      #f5f5f7;
  --text-2:      #a1a1a6;
  --text-3:      #6e6e73;

  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   18px;
  --radius-xl:   24px;

  --shadow-sm:   0 1px 2px rgba(0,0,0,.4);
  --shadow-md:   0 6px 24px rgba(0,0,0,.4);
  --shadow-lg:   0 20px 60px rgba(0,0,0,.55);
  --ease:        cubic-bezier(.34, 1.56, .64, 1);

  --sidebar-w:   248px;
  --header-h:    68px;
}

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

html { font-size: 15px; background: var(--bg); color: var(--text-1); }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
  position: relative;
}

/* Profundidade ambiente (glow sutil de fundo, estilo visionOS) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 12% -8%, rgba(224, 68, 82, 0.07), transparent 60%),
    radial-gradient(50rem 40rem at 108% 8%, rgba(125, 13, 13, 0.10), transparent 55%);
}

.layout, .login-page { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* --- Layout ------------------------------------------------ */
.layout { display: flex; min-height: 100vh; }

/* --- Sidebar ----------------------------------------------- */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--glass-1);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.sidebar.collapsed { transform: translateX(calc(-1 * var(--sidebar-w))); }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 22px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo img.brand-mark {
  width: 34px; height: 34px;
  object-fit: contain;
}

.sidebar-logo-text {
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: -.02em;
  color: var(--text-1);
}

.sidebar-nav { flex: 1; padding: 18px 14px; overflow-y: auto; }

.nav-group { margin-bottom: 26px; }

.nav-group-label {
  display: block;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 10px;
  margin-bottom: 8px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border-radius: var(--radius-md);
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-2);
  transition: background .18s ease, color .18s ease, transform .18s ease;
  margin-bottom: 3px;
}

.nav-item:hover { background: var(--surface-3); color: var(--text-1); }
.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: var(--hairline);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}
.nav-item svg { flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-user { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; }

.sidebar-user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-name { font-size: .85rem; font-weight: 600; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: .74rem; color: var(--text-3); }

.btn-logout {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  transition: background .18s, color .18s;
  flex-shrink: 0;
}
.btn-logout:hover { background: var(--red-dim); color: var(--red); }

/* --- Account Switcher (troca rápida de conta) --------------- */
[x-cloak] { display: none !important; }
.account-switcher { position: relative; flex: 1; min-width: 0; }

.account-trigger {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: none;
  cursor: pointer;
  text-align: left;
  transition: background .18s, border-color .18s;
}
.account-trigger:hover { background: var(--surface-3); border-color: var(--border); }
.account-trigger .chevron { margin-left: auto; color: var(--text-3); flex-shrink: 0; transition: transform .2s; }

.account-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0,0,0,.45);
  padding: 6px;
  z-index: 60;
  max-height: 60vh;
  overflow-y: auto;
}
.account-menu-label {
  font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-3); padding: 8px 8px 6px;
}
.account-item { display: flex; align-items: center; gap: 4px; }
.account-item-main {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 0;
  padding: 8px; border-radius: var(--radius-sm);
  transition: background .15s;
}
.account-item-main:hover { background: var(--surface-3); }
.account-item.is-current .account-item-main { cursor: default; }
.account-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-1);
  font-size: .78rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.account-avatar.is-current { background: var(--accent); color: #fff; }
.account-texts { display: flex; flex-direction: column; min-width: 0; }
.account-name { font-size: .82rem; font-weight: 600; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-email { font-size: .72rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-current-tag { font-size: .66rem; color: var(--accent); font-weight: 600; }
.account-remove {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  color: var(--text-3); flex-shrink: 0; transition: background .15s, color .15s;
}
.account-remove:hover { background: var(--red-dim); color: var(--red); }
.account-menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.account-action {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px; border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 500; color: var(--text-2);
  transition: background .15s, color .15s;
}
.account-action:hover { background: var(--surface-3); color: var(--text-1); }
.account-action.is-logout:hover { background: var(--red-dim); color: var(--red); }

/* Chips de contas na tela de login */
.login-accounts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.login-account {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: background .15s, border-color .15s;
}
.login-account:hover { background: var(--surface-3); border-color: var(--border-light); }

/* --- Área de Acessos (cofre de credenciais) ---------------- */
.cred-cell { display: inline-flex; align-items: center; gap: 8px; }
.cred-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .82rem;
  color: var(--text-1);
  letter-spacing: .02em;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cred-senha { color: var(--text-2); }
.cred-eye, .cred-copy {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  color: var(--text-3);
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.cred-eye:hover, .cred-copy:hover { background: var(--surface-3); color: var(--text-1); }
.cred-copy.cred-copied { color: var(--green); background: var(--green-dim); }

/* --- Main Content ------------------------------------------ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .3s cubic-bezier(.4,0,.2,1);
}

.main-content.full { margin-left: 0; }

/* --- Page Header ------------------------------------------- */
.page-header {
  height: var(--header-h);
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--glass-1);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  position: sticky;
  top: 0;
  z-index: 50;
}

.sidebar-toggle {
  background: none; border: none; padding: 7px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  transition: background .18s, color .18s;
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--surface-3); color: var(--text-1); }

.page-header-title { flex: 1; }
.page-header-title h1 { font-size: 1.15rem; font-weight: 600; color: var(--text-1); letter-spacing: -.02em; }
.page-subtitle { font-size: .82rem; color: var(--text-3); margin-top: 1px; }

.page-header-actions { display: flex; align-items: center; gap: 10px; }

.page-body {
  padding: 32px; flex: 1; max-width: 1400px; width: 100%;
  animation: pageIn .45s var(--ease) both;
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* --- Cards KPI --------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

/* Revelação em cascata dos KPIs (entrada premium) */
.kpi-grid .kpi-card { animation: kpiIn .5s var(--ease) both; }
.kpi-grid .kpi-card:nth-child(1) { animation-delay: .02s; }
.kpi-grid .kpi-card:nth-child(2) { animation-delay: .06s; }
.kpi-grid .kpi-card:nth-child(3) { animation-delay: .10s; }
.kpi-grid .kpi-card:nth-child(4) { animation-delay: .14s; }
.kpi-grid .kpi-card:nth-child(5) { animation-delay: .18s; }
.kpi-grid .kpi-card:nth-child(6) { animation-delay: .22s; }
.kpi-grid .kpi-card:nth-child(7) { animation-delay: .26s; }
.kpi-grid .kpi-card:nth-child(8) { animation-delay: .30s; }

@keyframes kpiIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.kpi-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, var(--glass-2), var(--glass-1));
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm), var(--hairline);
  transition: border-color .3s, transform .3s var(--ease), box-shadow .3s;
}
.kpi-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(160deg, rgba(255,255,255,.10), transparent 40%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
.kpi-card:hover {
  border-color: var(--border-light);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md), var(--hairline);
}

.kpi-label {
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-2);
  margin-bottom: 12px;
}

.kpi-value {
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.kpi-sub { font-size: .78rem; color: var(--text-3); margin-top: 8px; }

.kpi-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: .74rem; font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  margin-top: 10px;
}
.kpi-badge.up   { background: var(--green-dim); color: var(--green); }
.kpi-badge.down { background: var(--red-dim);   color: var(--red); }

/* --- Cards Gráficos / Seções ------------------------------ */
.card {
  background: linear-gradient(160deg, var(--glass-2), var(--glass-1));
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm), var(--hairline);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 12px;
}

.card-title { font-size: 1rem; font-weight: 600; color: var(--text-1); letter-spacing: -.02em; }
.card-sub   { font-size: .8rem; color: var(--text-3); margin-top: 3px; }

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}

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

/* --- Filtros de Período ------------------------------------ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  background: var(--glass-2);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: 30px;
  padding: 5px;
  width: fit-content;
  max-width: 100%;
  box-shadow: var(--hairline);
}

.filter-btn {
  padding: 7px 16px;
  border-radius: 24px;
  font-size: .82rem;
  font-weight: 500;
  background: transparent;
  border: none;
  color: var(--text-2);
  transition: all .18s;
}
.filter-btn:hover  { color: var(--text-1); }
.filter-btn.active { background: var(--surface-3); color: var(--text-1); box-shadow: 0 1px 3px rgba(0,0,0,.3); }

.filter-custom {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-radius: 24px;
  background: transparent;
  font-size: .82rem;
}
.filter-custom input[type="date"] {
  background: none; border: none; color: var(--text-1);
  font-size: .82rem; outline: none;
  color-scheme: dark;
}

/* --- Tabelas ----------------------------------------------- */
.table-wrap { overflow-x: auto; max-height: 70vh; }

table { width: 100%; border-collapse: collapse; font-size: .88rem; }

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 13px 16px;
  text-align: left;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

thead th.sortable { cursor: pointer; user-select: none; transition: color .15s; }
thead th.sortable:hover { color: var(--text-1); }

tbody tr { border-bottom: 1px solid var(--border); transition: background .15s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }

tbody td { padding: 14px 16px; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
tbody td.td-name { font-weight: 600; color: var(--text-1); }

/* --- Badges de Status ------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: .74rem;
  font-weight: 600;
  box-shadow: var(--hairline);
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge-aprovada   { background: var(--green-dim);  color: var(--green); }
.badge-pendente   { background: var(--yellow-dim); color: var(--yellow); }
.badge-recusada   { background: var(--red-dim);    color: var(--red); }
.badge-reembolso  { background: var(--accent-dim); color: var(--accent); }
.badge-chargeback { background: rgba(255,69,58,.2);  color: #ff6961; }

/* --- Valores coloridos ------------------------------------ */
.valor-positivo { color: var(--green); font-weight: 600; }
.valor-negativo { color: var(--red);   font-weight: 600; }
.valor-alerta   { color: var(--yellow); font-weight: 600; }
.valor-neutro   { color: var(--text-2); }

/* --- Botões ----------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px;
  border-radius: 980px;
  font-size: .86rem;
  font-weight: 500;
  border: none;
  transition: background .18s, box-shadow .18s, transform .12s;
  line-height: 1;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow), var(--hairline);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 18px var(--accent-glow), var(--hairline); }

.btn-secondary {
  background: var(--surface-2); color: var(--text-1);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-3); border-color: var(--border-light); }

.btn-danger {
  background: var(--red-dim); color: var(--red);
  border: 1px solid rgba(255,69,58,.24);
}
.btn-danger:hover { background: rgba(255,69,58,.22); }

.btn-success {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--green); color: #04140a;
  border: 1px solid transparent;
  font-weight: 700; letter-spacing: .02em;
}
.btn-success:hover { filter: brightness(1.08); }

.btn-sm { padding: 6px 13px; font-size: .8rem; }
.btn-icon { padding: 8px; }

/* --- Formulários ------------------------------------------ */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: .82rem; font-weight: 500;
  color: var(--text-2);
  margin-bottom: 7px;
}

.form-control {
  width: 100%;
  padding: 11px 15px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-1);
  font-size: .9rem;
  transition: border-color .18s, box-shadow .18s;
  outline: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-dim); }
.form-control::placeholder { color: var(--text-3); }

select.form-control { color-scheme: dark; }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-hint { font-size: .78rem; color: var(--text-3); margin-top: 5px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* --- Modal ------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: linear-gradient(160deg, var(--glass-2), var(--glass-1));
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 480px;
  padding: 32px;
  box-shadow: var(--shadow-lg), var(--hairline);
  animation: modalIn .32s var(--ease) both;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.modal-title { font-size: 1.1rem; font-weight: 600; letter-spacing: -.02em; }
.modal-close {
  background: none; border: none; color: var(--text-3);
  padding: 5px; border-radius: var(--radius-sm);
  transition: background .18s, color .18s;
}
.modal-close:hover { background: var(--surface-3); color: var(--text-1); }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 28px; }

/* Corpo rolável do modal (listas de gerenciamento de estoque) */
.modal-body { max-height: 55vh; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.stock-manage-list { display: flex; flex-direction: column; gap: 8px; }
.stock-manage-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

/* --- Alert / Toast ---------------------------------------- */
.alert {
  padding: 13px 17px 13px 20px;
  border-radius: var(--radius-md);
  font-size: .86rem;
  font-weight: 500;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
  animation: pageIn .35s var(--ease) both;
}
.alert::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: currentColor;
}
.alert-success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(50,215,75,.24); }
.alert-error   { background: var(--red-dim);   color: var(--red);   border: 1px solid rgba(255,69,58,.24); }
.alert-warning { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(255,214,10,.24); }
.alert-info    { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(224,68,82,.24); }

.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 19px;
  font-size: .86rem;
  font-weight: 500;
  color: var(--text-1);
  box-shadow: var(--shadow-lg);
  animation: slideIn .22s ease;
  display: flex; align-items: center; gap: 10px;
}
.toast.toast-success { border-color: rgba(50,215,75,.3); }
.toast.toast-error   { border-color: rgba(255,69,58,.3); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* --- Webhook Box ------------------------------------------ */
.webhook-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 15px;
  font-size: .82rem; font-family: 'SF Mono', ui-monospace, 'Courier New', monospace;
  color: var(--accent);
  word-break: break-all;
}
.webhook-box-copy {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 980px;
  background: var(--accent-dim);
  border: 1px solid transparent;
  color: var(--accent);
  font-size: .76rem; font-weight: 600;
  transition: background .18s, color .18s;
}
.webhook-box-copy:hover { background: var(--accent); color: #fff; }

/* --- Realtime dot ----------------------------------------- */
.realtime-dot {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .76rem; color: var(--green);
}
.realtime-dot::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* --- Divider ---------------------------------------------- */
.divider { height: 1px; background: var(--border); margin: 28px 0; }

/* --- Scrollbar -------------------------------------------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* --- Responsivo ------------------------------------------- */
@media (max-width: 768px) {
  :root { --sidebar-w: 268px; }
  .sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-body { padding: 18px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

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

/* --- Página de Login -------------------------------------- */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.login-card {
  position: relative;
  background: linear-gradient(160deg, var(--glass-2), var(--glass-1));
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg), var(--hairline);
  animation: loginIn .5s var(--ease) both;
}

@keyframes loginIn {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  margin-bottom: 32px;
}
.login-logo img.brand-mark {
  width: 64px; height: 64px; object-fit: contain;
  filter: drop-shadow(0 6px 18px var(--accent-glow));
}
.login-logo-text { font-size: 1.35rem; font-weight: 600; letter-spacing: -.03em; }

.login-title { font-size: 1.5rem; font-weight: 600; margin-bottom: 8px; text-align: center; letter-spacing: -.03em; }
.login-sub   { font-size: .86rem; color: var(--text-3); text-align: center; margin-bottom: 30px; }

/* --- Utilitários ------------------------------------------ */
.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.text-sm { font-size: .82rem; }
.text-muted { color: var(--text-3); }
.font-bold { font-weight: 600; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* --- Spinner --------------------------------------------- */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Empty state ------------------------------------------ */
.empty-state { text-align: center; padding: 56px 24px; color: var(--text-3); }
.empty-state svg {
  display: block;
  margin: 0 auto 16px;
  padding: 16px;
  width: 68px; height: 68px;
  box-sizing: content-box;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.empty-state p { font-size: .9rem; }

/* --- Comparativo highlight -------------------------------- */
.highlight-best  td:first-child { box-shadow: inset 3px 0 0 var(--green); }
.highlight-worst td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.highlight-best  { background: rgba(50,215,75,.06); }
.highlight-worst { background: rgba(255,69,58,.06); }
.highlight-best:hover  { background: rgba(50,215,75,.10); }
.highlight-worst:hover { background: rgba(255,69,58,.10); }

/* --- Abas (tabs) ------------------------------------------ */
.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-3);
  font-size: .9rem;
  font-weight: 500;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--text-1); }
.tab-btn.tab-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  box-shadow: 0 6px 12px -8px var(--accent-glow);
}

/* --- Toggle Cartão para Domínios -------------------------- */
.domain-toggle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text-1);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.domain-toggle:hover { border-color: var(--text-3); }
.domain-toggle-on {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
  color: var(--accent);
}

/* ============================================================
   ESTOQUE / DOMÍNIOS / NOTIFICAÇÕES
   ============================================================ */

/* Botão largura total (usado nos cards de estoque) */
.btn-block { display: flex; width: 100%; justify-content: center; }

/* --- Cards de contagem do estoque ------------------------- */
.stock-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stock-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--hairline);
}
.stock-card-head { display: flex; align-items: center; gap: 12px; }
.stock-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stock-icon-google { background: var(--green-dim);  color: var(--green); }
.stock-icon-proxy  { background: var(--yellow-dim); color: var(--yellow); }
.stock-icon-domain { background: var(--accent-dim); color: var(--accent); }
.stock-card-title { font-weight: 600; font-size: .98rem; color: var(--text-1); }
.stock-card-sub   { font-size: .78rem; color: var(--text-3); }
.stock-count {
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.stock-count span { font-size: .82rem; font-weight: 500; color: var(--text-3); }
.stock-actions { margin-top: auto; }

/* --- Lista de itens reivindicados ------------------------- */
.stock-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  padding: 20px 24px;
}
.stock-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stock-item-top { display: flex; align-items: center; gap: 8px; }
.stock-item-content {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.stock-item-content code { flex: 1; font-size: .8rem; color: var(--text-1); }
.stock-item-note {
  font-size: .82rem;
  color: var(--text-2);
  background: var(--yellow-dim);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  line-height: 1.4;
}
.stock-item-actions { display: flex; gap: 8px; margin-top: auto; }
.conta-subida-ok {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--green-dim);
  color: var(--green);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .02em;
}

/* --- Status de domínio ------------------------------------ */
.dom-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
}
.dom-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dom-online  { background: var(--green-dim);  color: var(--green); }
.dom-online  .dom-dot { background: var(--green); box-shadow: 0 0 0 3px rgba(50,215,75,.18); }
.dom-offline { background: var(--red-dim);    color: var(--red); }
.dom-offline .dom-dot { background: var(--red); box-shadow: 0 0 0 3px rgba(255,69,58,.18); }
.dom-unknown { background: var(--surface-3);  color: var(--text-3); }
.dom-unknown .dom-dot { background: var(--text-3); }

/* --- Sino de notificações --------------------------------- */
.notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: color .15s, background .15s, border-color .15s;
  flex-shrink: 0;
}
.notif-bell:hover { color: var(--text-1); border-color: var(--border-light); }
.notif-badge {
  position: absolute;
  top: -5px; right: -5px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}

/* --- Central de notificações ------------------------------ */
.notif-list { display: flex; flex-direction: column; }
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}
.notif-item:first-child { border-top: none; }
.notif-item.is-unread { background: var(--accent-dim); }
.notif-ic {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.notif-ic-report { background: var(--yellow-dim); color: var(--yellow); }
.notif-ic-domain { background: var(--red-dim);    color: var(--red); }
.notif-ic-info   { background: var(--accent-dim); color: var(--accent); }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-weight: 600; font-size: .92rem; color: var(--text-1); }
.notif-msg   { font-size: .85rem; color: var(--text-2); margin-top: 2px; line-height: 1.45; }
.notif-meta  { font-size: .75rem; color: var(--text-3); margin-top: 6px; }
.notif-item-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

@media (max-width: 760px) {
  .stock-grid { grid-template-columns: 1fr; }
  .notif-item { flex-wrap: wrap; }
  .notif-item-actions { width: 100%; justify-content: flex-end; }
}
