﻿/* ===========================================
   Taller Santa Carolina — Design System
   Paleta: negro / blanco / dorado
   Tipografía: Inter + Sora
   =========================================== */

:root {
  /* Colores base */
  --black:      #0f0f0f;
  --black-soft: #1c1c1c;
  --gold:       #c9a227;
  --gold-light: #e8c34a;
  --gold-pale:  #fdf8e8;
  --white:      #ffffff;
  --off-white:  #f9f8f6;
  --gray-50:    #fafaf9;
  --gray-100:   #f3f2f0;
  --gray-200:   #e5e3de;
  --gray-400:   #a09d95;
  --gray-600:   #6b6860;
  --gray-800:   #2d2b27;

  /* Alias semánticos */
  --bg:      var(--off-white);
  --surface: var(--white);
  --text:    var(--black);
  --muted:   var(--gray-600);
  --border:  var(--gray-200);
  --red:     #b83232;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.05);

  /* Tipografía */
  --font-display: "Sora", system-ui, sans-serif;
  --font-body:    "Inter", system-ui, sans-serif;
  --font-mono:    "SFMono-Regular", "Consolas", "Liberation Mono", monospace;

  --text-xs:   0.75rem;
  --text-sm:   0.8125rem;
  --text-base: 0.875rem;
  --text-lg:   1rem;
  --text-xl:   1.175rem;
  --text-2xl:  1.5rem;
  --text-3xl:  2rem;

  /* Bordes */
  --r-sm:  5px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;
}

/* ── Reset ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.015em;
}

/* ── Layout ────────────────────────────── */
.container {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

/* ═══════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════ */
.site-header {
  background: var(--black);
  border-bottom: 2px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 100;
  /* Necesario para que el nav-drawer mobile se posicione relativo al header */
  isolation: isolate;
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
}

/* Marca */
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.4));
}

.brand-name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--white);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

/* Nav links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex: 1;
  justify-content: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-links::-webkit-scrollbar { display: none; }

.nav-links a {
  color: rgba(255,255,255,.62);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 0.4rem 0.7rem;
  border-radius: var(--r-sm);
  white-space: nowrap;
  transition: color .15s, background .15s;
  letter-spacing: 0.01em;
}

.nav-links a:hover {
  color: var(--white);
  background: rgba(255,255,255,.09);
}

.nav-links a.active { color: var(--gold-light); }

/* Separador de sección */
.nav-sep {
  width: 1px;
  height: 14px;
  background: rgba(255,255,255,.18);
  flex-shrink: 0;
  margin: 0 0.3rem;
}

/* ── Extremo derecho del nav-bar ─────────── */
.nav-end {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ── Hamburger (solo mobile) ─────────────── */
.nav-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1.5px solid rgba(255,255,255,.35);
  border-radius: var(--r-sm);
  color: rgba(255,255,255,.8);
  cursor: pointer;
  transition: border-color .15s, color .15s;
  flex-shrink: 0;
}

.nav-hamburger:hover,
.site-header.nav-open .nav-hamburger {
  border-color: var(--gold);
  color: var(--gold);
}

/* ── Badge de usuario ──────────────────── */
.user-menu {
  position: relative;
  flex-shrink: 0;
}

.user-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid rgba(255,255,255,.45);
  color: rgba(255,255,255,.9);
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  line-height: 1;
}

.user-badge:hover,
.user-menu.open .user-badge {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(201,162,39,.08);
}

/* Dropdown */
.user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 200px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 200;
}

.user-menu.open .user-dropdown { display: block; }

.dropdown-info {
  padding: 0.85rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--gray-50);
}

