/* ============================================================
   ESCUELA DE MÚSICA — Estilos principales
   ============================================================ */

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

:root {
  --bg:        #ffffff;
  --bg2:       #f5f5f3;
  --bg3:       #efefec;
  --text:      #1a1a18;
  --text2:     #5f5e5a;
  --text3:     #9a9894;
  --border:    rgba(0,0,0,0.10);
  --border2:   rgba(0,0,0,0.18);
  --accent:    #1a1a18;
  --accent-fg: #ffffff;
  --ok-bg:     #eaf3de; --ok-fg:  #3b6d11;
  --warn-bg:   #faeeda; --warn-fg: #854f0b;
  --info-bg:   #e6f1fb; --info-fg: #185fa5;
  --danger-bg: #fcebeb; --danger-fg: #a32d2d;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow:    0 1px 4px rgba(0,0,0,0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:      #1c1c1a; --bg2: #252523; --bg3: #2e2e2b;
    --text:    #f0efe8; --text2: #9a9894; --text3: #6a6a66;
    --border:  rgba(255,255,255,0.10); --border2: rgba(255,255,255,0.18);
    --accent:  #f0efe8; --accent-fg: #1c1c1a;
    --ok-bg:   #173404; --ok-fg:  #c0dd97;
    --warn-bg: #412402; --warn-fg: #fac775;
    --info-bg: #042c53; --info-fg: #b5d4f4;
    --danger-bg: #501313; --danger-fg: #f7c1c1;
  }
}

body { font-family: -apple-system, 'Segoe UI', system-ui, sans-serif; background: var(--bg3); color: var(--text); font-size: 15px; line-height: 1.5; min-height: 100vh; }

/* ---- LOGIN ---- */
#login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg3); }
.login-card { background: var(--bg); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 2.5rem 2rem; width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.login-logo { font-size: 2.5rem; text-align: center; margin-bottom: 0.75rem; }
.login-card h1 { text-align: center; font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--text2); font-size: 13px; margin-bottom: 1.75rem; }
.login-error { color: var(--danger-fg); background: var(--danger-bg); border-radius: var(--radius); padding: 8px 12px; font-size: 13px; margin-bottom: 12px; display: none; }
.btn-full { width: 100%; margin-top: 8px; justify-content: center; }

/* ---- HEADER ---- */
.header { background: var(--bg); border-bottom: 0.5px solid var(--border); position: sticky; top: 0; z-index: 50; }
.header-inner { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; height: 56px; display: flex; align-items: center; gap: 1.5rem; }
.header-logo { font-size: 15px; color: var(--text); white-space: nowrap; }
.nav { display: flex; gap: 2px; flex: 1; }
.nav-btn { background: none; border: none; padding: 8px 14px; font-size: 14px; color: var(--text2); cursor: pointer; border-radius: var(--radius); transition: background 0.15s, color 0.15s; }
.nav-btn:hover { background: var(--bg2); color: var(--text); }
.nav-btn.active { background: var(--bg2); color: var(--text); font-weight: 500; }

/* ---- MAIN ---- */
.main { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }
.page { display: none; }
.page.active { display: block; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.page-header h2 { font-size: 20px; font-weight: 600; }

/* ---- METRICS ---- */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 1.5rem; }
.metric { background: var(--bg); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; }
.metric-label { font-size: 12px; color: var(--text2); margin-bottom: 8px; letter-spacing: 0.01em; }
.metric-value { font-size: 26px; font-weight: 600; color: var(--text); }
.metric-sub { font-size: 12px; color: var(--text3); margin-top: 4px; }

/* ---- CHARTS ---- */
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 1.5rem; }
.chart-card { background: var(--bg); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; }
.chart-card-title { font-size: 13px; font-weight: 500; color: var(--text2); margin-bottom: 14px; }

/* ---- TABLES ---- */
.section-hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-title { font-size: 14px; font-weight: 500; }
.tbl-wrap { background: var(--bg); border: 0.5px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 1.5rem; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--bg2); padding: 10px 16px; text-align: left; font-size: 12px; font-weight: 500; color: var(--text2); border-bottom: 0.5px solid var(--border); white-space: nowrap; }
td { padding: 11px 16px; border-bottom: 0.5px solid var(--border); color: var(--text); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg2); }
.td-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---- BADGES ---- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.badge-ok   { background: var(--ok-bg);   color: var(--ok-fg); }
.badge-warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge-info { background: var(--info-bg); color: var(--info-fg); }
.badge-danger { background: var(--danger-bg); color: var(--danger-fg); }

/* ---- BUTTONS ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0.5px solid var(--border2); border-radius: var(--radius); padding: 8px 16px; font-size: 13px; color: var(--text); cursor: pointer; text-decoration: none; transition: background 0.15s; white-space: nowrap; }
.btn:hover { background: var(--bg2); }
.btn-primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn-primary:hover { opacity: 0.85; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-danger { color: var(--danger-fg); border-color: var(--danger-fg); }
.btn-danger:hover { background: var(--danger-bg); }

/* ---- FILTERS ---- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filter-select { padding: 7px 10px; font-size: 13px; border: 0.5px solid var(--border2); border-radius: var(--radius); background: var(--bg); color: var(--text); cursor: pointer; }

/* ---- MONTH TABS ---- */
.month-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 1rem; }
.month-tab { padding: 5px 14px; font-size: 12px; border: 0.5px solid var(--border2); border-radius: 20px; cursor: pointer; background: none; color: var(--text2); transition: all 0.15s; }
.month-tab.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.month-tab:hover:not(.active) { background: var(--bg2); color: var(--text); }

/* ---- FORM ---- */
.form-row { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; color: var(--text2); margin-bottom: 5px; font-weight: 500; }
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], select, textarea {
  width: 100%; padding: 9px 12px; font-size: 14px;
  border: 0.5px solid var(--border2); border-radius: var(--radius);
  background: var(--bg); color: var(--text);
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---- MODAL ---- */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200; align-items: flex-start; justify-content: center;
  padding: 5vh 1rem;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg); border: 0.5px solid var(--border2);
  border-radius: var(--radius-lg); padding: 1.75rem;
  width: 100%; max-width: 480px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  margin: auto;
}
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 1.5rem; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 1.5rem; padding-top: 1rem; border-top: 0.5px solid var(--border); }

/* ---- MISC ---- */
.empty { text-align: center; padding: 3rem 1rem; color: var(--text3); font-size: 13px; }
.toast { position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--accent-fg); padding: 10px 22px; border-radius: var(--radius); font-size: 13px; opacity: 0; transition: opacity 0.3s; pointer-events: none; z-index: 999; white-space: nowrap; box-shadow: 0 4px 16px rgba(0,0,0,0.2); }
.toast.show { opacity: 1; }
.loading { text-align: center; padding: 2rem; color: var(--text3); font-size: 13px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .charts-row { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .header-inner { gap: 0.75rem; }
  .main { padding: 1rem; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
}
@media (max-width: 480px) {
  .metrics { grid-template-columns: 1fr; }
  .nav-btn { padding: 8px 10px; font-size: 13px; }
}
