/* ============================================================
   CENTRAL — painel do negócio de dropshipping
   Estilo: moderno, limpo, com suporte a tema claro/escuro
   ============================================================ */

:root {
  --bg: #150a1c;
  --bg-soft: #241a2b;
  --card: rgba(30, 21, 36, 0.72);
  --border: #3d2c40;
  --text: #f6eef2;
  --text-soft: #c8afba;
  --brand: #ff7a3c;
  --brand-strong: #f0561e;
  --danger: #ff5b6e;
  --ok: #3ecf8e;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
}
body {
  min-height: 100vh;
  background: linear-gradient(
    180deg,
    #160a1c 0%,
    #241026 18%,
    #3a1528 38%,
    #6e2724 58%,
    #b8401d 80%,
    #ff6a24 100%
  ) fixed;
}

/* ---------- utilidades ---------- */
.hidden { display: none !important; }

button {
  font-family: var(--font);
  cursor: pointer;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  transition: transform 0.06s ease, background 0.15s ease, opacity 0.15s ease;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.55; cursor: default; }

/* ============================================================
   TELA DE LOGIN / CADASTRO
   ============================================================ */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.brand .logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ffb04a, #f0561e);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #2a0f06;
  font-size: 20px;
}
.brand h1 { font-size: 20px; margin: 0; letter-spacing: -0.02em; }

.auth-h {
  font-size: 22px;
  margin: 16px 0 22px;
  letter-spacing: -0.02em;
}
.auth-sub {
  color: var(--text-soft);
  font-size: 14px;
  margin: 4px 0 24px;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  transition: border 0.15s ease;
}
.field input:focus { border-color: var(--brand); }

.btn-primary {
  width: 100%;
  padding: 13px;
  background: var(--brand-strong);
  color: #fff;
  font-size: 15px;
}
.btn-primary:hover:not(:disabled) { background: var(--brand); }

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-soft);
}
.auth-switch a { color: var(--brand); cursor: pointer; font-weight: 600; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

.msg {
  margin-top: 16px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.4;
}
.msg.error { background: rgba(255, 91, 110, 0.12); color: #ff9aa6; border: 1px solid rgba(255, 91, 110, 0.3); }
.msg.ok { background: rgba(62, 207, 142, 0.12); color: #7ee2b4; border: 1px solid rgba(62, 207, 142, 0.3); }
.msg.warn { background: rgba(255, 193, 71, 0.12); color: #ffd98a; border: 1px solid rgba(255, 193, 71, 0.3); }

/* ============================================================
   PAINEL (depois do login)
   ============================================================ */
.app-shell { min-height: 100vh; display: flex; flex-direction: row; }

/* ============================================================
   BARRA LATERAL (sidebar)
   ============================================================ */
.sidebar {
  width: 258px;
  flex-shrink: 0;
  min-height: 100vh;
  height: 100vh;
  position: sticky;
  top: 0;
  background: rgba(12, 7, 16, 0.82);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
}

.side-brand { margin: 4px 6px 20px; }
.side-brand h1 { font-size: 18px; line-height: 1.15; }
.side-brand h1 span { color: var(--brand); }

.side-user {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 8px;
  margin-bottom: 6px;
  border-radius: 12px;
}
.side-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ffb04a, #f0561e);
  color: #2a0f06;
  font-weight: 800;
  font-size: 16px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.side-user-info { display: flex; flex-direction: column; line-height: 1.25; overflow: hidden; }
.side-user-info b { font-size: 14px; }
.side-user-info span { font-size: 12px; color: var(--text-soft); }

.side-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 10px; }
.side-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-soft);
  font-weight: 700;
  margin: 18px 10px 6px;
}

.side-nav .nav-btn,
.side-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-soft);
  font-size: 14.5px;
}
.side-nav .nav-btn .ic,
.side-link .ic { display: inline-flex; align-items: center; justify-content: center; width: 20px; flex-shrink: 0; }
.side-nav .nav-btn .ic svg,
.side-link .ic svg { width: 18px; height: 18px; }
.side-nav .nav-btn:hover,
.side-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.side-nav .nav-btn.active {
  background: rgba(255, 122, 60, 0.14);
  color: var(--brand);
  border-color: rgba(255, 122, 60, 0.32);
}

.sidebar-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.content { flex: 1; min-width: 0; padding: 34px 36px 60px; }

/* ---------- Página Hub ---------- */
.hub-sub { color: var(--text-soft); margin: -6px 0 24px; font-size: 14px; }
.hub-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.hub-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hs-label { font-size: 12px; color: var(--text-soft); font-weight: 600; }
.hs-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }

.hub-stores {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.hub-stores h3 { margin: 0 0 6px; font-size: 16px; }
.hub-store-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--border);
}
.hs-name { font-weight: 600; flex: 1; }
.hs-rev { font-weight: 700; }
.hs-ord { color: var(--text-soft); font-size: 13px; min-width: 92px; text-align: right; }

