/* ── Variables ──────────────────────────────────────────────────────────────── */
:root {
  --color-bg:          #f5f5f3;
  --color-surface:     #ffffff;
  --color-border:      #e2e2e0;
  --color-border-soft: #ebebea;

  --color-text:        #1a1a18;
  --color-text-muted:  #6b6b69;
  --color-text-soft:   #9b9b99;

  --color-accent:      #14375e;   /* navy — acento único */
  --color-accent-dark: #0d2540;
  --color-accent-bg:   #eaf0f7;

  --color-error:       #c0392b;
  --color-error-bg:    #fdf2f0;

  --color-warn-bg:     #fffbeb;
  --color-warn-border: #f59e0b;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', Consolas, monospace;

  /* Motion */
  --motion-duration-fast:   150ms;
  --motion-duration-base:   200ms;
  --motion-duration-slow:   300ms;
  --motion-easing-standard: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reduced motion ──────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-duration-fast:  0.01ms;
    --motion-duration-base:  0.01ms;
    --motion-duration-slow:  0.01ms;
  }
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

/* ── Utilidades ─────────────────────────────────────────────────────────────── */
[hidden] { display: none !important; }

/* ── Pantallas ──────────────────────────────────────────────────────────────── */
.screen { min-height: 100vh; }

/* ── Auth (login + OTP) ─────────────────────────────────────────────────────── */
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
}

.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  margin-bottom: 24px;
}

.auth-brand-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: -.3px;
}

.auth-brand-sub {
  font-size: 12px;
  color: var(--color-text-muted);
  letter-spacing: .3px;
  text-transform: uppercase;
  margin-top: 2px;
}

.auth-hint {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* ── Campos de formulario ───────────────────────────────────────────────────── */
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}

.field-input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color var(--motion-duration-fast) var(--motion-easing-standard),
              box-shadow    var(--motion-duration-fast) var(--motion-easing-standard);
  outline: none;
  margin-bottom: 8px;
}

.field-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-bg);
}

.field-input--code {
  font-family: var(--font-mono);
  font-size: 22px;
  letter-spacing: .25em;
  text-align: center;
}

.field-error {
  font-size: 13px;
  color: var(--color-error);
  margin-bottom: 8px;
  padding: 8px 10px;
  background: var(--color-error-bg);
  border-radius: var(--radius-sm);
}

/* ── Botones ────────────────────────────────────────────────────────────────── */
.btn-primary {
  display: block;
  width: 100%;
  padding: 11px 16px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  color: #fff;
  background: var(--color-accent);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-top: 12px;
  transition: background var(--motion-duration-fast) var(--motion-easing-standard);
}

.btn-primary:hover  { background: var(--color-accent-dark); }
.btn-primary:active { background: var(--color-accent-dark); }

.btn-primary:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.btn-ghost {
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--motion-duration-fast) var(--motion-easing-standard),
              color         var(--motion-duration-fast) var(--motion-easing-standard);
}

.btn-ghost:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

.btn-link {
  display: inline-block;
  margin-top: 16px;
  padding: 0;
  font-size: 14px;
  font-family: var(--font);
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

/* ── App: Header ────────────────────────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  height: 56px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.header-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: -.2px;
  flex-shrink: 0;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.header-email {
  font-size: 13px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* ── App: Main + Tabs ───────────────────────────────────────────────────────── */
.app-main {
  max-width: 780px;
  margin: 0 auto;
  padding: 32px 16px 48px;
}

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 28px;
}

.tab-btn {
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--color-text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color        var(--motion-duration-fast) var(--motion-easing-standard),
              border-color var(--motion-duration-fast) var(--motion-easing-standard);
}

.tab-btn:hover { color: var(--color-text); }

.tab-btn--active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  font-weight: 600;
}

.tab-panel { padding-top: 0; }

.tab-panel:not([hidden]) {
  animation: tab-fade-in var(--motion-duration-fast) var(--motion-easing-standard) both;
}

@keyframes tab-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Disclaimer ─────────────────────────────────────────────────────────────── */
.disclaimer-banner {
  font-size: 12.5px;
  color: #7a6d20;
  background: var(--color-warn-bg);
  border: 1px solid #f0e0a0;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 20px;
  line-height: 1.45;
}

