/* =========================================================================
   SSTAPGROUP — hoja de estilos del sitio público
   Concepto: "El Libro Mayor" — tipografía editorial sobre un fondo que evoca
   el papel pautado de un libro contable: reglas finas, cifras tabulares,
   entradas numeradas como asientos contables, sellos y folios.
   Paleta: tomada del logo real de SSTAPGROUP (azul marino + verde), extraída
   por muestreo de píxeles del logo para máxima fidelidad. Los nombres de
   variable ("--brass" etc.) se conservaron para no romper el resto del CSS,
   aunque ahora representan el verde de marca en vez del bronce original.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,400;1,9..144,500&family=Archivo:wght@400;500;600;700&display=swap');

:root {
  --ink: #003974;
  --ink-soft: #2f5a80;
  --cream: #f5f7f6;
  --cream-deep: #e7ece9;
  --white: #ffffff;
  --brass: #5a7011;
  --brass-deep: #46590d;
  --brass-light: #c9dc7f;
  --rule: rgba(0, 57, 116, 0.14);
  --rule-soft: rgba(0, 57, 116, 0.08);
  --shadow: 0 20px 45px -20px rgba(0, 57, 116, 0.35);
  --radius: 2px;
  --serif: 'Fraunces', 'Iowan Old Style', 'Georgia', serif;
  --sans: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 32px;
}

/* --------------------------- Textura de fondo --------------------------- */

.ledger-bg {
  background-image: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 37px,
    var(--rule-soft) 38px
  );
}

/* --------------------------- Encabezados de sección --------------------------- */

.eyebrow {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass-deep);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.eyebrow::before {
  content: '';
  width: 22px;
  height: 1px;
  background: var(--brass);
  display: inline-block;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.12;
  margin: 0.35em 0 0.5em;
  color: var(--ink);
}

h1 { font-size: clamp(2.6rem, 5vw, 4.4rem); font-weight: 500; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.9rem, 3.2vw, 2.6rem); }
h3 { font-size: 1.35rem; }

p { margin: 0 0 1em; }

.lede {
  font-size: 1.2rem;
  color: var(--ink-soft);
  max-width: 60ch;
}

.tnum { font-variant-numeric: tabular-nums; }

/* --------------------------- Botones --------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  padding: 14px 26px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.btn-primary {
  background: var(--ink);
  color: var(--cream);
}
.btn-primary:hover { background: var(--brass-deep); transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-outline {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}
.btn-outline:hover { background: var(--ink); color: var(--cream); }

.btn-gold {
  background: var(--brass);
  color: var(--white);
}
.btn-gold:hover { background: var(--brass-deep); transform: translateY(-1px); }

.btn-sm { padding: 8px 16px; font-size: 0.82rem; }
.btn-danger { background: transparent; border-color: #9a3324; color: #9a3324; }
.btn-danger:hover { background: #9a3324; color: #fff; }

.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* --------------------------- Accesibilidad: saltar al contenido --------------------------- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--ink);
  color: var(--white);
  padding: 12px 20px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
}

/* --------------------------- Aviso de cookies --------------------------- */

.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  background: var(--ink);
  color: rgba(255, 255, 255, 0.88);
  padding: 16px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 0.86rem;
  box-shadow: 0 -8px 20px -6px rgba(0, 0, 0, 0.3);
}
/* Sin esta regla, el atributo HTML "hidden" (que main.js activa al aceptar
   el aviso) queda sin efecto: una regla de clase como ".cookie-banner" y el
   estilo por defecto del navegador para "[hidden]" tienen la misma
   prioridad técnica, y el navegador siempre deja ganar a la hoja de
   estilos del sitio — así que el aviso se quedaba visible aunque ya
   estuviera marcado como oculto. Este selector, al ser más específico,
   sí gana y oculta el aviso de verdad. */
.cookie-banner[hidden] { display: none; }
.cookie-banner p { margin: 0; max-width: 60ch; }
.cookie-banner a { color: var(--brass-light); }
.cookie-banner .btn { flex-shrink: 0; }

/* Cuando el aviso de cookies está visible, el botón de WhatsApp sube para
   no encimarse con él. */
body.has-cookie-banner .whatsapp-float { bottom: 96px; }
@media (max-width: 480px) {
  body.has-cookie-banner .whatsapp-float { bottom: 132px; }
}