/* ---------- Responsivo (celular): barra lateral vira topo ---------- */
@media (max-width: 820px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    min-height: 0;
    position: static;
    padding: 14px 16px;
  }
  .side-nav { flex-direction: row; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
  .side-section { display: none; }
  .side-nav .nav-btn { width: auto; }
  .sidebar-bottom { flex-direction: row; margin-top: 12px; padding-top: 12px; }
  .side-link { width: auto; }
  .content { padding: 22px 18px 48px; }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(22, 27, 34, 0.6);
  backdrop-filter: blur(8px);
}
.topbar .who { font-size: 14px; color: var(--text-soft); }
.topbar .who b { color: var(--text); }

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--border);
  padding: 9px 14px;
  font-size: 14px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--brand); }

.main {
  flex: 1;
  padding: 40px 28px;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

.welcome h2 { font-size: 26px; margin: 0 0 8px; letter-spacing: -0.02em; }
.welcome p { color: var(--text-soft); margin: 0 0 32px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.tile .icon { font-size: 26px; }
.tile h3 { margin: 12px 0 4px; font-size: 16px; }
.tile p { margin: 0; font-size: 13px; color: var(--text-soft); }
.tile.soon { opacity: 0.6; }
.tag-soon {
  display: inline-block;
  margin-top: 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  background: rgba(91, 140, 255, 0.12);
  padding: 3px 8px;
  border-radius: 6px;
}

/* ---------- Painéis (Criar acesso / Trocar senha) ---------- */
.panel {
  margin-top: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.panel h3 { margin: 0 0 4px; font-size: 17px; }
.panel-sub { margin: 0 0 16px; font-size: 13px; color: var(--text-soft); }

.row-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.row-form input {
  flex: 1 1 160px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
}
.row-form input:focus { border-color: var(--brand); }
.row-form .btn-primary { width: auto; flex: 0 0 auto; padding: 12px 22px; }

.loading-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--text-soft);
}
.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   NAV + PERÍODO + PÁGINAS (lojas / relatórios)
   ============================================================ */
.nav { display: flex; gap: 6px; }
.nav-btn {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid transparent;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
}
.nav-btn:hover { color: var(--text); }
.nav-btn.active { background: rgba(255,122,60,0.15); color: var(--brand); border-color: rgba(255,122,60,0.35); }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.period-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.period-label { color: var(--text-soft); font-size: 13px; margin-right: 4px; }
.period-btn {
  background: var(--bg-soft);
  color: var(--text-soft);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13.5px;
}
.period-btn.active { background: var(--brand-strong); color: #fff; border-color: var(--brand-strong); }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.page-head h2 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
.btn-inline { width: auto; padding: 11px 18px; font-size: 14px; }

.empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  color: var(--text-soft);
}

/* ============================================================
   CARDS DE LOJA
   ============================================================ */
.stores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.store-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
}
.store-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 16px; }
.store-id { min-width: 0; }
.store-head h3 { margin: 0 0 2px; font-size: 17px; }
.store-dom { font-size: 12px; color: var(--text-soft); }
.store-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* Indicadores de conexão (Shopify / Métricas / Google) */
.conns { display: inline-flex; align-items: center; gap: 9px; margin-right: 2px; }
.conn { display: inline-flex; align-items: center; gap: 3px; line-height: 1; cursor: default; color: var(--text-soft); }
.conn svg { width: 14px; height: 14px; }
.conn .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dot.on { background: var(--ok); box-shadow: 0 0 5px rgba(62, 207, 142, 0.75); }
.dot.off { background: var(--danger); }

.icon-btn {
  background: transparent;
  border: none;
  padding: 3px;
  border-radius: 7px;
  opacity: 0.55;
  display: inline-flex;
  align-items: center;
  color: var(--text-soft);
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { opacity: 1; background: rgba(255,255,255,0.06); }

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.metrics.big { grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metric {
  background: rgba(0,0,0,0.22);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.m-label { font-size: 10.5px; letter-spacing: 0.08em; color: var(--text-soft); font-weight: 700; }
.m-value { font-size: 17px; font-weight: 700; }

.btn-ghost.full { width: 100%; margin-top: auto; }

.add-card {
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 160px;
  font-size: 15px;
  cursor: pointer;
}
.add-card:hover { border-color: var(--brand); color: var(--brand); }
.add-card .plus { font-size: 34px; line-height: 1; }

/* ============================================================
   RELATÓRIOS
   ============================================================ */
.report-controls { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.seg-btn { background: transparent; color: var(--text-soft); padding: 8px 16px; border-radius: 999px; font-size: 13.5px; }
.seg-btn.active { background: var(--brand-strong); color: #fff; }
.select {
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font);
}
.report-output { }
.report-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.report-title { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.report-title h3 { margin: 0; font-size: 20px; }
.report-period { font-size: 13px; color: var(--brand); font-weight: 600; }
.calc-note { font-size: 12px; color: var(--text-soft); margin: 14px 0 0; }

/* ============================================================
   MODAIS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
}
.modal {
  width: 100%;
  max-width: 460px;
  background: #1c1424;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
}
.modal h3 { margin: 0 0 14px; font-size: 19px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .field { margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.modal-actions .btn-primary, .modal-actions .btn-ghost { width: auto; padding: 11px 20px; }
.muted { color: var(--text-soft); font-weight: 400; font-size: 0.85em; }
