/* ============================================================
   MuayOS — Design System
   Tema dark de combate. Vermelho/dourado tailandês.
   ============================================================ */

:root {
  /* Cores base */
  --bg:        #0E1014;
  --bg-2:      #14171E;
  --surface:   #1A1E27;
  --surface-2: #222734;
  --border:    #2B3140;
  --border-2:  #3A4252;

  /* Texto */
  --text:      #EDEFF4;
  --text-soft: #B7BEcc;
  --text-muted:#7C8597;

  /* Marca */
  --red:       #E11D2A;
  --red-dark:  #B11320;
  --red-soft:  rgba(225,29,42,.14);
  --gold:      #E6B450;
  --gold-soft: rgba(230,180,80,.14);

  /* Estado */
  --success:   #25C26E;
  --success-soft: rgba(37,194,110,.14);
  --warning:   #F2A93B;
  --warning-soft: rgba(242,169,59,.14);
  --danger:    #FF4D5E;
  --info:      #3B9DF2;

  --radius:    14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --shadow:    0 8px 30px rgba(0,0,0,.35);
  --shadow-sm: 0 2px 10px rgba(0,0,0,.25);
  --ring:      0 0 0 3px rgba(225,29,42,.30);

  --sidebar-w: 256px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; }
body {
  font-family:var(--font);
  background:var(--bg);
  color:var(--text);
  line-height:1.55;
  -webkit-font-smoothing:antialiased;
}
a { color:inherit; text-decoration:none; }
img { max-width:100%; display:block; }
button { font-family:inherit; cursor:pointer; }
::selection { background:var(--red); color:#fff; }

/* Scrollbar */
::-webkit-scrollbar { width:10px; height:10px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border-2); border-radius:20px; border:2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background:#4a5366; }

/* ---------- Tipografia ---------- */
h1 { font-size:1.7rem; font-weight:800; letter-spacing:-.02em; }
h2 { font-size:1.35rem; font-weight:800; letter-spacing:-.01em; }
h3 { font-size:1.1rem; font-weight:700; }
h4 { font-size:.98rem; font-weight:700; }
.text-muted { color:var(--text-muted); }
.text-soft  { color:var(--text-soft); }
.text-gold  { color:var(--gold); }
.text-red   { color:var(--red); }
.text-success { color:var(--success); }
.text-center { text-align:center; }
.text-sm { font-size:.85rem; }
.text-xs { font-size:.75rem; }
.fw-700 { font-weight:700; }
.fw-800 { font-weight:800; }
.mono { font-family:'SF Mono', ui-monospace, 'Roboto Mono', monospace; }

/* ---------- Utilitários ---------- */
.d-flex { display:flex; }
.d-grid { display:grid; }
.flex-col { flex-direction:column; }
.items-center { align-items:center; }
.items-start { align-items:flex-start; }
.justify-between { justify-content:space-between; }
.justify-center { justify-content:center; }
.flex-wrap { flex-wrap:wrap; }
.flex-1 { flex:1; }
.gap-1 { gap:8px; }  .gap-2 { gap:16px; }  .gap-3 { gap:24px; }
.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}
.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}
.w-100{width:100%}
.hidden { display:none !important; }

/* ============================================================
   App Shell
   ============================================================ */
.app { display:flex; min-height:100vh; }

.sidebar {
  width:var(--sidebar-w);
  background:var(--bg-2);
  border-right:1px solid var(--border);
  display:flex; flex-direction:column;
  position:fixed; inset:0 auto 0 0; z-index:40;
  transition:transform .25s ease;
}
.sidebar-brand {
  display:flex; align-items:center; gap:11px;
  padding:20px 20px 16px;
  border-bottom:1px solid var(--border);
}
.brand-mark {
  width:38px; height:38px; border-radius:11px;
  background:linear-gradient(135deg,var(--red),var(--red-dark));
  display:flex; align-items:center; justify-content:center;
  font-size:1.2rem; box-shadow:0 4px 14px rgba(225,29,42,.4);
}
.brand-name { font-weight:800; font-size:1.15rem; letter-spacing:-.02em; }
.brand-name span { color:var(--red); }
.brand-sub { font-size:.68rem; color:var(--text-muted); letter-spacing:.12em; text-transform:uppercase; }