/* --------------------------- Encabezado / nav --------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 20px;
  padding-bottom: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}

.brand-mark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: 0.01em;
}

.brand-icon {
  width: auto;
  display: block;
}

.brand > .brand-icon { height: 36px; }

.brand-tagline {
  display: none;
}

@media (min-width: 1180px) {
  .brand-tagline {
    display: inline;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--brass-deep);
    border-left: 1px solid var(--rule);
    padding-left: 10px;
  }
}

.nav-links {
  display: none;
  gap: 34px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-soft);
  position: relative;
  padding-bottom: 4px;
}

.nav-links a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.nav-links a:hover::after,
.nav-links a[aria-current="page"]::after { transform: scaleX(1); }

.nav-actions { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

.nav-toggle {
  display: inline-flex;
  background: none;
  border: 1px solid var(--rule);
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: pointer;
}
.nav-toggle span, .nav-toggle::before, .nav-toggle::after { content: ''; display: block; width: 18px; height: 2px; background: var(--ink); margin: 4px 0; }

.nav-cta { display: none; }

@media (min-width: 920px) {
  .nav-links { display: flex; }
  .nav-toggle { display: none; }
  .nav-cta { display: inline-flex; }
}

.mobile-menu {
  display: none;
  border-top: 1px solid var(--rule);
  background: var(--cream);
  padding: 18px 32px 24px;
}
.mobile-menu.is-open { display: block; }
.mobile-menu ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.mobile-menu ul a { text-decoration: none; color: var(--ink); font-weight: 500; font-size: 1.05rem; }
.mobile-menu > .btn { width: 100%; justify-content: center; }

@media (min-width: 920px) { .mobile-menu { display: none !important; } }

/* --------------------------- Hero --------------------------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 96px 0 80px;
  border-bottom: 1px solid var(--rule);
}

.hero-grid {
  display: grid;
  gap: 48px;
  align-items: end;
}

@media (min-width: 900px) {
  .hero-grid { grid-template-columns: 1.3fr 0.7fr; }
}

.hero-stamp {
  justify-self: start;
  border: 1px solid var(--brass);
  color: var(--brass-deep);
  padding: 18px 20px;
  text-align: center;
  font-family: var(--serif);
  transform: rotate(-3deg);
  background: var(--white);
  box-shadow: var(--shadow);
}
.hero-stamp .num { font-size: 2.6rem; font-weight: 600; display: block; line-height: 1; }
.hero-stamp .label { font-family: var(--sans); font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; display: block; margin-top: 6px; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 34px; }

/* --------------------------- Bandas de sección --------------------------- */

.section { padding: 88px 0; }
.section-tight { padding: 56px 0; }
.band-ink { background: var(--ink); color: var(--cream); }
.band-ink h2, .band-ink h3 { color: var(--white); }
.band-ink .eyebrow { color: var(--brass-light); }
.band-ink .eyebrow::before { background: var(--brass-light); }

.section-head { max-width: 720px; margin-bottom: 48px; }

/* --------------------------- Servicios (entradas de libro mayor) --------------------------- */

.ledger-list { border-top: 1px solid var(--rule); }
.band-ink .ledger-list { border-top-color: rgba(255,255,255,0.18); }

.ledger-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 22px;
  padding: 30px 0;
  border-bottom: 1px solid var(--rule);
}
.band-ink .ledger-item { border-bottom-color: rgba(255,255,255,0.18); }

.ledger-item .folio {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.6rem;
  color: var(--brass);
}

.ledger-item h3 { margin-top: 0; }
.ledger-item p { color: var(--ink-soft); margin-bottom: 0; max-width: 62ch; }
.band-ink .ledger-item p { color: rgba(255,255,255,0.78); }

.service-grid {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.service-card {
  background: var(--white);
  border: 1px solid var(--rule);
  padding: 30px 26px;
  border-radius: var(--radius);
  transition: box-shadow .2s ease, transform .2s ease;
}
.service-card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }
.service-card .folio { font-family: var(--serif); color: var(--brass); font-size: 1.15rem; display: block; margin-bottom: 10px; }
.service-card p { color: var(--ink-soft); font-size: 0.95rem; margin-bottom: 0; }

/* --------------------------- Cifras / stats --------------------------- */

.stat-row {
  display: grid;
  gap: 32px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 40px 0;
}
.stat { text-align: left; }
.stat .value { font-family: var(--serif); font-size: 2.6rem; color: var(--brass-deep); display: block; }
.stat .label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-soft); }

/* Variante compacta del mismo componente, para usarse dentro del panel de
   administración (números más chicos, sin las reglas horizontales anchas). */
.admin-main .stat-row {
  border: 1px solid var(--rule);
  background: var(--white);
  padding: 22px 28px;
  gap: 22px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}
.admin-main .stat .value { font-size: 1.9rem; }

/* --------------------------- Mini gráfica de barras --------------------------- */

.mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 90px;
  margin-top: 18px;
}
.mini-chart-bar {
  flex: 1;
  background: var(--brass);
  min-height: 3px;
  border-radius: 2px 2px 0 0;
  transition: background 0.15s ease;
}
.mini-chart-bar:hover { background: var(--brass-deep); }
.mini-chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin-top: 8px;
}

/* --------------------------- Tarjetas de contacto --------------------------- */