/* ── Búsqueda ───────────────────────────────────────────────────────────────── */
.search-form {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  align-items: flex-start;
}

.search-input {
  flex: 1;
  padding: 10px 14px;
  font-size: 15px;
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--motion-duration-fast) var(--motion-easing-standard),
              box-shadow    var(--motion-duration-fast) var(--motion-easing-standard);
}

.search-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-bg);
}

.search-form .btn-primary {
  width: auto;
  margin-top: 0;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Cards de resultados ────────────────────────────────────────────────────── */
.results-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.result-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}

.result-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.result-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 20px;
  flex-shrink: 0;
}

.result-badge--faq {
  background: #e8f0fb;
  color: #1a4a8a;
}

.result-badge--cnv_news {
  background: #e6f4ea;
  color: #1a6b35;
}

.result-badge--document {
  background: #fef3e2;
  color: #9a5000;
}

.result-relevance {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-soft);
  margin-left: auto;
}

.result-relevance--high {
  color: var(--color-accent);
  font-weight: 600;
}

.result-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
  line-height: 1.4;
}

.result-content {
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.6;
  white-space: pre-line;
}

.result-source {
  font-size: 12px;
  color: var(--color-text-soft);
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border-soft);
}

/* ── Estados vacío / error ──────────────────────────────────────────────────── */
.state-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 32px 24px;
  text-align: center;
}

.state-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
}

.state-card-body {
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.55;
}

.state-card--error .state-card-title { color: var(--color-error); }

.empty-state {
  padding: 60px 24px;
  text-align: center;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.empty-state-body {
  font-size: 14px;
  color: var(--color-text-soft);
  max-width: 360px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Skeleton loading ───────────────────────────────────────────────────────── */
.skeleton-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
}

.skeleton-line {
  background: linear-gradient(90deg, #ebebea 25%, #dededc 50%, #ebebea 75%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
  height: 12px;
  margin-bottom: 10px;
}

.skeleton-line--short { width: 40%; }
.skeleton-line--title { height: 16px; width: 80%; margin-bottom: 14px; }
.skeleton-line--badge { height: 20px; width: 60px; border-radius: 20px; margin-bottom: 14px; }

@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 540px) {
  .auth-card { padding: 28px 20px; }

  .app-header { padding: 0 16px; }
  .header-email { max-width: 120px; }

  .search-form { flex-direction: column; }
  .search-form .btn-primary { width: 100%; margin-top: 0; }

  .result-card { padding: 16px; }
  .tab-btn { padding: 10px 10px; font-size: 13px; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   FASE 3 — PANEL ADMIN
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Admin: header del tab ──────────────────────────────────────────────────── */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.admin-header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}

.btn-new-faq {
  width: auto;
  margin-top: 0;
  padding: 9px 16px;
  font-size: 14px;
}

/* ── Admin: tabla de FAQs ───────────────────────────────────────────────────── */
.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border-soft);
  vertical-align: middle;
  transition: background-color var(--motion-duration-fast) var(--motion-easing-standard);
}

.admin-table tr:last-child td { border-bottom: none; }

.admin-table tr:hover td { background: #fafaf8; }

.col-question {
  max-width: 300px;
  color: var(--color-text);
  line-height: 1.45;
}

.col-actions { white-space: nowrap; }

/* ── Admin: badge de categoría ──────────────────────────────────────────────── */
.category-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--color-accent-bg);
  color: var(--color-accent);
  white-space: nowrap;
}

/* ── Admin: estado de verificación ──────────────────────────────────────────── */
.verified--never {
  font-size: 13px;
  color: var(--color-text-soft);
  font-style: italic;
}

.verified--stale {
  font-size: 13px;
  color: #b45309;   /* amber — llama la atención sin ser alarmante */
}

.verified--stale::before {
  content: '· ';
  font-weight: 700;
}

.verified--ok {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* ── Admin: botones de acción en tabla ──────────────────────────────────────── */
.btn-action {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-right: 4px;
  transition: border-color var(--motion-duration-fast) var(--motion-easing-standard),
              color         var(--motion-duration-fast) var(--motion-easing-standard),
              background    var(--motion-duration-fast) var(--motion-easing-standard);
}

.btn-action:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-accent-bg);
}

.btn-action:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.btn-action--verify {
  color: #166534;
  border-color: #bbf7d0;
}

