/*
 * Total Look Signature — fundamentos globales P0-G.
 *
 * Los tokens :root no alteran el ERP legacy. Los estilos visuales requieren
 * activación explícita mediante .tl-signature o .tl-signature-shell.
 * Las fuentes son pilas locales/seguras: no existe ninguna descarga remota.
 */
:root{
  --tl-color-charcoal:#151515;
  --tl-color-charcoal-soft:#20201f;
  --tl-color-ivory:#f6f1e8;
  --tl-color-paper:#fffdf8;
  --tl-color-warm-surface:#faf4e8;
  --tl-color-gold:#b9974d;
  --tl-color-gold-dark:#82672d;
  --tl-color-gold-soft:#f5ecd8;
  --tl-color-burgundy:#762f42;
  --tl-color-burgundy-soft:#f6e9ed;
  --tl-color-navy:#183b59;
  --tl-color-navy-soft:#e9f1f7;
  --tl-color-success:#29744a;
  --tl-color-success-soft:#e8f4ed;
  --tl-color-warning:#ad6a16;
  --tl-color-warning-soft:#fff1dc;
  --tl-color-error:#a93d46;
  --tl-color-error-soft:#fbeaec;
  --tl-color-info:var(--tl-color-navy);
  --tl-color-info-soft:var(--tl-color-navy-soft);
  --tl-color-text:#252321;
  --tl-color-text-muted:#746f68;
  --tl-color-text-subtle:#92897c;
  --tl-color-border:#e4dccf;
  --tl-color-border-strong:#d3c7b6;
  --tl-color-disabled:#d9d3c9;

  --tl-font-sans:Poppins,"Segoe UI",Arial,sans-serif;
  --tl-font-serif:"DM Serif Display",Georgia,"Times New Roman",serif;
  --tl-font-mono:Consolas,"Liberation Mono",monospace;

  --tl-radius-xs:6px;
  --tl-radius-sm:9px;
  --tl-radius-md:13px;
  --tl-radius-lg:18px;
  --tl-radius-xl:20px;
  --tl-radius-pill:999px;

  --tl-shadow-sm:0 4px 13px rgba(46,37,26,.045);
  --tl-shadow-md:0 12px 34px rgba(46,37,26,.07);
  --tl-shadow-lg:0 20px 52px rgba(28,23,17,.14);

  --tl-space-1:4px;
  --tl-space-2:8px;
  --tl-space-3:12px;
  --tl-space-4:16px;
  --tl-space-5:20px;
  --tl-space-6:24px;
  --tl-space-7:32px;
  --tl-space-8:40px;
  --tl-transition-fast:160ms ease;
  --tl-transition-base:220ms ease;
}

/* Activación base deliberada por pantalla/módulo. */
.tl-signature{
  background:var(--tl-color-ivory);
  color:var(--tl-color-text);
  font-family:var(--tl-font-sans);
}
.tl-signature .tl-title,
.tl-signature .tl-section-title{
  margin:0;
  color:var(--tl-color-text);
  font-family:var(--tl-font-serif);
  font-weight:400;
  letter-spacing:-.025em;
  line-height:1.12;
}
.tl-signature .tl-kicker{
  display:block;
  color:var(--tl-color-gold-dark);
  font-size:.64rem;
  font-weight:850;
  letter-spacing:.13em;
  text-transform:uppercase;
}
.tl-signature .tl-section-heading{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:var(--tl-space-5);
  margin-bottom:var(--tl-space-4);
}
.tl-signature .tl-section-heading p{
  margin:0;
  color:var(--tl-color-text-muted);
  font-size:.78rem;
}