.contact-grid { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.contact-card {
  background: var(--white);
  border: 1px solid var(--rule);
  padding: 28px;
}
.contact-card a { color: var(--brass-deep); text-decoration: none; font-weight: 600; word-break: break-word; }
.contact-card a:hover { text-decoration: underline; }

/* --------------------------- Pie de página --------------------------- */

.site-footer {
  background: var(--ink);
  color: rgba(255,255,255,0.72);
  padding: 56px 0 28px;
}
.site-footer a { color: var(--cream); text-decoration: none; }
.site-footer a:hover { color: var(--brass-light); }
.footer-grid { display: grid; gap: 40px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 40px; }
.footer-grid h4 { color: var(--white); font-size: 0.95rem; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 0.92rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.16); padding-top: 22px; font-size: 0.78rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; color: rgba(255,255,255,0.5); }
.footer-bottom a { color: rgba(255,255,255,0.5); }
.footer-legal { display: flex; flex-direction: column; gap: 4px; }
.footer-company-id { color: rgba(255,255,255,0.38); }
.footer-bottom nav { display: flex; flex-wrap: wrap; gap: 16px; }

/* --------------------------- Botón flotante de WhatsApp --------------------------- */

.whatsapp-float {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  background: #25d366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.4);
  z-index: 60;
  transition: transform 0.2s ease;
}
.whatsapp-float:hover { transform: scale(1.08); }
.whatsapp-float svg { width: 30px; height: 30px; fill: #fff; }

@media (max-width: 480px) {
  .whatsapp-float { right: 16px; bottom: 16px; width: 52px; height: 52px; }
  .whatsapp-float svg { width: 28px; height: 28px; }
}

/* --------------------------- Páginas de error --------------------------- */

.error-page { min-height: 60vh; display: flex; align-items: center; }
.error-page .code { font-family: var(--serif); font-size: 5rem; color: var(--brass); margin: 0; }

/* =========================================================================
   Panel de administración
   ========================================================================= */

.admin-body { background: var(--cream-deep); min-height: 100vh; }

.admin-shell { display: flex; flex-direction: column; min-height: 100vh; }
@media (min-width: 860px) { .admin-shell { flex-direction: row; } }

.admin-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--ink);
  color: var(--cream);
  padding: 28px 22px;
  display: none;
}
@media (min-width: 860px) { .admin-sidebar { display: flex; flex-direction: column; } }

.admin-sidebar .brand-mark { color: var(--white); font-size: 1.2rem; display: inline-flex; align-items: center; gap: 8px; }
.admin-sidebar .brand-mark .brand-icon { height: 26px; }
.admin-sidebar nav { margin-top: 40px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.admin-sidebar nav a {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 500;
}
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { background: rgba(255,255,255,0.1); color: var(--white); }
.admin-sidebar .view-site { font-size: 0.8rem; color: var(--brass-light); text-decoration: none; }

.admin-main { flex: 1; padding: 36px 26px 60px; max-width: 900px; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-wrap: wrap; gap: 12px; }
.admin-topbar h1 { font-size: 1.9rem; margin: 0; }

.admin-mobile-nav { display: flex; gap: 14px; flex-wrap: wrap; margin: 18px 0 30px; }
.admin-mobile-nav a { font-size: 0.85rem; text-decoration: none; color: var(--ink-soft); border: 1px solid var(--rule); padding: 6px 12px; }
@media (min-width: 860px) { .admin-mobile-nav { display: none; } }

.card { background: var(--white); border: 1px solid var(--rule); padding: 28px; margin-bottom: 24px; }

.field { margin-bottom: 20px; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 8px; color: var(--ink-soft); }
.field .hint { font-size: 0.78rem; color: var(--ink-soft); opacity: 0.7; margin-top: 6px; }

input[type="text"], input[type="password"], input[type="email"], input[type="file"], textarea {
  width: 100%;
  font-family: var(--sans);
  font-size: 0.96rem;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  background: var(--white);
  color: var(--ink);
  border-radius: var(--radius);
}
textarea { resize: vertical; min-height: 110px; }
input:focus, textarea:focus { outline: 2px solid var(--brass); outline-offset: 1px; }

.checkbox-row { display: flex; align-items: center; gap: 10px; }
.checkbox-row input { width: auto; }

.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 28px; }

.alert { padding: 14px 18px; border-radius: var(--radius); font-size: 0.9rem; margin-bottom: 20px; }
.alert-success { background: #eef4ea; color: #33502a; border: 1px solid #c7dcbc; }
.alert-error { background: #fbecea; color: #8a2f22; border: 1px solid #f0c6bd; }

table.admin-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.admin-table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); border-bottom: 1px solid var(--rule); padding: 10px 8px; }
table.admin-table td { padding: 14px 8px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
table.admin-table td.desc { color: var(--ink-soft); max-width: 420px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.badge { display: inline-block; font-size: 0.7rem; padding: 3px 8px; border-radius: 20px; }
.badge-on { background: #eef4ea; color: #33502a; }
.badge-off { background: #eee; color: #777; }

.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--ink); padding: 24px; }
.login-card { background: var(--cream); width: 100%; max-width: 400px; padding: 44px 36px; box-shadow: var(--shadow); }
.login-card .brand-mark { display: flex; align-items: center; justify-content: center; gap: 10px; text-align: center; font-size: 1.6rem; margin-bottom: 6px; }
.login-card .brand-mark .brand-icon { height: 40px; }
.login-card .eyebrow { display: flex; justify-content: center; margin-bottom: 30px; }
.login-card .eyebrow::before { display: none; }