.btn-action--verify:hover {
  background: #f0fdf4;
  border-color: #86efac;
  color: #14532d;
}

.btn-action--danger {
  color: var(--color-error);
  border-color: #fca5a5;
}

.btn-action--danger:hover {
  background: var(--color-error-bg);
  border-color: #f87171;
}

/* ── Admin: animaciones de filas ────────────────────────────────────────────── */
@keyframes row-appear {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes row-remove {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-6px); }
}

@keyframes row-flash {
  0%,  100% { background-color: transparent; }
  25%        { background-color: var(--color-accent-bg); }
}

.faq-row--new {
  animation: row-appear var(--motion-duration-slow) var(--motion-easing-standard) both;
}

.faq-row--removing {
  pointer-events: none;
  animation: row-remove var(--motion-duration-base) var(--motion-easing-standard) forwards;
}

.faq-row--updated td {
  animation: row-flash 600ms var(--motion-easing-standard) both;
}

/* ── Admin: estado vacío / loading ──────────────────────────────────────────── */
.admin-empty {
  padding: 48px 24px;
  text-align: center;
  font-size: 14px;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

/* ── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal-card {
  position: relative;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
  width: 100%;
  max-width: 580px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 32px;
}

/* ── Modal: animaciones de apertura y cierre ─────────────────────────────────── */
.modal-overlay:not([hidden]):not(.is-closing) {
  animation: modal-open var(--motion-duration-base) var(--motion-easing-standard) both;
}
.modal-overlay:not([hidden]):not(.is-closing) .modal-card {
  animation: modal-card-open var(--motion-duration-base) var(--motion-easing-standard) both;
}
.modal-overlay.is-closing {
  animation: modal-close var(--motion-duration-fast) var(--motion-easing-standard) both;
}
.modal-overlay.is-closing .modal-card {
  animation: modal-card-close var(--motion-duration-fast) var(--motion-easing-standard) both;
}

@keyframes modal-open {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modal-close {
  from { opacity: 1; }
  to   { opacity: 0; }
}
@keyframes modal-card-open {
  from { transform: scale(0.96); }
  to   { transform: scale(1); }
}
@keyframes modal-card-close {
  from { transform: scale(1); }
  to   { transform: scale(0.96); }
}

/* ── Modal: botón cerrar (×) ─────────────────────────────────────────────────── */
.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  color: var(--color-text-soft);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color            var(--motion-duration-fast) var(--motion-easing-standard),
              background-color var(--motion-duration-fast) var(--motion-easing-standard);
}

.modal-close-btn:hover {
  color: var(--color-text-muted);
  background-color: var(--color-bg);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 24px;
}

/* ── Modal: campos de formulario ────────────────────────────────────────────── */
.form-field { margin-bottom: 18px; }

.field-textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  resize: vertical;
  outline: none;
  line-height: 1.6;
  transition: border-color var(--motion-duration-fast) var(--motion-easing-standard),
              box-shadow    var(--motion-duration-fast) var(--motion-easing-standard);
}

.field-textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-bg);
}

/* ── Modal: fila de botones ─────────────────────────────────────────────────── */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border-soft);
}

/* Overrides necesarios: .btn-primary dentro de modal NO es full-width */
.modal-actions .btn-primary {
  width: auto;
  margin-top: 0;
}

/* ── Toasts ─────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 300;
  pointer-events: none;
}

.toast {
  padding: 11px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
  white-space: nowrap;
  pointer-events: auto;
  animation: toast-in 250ms var(--motion-easing-standard) both;
}

.toast--success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.toast--error {
  background: var(--color-error-bg);
  border: 1px solid #fca5a5;
  color: var(--color-error);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(20px); }
}

/* ── Tab Novedades: toolbar ──────────────────────────────────────────────────── */
.news-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.news-filter-select {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: border-color var(--motion-duration-fast) var(--motion-easing-standard);
}

.news-filter-select:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* ── Tab Novedades: cards ────────────────────────────────────────────────────── */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.news-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  transition: box-shadow var(--motion-duration-fast) var(--motion-easing-standard),
              border-color var(--motion-duration-fast) var(--motion-easing-standard);
  animation: row-appear var(--motion-duration-slow) var(--motion-easing-standard) both;
}

.news-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: #d0d0ce;
}

