/* =========================================================
   Bilingüe El Prado · Recursos Humanos
   Sistema de diseño v2
   Marca: azul institucional + dorado del escudo (50 aniversario)
   Fondo: papel azulado frío, superficies blancas, bordes finos
   Tipografía: Newsreader (títulos y cifras) + Figtree (interfaz)
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&family=Newsreader:opsz,wght@6..72,500;6..72,600;6..72,700&display=swap');

:root{
  /* Marca */
  --navy:        #1c3d5a;
  --navy-deep:   #0f2438;
  --navy-mid:    #2a5478;
  --gold:        #c99a3c;
  --gold-deep:   #a37a24;
  --gold-soft:   #ecd9a8;

  /* Neutros */
  --paper:       #f1f4f8;
  --surface:     #ffffff;
  --surface-alt: #f7f9fb;
  --ink:         #16212b;
  --ink-soft:    #566471;
  --ink-faint:   #8a96a3;
  --line:        #e0e6ed;
  --line-strong: #cbd4de;

  /* Semánticos */
  --green:       #1f7a4d;
  --green-bg:    #e5f4ec;
  --amber:       #9a5b08;
  --amber-bg:    #fcf0d9;
  --red:         #b3372a;
  --red-bg:      #fbe8e5;
  --blue-bg:     #e6eef7;

  /* Compatibilidad con nombres anteriores */
  --cream:       var(--paper);
  --cream-panel: var(--surface);

  --radius:      14px;
  --radius-sm:   9px;
  --radius-xs:   6px;
  --ring:        0 0 0 3px rgba(201,154,60,.35);
  --shadow:      0 1px 2px rgba(15,36,56,.05);
  --shadow-lift: 0 10px 30px -14px rgba(15,36,56,.28);

  --font-ui:      'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Newsreader', Georgia, 'Times New Roman', serif;
}

*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  font-family:var(--font-ui);
  font-size:15px; line-height:1.5;
  color:var(--ink);
  background:var(--paper);
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3{ font-family:var(--font-display); font-weight:600; margin:0; letter-spacing:-.005em; }
a{ color:inherit; text-decoration:none; }
input,select,textarea,button{ font-family:inherit; font-size:15px; }
img{ max-width:100%; }
::selection{ background:var(--gold-soft); color:var(--navy-deep); }

:focus-visible{ outline:none; box-shadow:var(--ring); border-radius:var(--radius-xs); }
a:focus-visible, button:focus-visible{ outline:2px solid var(--gold); outline-offset:2px; box-shadow:none; }

@media (prefers-reduced-motion:reduce){
  *{ animation:none !important; transition:none !important; scroll-behavior:auto !important; }
}

/* =========================================================
   Acceso (login / recuperar contraseña)
   El único momento "de marca" del panel: anillos del escudo
   ========================================================= */
.auth-body{
  min-height:100vh;
  display:flex; align-items:center; justify-content:center;
  padding:24px;
  background:
    repeating-radial-gradient(circle at 0% 100%, transparent 0 74px, rgba(255,255,255,.045) 74px 75px),
    radial-gradient(900px 520px at 100% 0%, rgba(201,154,60,.22), transparent 62%),
    linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 70%);
}
.auth-card{
  width:100%; max-width:420px;
  background:var(--surface);
  border-radius:18px;
  padding:38px 34px 32px;
  box-shadow:0 40px 80px -30px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.08);
  border-top:4px solid var(--gold);
}
.auth-logo{ text-align:center; margin-bottom:26px; }
.auth-logo img{ border-radius:12px; }
.auth-logo-badge{
  width:56px; height:56px; margin:0 auto 14px;
  border-radius:14px;
  background:linear-gradient(135deg,var(--navy),var(--navy-deep));
  color:var(--gold-soft);
  display:flex; align-items:center; justify-content:center;
  font-family:var(--font-display); font-weight:700; font-size:22px;
  box-shadow:inset 0 0 0 2px rgba(201,154,60,.4);
}
.auth-logo h1{ font-size:26px; color:var(--navy); line-height:1.15; }
.auth-logo p{ margin:6px 0 0; color:var(--ink-soft); font-size:14px; }
.auth-form{ display:flex; flex-direction:column; gap:6px; }
.auth-form label{ font-size:13px; font-weight:600; color:var(--ink); margin-top:12px; }
.auth-form input{
  padding:12px 14px; border:1.5px solid var(--line-strong); border-radius:var(--radius-sm);
  background:var(--surface); transition:border-color .15s, box-shadow .15s;
}
.auth-form input:hover{ border-color:var(--ink-faint); }
.auth-form input:focus{ outline:none; border-color:var(--navy); box-shadow:0 0 0 3px rgba(28,61,90,.15); }
.auth-hint{ text-align:center; font-size:13px; color:var(--ink-soft); margin-top:20px; }
.auth-hint a{ color:var(--navy); font-weight:600; }
.auth-hint a:hover{ text-decoration:underline; }

