@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --ink: #12253E;
  --paper: #F7F3EC;
  --teal: #1F6F63;
  --teal-dark: #164F46;
  --stamp: #C1440E;
  --steel: #5B6472;
  --line: #DCD5C6;
  --card: #FFFFFF;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
.mono { font-family: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace; }
a { color: inherit; }

/* ---------- shared atoms ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--steel); letter-spacing: .01em; }
.field-hint { font-size: 11.5px; color: var(--steel); }
.field-error { font-size: 11.5px; color: var(--stamp); display: flex; align-items: center; gap: 4px; }
.input, select.input, textarea.input {
  border: 1.5px solid var(--line); border-radius: 9px; padding: 10px 12px; font-size: 14px;
  font-family: inherit; background: #fff; color: var(--ink); width: 100%; outline: none;
  transition: border-color .15s;
}
.input:focus { border-color: var(--teal); }
.input:disabled { background: #F1EEE6; color: var(--steel); }
/* Oculta las flechas de incremento/decremento en todos los campos numéricos del sistema. */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.btn { border: none; border-radius: 9px; font-family: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: opacity .15s; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-md { padding: 10px 18px; font-size: 14px; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--teal-dark); }
.btn-secondary { background: var(--ink); color: #fff; }
.btn-secondary:hover:not(:disabled) { opacity: .9; }
.btn-ghost { background: transparent; color: var(--steel); border: 1.5px solid var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--steel); }
.btn-cta { background: var(--stamp); color: #fff; }
.btn-cta:hover:not(:disabled) { background: #A6390B; }
.btn-ingreso-primary { background: var(--stamp); color: #fff; padding: 14px 24px; font-size: 14.5px; box-shadow: 0 3px 10px rgba(193,68,14,.35); }
.btn-ingreso-primary:hover:not(:disabled) { background: #A6390B; }
.btn-ingreso-secondary { background: var(--ink); color: #fff; padding: 14px 24px; font-size: 14.5px; }
.btn-ingreso-secondary:hover:not(:disabled) { background: #0A1729; }
.w-full { width: 100%; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--steel); margin-bottom: 14px; cursor: pointer; }
.radio-row { display: flex; gap: 18px; align-items: center; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; }
.radio-option { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.radio-option input { accent-color: var(--teal); width: 15px; height: 15px; }
.section-heading { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--teal); margin-bottom: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
.section-title { display: flex; align-items: center; gap: 8px; font-family: 'Fraunces', serif; font-weight: 600; font-size: 19px; margin: 0 0 6px; }
.section-desc { color: var(--steel); font-size: 13px; margin: 0 0 16px; }
.disclaimer { display: flex; align-items: flex-start; gap: 6px; font-size: 11.5px; color: var(--steel); margin-top: 12px; line-height: 1.5; }
.empty-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; color: var(--steel); padding: 36px 20px; }
.empty-card p { margin: 0; font-size: 13px; max-width: 280px; }

/* ---------- brand ---------- */
.brand-mark { font-family: 'Fraunces', serif; font-weight: 600; font-size: 20px; color: var(--ink); text-decoration: none; }
.brand-mark span { color: var(--stamp); }
.brand-logo { display: block; height: 52.5px; width: auto; border-radius: 6px; }
.brand-logo-lg { display: block; height: 84px; width: auto; border-radius: 8px; }
.brand-logo-sidebar { display: block; height: 62.5px; width: auto; margin-bottom: 22px; border-radius: 6px; }

/* ---------- auth shell ---------- */
.auth-shell { flex: 1; display: flex; flex-direction: column; }
.auth-top { padding: 22px clamp(16px, 5vw, 48px) 0; }
.auth-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth-topbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.auth-center { flex: 1; display: flex; align-items: center; justify-content: center; padding: 28px 16px 60px; }
.auth-card { width: 100%; max-width: 400px; margin: 0 auto; position: relative; }
.auth-card-wide { max-width: 640px; }

/* Página de entrada: tarjeta de ingreso + banners lado a lado */
.auth-layout { flex: 1; display: flex; gap: 24px; align-items: stretch; justify-content: center; flex-wrap: wrap; padding: 28px 16px 60px; }
.auth-layout .auth-card { margin: 0; height: 478px; }
.banner-stack { display: flex; flex-direction: column; gap: 14px; width: 350px; max-width: 350px; flex-shrink: 0; }
.banner-stack-card { width: 350px; height: 150px; flex: 0 0 150px; border: none; border-radius: 12px; padding: 18px; color: #fff; text-align: left; cursor: pointer; display: flex; flex-direction: column; justify-content: center; gap: 3px; text-decoration: none; position: relative; overflow: hidden; background-size: cover; background-position: center; }
.banner-stack-card-image::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(18,37,62,0) 35%, rgba(18,37,62,.82) 100%); }
.banner-stack-card-image .banner-title, .banner-stack-card-image .banner-sub { position: relative; z-index: 1; }
@media (max-width: 760px) { .auth-layout { flex-direction: column; align-items: center; } }
.ledger-tab { position: absolute; top: -14px; left: 22px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 5px 12px; border-radius: 6px; }
.sub-steps { display:flex; gap:10px; flex-wrap:wrap; margin:6px 0 20px; }
.sub-step { display:flex; align-items:center; gap:6px; font-size:12px; font-weight:600; color:var(--steel); }
.sub-step-n { width:20px; height:20px; border-radius:50%; background:var(--line); color:var(--steel); display:flex; align-items:center; justify-content:center; font-size:11px; }
.sub-step-active { color:var(--teal); }
.sub-step-active .sub-step-n { background:var(--teal); color:#fff; }
.auth-title { font-family: 'Fraunces', serif; font-size: 24px; font-weight: 600; margin: 10px 0 4px; }
.auth-sub { color: var(--steel); font-size: 13.5px; margin: 0 0 20px; }
.auth-error { display: flex; align-items: center; gap: 6px; color: var(--stamp); font-size: 12.5px; background: #FBEAE3; border-radius: 8px; padding: 8px 10px; margin: 6px 0; }
.auth-success { display: flex; align-items: center; gap: 6px; color: var(--teal-dark); font-size: 12.5px; background: #E3F0EC; border-radius: 8px; padding: 8px 10px; margin: 6px 0; }
.auth-warning { display: flex; align-items: flex-start; gap: 6px; color: #8A5A00; font-size: 12.5px; background: #FFF3DC; border-radius: 8px; padding: 8px 10px; margin: 6px 0; line-height: 1.5; }
.auth-links { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; flex-wrap: wrap; gap: 8px; }
.auth-actions-row { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.link-btn { background: none; border: none; color: var(--steel); font-size: 12.5px; cursor: pointer; font-family: inherit; text-decoration: none; }
.link-btn-strong { color: var(--teal); font-weight: 600; }
.demo-hint { margin-top: 16px; font-size: 11px; color: var(--steel); text-align: center; background: #F1EEE6; border-radius: 8px; padding: 8px; }
.demo-code { font-family: 'IBM Plex Mono', monospace; font-size: 26px; letter-spacing: .3em; text-align: center; background: var(--ink); color: #fff; border-radius: 10px; padding: 14px; margin-bottom: 16px; }
.success-icon { width: 42px; height: 42px; border-radius: 50%; background: var(--teal); color: #fff; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }

/* ---------- banners ---------- */
.banner-strip { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; margin-top: 14px; }
.banner-card { flex: 1 1 220px; min-width: 200px; border: none; border-radius: 12px; padding: 16px; color: #fff; text-align: left; cursor: pointer; position: relative; display: flex; flex-direction: column; gap: 3px; text-decoration: none; }
.banner-title { font-weight: 700; font-size: 13.5px; }
.banner-sub { font-size: 11.5px; opacity: .85; }
.post-banner { border: none; border-radius: 12px; padding: 16px 18px; color: #fff; width: 100%; display: flex; align-items: center; justify-content: space-between; cursor: pointer; margin-bottom: 18px; text-decoration: none; }
.post-banner-title { font-weight: 700; font-size: 14px; }
.post-banner-sub { font-size: 12px; opacity: .85; }

/* ---------- app shell ---------- */
.app-shell { flex: 1; display: flex; }
.sidebar { width: 220px; background: var(--ink); color: #fff; display: flex; flex-direction: column; padding: 20px 14px; flex-shrink: 0; }
.sidebar-brand { color: #fff; margin-bottom: 26px; padding-left: 6px; display: block; }
.sidebar-brand span { color: #E88A5E; }
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.sidebar-item { display: flex; align-items: center; gap: 10px; background: none; border: none; color: #C7D0DC; padding: 10px 12px; border-radius: 9px; font-size: 13.5px; font-weight: 500; cursor: pointer; text-align: left; font-family: inherit; text-decoration: none; }
.sidebar-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-item-active { background: var(--teal); color: #fff; }
.sidebar-sep { height: 1px; background: rgba(255,255,255,.14); margin: 8px 12px; flex-shrink: 0; }
.sidebar-item-disabled { opacity: .4; cursor: not-allowed; }
.sidebar-item-disabled:hover { background: none; color: #C7D0DC; }
.sidebar-item-cta { background: var(--stamp); color: #fff; margin-top: 10px; text-align: center; justify-content: center; }
.sidebar-item-cta:hover { opacity: .9; }
.sidebar-item-secondary { background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.18); margin-top: 8px; text-align: center; justify-content: center; font-weight: 600; }
.sidebar-item-secondary:hover { background: rgba(255,255,255,.14); color: #fff; }
.sidebar-logout { color: #fff; background: rgba(193,68,14,.32); border: 1px solid rgba(232,163,138,.35); margin-top: 10px; text-align: center; justify-content: center; font-weight: 600; }
.sidebar-logout:hover { background: rgba(193,68,14,.5); color: #fff; }
/* "Cerrar sesión" es un botón de formulario (POST con CSRF): se ve igual que los enlaces del menú. */
.sidebar-logout-form { margin: 0; }
button.sidebar-logout { width: 100%; font-family: inherit; font-size: inherit; cursor: pointer; }
@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 40; height: 100%; left: -240px; transition: left .2s; top: 0; }
  .sidebar.sidebar-open { left: 0; }
}
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px; border-bottom: 1px solid var(--line); background: #fff; gap: 10px; }
.topbar-menu { display: none; background: none; border: none; cursor: pointer; color: var(--ink); }
@media (max-width: 860px) { .topbar-menu { display: inline-flex; } }
.topbar-end { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.topbar-user { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--teal); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: 'Fraunces', serif; }
.topbar-user-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.topbar-user-plan { font-size: 10.5px; color: var(--steel); }
.topbar-consultas-btn { display: flex; align-items: center; gap: 6px; background: none; border: none; cursor: pointer; font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--steel); padding: 0; }
.topbar-consultas-btn:hover { color: var(--teal-dark); }
.topbar-consultas-icon { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--teal); color: #fff; font-size: 12px; font-weight: 700; }
.content-area { padding: clamp(16px, 3vw, 30px); flex: 1; }
.content-inner { max-width: 1080px; margin: 0 auto; }

/* ---------- section layout ---------- */
.section-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .section-grid { grid-template-columns: 1fr; } }

/* ---------- ticket / payslip ---------- */
.ticket { background: var(--ink); border-radius: 14px; overflow: hidden; color: #fff; }
.ticket-teal .ticket-top { background: var(--teal); }
.ticket-stamp .ticket-top { background: var(--stamp); }
.ticket-top { padding: 12px 18px; font-family: 'Fraunces', serif; font-weight: 600; font-size: 15px; }
.ticket-perf { height: 10px; background: repeating-linear-gradient(90deg, transparent 0 6px, rgba(255,255,255,.5) 6px 7px); opacity: .5; }
.ticket-body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.ticket-row { display: flex; justify-content: space-between; font-size: 13px; color: #D6DCE4; }
.ticket-row-strong { font-weight: 700; color: #fff; font-size: 14.5px; }
.ticket-divider { border-top: 1px dashed rgba(255,255,255,.25); margin: 4px 0; }

/* ---------- history ---------- */
.hist-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.hist-filters { display: flex; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font-size: 12px; font-weight: 600; color: var(--steel); cursor: pointer; font-family: inherit; text-decoration: none; display: inline-block; }
.chip-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.hist-list { display: flex; flex-direction: column; gap: 8px; }
.hist-item { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.hist-item-main { display: flex; align-items: center; gap: 12px; width: 100%; background: #fff; border: none; padding: 12px 14px; cursor: pointer; text-align: left; font-family: inherit; }
.hist-badge { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; flex-shrink: 0; }
.hist-badge-liquidacion { background: #E3F0EC; color: var(--teal-dark); }
.hist-badge-sueldo_base { background: #EFE8DC; color: #8A5A2B; }
.hist-badge-casa_particular { background: #E6E9F5; color: #3D4A9E; }
.hist-badge-boleta_honorarios { background: #FDEBD3; color: #8A4B00; }
.hist-badge-finiquito { background: #FBEAE3; color: var(--stamp); }
.hist-badge-remanente_iva { background: #EFE6F5; color: #6B3FA0; }
.hist-resumen { flex: 1; font-size: 13px; font-weight: 500; }
.hist-fecha { font-size: 11.5px; color: var(--steel); }
.hist-detail { padding: 12px 14px; background: #FAF8F3; border-top: 1px solid var(--line); }
.hist-json { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; background: var(--ink); color: #D6DCE4; padding: 12px; border-radius: 8px; overflow-x: auto; margin: 0 0 10px; white-space: pre-wrap; }

/* ---------- plan card ---------- */
.plan-card { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.plan-card:last-child { border-bottom: none; }
.plan-name { font-weight: 600; font-size: 13.5px; }
.plan-desc { font-size: 11.5px; color: var(--steel); }
.chip-active.plan-chip { background: var(--teal); color: #fff; border-color: var(--teal); cursor: default; }

/* ---------- admin ---------- */
.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.admin-tabs .chip { white-space: nowrap; }
.banner-editor { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.banner-editor-head { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; font-weight: 700; color: var(--steel); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px; }
.banner-preview { border-radius: 10px; padding: 14px; color: #fff; display: flex; flex-direction: column; gap: 2px; margin-top: 4px; position: relative; overflow: hidden; width: 350px; max-width: 100%; height: 150px; justify-content: center; background-size: cover; background-position: center; }
input[type=color] { padding: 3px; height: 40px; }

/* ---------- modal (Simulación Express) ---------- */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(18,37,62,.55); z-index: 100; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.modal-open { display: flex; }
.modal-box { background: var(--card); border-radius: 14px; padding: 30px 28px; max-width: 440px; width: 100%; position: relative; max-height: 90vh; overflow-y: auto; }
.modal-box-wide { max-width: 500px; }
.modal-close { position: absolute; top: 12px; right: 14px; background: none; border: none; font-size: 22px; line-height: 1; color: var(--steel); cursor: pointer; z-index: 1; }
.modal-close:hover { color: var(--ink); }
/* Etiqueta de sección dentro de un modal: a diferencia de .ledger-tab (pensada
   para tarjetas con overflow visible), esta va en flujo normal, porque un
   modal con overflow-y:auto recorta cualquier hijo posicionado fuera de su
   caja (como el top:-14px de .ledger-tab), dejando el título invisible. */
.modal-tab { display: inline-block; background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 5px 12px; border-radius: 6px; margin-bottom: 12px; }

/* ---------- footer ---------- */
.app-footer { background: var(--ink); color: #D6DCE4; margin-top: auto; }
.footer-inner { max-width: 1080px; margin: 0 auto; padding: 18px clamp(16px, 4vw, 30px); display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.footer-brand { font-family: 'Fraunces', serif; font-weight: 600; color: #fff; }
.footer-brand span { color: #E88A5E; }
.footer-indicators { display: flex; gap: 22px; flex-wrap: wrap; }
.ind { display: flex; flex-direction: column; gap: 1px; }
.ind-label { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: #93A0B2; }
.ind-value { font-size: 13px; font-weight: 600; color: #fff; }
.footer-note { font-size: 10.5px; color: #7C8AA0; margin-left: auto; }

/* ---------- tabla simple (detalle mes a mes) ---------- */
.simple-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 10px; }
.simple-table th { text-align: left; padding: 6px 8px; color: var(--steel); font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: .02em; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
.simple-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.simple-table tbody tr:last-child td { font-weight: 700; }
.simple-table.simple-table-plana tbody tr:last-child td { font-weight: inherit; }
.simple-table-wrap { overflow-x: auto; }

/* ---------- texto descriptivo de la portada (SEO) ---------- */
.seo-home { max-width: 860px; margin: 30px auto 40px; padding: 0 20px; color: var(--ink); }
.seo-home-title { font-family: 'Fraunces', serif; font-size: 20px; font-weight: 600; margin: 0 0 8px; }
.seo-home-lead { font-size: 14px; line-height: 1.6; color: var(--steel); margin: 0 0 12px; }
.seo-home-list { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.7; color: var(--steel); }
.seo-home-list a { color: var(--teal); text-decoration: none; }
.seo-home-list a:hover { text-decoration: underline; }