.nav-section { padding:16px 12px; flex:1; overflow-y:auto; }
.nav-label { font-size:.68rem; text-transform:uppercase; letter-spacing:.12em; color:var(--text-muted); padding:8px 12px 6px; font-weight:700; }
.nav-item {
  display:flex; align-items:center; gap:12px;
  padding:11px 13px; border-radius:10px;
  color:var(--text-soft); font-weight:500; font-size:.92rem;
  margin-bottom:2px; transition:.15s;
}
.nav-item:hover { background:var(--surface); color:var(--text); }
.nav-item.active { background:var(--red-soft); color:#fff; font-weight:600; }
.nav-item.active .nav-ico { filter:none; }
.nav-ico { font-size:1.1rem; width:22px; text-align:center; }
.nav-badge { margin-left:auto; background:var(--red); color:#fff; font-size:.68rem; font-weight:700; padding:1px 7px; border-radius:20px; }

.sidebar-foot { padding:14px; border-top:1px solid var(--border); }
.user-chip { display:flex; align-items:center; gap:10px; padding:8px; border-radius:10px; }
.user-chip:hover { background:var(--surface); }
.avatar {
  width:36px; height:36px; border-radius:50%;
  background:linear-gradient(135deg,var(--surface-2),var(--border-2));
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:.85rem; color:var(--text); flex-shrink:0;
  border:1px solid var(--border-2);
}
.avatar.gold { background:linear-gradient(135deg,var(--gold),#caa23f); color:#3a2d08; border:none; }

.main { flex:1; margin-left:var(--sidebar-w); min-width:0; }

/* Topbar */
.topbar {
  height:64px; padding:0 28px;
  display:flex; align-items:center; justify-content:space-between;
  border-bottom:1px solid var(--border);
  background:rgba(14,16,20,.8); backdrop-filter:blur(12px);
  position:sticky; top:0; z-index:30;
}
.topbar-left { display:flex; align-items:center; gap:14px; }
.topbar-title { font-weight:700; font-size:1.05rem; }
.topbar-right { display:flex; align-items:center; gap:10px; }
.topbar-search {
  display:flex; align-items:center; gap:8px;
  background:var(--surface); border:1px solid var(--border);
  border-radius:10px; padding:8px 13px; width:280px;
}
.topbar-search input { background:none; border:none; outline:none; color:var(--text); width:100%; font-size:.9rem; }
.topbar-search input::placeholder { color:var(--text-muted); }
.topbar-btn {
  width:40px; height:40px; border-radius:10px;
  background:var(--surface); border:1px solid var(--border);
  color:var(--text-soft); display:flex; align-items:center; justify-content:center;
  font-size:1.05rem; position:relative; transition:.15s;
}
.topbar-btn:hover { background:var(--surface-2); color:var(--text); }
.notif-dot { position:absolute; top:9px; right:10px; width:8px; height:8px; background:var(--red); border-radius:50%; border:2px solid var(--bg-2); }

.content { padding:28px; max-width:1320px; }
.page-header { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; margin-bottom:26px; flex-wrap:wrap; }
.page-header p { color:var(--text-muted); margin-top:3px; font-size:.92rem; }

/* ============================================================
   Componentes
   ============================================================ */
.card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:22px;
}
.card-pad-sm { padding:16px; }
.card-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; gap:12px; }
.card-head h3, .card-head h4 { margin:0; }
.card-sub { font-size:.83rem; color:var(--text-muted); margin-top:2px; }

/* Botões */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:11px 18px; border-radius:10px; border:1px solid transparent;
  font-weight:600; font-size:.92rem; transition:.15s; white-space:nowrap;
  background:var(--surface-2); color:var(--text);
}
.btn:hover { transform:translateY(-1px); }
.btn:active { transform:translateY(0); }
.btn-primary { background:linear-gradient(135deg,var(--red),var(--red-dark)); color:#fff; box-shadow:0 4px 16px rgba(225,29,42,.35); }
.btn-primary:hover { box-shadow:0 6px 22px rgba(225,29,42,.5); }
.btn-gold { background:linear-gradient(135deg,var(--gold),#d4a13c); color:#3a2d08; }
.btn-outline { background:transparent; border-color:var(--border-2); color:var(--text-soft); }
.btn-outline:hover { border-color:var(--text-muted); color:var(--text); }
.btn-ghost { background:transparent; color:var(--text-soft); }
.btn-ghost:hover { background:var(--surface); }
.btn-danger { background:var(--red-soft); color:var(--danger); }
.btn-success { background:var(--success); color:#04210f; }
.btn-sm { padding:7px 13px; font-size:.84rem; border-radius:8px; }
.btn-lg { padding:15px 26px; font-size:1rem; border-radius:12px; }
.btn-block { width:100%; }
.btn-icon { width:40px; height:40px; padding:0; }

/* Badges / chips */
.badge {
  display:inline-flex; align-items:center; gap:5px;
  padding:3px 10px; border-radius:20px; font-size:.74rem; font-weight:700;
  background:var(--surface-2); color:var(--text-soft);
}
.badge-success { background:var(--success-soft); color:var(--success); }
.badge-warning { background:var(--warning-soft); color:var(--warning); }
.badge-danger  { background:var(--red-soft); color:var(--danger); }
.badge-gold    { background:var(--gold-soft); color:var(--gold); }
.badge-dot::before { content:''; width:6px; height:6px; border-radius:50%; background:currentColor; display:inline-block; }

/* KPIs */
.kpi-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:18px; }
.kpi {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:20px; position:relative; overflow:hidden;
}
.kpi::after { content:''; position:absolute; top:0; right:0; width:120px; height:120px; background:radial-gradient(circle at top right,var(--red-soft),transparent 70%); }
.kpi-ico { width:42px; height:42px; border-radius:11px; display:flex; align-items:center; justify-content:center; font-size:1.25rem; background:var(--red-soft); margin-bottom:14px; }
.kpi-ico.gold { background:var(--gold-soft); }
.kpi-ico.green { background:var(--success-soft); }
.kpi-ico.blue { background:rgba(59,157,242,.14); }
.kpi-value { font-size:1.9rem; font-weight:800; letter-spacing:-.02em; line-height:1; }
.kpi-label { color:var(--text-muted); font-size:.85rem; margin-top:6px; }
.kpi-trend { font-size:.8rem; font-weight:700; margin-top:10px; display:inline-flex; align-items:center; gap:4px; }
.kpi-trend.up { color:var(--success); }
.kpi-trend.down { color:var(--danger); }

/* Tabelas */
.table-wrap { overflow-x:auto; border-radius:var(--radius); border:1px solid var(--border); }
table.data { width:100%; border-collapse:collapse; font-size:.9rem; background:var(--surface); }
table.data th {
  text-align:left; padding:13px 18px; font-size:.74rem; text-transform:uppercase;
  letter-spacing:.06em; color:var(--text-muted); font-weight:700;
  border-bottom:1px solid var(--border); background:var(--bg-2);
}
table.data td { padding:13px 18px; border-bottom:1px solid var(--border); }
table.data tr:last-child td { border-bottom:none; }
table.data tbody tr { transition:.12s; }
table.data tbody tr:hover { background:var(--surface-2); }
.cell-user { display:flex; align-items:center; gap:11px; }

/* Forms */
.form-group { margin-bottom:16px; }
.form-label { display:block; font-size:.84rem; font-weight:600; color:var(--text-soft); margin-bottom:7px; }
.form-control, .form-select {
  width:100%; padding:11px 14px; border-radius:10px;
  background:var(--bg-2); border:1px solid var(--border); color:var(--text);
  font-size:.92rem; font-family:inherit; transition:.15s; outline:none;
}
.form-control:focus, .form-select:focus { border-color:var(--red); box-shadow:var(--ring); }
.form-control::placeholder { color:var(--text-muted); }
textarea.form-control { resize:vertical; min-height:90px; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.form-hint { font-size:.78rem; color:var(--text-muted); margin-top:5px; }

/* Progress */
.progress { height:8px; background:var(--bg-2); border-radius:20px; overflow:hidden; }
.progress-bar { height:100%; background:linear-gradient(90deg,var(--red),var(--gold)); border-radius:20px; transition:width .6s ease; }

/* Avatar grande */
.avatar-lg { width:64px; height:64px; border-radius:50%; font-size:1.4rem; }
.avatar-xl { width:96px; height:96px; border-radius:50%; font-size:2rem; }

/* Faixa / prajioud */
.faixa-tag {
  display:inline-flex; align-items:center; gap:7px;
  padding:4px 12px; border-radius:8px; font-weight:700; font-size:.8rem;
  background:var(--surface-2); position:relative;
}
.faixa-dot { width:14px; height:14px; border-radius:4px; box-shadow:inset 0 0 0 1px rgba(255,255,255,.2); }

/* Empty state */
.empty { text-align:center; padding:50px 20px; color:var(--text-muted); }
.empty-ico { font-size:3rem; opacity:.5; margin-bottom:12px; }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,.62); backdrop-filter:blur(4px);
  display:none; align-items:center; justify-content:center; z-index:100; padding:20px;
}
.modal-overlay.open { display:flex; }
.modal {
  background:var(--surface); border:1px solid var(--border-2);
  border-radius:var(--radius-lg); width:100%; max-width:520px;
  max-height:90vh; overflow-y:auto; box-shadow:var(--shadow);
  animation:modalIn .25s cubic-bezier(.2,.9,.3,1.2);
}
.modal.wide { max-width:760px; }
@keyframes modalIn { from { opacity:0; transform:translateY(16px) scale(.97); } to { opacity:1; transform:none; } }
.modal-head { display:flex; align-items:center; justify-content:space-between; padding:20px 24px; border-bottom:1px solid var(--border); }
.modal-body { padding:24px; }
.modal-foot { padding:18px 24px; border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:10px; }
.modal-close { width:34px; height:34px; border-radius:9px; background:var(--surface-2); border:none; color:var(--text-soft); font-size:1.1rem; }
.modal-close:hover { background:var(--border); color:var(--text); }

/* ============================================================
   Toast
   ============================================================ */
.toast-stack { position:fixed; bottom:24px; right:24px; z-index:200; display:flex; flex-direction:column; gap:10px; }
.toast {
  background:var(--surface-2); border:1px solid var(--border-2);
  border-left:4px solid var(--red); border-radius:11px; padding:14px 18px;
  display:flex; align-items:center; gap:11px; min-width:280px; box-shadow:var(--shadow);
  animation:toastIn .3s ease;
}
.toast.success { border-left-color:var(--success); }
.toast.warning { border-left-color:var(--warning); }
.toast.error { border-left-color:var(--danger); }
.toast-ico { font-size:1.2rem; }
.toast-msg { font-size:.9rem; }
@keyframes toastIn { from { opacity:0; transform:translateX(40px); } to { opacity:1; transform:none; } }

/* ============================================================
   Mobile / responsive
   ============================================================ */
.sidebar-backdrop { position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:39; display:none; }
@media (max-width:1000px) {
  .form-row { grid-template-columns:1fr; }
}
@media (max-width:860px) {
  .sidebar { transform:translateX(-100%); }
  .sidebar.open { transform:translateX(0); }
  .sidebar-backdrop.open { display:block; }
  .main { margin-left:0; }
  .topbar-search { display:none; }
  .content { padding:18px; }
}

/* ============================================================
   Auth / Check-in (páginas públicas)
   ============================================================ */
.auth-wrap {
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  padding:24px; position:relative; overflow:hidden;
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(225,29,42,.18), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(230,180,80,.12), transparent 60%),
    var(--bg);
}
.auth-card {
  width:100%; max-width:430px; background:var(--surface);
  border:1px solid var(--border-2); border-radius:var(--radius-lg);
  padding:34px 30px; box-shadow:var(--shadow); position:relative; z-index:2;
}
.auth-brand { display:flex; align-items:center; gap:11px; justify-content:center; margin-bottom:8px; }
.auth-title { text-align:center; margin:18px 0 4px; }
.auth-sub { text-align:center; color:var(--text-muted); font-size:.9rem; margin-bottom:24px; }

.checkin-pulse {
  width:120px; height:120px; border-radius:50%; margin:0 auto 8px;
  display:flex; align-items:center; justify-content:center; font-size:3rem;
  background:radial-gradient(circle,var(--red-soft),transparent 70%);
  position:relative;
}
.checkin-pulse::before, .checkin-pulse::after {
  content:''; position:absolute; inset:0; border-radius:50%;
  border:2px solid var(--red); animation:pulse 2.2s ease-out infinite; opacity:0;
}
.checkin-pulse::after { animation-delay:1.1s; }
@keyframes pulse { 0%{transform:scale(.7);opacity:.7} 100%{transform:scale(1.4);opacity:0} }

/* Ranking pódio */
.podium { display:flex; align-items:flex-end; justify-content:center; gap:14px; margin:10px 0 6px; }
.podium-col { display:flex; flex-direction:column; align-items:center; gap:8px; }
.podium-block { border-radius:12px 12px 0 0; width:88px; display:flex; align-items:flex-start; justify-content:center; padding-top:10px; font-weight:800; font-size:1.3rem; }
.podium-1 .podium-block { height:110px; background:linear-gradient(180deg,var(--gold),#9b7a26); color:#3a2d08; }
.podium-2 .podium-block { height:84px; background:linear-gradient(180deg,#c7ccd6,#8b919e); color:#1b1e27; }
.podium-3 .podium-block { height:64px; background:linear-gradient(180deg,#d08a52,#8a5a32); color:#fff; }

/* Streak flame */
.streak-pill { display:inline-flex; align-items:center; gap:6px; padding:5px 12px; border-radius:20px; background:var(--warning-soft); color:var(--warning); font-weight:700; font-size:.85rem; }

/* QR box */
.qr-box {
  background:#fff; border-radius:16px; padding:18px; display:inline-flex;
  align-items:center; justify-content:center; box-shadow:var(--shadow);
}
.qr-box img { width:240px; height:240px; }
.code-display {
  font-family:'SF Mono',ui-monospace,monospace; font-size:2.2rem; font-weight:800;
  letter-spacing:.3em; color:var(--gold); text-align:center;
  background:var(--bg-2); border:1px dashed var(--border-2); border-radius:12px;
  padding:16px 20px;
}

/* segmented */
.seg { display:inline-flex; background:var(--bg-2); border:1px solid var(--border); border-radius:10px; padding:4px; gap:2px; }
.seg button { padding:7px 16px; border:none; background:none; color:var(--text-muted); font-weight:600; font-size:.86rem; border-radius:7px; }
.seg button.active { background:var(--surface-2); color:var(--text); }

/* list rows */
.lrow { display:flex; align-items:center; gap:14px; padding:13px 0; border-bottom:1px solid var(--border); }
.lrow:last-child { border-bottom:none; }
.lrank { width:30px; text-align:center; font-weight:800; color:var(--text-muted); font-size:1rem; }
.lrank.top { color:var(--gold); }

/* ============================================================
   PWA / Safe-area (notch) e topbar fixa
   ============================================================ */
body { min-height:100vh; }
.topbar { padding-top:env(safe-area-inset-top,0); height:auto; min-height:64px; }
.sidebar { padding-top:env(safe-area-inset-top,0); }
.auth-wrap { padding-top:max(24px,env(safe-area-inset-top)); padding-bottom:max(24px,env(safe-area-inset-bottom)); }
#pwa-install { bottom:max(16px,env(safe-area-inset-bottom)) !important; }

/* ============================================================
   MOBILE — colapsa grids de 2+ colunas, ajusta tipografia
   ============================================================ */
@media (max-width:760px) {
  h1 { font-size:1.4rem; }
  h2 { font-size:1.2rem; }
  .content { padding:16px 14px; }
  .page-header { margin-bottom:18px; }

  /* colapsa qualquer grid inline de várias colunas dentro do app */
  .main .d-grid { grid-template-columns:1fr !important; }
  .kpi-grid { grid-template-columns:1fr 1fr !important; gap:12px; }
  .kpi { padding:15px; }
  .kpi-value { font-size:1.5rem; }
  .kpi-ico { width:36px; height:36px; font-size:1.05rem; margin-bottom:10px; }

  /* topbar mais enxuta no celular */
  .topbar { padding-left:14px; padding-right:14px; gap:8px; }
  .topbar-title { font-size:.98rem; }
  .topbar-right { gap:6px; }
  .topbar-right .btn { padding:9px 12px; font-size:.82rem; }

  /* cards e modais */
  .card { padding:16px; }
  .modal-foot { flex-wrap:wrap; }
  .modal-foot .btn { flex:1; }

  /* QR / código menores */
  .qr-box img { width:200px; height:200px; }
  .code-display { font-size:1.7rem; letter-spacing:.2em; padding:14px; }

  /* segmented vira rolável se faltar espaço */
  .seg { width:100%; overflow-x:auto; }
  .seg button { flex:1; white-space:nowrap; }

  /* pódio compacto */
  .podium-block { width:64px; }
  .podium { gap:8px; }
}

@media (max-width:420px) {
  .kpi-grid { grid-template-columns:1fr !important; }
  .stat-3 { gap:8px; }
  .topbar-right .btn span.btn-label { display:none; }
  .lp-nav { padding:12px 14px !important; }
  .lp-nav .btn { padding:8px 11px !important; font-size:.8rem !important; }
  .lp-nav a[href="#planos"] { display:none; }
}