.news-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.news-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.news-badge--noticia_cnv {
  background: #e8f0fb;
  color: #1a4a8a;
}

.news-badge--resolucion_general {
  background: #e6f4ea;
  color: #1a6b35;
}

.news-date {
  font-size: 12px;
  color: var(--color-text-soft);
  margin-left: auto;
  white-space: nowrap;
}

.news-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  color: var(--color-text);
}

.news-link {
  color: inherit;
  text-decoration: none;
  transition: color var(--motion-duration-fast) var(--motion-easing-standard);
}

.news-link:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

.news-summary {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.55;
}

/* Separador "•" entre sección y Art. 1° en resoluciones */
.news-summary-sep {
  margin: 0 4px;
  color: var(--color-border);
  user-select: none;
}

/* Etiqueta "Art. 1°:" en semibold para destacar el origen del texto */
.news-summary-art1-label {
  font-weight: 600;
  color: var(--color-text-muted);
}

/* ── Tab Novedades: load more ────────────────────────────────────────────────── */
.news-load-more {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

/* ── Admin: sección de sincronización CNV ────────────────────────────────────── */
.admin-sync-section {
  margin-top: 32px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: hidden;
}

.admin-sync-summary {
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  user-select: none;
  list-style: none;         /* ocultar triángulo nativo */
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-sync-summary::-webkit-details-marker { display: none; }

/* indicador chevron via ::before */
.admin-sync-summary::before {
  content: '›';
  display: inline-block;
  font-size: 18px;
  line-height: 1;
  color: var(--color-text-muted);
  transition: transform var(--motion-duration-fast) var(--motion-easing-standard);
}

details.admin-sync-section[open] .admin-sync-summary::before {
  transform: rotate(90deg);
}

.admin-sync-body {
  padding: 0 18px 18px;
  border-top: 1px solid var(--color-border-soft);
}

.admin-sync-desc {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 14px 0 14px;
  line-height: 1.5;
}

.admin-sync-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-muted);
  cursor: pointer;
  user-select: none;
  margin-bottom: 12px;
}

.admin-sync-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--color-accent);
  cursor: pointer;
  flex-shrink: 0;
}

.admin-sync-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.sync-status {
  font-size: 13px;
  color: var(--color-text-muted);
}

.sync-status--ok    { color: #1a6b35; }
.sync-status--error { color: var(--color-error); }

/* ── Responsive: admin ──────────────────────────────────────────────────────── */
@media (max-width: 540px) {
  .modal-card { padding: 20px 16px; }
  .admin-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .btn-new-faq  { width: 100%; }
  .col-actions  { display: flex; flex-direction: column; gap: 4px; }
  .btn-action   { margin-right: 0; }
  .news-card    { padding: 16px; }
  .news-date    { display: none; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   FASE 5 — NUEVA ARQUITECTURA (5 tabs + widget flotante)
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Tab placeholders (Repositorio, Antes/Después) ───────────────────────────── */
.tab-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 72px 24px;
  text-align: center;
}

.tab-placeholder-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 20px;
  color: var(--color-border);
}

.tab-placeholder-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}

.tab-placeholder-body {
  font-size: 14px;
  color: var(--color-text-soft);
  max-width: 400px;
  line-height: 1.65;
}

/* ── FAQs públicas (read-only, details/summary) ──────────────────────────────── */
.faq-public-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-public-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--motion-duration-fast) var(--motion-easing-standard);
}

.faq-public-card[open] {
  border-color: var(--color-accent);
}

.faq-public-question {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  list-style: none;
  user-select: none;
  line-height: 1.45;
}

.faq-public-question::-webkit-details-marker { display: none; }

.faq-public-question::after {
  content: '›';
  font-size: 20px;
  line-height: 1;
  color: var(--color-text-muted);
  margin-left: auto;
  flex-shrink: 0;
  padding-top: 1px;
  transition: transform var(--motion-duration-fast) var(--motion-easing-standard);
}

.faq-public-card[open] .faq-public-question::after {
  transform: rotate(90deg);
}

.faq-public-badge {
  flex-shrink: 0;
  margin-top: 2px;
}

.faq-public-answer {
  padding: 0 20px 18px 20px;
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.65;
  white-space: pre-line;
  border-top: 1px solid var(--color-border-soft);
  padding-top: 14px;
}