.dropdown-name {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.dropdown-role {
  display: block;
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: 2px;
}

.user-dropdown a {
  display: block;
  padding: 0.6rem 1rem;
  font-size: var(--text-sm);
  color: var(--gray-800);
  transition: background .12s;
}

.user-dropdown a:hover { background: var(--gray-100); }

.dropdown-signout {
  border-top: 1px solid var(--border);
  color: var(--red) !important;
}

.dropdown-signout:hover { background: #fff5f5 !important; }

/* ── Footer ────────────────────────────── */
.site-footer {
  background: var(--black);
  color: rgba(255,255,255,.35);
  font-size: var(--text-xs);
  padding: 1.25rem 0;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,.07);
  margin-top: auto;
}

/* ── Page shell ────────────────────────── */
.page-shell {
  flex: 1;
  padding: 1.5rem 0 3rem;
}

/* ── Flash messages ────────────────────── */
.flash-stack { display: grid; gap: 0.5rem; margin-bottom: 1rem; }

.flash {
  padding: 0.7rem 1rem;
  border-radius: var(--r-md);
  background: var(--white);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.flash-danger  { border-left: 3px solid var(--red); }
.flash-warning { border-left: 3px solid var(--gold); }
.flash-info    { border-left: 3px solid var(--gray-400); }
.flash-success { border-left: 3px solid #2a7a3b; }

/* ═══════════════════════════════════════════
   COMPONENTES BASE
   ═══════════════════════════════════════════ */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.panel:last-child { margin-bottom: 0; }

.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1rem;
  display: grid;
  gap: 1.25rem;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  padding: 1.75rem;
}

/* ── Tipografía ────────────────────────── */
.eyebrow {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.4rem;
}

.hero-card h1,
.auth-card h1 {
  font-size: var(--text-2xl);
  margin-bottom: 0.5rem;
}

.panel h2 {
  font-size: var(--text-xl);
  margin-bottom: 0.85rem;
}

.lead {
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.7;
  margin-bottom: 0.5rem;
}

.muted { color: var(--muted); }

.text-link {
  color: var(--black);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-link:hover { color: var(--gold); }

/* ── Section head ──────────────────────── */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.section-head h2 { margin: 0; }

/* ── Métricas hero ─────────────────────── */
.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

.metric {
  background: var(--gray-100);
  border-radius: var(--r-md);
  padding: 0.85rem 1rem;
  text-align: center;
  border: 1px solid var(--border);
}

.metric span {
  display: block;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.2rem;
}

.metric strong {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--black);
}

/* ═══════════════════════════════════════════
   MÓDULO CUENTAS — KPIs y período
   ═══════════════════════════════════════════ */

.periodo-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 1rem;
  padding: 0.65rem 1rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.periodo-label {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  min-width: 160px;
  text-align: center;
}

.periodo-btn {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
  padding: 0.3rem 0.65rem;
  border-radius: var(--r-sm);
  transition: color .15s, background .15s;
}

.periodo-btn:hover {
  color: var(--text);
  background: var(--gray-100);
}

/* KPI grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.kpi {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.kpi-value {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--black);
  line-height: 1.1;
}

.kpi-sub {
  display: block;
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: 0.2rem;
}

.kpi-green { border-left: 3px solid #2a7a3b; }
.kpi-yellow { border-left: 3px solid var(--gold); }
.kpi-red { border-left: 3px solid var(--red); }
.kpi-big { grid-column: 1 / -1; }

/* Detalle dos columnas */
.detalle-mes-grid {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* Utilidades de tabla */
.text-right { text-align: right !important; }
.mono { font-family: var(--font-mono); font-size: 0.9em; }
.text-green { color: #2a7a3b; }
.text-red { color: var(--red); }

.row-active {
  background: var(--gold-pale) !important;
  font-weight: 600;
}

.table-total td {
  border-top: 2px solid var(--border) !important;
  background: var(--gray-100);
  font-weight: 700;
}

.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-200);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--gray-800);
}

.empty-msg {
  padding: 1rem 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

/* ═══════════════════════════════════════════
   GRILLAS Y TARJETAS
   ═══════════════════════════════════════════ */

.content-grid { display: grid; gap: 0.75rem; margin-bottom: 0.75rem; }
.card-grid    { display: grid; gap: 0.75rem; }

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
  display: flex;
  flex-direction: column;
}

.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.card > *:not(.card-media-wrap) { padding: 0 1rem; }
.card > *:first-child:not(.card-media-wrap) { padding-top: 1rem; }
.card > *:last-child:not(.card-media-wrap)  { padding-bottom: 1rem; }

.card h3 { font-size: var(--text-lg); margin-bottom: 0.3rem; }
.card h3 a:hover { color: var(--gold); }
.card p  { color: var(--muted); font-size: var(--text-sm); line-height: 1.55; }

.card-tag {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  padding-top: 1rem;
}

.card-media-wrap {
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--gray-100);
}

.card-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s;
}

.card:hover .card-media { transform: scale(1.04); }

.detalle-media {
  width: 100%;
  max-height: 440px;
  object-fit: cover;
  border-radius: var(--r-lg);
  margin-bottom: 1rem;
}

/* ── Tags ──────────────────────────────── */
.tag-row  { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.tag-grid { display: flex; flex-wrap: wrap; gap: 0.4rem 0.85rem; margin-top: 0.65rem; }

/* ── Auth ──────────────────────────────── */
.auth-shell {
  display: grid;
  place-items: center;
  min-height: calc(100dvh - 160px);
  padding: 2rem 0;
}

.auth-card { width: min(100%, 440px); }

/* ═══════════════════════════════════════════
   FORMULARIOS
   ═══════════════════════════════════════════ */

.form-stack { display: grid; gap: 0.85rem; margin-top: 1rem; }

.form-stack label,
.form-grid  label {
  display: grid;
  gap: 0.35rem;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-800);
}

