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

:root {
  --blue-dark:  #0B2D8F;
  --blue-mid:   #1B5EBF;
  --blue-light: #3B9EE8;
  --blue-pale:  #6BB8F5;
  --gold:       #E8861A;
  --white:      #FFFFFF;
  --gray-100:   #F0F4FF;
  --gray-200:   #D8E4F8;
  --gray-500:   #6B7A99;
  --gray-800:   #1A2340;
  --green:      #22C55E;
  --red:        #EF4444;
  --surface:    #0D1B3E;
  --surface-2:  #142050;
  --surface-3:  #1A2B60;
  --radius:     10px;
  --shadow:     0 4px 24px rgba(0,0,0,0.4);
}

html, body { height: 100%; font-family: var(--font-family, 'Inter', sans-serif); background: var(--surface); color: var(--white); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--blue-mid); border-radius: 3px; }

/* ── LOGIN ── */
#login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, #1B5EBF22 0%, transparent 70%), var(--surface);
}
.login-card {
  background: var(--surface-2); border: 1px solid var(--blue-mid);
  border-radius: 16px; padding: 48px 40px; width: 380px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 24px;
}
.login-logo { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.login-logo .club-name { font-size: 28px; font-weight: 300; letter-spacing: 1px; }
.login-logo .club-name span { font-weight: 900; }
.login-logo .club-sub { color: var(--blue-pale); font-size: 13px; font-weight: 600; letter-spacing: 3px; }
.login-logo .club-id { background: var(--blue-mid); border-radius: 6px; padding: 4px 14px; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.login-logo .club-id span { color: var(--gold); font-weight: 700; }
.login-form { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.login-form label { font-size: 12px; color: var(--blue-pale); font-weight: 500; margin-bottom: 4px; display: block; }
.login-form input {
  width: 100%; padding: 12px 16px; background: var(--surface-3);
  border: 1px solid var(--blue-mid); border-radius: var(--radius);
  color: var(--white); font-size: 15px; font-family: inherit; outline: none;
  transition: border-color 0.2s;
}
.login-form input:focus { border-color: var(--blue-light); }
.btn-primary {
  width: 100%; padding: 13px; background: var(--blue-mid); color: var(--white);
  border: none; border-radius: var(--radius); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background 0.2s; font-family: inherit;
}
.btn-primary:hover { background: var(--blue-light); }
.login-error { color: var(--red); font-size: 13px; text-align: center; min-height: 18px; }

/* ── APP SHELL ── */
#app-shell { display: none; height: 100vh; }
#app-shell.active { display: flex; }

/* ── SIDEBAR ── */
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--surface-2);
  border-right: 1px solid var(--blue-mid); display: flex; flex-direction: column;
  padding: 20px 0; overflow-y: auto;
}
.sidebar-logo { padding: 0 20px 20px; border-bottom: 1px solid var(--blue-mid); margin-bottom: 12px; }
.sidebar-logo .s-name { font-size: 18px; font-weight: 300; }
.sidebar-logo .s-name b { font-weight: 900; }
.sidebar-logo .s-sub { color: var(--blue-pale); font-size: 10px; letter-spacing: 2px; margin-top: 2px; }
.sidebar-logo .s-id { color: var(--gold); font-size: 11px; font-weight: 700; margin-top: 4px; }

.nav-section { padding: 8px 12px 4px; color: var(--gray-500); font-size: 10px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 20px;
  color: var(--gray-200); cursor: pointer; font-size: 14px; font-weight: 400;
  border-left: 3px solid transparent; transition: all 0.15s; text-decoration: none;
}
.nav-item:hover { background: var(--surface-3); color: var(--white); }
.nav-item.active { border-left-color: var(--blue-light); background: var(--surface-3); color: var(--white); font-weight: 500; }
.nav-item .icon { width: 18px; text-align: center; font-size: 16px; }
.sidebar-footer { margin-top: auto; padding: 16px 20px; border-top: 1px solid var(--blue-mid); }
.user-info { font-size: 12px; color: var(--blue-pale); }
.user-info .u-name { color: var(--white); font-weight: 500; font-size: 14px; }
.btn-alterar-senha { margin-top: 10px; padding: 8px; background: transparent; border: 1px solid var(--blue-mid); border-radius: var(--radius); color: var(--blue-pale); font-size: 13px; cursor: pointer; width: 100%; font-family: inherit; transition: all 0.2s; }
.btn-alterar-senha:hover { background: var(--blue-mid); color: var(--white); }
.btn-logout { margin-top: 6px; padding: 8px; background: transparent; border: 1px solid var(--blue-mid); border-radius: var(--radius); color: var(--gray-200); font-size: 13px; cursor: pointer; width: 100%; font-family: inherit; transition: all 0.2s; }
.btn-logout:hover { background: var(--red); border-color: var(--red); color: var(--white); }

/* ── MAIN CONTENT ── */
.main-content { flex: 1; overflow-y: auto; padding: 32px; }
.page { display: none; }
.page.active { display: block; }
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 24px; font-weight: 600; }
.page-header p { color: var(--blue-pale); font-size: 14px; margin-top: 4px; }