/* ── Novedades: filtros de período (pills) ───────────────────────────────────── */
.news-week-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.news-filter-btn {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background  var(--motion-duration-fast) var(--motion-easing-standard),
              color        var(--motion-duration-fast) var(--motion-easing-standard),
              border-color var(--motion-duration-fast) var(--motion-easing-standard);
}

.news-filter-btn:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

.news-filter-btn--active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.news-filter-btn--active:hover {
  background: var(--color-accent-dark);
  border-color: var(--color-accent-dark);
  color: #fff;
}

/* ── Novedades: vista "librito" (Esta semana) ────────────────────────────────── */
.news-week-header {
  margin-bottom: 24px;
}

.news-week-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
  letter-spacing: -.3px;
}

.news-week-range {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.news-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--color-text-muted);
  margin: 28px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border-soft);
}

.news-featured-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.news-small-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.news-card--featured {
  border-left: 3px solid var(--color-accent);
  padding: 22px 24px;
}

.news-card--small {
  padding: 12px 18px;
}

.news-card--small .news-title {
  font-size: 14px;
}

.news-week-empty {
  padding: 48px 0 24px;
  text-align: center;
}

.news-week-empty-text {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

.news-week-link {
  display: inline-block;
  margin-top: 28px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: -.1px;
}

.news-week-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Chat widget flotante ────────────────────────────────────────────────────── */
#chat-widget {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.chat-widget-btn {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(20, 55, 94, .35);
  transition: background     var(--motion-duration-fast) var(--motion-easing-standard),
              transform      var(--motion-duration-base)  var(--motion-easing-standard),
              box-shadow     var(--motion-duration-fast) var(--motion-easing-standard);
  flex-shrink: 0;
  animation: chat-pulse 10s ease-in-out infinite;
}

.chat-widget-btn:hover {
  background: var(--color-accent-dark);
  box-shadow: 0 6px 20px rgba(20, 55, 94, .45);
}

.chat-widget-btn--open {
  transform: rotate(180deg);
  animation: none;
  background: var(--color-accent-dark);
}

/* Tooltip puro CSS */
.chat-widget-btn::before {
  content: 'Consultas rápidas';
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(26, 26, 24, .82);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--motion-duration-fast) var(--motion-easing-standard);
}

.chat-widget-btn:not(.chat-widget-btn--open):hover::before {
  opacity: 1;
}

/* Íconos del botón */
.chat-icon-bubble,
.chat-icon-close {
  position: absolute;
  transition: opacity var(--motion-duration-fast) var(--motion-easing-standard);
}

.chat-icon-close { opacity: 0; }

.chat-widget-btn--open .chat-icon-bubble { opacity: 0; }
.chat-widget-btn--open .chat-icon-close  { opacity: 1; }

.chat-widget-badge {
  position: absolute;
  bottom: 7px;
  right: 6px;
  width: 16px;
  height: 16px;
  background: #fff;
  color: var(--color-accent);
  font-size: 10px;
  font-weight: 800;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
  transition: opacity var(--motion-duration-fast) var(--motion-easing-standard);
}

.chat-widget-btn--open .chat-widget-badge { opacity: 0; }

@keyframes chat-pulse {
  0%,  90%, 100% { box-shadow: 0 4px 16px rgba(20, 55, 94, .35); }
  95%             { box-shadow: 0 4px 16px rgba(20, 55, 94, .35), 0 0 0 10px rgba(20, 55, 94, .10); }
}

@media (prefers-reduced-motion: reduce) {
  .chat-widget-btn { animation: none; }
}

/* ── Chat popup ──────────────────────────────────────────────────────────────── */
.chat-popup {
  width: 400px;
  max-height: 520px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .14), 0 2px 8px rgba(0, 0, 0, .06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom right;
  animation: chat-popup-open var(--motion-duration-base) var(--motion-easing-standard) both;
}

.chat-popup.is-closing {
  animation: chat-popup-close var(--motion-duration-fast) var(--motion-easing-standard) both;
}

@keyframes chat-popup-open {
  from { opacity: 0; transform: scale(.94) translateY(8px); }
  to   { opacity: 1; transform: scale(1)  translateY(0);    }
}

@keyframes chat-popup-close {
  from { opacity: 1; transform: scale(1)  translateY(0);    }
  to   { opacity: 0; transform: scale(.94) translateY(8px); }
}