.input,
textarea.input,
select.input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.65rem 0.8rem;
  font: inherit;
  font-size: var(--text-base);
  background: var(--white);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
}

.input:focus {
  outline: none;
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(15,15,15,.08);
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-weight: 400 !important;
}

.field-error { color: var(--red); font-size: var(--text-xs); font-weight: 600; }

.form-panel h1 { margin-top: 0; }

.form-grid {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.full-span { grid-column: 1 / -1; }

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 0.25rem;
}

/* ═══════════════════════════════════════════
   BOTONES
   ═══════════════════════════════════════════ */

.button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: var(--r-md);
  padding: 0.7rem 1.25rem;
  background: var(--black);
  color: var(--white);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  min-height: 40px;
  transition: background .15s;
}

.button-primary:hover { background: var(--black-soft); }

.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.65rem 1.1rem;
  background: var(--white);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
  transition: border-color .15s, background .15s;
}

.button-secondary:hover { border-color: var(--black); background: var(--gray-100); }

/* Pills */
.pill-link,
.pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  min-height: 30px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  white-space: nowrap;
}

.pill-link:hover,
.pill-button:hover { border-color: var(--black); background: var(--gray-100); }

.pill-link.active { background: var(--black); color: var(--white); border-color: var(--black); }

/* ═══════════════════════════════════════════
   TABLAS
   ═══════════════════════════════════════════ */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.data-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }

.data-table thead { background: var(--gray-100); }

.data-table th {
  padding: 0.55rem 0.85rem;
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-600);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: 0; }

.action-cell { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }

/* ═══════════════════════════════════════════
   MISC
   ═══════════════════════════════════════════ */

.hero-panel { margin-bottom: 0.75rem; }

.feature-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 2;
}

/* ═══════════════════════════════════════════
   STAFF CARDS (public index)
   ═══════════════════════════════════════════ */
.staff-showcase {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 1.5rem;
}
.staff-group {
  flex: 1;
  min-width: 130px;
}
.staff-group-title {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 .6rem;
}
.staff-card {
  position: relative;
  padding: .35rem 0;
  cursor: default;
}
.staff-name {
  font-size: var(--text-sm);
  font-weight: 600;
  display: block;
  color: var(--text);
}
.staff-tooltip {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  background: #1a1a1a;
  border: 1px solid rgba(201,162,39,.25);
  border-radius: var(--r-md);
  padding: .55rem .75rem;
  font-size: var(--text-xs);
  color: var(--off-white);
  white-space: nowrap;
  z-index: 200;
  flex-direction: column;
  gap: .25rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.45);
}
.staff-tip-muted {
  color: rgba(249,248,246,.4);
}
.staff-card:hover .staff-tooltip {
  display: flex;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

@media (min-width: 600px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  /* kpi-big siempre full-width (no se cancela en desktop) */
  .detalle-mes-grid { grid-template-columns: 1fr 1fr; }
  .content-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid    { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .card-grid { grid-template-columns: repeat(3, 1fr); }

  .hero-card {
    grid-template-columns: 1.4fr 1fr;
    align-items: center;
    padding: 2rem;
    gap: 2rem;
  }

  .hero-metrics { grid-template-columns: 1fr; gap: 0.65rem; }
  .panel { padding: 1.5rem; }
}

/* Mobile nav */
@media (max-width: 767px) {
  .nav-hamburger { display: flex; }

  /* Nav oculta por defecto en mobile — se muestra como drawer */
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--black);
    border-top: 1px solid rgba(255,255,255,.1);
    border-bottom: 2px solid var(--gold);
    padding: 0.5rem 1rem 0.75rem;
    z-index: 99;
    overflow-x: visible;
    overflow-y: auto;
    max-height: calc(100dvh - 56px);
  }

  .site-header.nav-open .nav-links { display: flex; }

  .nav-links a {
    padding: 0.75rem 0.5rem;
    border-radius: var(--r-sm);
    white-space: normal;
    font-size: var(--text-base);
  }

  /* Separadores horizontales en mobile */
  .nav-sep {
    width: 100%;
    height: 1px;
    background: rgba(255,255,255,.1);
    margin: 0.25rem 0;
  }

  .brand-logo { width: 36px; height: 36px; }
  .brand-name { font-size: 0.88rem; }
}