/* Acciones. Se usan en lugar de sobrescribir .primary-action legacy. */
.tl-signature .tl-button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:var(--tl-space-2);
  min-height:42px;
  padding:9px 16px;
  border:1px solid transparent;
  border-radius:var(--tl-radius-sm);
  font:700 .82rem/1 var(--tl-font-sans);
  text-decoration:none;
  cursor:pointer;
  transition:border-color var(--tl-transition-fast),background-color var(--tl-transition-fast),color var(--tl-transition-fast),box-shadow var(--tl-transition-fast),transform var(--tl-transition-fast);
}
.tl-signature .tl-button--primary{
  border-color:#9e7b34;
  background:linear-gradient(105deg,#c7a75e,#ad873d);
  box-shadow:0 8px 20px rgba(130,103,45,.18);
  color:#19160f;
}
.tl-signature .tl-button--primary:hover{background:linear-gradient(105deg,#d2b36c,#b59043);color:#15130e;transform:translateY(-1px)}
.tl-signature .tl-button--secondary{border-color:var(--tl-color-border-strong);background:var(--tl-color-paper);color:var(--tl-color-text);box-shadow:var(--tl-shadow-sm)}
.tl-signature .tl-button--secondary:hover{border-color:var(--tl-color-gold);background:#fffaf0;color:var(--tl-color-text)}
.tl-signature .tl-button--danger{border-color:var(--tl-color-error);background:var(--tl-color-error);color:#fff}
.tl-signature .tl-button--danger:hover{background:#8f3039;color:#fff}
.tl-signature .tl-button--ghost{border-color:transparent;background:transparent;color:var(--tl-color-burgundy);box-shadow:none}
.tl-signature .tl-button--ghost:hover{background:var(--tl-color-burgundy-soft);color:var(--tl-color-burgundy)}
.tl-signature .tl-button:disabled,.tl-signature .tl-button[aria-disabled="true"]{cursor:not-allowed;opacity:.52;transform:none}

/* Campos operativos. */
.tl-signature .tl-field{display:grid;gap:6px;color:var(--tl-color-text-muted);font-size:.72rem;font-weight:750}
.tl-signature .tl-input,
.tl-signature .tl-select,
.tl-signature .tl-textarea{
  box-sizing:border-box;
  width:100%;
  min-height:42px;
  padding:9px 11px;
  border:1px solid var(--tl-color-border-strong);
  border-radius:var(--tl-radius-sm);
  background:var(--tl-color-paper);
  color:var(--tl-color-text);
  font:inherit;
  transition:border-color var(--tl-transition-fast),box-shadow var(--tl-transition-fast),background-color var(--tl-transition-fast);
}
.tl-signature .tl-textarea{min-height:86px;resize:vertical}
.tl-signature .tl-input:hover,.tl-signature .tl-select:hover,.tl-signature .tl-textarea:hover{border-color:#b9aa95}
.tl-signature .tl-input:focus,.tl-signature .tl-select:focus,.tl-signature .tl-textarea:focus{border-color:var(--tl-color-gold);box-shadow:0 0 0 3px rgba(185,151,77,.16);outline:0}
.tl-signature .tl-input:disabled,.tl-signature .tl-select:disabled,.tl-signature .tl-textarea:disabled{background:#eee9e1;color:#8a837a;cursor:not-allowed}

/* Superficies y tarjetas. */
.tl-signature .tl-surface,
.tl-signature .tl-card{
  border:1px solid var(--tl-color-border);
  border-radius:var(--tl-radius-md);
  background:var(--tl-color-paper);
  box-shadow:var(--tl-shadow-sm);
}
.tl-signature .tl-card{padding:var(--tl-space-5)}
.tl-signature .tl-surface--soft{background:#faf7f1}
.tl-signature .tl-surface--dark{border-color:#2a2926;background:var(--tl-color-charcoal);color:#fff}

/* Badges y estados: el color funcional siempre conserva significado. */
.tl-signature .tl-badge,
.tl-signature .tl-state{
  display:inline-flex;
  align-items:center;
  gap:6px;
  width:max-content;
  padding:5px 9px;
  border-radius:var(--tl-radius-pill);
  font-size:.66rem;
  font-weight:850;
  line-height:1.2;
  white-space:nowrap;
}
.tl-signature .tl-badge{background:var(--tl-color-gold-soft);color:var(--tl-color-gold-dark)}
.tl-signature .tl-state::before{width:6px;height:6px;border-radius:50%;background:currentColor;content:""}
.tl-signature .tl-state--success{background:var(--tl-color-success-soft);color:var(--tl-color-success)}
.tl-signature .tl-state--warning{background:var(--tl-color-warning-soft);color:var(--tl-color-warning)}
.tl-signature .tl-state--error{background:var(--tl-color-error-soft);color:var(--tl-color-error)}
.tl-signature .tl-state--info{background:var(--tl-color-info-soft);color:var(--tl-color-info)}
.tl-signature .tl-state--neutral{background:#efebe4;color:var(--tl-color-text-muted)}

/* Alertas. */
.tl-signature .tl-alert{padding:12px 14px;border:1px solid;border-radius:var(--tl-radius-sm);font-size:.8rem}
.tl-signature .tl-alert--success{border-color:#bbddca;background:var(--tl-color-success-soft);color:var(--tl-color-success)}
.tl-signature .tl-alert--warning{border-color:#eccb9f;background:var(--tl-color-warning-soft);color:#815012}
.tl-signature .tl-alert--error{border-color:#efc8cc;background:var(--tl-color-error-soft);color:var(--tl-color-error)}
.tl-signature .tl-alert--info{border-color:#c5d6e2;background:var(--tl-color-info-soft);color:var(--tl-color-info)}

/* Tablas opt-in. */
.tl-signature .tl-table-wrap{border:1px solid var(--tl-color-border);border-radius:var(--tl-radius-md);background:var(--tl-color-paper);box-shadow:var(--tl-shadow-sm);overflow:auto}
.tl-signature .tl-table{width:100%;border-collapse:collapse}
.tl-signature .tl-table th,.tl-signature .tl-table td{padding:13px 14px;border-bottom:1px solid var(--tl-color-border);text-align:left;vertical-align:middle}
.tl-signature .tl-table th{background:#faf7f1;color:var(--tl-color-text-muted);font-size:.66rem;font-weight:850;letter-spacing:.06em;text-transform:uppercase}
.tl-signature .tl-table tbody tr{transition:background-color var(--tl-transition-fast)}
.tl-signature .tl-table tbody tr:hover{background:#fcf8f0}
.tl-signature .tl-table tbody tr:last-child td{border-bottom:0}

/* Modales existentes: contenedor, encabezado y acciones. */
.tl-signature .tl-modal{width:min(540px,calc(100vw - 28px));padding:0;border:1px solid var(--tl-color-border);border-radius:var(--tl-radius-lg);background:var(--tl-color-paper);box-shadow:var(--tl-shadow-lg);color:var(--tl-color-text)}
.tl-signature .tl-modal::backdrop{background:rgba(15,15,14,.66);backdrop-filter:blur(2px)}
.tl-signature .tl-modal__header,.tl-signature .tl-modal__body,.tl-signature .tl-modal__actions{padding:var(--tl-space-5)}
.tl-signature .tl-modal__header{border-bottom:1px solid var(--tl-color-border)}
.tl-signature .tl-modal__actions{display:flex;justify-content:flex-end;gap:var(--tl-space-2);border-top:1px solid var(--tl-color-border)}

/* Estados vacíos e iconos ya usados por el ERP. No se introduce skeleton. */
.tl-signature .tl-empty-state{display:grid;justify-items:center;gap:8px;padding:42px 20px;color:var(--tl-color-text-muted);text-align:center}
.tl-signature .tl-empty-state h2{margin:0;color:var(--tl-color-text);font:400 1.25rem/1.2 var(--tl-font-serif)}
.tl-signature .tl-empty-state p{max-width:480px;margin:0;font-size:.8rem}
.tl-signature .tl-icon-container{display:inline-grid;place-items:center;flex:0 0 auto;width:40px;height:40px;border-radius:11px;background:var(--tl-color-gold-soft);color:var(--tl-color-gold-dark)}
.tl-signature .tl-icon-container svg{width:20px;height:20px}
.tl-signature .tl-icon-container--info{background:var(--tl-color-info-soft);color:var(--tl-color-info)}
.tl-signature .tl-icon-container--success{background:var(--tl-color-success-soft);color:var(--tl-color-success)}
.tl-signature .tl-icon-container--danger{background:var(--tl-color-error-soft);color:var(--tl-color-error)}

/*
 * Estrategia reutilizable para P3+: la vista opta por tl-signature-shell.
 * Dashboard conserva por ahora su selector aprobado .dashboard-signature.
 */
.tl-signature-shell .sidebar{background:linear-gradient(180deg,#111 0,#181817 62%,#101010 100%);box-shadow:8px 0 28px rgba(17,17,16,.1)}
.tl-signature-shell .sidebar-brand{border-bottom-color:rgba(185,151,77,.18)}
.tl-signature-shell .sidebar-brand::after{width:54px;background:var(--tl-color-gold)}
.tl-signature-shell .sidebar-brand-logo{object-fit:contain;opacity:.96}
.tl-signature-shell .sidebar-group-label{color:#827a6c}
.tl-signature-shell .sidebar-group-admin{border-top-color:rgba(185,151,77,.13)}
.tl-signature-shell .sidebar-link{color:#bcb6aa}
.tl-signature-shell a.sidebar-link:hover{background:rgba(185,151,77,.09);color:#fff}
.tl-signature-shell .sidebar-link.is-active{background:linear-gradient(90deg,rgba(185,151,77,.19),rgba(185,151,77,.05));box-shadow:inset 0 0 0 1px rgba(185,151,77,.17);color:#fff}
.tl-signature-shell .sidebar-link.is-active .nav-icon{color:#d8bd7d}
.tl-signature-shell .sidebar-avatar{border:1px solid rgba(185,151,77,.3);background:#25231e;color:#e6cc8f}
.tl-signature-shell .sidebar-user{border-top-color:rgba(185,151,77,.14)}

@media(max-width:650px){.tl-signature .tl-section-heading{align-items:flex-start;flex-direction:column;gap:3px}.tl-signature .tl-modal__actions{align-items:stretch;flex-direction:column}.tl-signature .tl-button{width:100%}}
@media(prefers-reduced-motion:reduce){.tl-signature *,.tl-signature *::before,.tl-signature *::after{transition-duration:.01ms!important}}