.chat-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.chat-popup-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
}

.chat-popup-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  font-size: 18px;
  line-height: 1;
  color: var(--color-text-soft);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--motion-duration-fast) var(--motion-easing-standard),
              background var(--motion-duration-fast) var(--motion-easing-standard);
}

.chat-popup-close:hover {
  color: var(--color-text-muted);
  background: var(--color-bg);
}

.chat-popup-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 18px;
}

.chat-popup-body .disclaimer-banner { margin-bottom: 14px; }

.chat-popup-body .search-form { margin-bottom: 16px; }

/* ── Responsive: chat widget ─────────────────────────────────────────────────── */
@media (max-width: 540px) {
  #chat-widget  { bottom: 16px; right: 16px; }
  .chat-popup   { width: calc(100vw - 32px); max-height: 70vh; }
  .chat-widget-btn::before { display: none; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   FASE 6 — SIDEBAR VERTICAL + LAYOUT DASHBOARD
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Layout principal ────────────────────────────────────────────────────────── */
#screen-app {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
}

#app-content {
  flex: 1;
  min-width: 0;
}

/* ── Sidebar contenedor ──────────────────────────────────────────────────────── */
#sidebar {
  width: 240px;
  flex-shrink: 0;
  align-self: flex-start;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  z-index: 20;
}

/* ── Sidebar: header ─────────────────────────────────────────────────────────── */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--color-border-soft);
  flex-shrink: 0;
}

.sidebar-logo {
  flex-shrink: 0;
  line-height: 0;
}

.sidebar-brand {
  min-width: 0;
}

.sidebar-brand-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -.2px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-brand-sub {
  font-size: 11px;
  color: var(--color-text-soft);
  letter-spacing: .3px;
  text-transform: uppercase;
  margin-top: 2px;
}

/* ── Sidebar: navegación ─────────────────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Override del .tab-btn horizontal para el contexto sidebar */
.sidebar-nav .tab-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-bottom: none;
  border-radius: var(--radius-sm);
  margin-bottom: 0;
  cursor: pointer;
  text-align: left;
  transition: background var(--motion-duration-base) var(--motion-easing-standard),
              color        var(--motion-duration-fast) var(--motion-easing-standard);
}

.sidebar-nav .tab-btn:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.sidebar-nav .tab-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

.sidebar-nav .tab-btn--active {
  background: var(--color-accent-bg);
  color: var(--color-accent);
  font-weight: 600;
  border-bottom-color: transparent;
}

.sidebar-nav .tab-btn--active:hover {
  background: var(--color-accent-bg);
  color: var(--color-accent);
}

.sidebar-nav-icon {
  flex-shrink: 0;
  display: block;
}

/* ── Sidebar: footer (usuario + logout) ──────────────────────────────────────── */
.sidebar-footer {
  padding: 12px 14px 16px;
  border-top: 1px solid var(--color-border-soft);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-user-email {
  display: block;
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background   var(--motion-duration-fast) var(--motion-easing-standard),
              border-color var(--motion-duration-fast) var(--motion-easing-standard),
              color         var(--motion-duration-fast) var(--motion-easing-standard);
}

.sidebar-logout-btn:hover {
  background: var(--color-bg);
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

.sidebar-logout-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ── Hamburger (solo mobile) ─────────────────────────────────────────────────── */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 60;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  transition: background var(--motion-duration-fast) var(--motion-easing-standard);
}

.sidebar-toggle:hover { background: var(--color-bg); }

.sidebar-toggle:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ── Backdrop (solo mobile) ──────────────────────────────────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  z-index: 40;
  opacity: 0;
  transition: opacity 200ms var(--motion-easing-standard);
}

.sidebar-backdrop.is-visible {
  opacity: 1;
}

/* ── Mobile: drawer ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #screen-app {
    display: block;
  }

  .app-main {
    padding-top: 72px;
  }

  .sidebar-toggle {
    display: flex;
  }

  .sidebar-backdrop {
    display: block;
  }

  #sidebar {
    position: fixed;
    top: 0;
    left: -240px;
    height: 100%;
    z-index: 50;
    box-shadow: none;
    transition: left       250ms cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1);
  }

  #sidebar.sidebar--open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, .15);
  }
}