/* =========================================================
   Botones
   ========================================================= */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:7px;
  padding:10px 16px; border-radius:var(--radius-sm);
  border:1.5px solid var(--line-strong); background:var(--surface); color:var(--ink);
  font-weight:600; font-size:14px; line-height:1.2; cursor:pointer; white-space:nowrap;
  transition:background .15s, border-color .15s, color .15s, transform .05s;
}
.btn:hover{ border-color:var(--navy); color:var(--navy); background:var(--surface-alt); }
.btn:active{ transform:translateY(1px); }
.btn-primary{ background:var(--navy); border-color:var(--navy); color:#fff; }
.btn-primary:hover{ background:var(--navy-deep); border-color:var(--navy-deep); color:#fff; }
.btn-danger{ color:var(--red); border-color:#ecc3bd; }
.btn-danger:hover{ border-color:var(--red); background:var(--red-bg); color:var(--red); }
.btn-block{ width:100%; margin-top:20px; padding:13px; }
.btn-sm{ padding:6px 12px; font-size:13px; border-radius:8px; }
.btn[disabled], .btn:disabled{ opacity:.5; cursor:not-allowed; }

/* =========================================================
   Avisos
   ========================================================= */
.alert{
  padding:12px 14px; border-radius:var(--radius-sm); font-size:14px; margin-bottom:16px;
  border:1px solid transparent; border-left-width:4px;
}
.alert-error{ background:var(--red-bg); color:#8c2a1f; border-color:#f0c9c3; border-left-color:var(--red); }
.alert-success{ background:var(--green-bg); color:#175c3a; border-color:#bfe3cf; border-left-color:var(--green); }

/* =========================================================
   Estructura del panel
   ========================================================= */
.panel-shell{ display:flex; min-height:100vh; }
.sidebar{
  width:268px; flex-shrink:0;
  background:linear-gradient(190deg,var(--navy) 0%,var(--navy-deep) 85%);
  color:#fff;
  display:flex; flex-direction:column;
  position:sticky; top:0; height:100vh;
}
.sidebar-brand{
  display:flex; align-items:center; gap:12px;
  padding:20px 18px; border-bottom:1px solid rgba(255,255,255,.1);
}
.brand-badge{
  width:44px; height:44px; border-radius:11px;
  background:rgba(201,154,60,.2); color:var(--gold-soft);
  display:flex; align-items:center; justify-content:center;
  font-family:var(--font-display); font-weight:700; font-size:16px;
  box-shadow:inset 0 0 0 1.5px rgba(201,154,60,.45);
  flex-shrink:0;
}
.brand-logo-img{
  width:46px; height:46px; padding:4px; object-fit:contain; flex-shrink:0;
  background:#fff; border-radius:11px; box-shadow:0 1px 3px rgba(0,0,0,.25);
}
.sidebar-brand strong{ display:block; font-family:var(--font-display); font-size:17px; font-weight:600; line-height:1.2; }
.sidebar-brand span{ display:block; font-size:12.5px; color:var(--gold-soft); opacity:.9; margin-top:1px; }

.sidebar-nav{ display:flex; flex-direction:column; padding:14px 12px; gap:2px; flex:1; min-height:0; overflow-y:auto; }
.sidebar-nav::-webkit-scrollbar{ width:6px; }
.sidebar-nav::-webkit-scrollbar-thumb{ background:rgba(255,255,255,.18); border-radius:3px; }
.sidebar-nav a{
  position:relative;
  display:flex; align-items:center; gap:12px;
  padding:10px 12px; border-radius:10px;
  color:rgba(255,255,255,.74); font-size:14px; font-weight:500;
  transition:background .15s, color .15s;
}
.sidebar-nav a svg{ flex-shrink:0; opacity:.85; }
.sidebar-nav a:hover{ background:rgba(255,255,255,.07); color:#fff; }
.sidebar-nav a.active{
  background:rgba(255,255,255,.13); color:#fff; font-weight:600;
}
.sidebar-nav a.active::before{
  content:""; position:absolute; left:-12px; top:9px; bottom:9px; width:4px;
  background:var(--gold); border-radius:0 4px 4px 0;
}
.sidebar-nav a.active svg{ color:var(--gold-soft); opacity:1; }
.sidebar-section-label{
  font-size:12.5px; font-weight:600;
  color:rgba(255,255,255,.45); padding:18px 12px 6px;
}
.sidebar-footer{
  padding:14px; border-top:1px solid rgba(255,255,255,.1);
  display:flex; align-items:center; gap:10px;
}
.sidebar-user{ display:flex; align-items:center; gap:10px; flex:1; min-width:0; }
.user-avatar{
  width:36px; height:36px; border-radius:50%; flex-shrink:0;
  background:var(--gold); color:var(--navy-deep);
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:15px;
}
.sidebar-user strong{ display:block; font-size:13.5px; line-height:1.25; overflow-wrap:anywhere; }
.sidebar-user span{ display:block; font-size:12px; color:rgba(255,255,255,.6); text-transform:capitalize; white-space:nowrap; }
.btn-logout{
  width:36px; height:36px; border-radius:10px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  color:rgba(255,255,255,.75); background:rgba(255,255,255,.06);
  transition:background .15s, color .15s;
}
.btn-logout:hover{ background:rgba(255,255,255,.16); color:#fff; }

.panel-main{ flex:1; min-width:0; }
.topbar{
  display:flex; align-items:center; gap:14px;
  padding:26px 32px 6px;
  background:var(--paper);
  position:sticky; top:0; z-index:10;
}
.topbar h1{ font-size:30px; color:var(--navy-deep); line-height:1.15; }
.hamburger{
  display:none; align-items:center; justify-content:center;
  width:40px; height:40px; background:var(--surface); border:1px solid var(--line-strong);
  border-radius:10px; cursor:pointer; color:var(--navy); padding:0;
}
.panel-content{ padding:18px 32px 64px; max-width:1200px; }

/* =========================================================
   Indicadores
   ========================================================= */
.stats-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:16px; margin-bottom:22px; }
.stat-card{
  position:relative; overflow:hidden;
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:18px 18px 18px 22px; display:flex; align-items:center; gap:14px; box-shadow:var(--shadow);
}
.stat-card::before{
  content:""; position:absolute; left:0; top:0; bottom:0; width:4px; background:var(--navy);
}
.stat-card:nth-child(2)::before{ background:var(--green); }
.stat-card:nth-child(3)::before{ background:var(--gold); }
.stat-card:nth-child(4)::before{ background:#7a4fb0; }
.stat-icon{ width:42px; height:42px; border-radius:11px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.stat-icon-blue{ background:var(--blue-bg); color:var(--navy); }
.stat-icon-green{ background:var(--green-bg); color:var(--green); }
.stat-icon-amber{ background:var(--amber-bg); color:var(--amber); }
.stat-icon-purple{ background:#f0e8f8; color:#6b3fa0; }
.stat-value{ display:block; font-family:var(--font-display); font-size:34px; font-weight:600; color:var(--navy-deep); line-height:1; font-variant-numeric:tabular-nums; }
.stat-label{ display:block; font-size:13px; color:var(--ink-soft); margin-top:5px; }

/* =========================================================
   Tarjetas y secciones
   ========================================================= */
.card{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:22px 24px; margin-bottom:20px; box-shadow:var(--shadow);
}
.card-narrow{ max-width:480px; }
.card-header{ display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; gap:10px; flex-wrap:wrap; }
.card-header h2{ font-size:20px; color:var(--navy-deep); }
.link-sm{ font-size:13.5px; color:var(--navy); font-weight:600; }
.link-sm:hover{ text-decoration:underline; text-underline-offset:3px; }

.dash-grid{ display:grid; grid-template-columns:1.4fr 1fr; gap:20px; }
.dash-grid > .card{ margin-bottom:0; }
.dash-grid{ margin-bottom:20px; }

/* =========================================================
   Formularios del panel
   ========================================================= */
.form-stack{ display:flex; flex-direction:column; gap:5px; }
.form-stack label{ font-size:13.5px; font-weight:600; color:var(--ink); margin-top:14px; }
.form-stack input, .form-stack select, .form-stack textarea{
  padding:10px 12px; border:1.5px solid var(--line-strong); border-radius:var(--radius-sm); background:var(--surface);
  transition:border-color .15s, box-shadow .15s; width:100%;
}
.form-stack input:hover, .form-stack select:hover, .form-stack textarea:hover{ border-color:var(--ink-faint); }
.form-stack input:focus, .form-stack select:focus, .form-stack textarea:focus{
  outline:none; border-color:var(--navy); box-shadow:0 0 0 3px rgba(28,61,90,.14);
}
.form-stack input[type="checkbox"], .form-stack input[type="radio"]{ width:auto; }
.field-hint{ color:var(--ink-soft); font-size:12.5px; margin-top:2px; }
.color-input{ height:42px; padding:4px !important; cursor:pointer; }

.filter-bar{ display:flex; flex-wrap:wrap; gap:10px; align-items:center; }
.filter-bar input, .filter-bar select{
  padding:10px 12px; border:1.5px solid var(--line-strong); border-radius:var(--radius-sm); background:var(--surface);
}
.filter-bar input:focus, .filter-bar select:focus{ outline:none; border-color:var(--navy); box-shadow:0 0 0 3px rgba(28,61,90,.14); }
.filter-bar input{ flex:1; min-width:200px; }

.link-result{ display:flex; gap:8px; margin-top:8px; }
.link-result input{
  flex:1; padding:11px 13px; border:1.5px solid var(--line-strong); border-radius:var(--radius-sm);
  background:var(--surface-alt); font-size:13.5px; color:var(--ink-soft);
}
.link-actions{ margin-top:14px; font-size:13.5px; }

/* =========================================================
   Áreas
   ========================================================= */
.two-col{ display:grid; grid-template-columns:1fr 1.2fr; gap:20px; align-items:start; }
.two-col > .card{ margin-bottom:0; }
.area-list{ display:flex; flex-direction:column; gap:8px; }
.area-item{
  display:flex; align-items:center; gap:12px; padding:12px 14px;
  border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface);
  transition:border-color .15s, background .15s;
}
.area-item:hover{ border-color:var(--line-strong); background:var(--surface-alt); }
.area-dot{ width:12px; height:12px; border-radius:50%; flex-shrink:0; box-shadow:0 0 0 3px rgba(15,36,56,.06); }
.area-item-info{ flex:1; min-width:0; }
.area-item-info strong{ display:block; font-size:14.5px; }
.area-item-info span{ display:block; font-size:12.5px; color:var(--ink-soft); }

.area-item-block{ margin-bottom:4px; }
.subarea-list{ margin:4px 0 10px 30px; display:flex; flex-direction:column; gap:4px; }
.subarea-item{
  display:flex; align-items:center; gap:8px; padding:7px 11px;
  background:var(--surface-alt); border:1px solid var(--line); border-radius:8px; font-size:13px;
}
.subarea-branch{ color:var(--ink-faint); font-size:13px; }
.subarea-name{ font-weight:600; flex:1; }
.subarea-count{ color:var(--ink-soft); font-size:12px; }
.subarea-delete{ color:var(--red); font-weight:700; font-size:13px; padding:2px 7px; border-radius:6px; flex-shrink:0; }
.subarea-delete:hover{ background:var(--red-bg); }

.area-bars{ display:flex; flex-direction:column; gap:14px; }
.area-bar-row{ display:grid; grid-template-columns:130px 1fr 34px; align-items:center; gap:12px; }
.area-bar-label{ font-size:13.5px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.area-bar-track{ height:10px; background:var(--paper); border-radius:6px; overflow:hidden; }
.area-bar-fill{ height:100%; border-radius:6px; }
.area-bar-count{ font-size:14px; font-weight:700; text-align:right; color:var(--ink); font-variant-numeric:tabular-nums; }

.quick-actions{ display:flex; flex-direction:column; gap:8px; }
.quick-action{
  display:flex; align-items:center; gap:12px; padding:13px 14px;
  border:1.5px solid var(--line); border-radius:var(--radius-sm); font-weight:600; font-size:14.5px;
  color:var(--navy); background:var(--surface); transition:border-color .15s, background .15s;
}
.quick-action svg{ color:var(--gold-deep); flex-shrink:0; }
.quick-action:hover{ border-color:var(--navy); background:var(--blue-bg); }

/* =========================================================
   Tablas
   ========================================================= */
.table-wrap{ overflow-x:auto; margin:0 -6px; padding:0 6px; }
.data-table{ width:100%; border-collapse:collapse; font-size:14px; }
.data-table th{
  text-align:left; padding:10px 12px; color:var(--ink-soft); font-size:13px; font-weight:600;
  border-bottom:1.5px solid var(--line-strong); background:transparent; white-space:nowrap;
}
.data-table td{ padding:13px 12px; border-bottom:1px solid var(--line); vertical-align:middle; }
.data-table tbody tr{ transition:background .12s; }
.data-table tbody tr:hover{ background:var(--surface-alt); }
.data-table tr:last-child td{ border-bottom:none; }
.text-right{ text-align:right; }
.text-muted{ color:var(--ink-soft); font-size:13px; }
.nowrap{ white-space:nowrap; }

.badge{ display:inline-block; padding:3px 11px; border-radius:20px; font-size:12.5px; font-weight:600; }
.status{
  display:inline-flex; align-items:center; gap:6px;
  padding:3px 11px 3px 9px; border-radius:20px; font-size:12.5px; font-weight:600;
}
.status::before{ content:""; width:7px; height:7px; border-radius:50%; background:currentColor; }
.status-done{ background:var(--green-bg); color:var(--green); }
.status-pending{ background:var(--amber-bg); color:var(--amber); }

.empty-state{
  color:var(--ink-soft); font-size:14.5px; padding:22px 16px; text-align:center;
  background:var(--surface-alt); border:1.5px dashed var(--line-strong); border-radius:var(--radius-sm);
}
.empty-state a{ color:var(--navy); font-weight:600; text-decoration:underline; text-underline-offset:3px; }

/* =========================================================
   Editor de plantillas de correo
   ========================================================= */
.ed-wrap{ border:1.5px solid var(--line-strong); border-radius:var(--radius-sm); overflow:hidden; background:var(--surface); }
.ed-toolbar{ display:flex; flex-wrap:wrap; align-items:center; gap:4px; padding:8px; background:var(--surface-alt); border-bottom:1px solid var(--line); }
.ed-btn{ border:1px solid transparent; background:transparent; border-radius:7px; padding:6px 10px; font-size:13px; cursor:pointer; color:var(--ink); min-width:34px; transition:background .12s; }
.ed-btn:hover{ background:var(--blue-bg); border-color:#cfdcec; }
.ed-btn-accent{ background:var(--gold); color:var(--navy-deep); font-weight:600; }
.ed-btn-accent:hover{ background:var(--gold-deep); color:#fff; }
.ed-sep{ width:1px; height:22px; background:var(--line-strong); margin:0 4px; }
.ed-select{ border:1px solid var(--line-strong); border-radius:7px; padding:6px 8px; font-size:13px; background:var(--surface); max-width:260px; }
.ed-area{ min-height:300px; max-height:560px; overflow:auto; padding:18px 20px; font-family:Arial,Helvetica,sans-serif; font-size:15px; line-height:1.7; color:var(--ink); outline:none; }
.ed-area:focus{ box-shadow:inset 0 0 0 2px rgba(28,61,90,.18); }
.ed-area p{ margin:0 0 12px; }
.var-chip{ display:inline-block; background:var(--blue-bg); color:var(--navy); border:1px solid #bdd0e6; border-radius:12px; padding:0 9px; font-size:13px; line-height:1.6; white-space:nowrap; user-select:all; }
.ed-modal{ position:fixed; inset:0; background:rgba(15,36,56,.55); backdrop-filter:blur(2px); display:flex; align-items:center; justify-content:center; z-index:1000; padding:16px; }
.ed-modal[hidden]{ display:none; }
.ed-modal-box{ background:var(--surface); border-radius:var(--radius); padding:24px; width:100%; max-width:440px; box-shadow:0 24px 60px rgba(0,0,0,.35); }
.ed-modal-box h3{ margin:0 0 12px; font-size:20px; color:var(--navy-deep); }
.ed-modal-box label{ display:block; margin:12px 0 4px; font-size:13.5px; font-weight:600; }
.ed-modal-box input, .ed-modal-box select{ width:100%; padding:9px 11px; border:1.5px solid var(--line-strong); border-radius:var(--radius-sm); }
.ed-modal-actions{ display:flex; gap:8px; justify-content:flex-end; margin-top:20px; }

/* =========================================================
   FORMULARIO PÚBLICO (candidato)
   La cara de la institución: encabezado azul con el escudo
   ========================================================= */
.form-body{ background:var(--paper); min-height:100vh; padding:0 0 70px; }
.form-hero{
  position:relative; overflow:hidden;
  background:
    repeating-radial-gradient(circle at 100% 0%, transparent 0 60px, rgba(255,255,255,.05) 60px 61px),
    linear-gradient(150deg,var(--navy),var(--navy-deep));
  padding:42px 18px 62px;
  text-align:center; color:#fff;
}
.form-hero::after{
  content:""; position:absolute; left:0; right:0; bottom:0; height:4px;
  background:linear-gradient(90deg,var(--gold),var(--gold-soft),var(--gold));
}
.form-hero .crest{
  width:72px; height:72px; margin:0 auto 14px;
  border-radius:18px;
  background:rgba(255,255,255,.96);
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 8px 20px -8px rgba(0,0,0,.5);
}
.form-hero .crest img{ max-width:56px; max-height:56px; object-fit:contain; }
.form-hero h1{ font-size:32px; color:#fff; line-height:1.15; }
.form-hero p{ margin:8px 0 0; font-size:15px; color:var(--gold-soft); }

.form-shell{ max-width:780px; margin:-34px auto 0; padding:0 16px; position:relative; }
.form-progress{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:14px 18px; box-shadow:var(--shadow-lift); margin-bottom:18px;
  display:flex; align-items:center; gap:14px; font-size:13.5px; color:var(--ink-soft);
}
.form-progress .bar{ flex:1; height:8px; background:var(--paper); border-radius:5px; overflow:hidden; }
.form-progress .bar-fill{ height:100%; background:linear-gradient(90deg,var(--gold),var(--gold-deep)); border-radius:5px; transition:width .3s ease; }
.form-progress strong{ color:var(--navy); }

.autosave-note{
  display:flex; align-items:center; gap:6px;
  font-size:12.5px; color:var(--green); margin-bottom:16px; padding:0 4px;
  opacity:0; transition:opacity .3s ease;
}
.autosave-note.show{ opacity:1; }

.fsection{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  margin-bottom:16px; overflow:hidden; box-shadow:var(--shadow);
}

/* Asistente por pasos */
.fstep{ display:none; }
.fstep.fstep-active{ display:block; animation:fstepIn .25s ease; }
@keyframes fstepIn{ from{ opacity:0; transform:translateY(6px);} to{ opacity:1; transform:translateY(0);} }

.step-badge{
  display:inline-flex; align-items:center; justify-content:center;
  width:26px; height:26px; border-radius:50%;
  background:var(--gold); color:var(--navy-deep);
  font-family:var(--font-ui); font-size:13px; font-weight:700;
  margin-right:10px; vertical-align:middle;
}
.step-title-bar{
  text-align:center; font-family:var(--font-display); font-size:16px; font-weight:600;
  color:var(--navy); margin-bottom:14px;
}

.step-nav{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:12px 16px; box-shadow:var(--shadow-lift); position:sticky; bottom:12px;
  margin-top:4px;
}
.step-dots{ display:flex; gap:6px; flex-wrap:wrap; justify-content:center; flex:1; }
.step-dot{
  width:9px; height:9px; border-radius:50%; border:none; padding:0; cursor:pointer;
  background:var(--line-strong); transition:all .15s ease; flex-shrink:0;
}
.step-dot:hover{ background:var(--gold); }
.step-dot.done{ background:var(--green); }
.step-dot.active{ background:var(--navy); width:24px; border-radius:5px; }
#btnSiguiente, #submitBtn{ flex-shrink:0; }
#btnAnterior{ flex-shrink:0; }

.fsection-title{
  background:var(--navy); color:#fff;
  padding:14px 20px; font-family:var(--font-display); font-size:19px; font-weight:600;
  border-bottom:3px solid var(--gold);
}
.fsection-body{ padding:22px 20px; }
.fsection-hint{ font-size:13px; color:var(--ink-soft); margin:-6px 0 16px; }

.frow{ display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:16px; }
.frow.f1{ grid-template-columns:1fr; }
.frow.f3{ grid-template-columns:1fr 1fr 1fr; }
.fgroup{ display:flex; flex-direction:column; gap:6px; }
.fgroup label{ font-size:13.5px; font-weight:600; color:var(--ink); }
.fgroup input, .fgroup select, .fgroup textarea{
  padding:11px 12px; border:1.5px solid var(--line-strong); border-radius:var(--radius-sm);
  background:var(--surface); width:100%; transition:border-color .15s, box-shadow .15s;
}
.fgroup input:hover, .fgroup select:hover, .fgroup textarea:hover{ border-color:var(--ink-faint); }
.fgroup input:focus, .fgroup select:focus, .fgroup textarea:focus{
  outline:none; border-color:var(--navy); box-shadow:0 0 0 3px rgba(28,61,90,.14);
}
.fgroup textarea{ resize:vertical; min-height:76px; }

.radio-row{ display:flex; gap:18px; align-items:center; flex-wrap:wrap; }
.radio-opt, .check-opt{ display:flex; align-items:center; gap:7px; font-size:14px; cursor:pointer; }
.radio-opt input, .check-opt input{ width:17px; height:17px; accent-color:var(--navy); cursor:pointer; }

.subblock{
  border:1px solid var(--line); border-radius:var(--radius-sm);
  padding:16px; margin-bottom:12px; background:var(--surface-alt);
}
.subblock-title{ font-weight:700; font-size:14px; color:var(--navy); margin-bottom:12px; }

.exp-block{ position:relative; padding-left:48px; margin-bottom:20px; }
.exp-num{
  position:absolute; left:0; top:0; width:34px; height:34px; border-radius:10px;
  background:var(--navy); color:var(--gold-soft); font-family:var(--font-display); font-weight:700;
  display:flex; align-items:center; justify-content:center; font-size:16px;
}

.family-table, .ref-table{ width:100%; border-collapse:collapse; margin-top:6px; }
.family-table th, .ref-table th{
  font-size:12.5px; font-weight:600; color:var(--ink-soft);
  padding:6px 6px; text-align:left; border-bottom:1.5px solid var(--line-strong);
}
.family-table td, .ref-table td{ padding:5px 6px; vertical-align:top; }
.family-table input, .ref-table input{
  width:100%; padding:8px 9px; border:1.5px solid var(--line-strong); border-radius:7px; background:var(--surface); font-size:13.5px;
}
.family-table input:focus, .ref-table input:focus{ outline:none; border-color:var(--navy); box-shadow:0 0 0 3px rgba(28,61,90,.14); }
.family-row-label{ font-weight:700; font-size:13px; white-space:nowrap; padding-top:10px !important; color:var(--navy); }

.photo-upload{
  border:2px dashed var(--line-strong); border-radius:var(--radius-sm);
  padding:20px; text-align:center; cursor:pointer; background:var(--surface-alt);
  transition:border-color .15s, background .15s;
}
.photo-upload:hover{ border-color:var(--navy); background:var(--blue-bg); }
.photo-upload img{ max-height:120px; border-radius:8px; margin-bottom:8px; }
.photo-upload span{ display:block; font-size:13px; color:var(--ink-soft); }

.signature-pad-wrap{ border:1.5px solid var(--line-strong); border-radius:var(--radius-sm); background:#fff; }
.signature-pad-wrap canvas{ width:100%; height:150px; display:block; touch-action:none; cursor:crosshair; }
.signature-actions{ display:flex; justify-content:flex-end; margin-top:6px; }

.form-submit-bar{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:22px; box-shadow:var(--shadow); text-align:center;
}
.form-submit-bar p{ font-size:13.5px; color:var(--ink-soft); margin:0 0 14px; }
.declaracion-text{
  font-size:13px; color:var(--ink-soft); background:var(--surface-alt); border:1px solid var(--line);
  border-radius:var(--radius-sm); padding:14px 16px; margin-bottom:16px; text-align:left; line-height:1.65;
}
.btn-submit{
  background:var(--gold); border-color:var(--gold); color:var(--navy-deep);
  font-size:16px; padding:13px 30px; font-weight:700;
}
.btn-submit:hover{ background:var(--gold-deep); border-color:var(--gold-deep); color:#fff; }

/* Pantalla de agradecimiento */
.thanks-screen{ max-width:540px; margin:80px auto; text-align:center; padding:0 20px; }
.thanks-icon{
  width:80px; height:80px; margin:0 auto 22px; border-radius:50%;
  background:var(--green-bg); color:var(--green);
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 0 0 10px rgba(31,122,77,.08);
}
.thanks-screen h1{ font-size:30px; color:var(--navy-deep); margin-bottom:10px; }
.thanks-screen p{ color:var(--ink-soft); font-size:15.5px; line-height:1.65; }

/* =========================================================
   VISTA DE SOLICITUD LLENA (ver_solicitud.php) — imprimible
   ========================================================= */
.view-toolbar{ display:flex; justify-content:space-between; align-items:center; margin-bottom:18px; gap:10px; flex-wrap:wrap; }
.doc-sheet{
  background:#fff; border:1px solid var(--line); border-radius:var(--radius);
  padding:32px 34px; box-shadow:var(--shadow-lift); max-width:900px; margin:0 auto;
}
.doc-header{ display:flex; justify-content:space-between; align-items:flex-start; border-bottom:3px solid var(--navy); padding-bottom:16px; margin-bottom:20px; gap:16px; }
.doc-header h1{ font-size:24px; color:var(--navy-deep); }
.doc-header p{ margin:3px 0 0; color:var(--ink-soft); font-size:13.5px; }
.doc-photo{ width:92px; height:112px; border:1px solid var(--line); border-radius:8px; object-fit:cover; background:var(--paper); }
.doc-section{ margin-bottom:22px; }
.doc-section h3{
  background:var(--navy); color:#fff; padding:8px 14px; font-size:16px;
  border-radius:8px; margin-bottom:10px; border-left:5px solid var(--gold);
}
.doc-grid{ display:grid; grid-template-columns:1fr 1fr; gap:8px 22px; font-size:13.5px; }
.doc-grid.full{ grid-template-columns:1fr; }
.doc-field{ padding:5px 0; border-bottom:1px solid var(--line); }
.doc-field b{ display:block; font-size:12px; font-weight:600; color:var(--ink-soft); margin-bottom:2px; }
.doc-table th{ background:var(--paper); text-align:left; padding:7px 9px; border:1px solid var(--line); font-size:12px; font-weight:600; }
.doc-table td{ padding:7px 9px; border:1px solid var(--line); }
.doc-sig{ margin-top:26px; display:flex; justify-content:space-between; align-items:flex-end; gap:20px; }
.doc-sig img{ max-height:70px; }

/* =========================================================
   Constructor de encuesta (form_builder.php)
   ========================================================= */
.fb-layout{ display:grid; grid-template-columns:310px minmax(0,1fr); gap:22px; align-items:start; }
.fb-main{ display:flex; flex-direction:column; gap:20px; min-width:0; }
.fb-card{ margin-bottom:0; }

/* Índice lateral */
.fb-rail{
  position:sticky; top:84px;
  max-height:calc(100vh - 108px);
  display:flex; flex-direction:column;
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow); overflow:hidden;
}
.fb-rail-head{ padding:18px 20px 12px; border-bottom:1px solid var(--line); }
.fb-rail-head h2{ font-size:20px; color:var(--navy-deep); }
.fb-rail-head .text-muted{ display:block; margin-top:2px; }
.fb-rail-scroll{ flex:1; min-height:0; overflow-y:auto; padding:6px 12px 12px; }
.fb-group-label{ margin:14px 8px 6px; font-size:12.5px; font-weight:600; color:var(--ink-soft); }
.fb-none{ margin:0 8px; }
.fb-list{ display:flex; flex-direction:column; gap:2px; }
.fb-item{
  position:relative; display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:9px 10px 9px 12px; border-radius:9px; font-size:14px; font-weight:500; color:var(--ink);
  transition:background .12s;
}
.fb-item:hover{ background:var(--paper); }
.fb-item.is-selected{ background:var(--blue-bg); color:var(--navy-deep); font-weight:600; }
.fb-item.is-selected::before{
  content:""; position:absolute; left:0; top:8px; bottom:8px; width:3px; border-radius:0 3px 3px 0; background:var(--gold);
}
.fb-item.is-hidden .fb-item-title{ color:var(--ink-faint); }
.fb-item-title{ min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.fb-item-custom{ padding:0 4px 0 0; }
.fb-item-link{ flex:1; min-width:0; display:flex; align-items:center; justify-content:space-between; gap:8px; padding:9px 4px 9px 12px; }
.fb-mover{ display:flex; flex-shrink:0; gap:2px; }
.fb-mover form{ margin:0; }
.fb-icon-btn{
  width:26px; height:26px; display:inline-flex; align-items:center; justify-content:center;
  border:none; background:transparent; border-radius:7px; color:var(--ink-soft); cursor:pointer; padding:0;
}
.fb-icon-btn:hover:not(:disabled){ background:var(--surface); color:var(--navy); box-shadow:inset 0 0 0 1px var(--line-strong); }
.fb-icon-btn:disabled{ opacity:.3; cursor:not-allowed; }

.fb-tag{ display:inline-block; padding:2px 9px; border-radius:20px; font-size:12px; font-weight:600; white-space:nowrap; }
.fb-tag-base{ background:var(--blue-bg); color:var(--navy); }
.fb-tag-custom{ background:var(--amber-bg); color:var(--amber); }
.fb-tag-off{ background:var(--paper); color:var(--ink-soft); box-shadow:inset 0 0 0 1px var(--line-strong); }

.fb-new{ border-top:1px solid var(--line); background:var(--surface-alt); }
.fb-new summary{
  list-style:none; cursor:pointer; display:flex; align-items:center; gap:8px;
  padding:14px 20px; font-weight:600; font-size:14px; color:var(--navy);
}
.fb-new summary::-webkit-details-marker{ display:none; }
.fb-new summary:hover{ background:var(--blue-bg); }
.fb-new[open] summary{ border-bottom:1px solid var(--line); }
.fb-new .form-stack{ padding:4px 20px 18px; }
.fb-new .btn-block{ margin-top:16px; }

/* Cabecera del editor */
.fb-editor-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:16px; flex-wrap:wrap; }
.fb-editor-head h2{ font-size:26px; color:var(--navy-deep); margin-top:8px; line-height:1.2; }
.fb-note{
  background:var(--blue-bg); border-left:4px solid var(--navy-mid); color:var(--navy-deep);
  padding:12px 14px; border-radius:var(--radius-sm); font-size:14px; margin-bottom:6px; line-height:1.55;
}
.fb-opt{ font-weight:400; color:var(--ink-soft); }
.fb-count{
  display:inline-flex; align-items:center; justify-content:center; min-width:26px; height:26px; padding:0 8px;
  margin-left:6px; border-radius:13px; background:var(--paper); color:var(--ink-soft);
  font-family:var(--font-ui); font-size:13px; font-weight:700; vertical-align:middle;
}
.fb-actions{ display:flex; flex-wrap:wrap; gap:10px; margin-top:20px; }

/* Interruptor (reemplaza casillas simples) */
.switch{ display:flex !important; align-items:flex-start; gap:12px; margin-top:18px !important; cursor:pointer; font-size:14.5px !important; font-weight:600 !important; color:var(--ink) !important; }
.switch input{ position:absolute; opacity:0; width:0; height:0; }
.switch-track{
  position:relative; flex-shrink:0; width:42px; height:24px; margin-top:1px; border-radius:12px;
  background:var(--line-strong); transition:background .18s;
}
.switch-track::after{
  content:""; position:absolute; top:3px; left:3px; width:18px; height:18px; border-radius:50%;
  background:#fff; box-shadow:0 1px 3px rgba(0,0,0,.3); transition:transform .18s;
}
.switch input:checked + .switch-track{ background:var(--green); }
.switch input:checked + .switch-track::after{ transform:translateX(18px); }
.switch input:focus-visible + .switch-track{ box-shadow:var(--ring); }
.switch-text small{ display:block; font-weight:400; font-size:12.5px; color:var(--ink-soft); margin-top:2px; }

/* Zona de peligro */
.fb-danger-zone{
  display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap;
  margin-top:24px; padding:14px 16px; border:1px solid #efc8c2; background:var(--red-bg); border-radius:var(--radius-sm);
}
.fb-danger-zone strong{ display:block; font-size:14px; color:#8c2a1f; }
.fb-danger-zone span{ display:block; font-size:12.5px; color:#8c2a1f; opacity:.85; margin-top:2px; }

/* Lista de campos */
.fb-fields{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:8px; }
.fb-field{
  display:flex; align-items:center; gap:12px; padding:10px 12px;
  border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface);
  transition:border-color .12s, background .12s;
}
.fb-field:hover{ border-color:var(--line-strong); background:var(--surface-alt); }
.fb-field.is-editing{ border-color:var(--gold); background:#fffaf0; box-shadow:0 0 0 3px rgba(201,154,60,.18); }
.fb-mover-col{ flex-direction:column; gap:0; }
.fb-field-info{ flex:1; min-width:0; }
.fb-field-info strong{ display:block; font-size:14.5px; line-height:1.3; }
.fb-field-meta{ display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin-top:4px; font-size:12.5px; color:var(--ink-soft); }
.fb-type{ padding:1px 9px; border-radius:20px; background:var(--blue-bg); color:var(--navy); font-weight:600; }
.fb-req{ padding:1px 9px; border-radius:20px; background:var(--amber-bg); color:var(--amber); font-weight:600; }
.fb-field-meta code{ font-family:ui-monospace,Consolas,monospace; font-size:12px; color:var(--ink-faint); }
.fb-field-actions{ display:flex; align-items:center; gap:6px; flex-shrink:0; }
.fb-field-actions form{ margin:0; }

/* Formulario de campo */
.fb-grid-2{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.fb-cell{ display:flex; flex-direction:column; gap:5px; min-width:0; }
.fb-options[hidden]{ display:none; }
.fb-options{ display:flex; flex-direction:column; gap:5px; }
.fb-options textarea{ resize:vertical; }

/* Estado vacío */
.fb-empty{
  text-align:center; padding:64px 28px;
  background:var(--surface); border:1.5px dashed var(--line-strong); border-radius:var(--radius);
}
.fb-empty-icon{
  width:64px; height:64px; margin:0 auto 18px; border-radius:18px;
  background:var(--blue-bg); color:var(--navy); display:flex; align-items:center; justify-content:center;
}
.fb-empty h2{ font-size:24px; color:var(--navy-deep); margin-bottom:8px; }
.fb-empty p{ margin:0 auto; max-width:420px; color:var(--ink-soft); font-size:14.5px; line-height:1.6; }

@media (max-width:980px){
  .fb-layout{ grid-template-columns:1fr; }
  .fb-rail{ position:static; max-height:none; }
  .fb-rail-scroll{ max-height:340px; }
}
@media (max-width:640px){
  .fb-grid-2{ grid-template-columns:1fr; }
  .fb-field{ flex-wrap:wrap; }
  .fb-field-actions{ width:100%; justify-content:flex-end; }
}

/* =========================================================
   Impresión
   ========================================================= */
@media print{
  body{ background:#fff; }
  .no-print{ display:none !important; }
  .doc-sheet{ box-shadow:none; border:none; padding:0; max-width:100%; }
  .doc-section h3, .fsection-title{ -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  .panel-shell .sidebar, .topbar{ display:none !important; }
  .panel-shell{ display:block; }
  .panel-content{ padding:0 !important; max-width:100% !important; }
}

/* =========================================================
   Adaptación a pantallas pequeñas
   ========================================================= */
@media (max-width:1100px){
  .stats-grid{ grid-template-columns:1fr 1fr; }
}
@media (max-width:980px){
  .dash-grid{ grid-template-columns:1fr; }
  .two-col{ grid-template-columns:1fr !important; }
}
@media (max-width:860px){
  .sidebar{
    position:fixed; left:0; top:0; z-index:50; transform:translateX(-100%);
    transition:transform .25s ease; box-shadow:20px 0 40px rgba(0,0,0,.3);
  }
  .sidebar.open{ transform:translateX(0); }
  .hamburger{ display:flex; }
  .topbar{ padding:16px 16px 4px; }
  .topbar h1{ font-size:24px; }
  .panel-content{ padding:14px 16px 56px; }
}
@media (max-width:640px){
  .stats-grid{ grid-template-columns:1fr; }
  .frow, .frow.f3{ grid-template-columns:1fr !important; }
  .doc-grid{ grid-template-columns:1fr; }
  .doc-header{ flex-direction:column; }
  .filter-bar{ flex-direction:column; align-items:stretch; }
  .filter-bar input, .filter-bar select{ width:100%; }
  .form-hero h1{ font-size:25px; }
  .fsection-body{ padding:18px 14px; }
  .card{ padding:18px 16px; }
  .auth-card{ padding:30px 22px 26px; }
  .area-bar-row{ grid-template-columns:90px 1fr 30px; }
  .doc-sheet{ padding:22px 18px; }
}

/* ---------- 2FA / autenticador ---------- */
.totp-pasos{ margin:0 0 12px 20px; line-height:1.6; }
.totp-qr{ display:flex; justify-content:center; margin:8px 0 12px; }
.totp-qr svg{ width:220px; height:220px; background:#fff; border:1px solid var(--line); border-radius:10px; padding:6px; }
.totp-clave{ font-size:16px; letter-spacing:2px; background:var(--bg, #f4f6f8); padding:8px 12px; border-radius:8px; word-break:break-all; }
.totp-recovery{ display:grid; grid-template-columns:repeat(2, 1fr); gap:8px; margin:10px 0 14px; }
.totp-recovery code{ font-size:16px; letter-spacing:2px; text-align:center; padding:10px; background:#f4f6f8; border:1px dashed var(--ink-faint, #aab); border-radius:8px; }
@media print{ .sidebar, .topbar, .btn, form{ display:none !important; } }