/* ── CARDS ── */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.card {
  background: var(--surface-2); border: 1px solid var(--blue-mid);
  border-radius: var(--radius); padding: 20px; position: relative; overflow: hidden;
}
.card-label { font-size: 12px; color: var(--blue-pale); font-weight: 500; letter-spacing: 0.5px; text-transform: uppercase; white-space: nowrap; }
.card-value { font-size: 22px; font-weight: 700; margin-top: 6px; white-space: nowrap; }
.card-value.green { color: var(--green); }
.card-value.red { color: var(--red); }
.card-value.gold { color: var(--gold); }
.card-value.blue { color: var(--blue-light); }
.card-accent { position: absolute; top: 0; left: 0; width: 4px; height: 100%; }

/* ── TABELA ── */
.table-wrap { background: var(--surface-2); border: 1px solid var(--blue-mid); border-radius: var(--radius); overflow-x: auto; }
.table-header { padding: 16px 20px; border-bottom: 1px solid var(--blue-mid); display: flex; justify-content: space-between; align-items: center; }
.table-header h3 { font-size: 15px; font-weight: 600; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { padding: 12px 16px; text-align: left; color: var(--blue-pale); font-weight: 500; font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase; border-bottom: 1px solid var(--blue-mid); }
tbody tr { border-bottom: 1px solid #1A2B4A; transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-3); }
tbody td { padding: 12px 16px; }
.td-right { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.td-center { text-align: center; white-space: nowrap; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.tag-comum    { background: #1A2B4A; color: var(--gray-200); }
.tag-cavalo   { background: #3B1A6B; color: #C084FC; }
.tag-especial { background: #1A3B1A; color: #86EFAC; }
.tag-socio    { background: #0F2940; color: #38BDF8; }
.tag-superadmin { background: #3B2E0A; color: #FCD34D; }
.tag-fechado  { background: #1A3B1A; color: var(--green); }
.tag-importado{ background: #3B3B1A; color: #FCD34D; }
.tag-reaberto { background: #3B1A1A; color: var(--red); }
.pos { color: var(--green); } .neg { color: var(--red); }
.bold { font-weight: 700; }

/* ── BOTÕES ── */
.btn { padding: 8px 16px; border-radius: var(--radius); border: none; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 500; transition: all 0.15s; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-blue { background: var(--blue-mid); color: var(--white); }
.btn-blue:hover { background: var(--blue-light); }
.btn-outline { background: transparent; border: 1px solid var(--blue-mid); color: var(--gray-200); }
.btn-outline:hover { background: var(--blue-mid); color: var(--white); }
.btn-gold { background: var(--gold); color: var(--white); }
.btn-red { background: var(--red); color: var(--white); }
.btn-group { display: flex; gap: 8px; }

/* ── FORMS ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; color: var(--blue-pale); font-weight: 500; }
.form-group input, .form-group select {
  padding: 10px 14px; background: var(--surface-3);
  border: 1px solid var(--blue-mid); border-radius: var(--radius);
  color: var(--white); font-size: 14px; font-family: inherit; outline: none;
}
.form-group input:focus, .form-group select:focus { border-color: var(--blue-light); }
.form-group select option { background: var(--surface-3); }

/* ── MODAL ── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 100; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--surface-2); border: 1px solid var(--blue-mid);
  border-radius: 14px; padding: 32px; width: 500px; max-width: 95vw;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow);
}
.modal h2 { font-size: 18px; font-weight: 600; margin-bottom: 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ── BADGES ── */
.badge-pos { background: #16301E; color: var(--green); padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-neg { background: #2D1616; color: var(--red); padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-zero { background: #1A2340; color: var(--gray-500); padding: 3px 10px; border-radius: 20px; font-size: 12px; }

/* ── EMPTY STATE ── */
.empty { text-align: center; padding: 48px; color: var(--gray-500); }
.empty-icon { font-size: 40px; margin-bottom: 12px; }

/* ── LOADING ── */
.loading { text-align: center; padding: 48px; color: var(--blue-pale); }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 28px; height: 28px; border: 3px solid var(--blue-mid); border-top-color: var(--blue-light); border-radius: 50%; animation: spin 0.7s linear infinite; margin: 0 auto 12px; }

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  background: var(--surface-3); border: 1px solid var(--blue-mid);
  border-radius: var(--radius); padding: 14px 20px; font-size: 14px;
  box-shadow: var(--shadow); transform: translateY(80px); opacity: 0;
  transition: all 0.3s; max-width: 320px;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { border-color: var(--green); }
#toast.error   { border-color: var(--red); }

/* ── MOBILE ── */
.mobile-header { display: none; background: var(--surface-2); border-bottom: 1px solid var(--blue-mid); padding: 14px 20px; justify-content: space-between; align-items: center; }
.hamburger { background: none; border: none; color: var(--white); font-size: 22px; cursor: pointer; }

@media (max-width: 768px) {
  .mobile-header { display: flex; }
  .sidebar { position: fixed; left: -220px; top: 0; height: 100vh; z-index: 50; transition: left 0.3s; }
  .sidebar.open { left: 0; box-shadow: 4px 0 20px rgba(0,0,0,0.5); }
  .main-content { padding: 20px 16px; }
  .cards-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  #app-shell { flex-direction: column; }
}
