:root {
  --primary: #0f172a;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-light: #eef2ff;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --text-dark: #1e293b;
  --text-gray: #64748b;
  --border: #e2e8f0;
  --bg: #f8fafc;
  --white: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;
  background: var(--bg);
  color: var(--text-dark);
  line-height: 1.5;
}

.container { max-width: 960px; margin: 0 auto; padding: 0 24px 48px; }
@media (max-width: 480px) {
  .container { padding: 0 16px 40px; }
}

/* Hero / brand header */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #1e1b4b 60%, var(--brand-dark) 100%);
  color: white;
  padding: 40px 24px 56px;
  margin-bottom: -32px;
}
@media (max-width: 480px) {
  .hero { padding: 28px 16px 44px; }
}
.hero-inner { max-width: 960px; margin: 0 auto; }
.brand-badge {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(79,70,229,0.4);
}
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.hero h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; max-width: 620px; }
@media (max-width: 480px) {
  .hero h1 { font-size: 21px; }
  .hero p.lead { font-size: 13.5px; }
}
.hero p.lead { color: #c7d2fe; font-size: 15px; max-width: 560px; margin-bottom: 20px; }
.feature-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #e0e7ff;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
}

/* Cards */
.card {
  background: white;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04), 0 8px 24px rgba(15,23,42,0.06);
  margin-bottom: 24px;
  border: 1px solid var(--border);
  position: relative;
  z-index: 1;
  overflow-x: auto;
}
@media (max-width: 480px) {
  .card { padding: 18px; border-radius: 12px; }
}
.card h2 { color: var(--primary); font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.card .card-subtitle { color: var(--text-gray); font-size: 13px; margin-bottom: 20px; }

.card-header-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.card-header-row h2 { margin-bottom: 4px; }

/* Botones de acción (más protagonismo que los .action-link de las tablas) */
.action-button {
  display: inline-block; background: var(--bg); color: var(--text-dark);
  border: 1.5px solid var(--border); padding: 9px 16px; border-radius: 8px;
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.action-button:hover { text-decoration: none; border-color: var(--brand); background: var(--brand-light); }
.action-button.primary-button { background: var(--brand); color: white; border-color: var(--brand); }
.action-button.primary-button:hover { background: var(--brand-dark); }

/* Estadísticas del dashboard */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px; margin-bottom: 22px;
}
.stat-tile {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px;
}
.stat-tile .value { font-size: 26px; font-weight: 800; color: var(--primary); line-height: 1.2; }
.stat-tile .label { font-size: 11px; color: var(--text-gray); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 4px; }

.quick-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.banner {
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 13px;
}
.banner-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.banner-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* Form */
label { display: block; font-size: 13px; color: #475569; margin-bottom: 5px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 16px; margin-bottom: 14px; font-family: inherit;
  color: var(--text-dark); background: white;
}
/* font-size 16px a propósito: por debajo de eso, Safari/iOS hace zoom automático al enfocar el input */
input:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
textarea { min-height: 110px; resize: vertical; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .grid { grid-template-columns: 1fr; } }

.file-drop {
  display: block;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  color: var(--text-gray);
  font-size: 13px;
  margin-bottom: 14px;
  cursor: pointer;
  background: var(--bg);
  transition: border-color .15s, background .15s;
}
.file-drop:hover { border-color: var(--brand); background: var(--brand-light); }
.file-drop input[type=file] { display: none; }
#file-list { font-size: 12.5px; color: var(--text-dark); margin-top: 8px; text-align: left; }
#file-list div { padding: 2px 0; }

button.primary {
  background: var(--brand); color: white; border: none; padding: 13px 24px;
  border-radius: 9px; font-size: 14.5px; font-weight: 600; cursor: pointer;
  width: 100%; transition: background .15s;
}
button.primary:hover { background: var(--brand-dark); }

select {
  padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 16px; font-family: inherit; color: var(--text-dark); background: white;
}
button.secondary {
  background: white; color: var(--brand); border: 1.5px solid var(--brand);
  padding: 9px 18px; border-radius: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
button.secondary:hover { background: var(--brand-light); }

/* Filtros de la lista de notificaciones */
.filter-bar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.filter-bar input[type=text] { flex: 1; min-width: 180px; width: auto; margin-bottom: 0; }
.filter-bar select { flex-shrink: 0; }
.clear-filters { font-size: 13px; color: var(--text-gray); white-space: nowrap; }
@media (max-width: 480px) {
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar input[type=text], .filter-bar select, .filter-bar button.secondary { width: 100%; }
}

/* Paginación */
.pagination {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 13.5px;
}
.pagination a { font-weight: 600; }
.pagination .disabled { color: #cbd5e1; font-weight: 600; }
.pagination .page-info { color: var(--text-gray); }

/* Table */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 8px 8px; border-bottom: 2px solid var(--border);
  color: var(--text-gray); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
}
td {
  padding: 11px 8px; border-bottom: 1px solid #f1f5f9; vertical-align: middle;
  overflow-wrap: anywhere;
}
tr:hover td { background: var(--bg); }
a { color: var(--brand); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }
.action-link { display: inline-block; padding: 6px 4px; }

/* Tablas -> tarjetas apiladas en mobile, para no depender de scroll horizontal */
@media (max-width: 640px) {
  table.responsive-table thead { display: none; }
  table.responsive-table, table.responsive-table tbody,
  table.responsive-table tr, table.responsive-table td { display: block; width: 100%; }
  table.responsive-table tr {
    border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; padding: 4px 12px;
  }
  table.responsive-table td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 8px 0; border-bottom: 1px solid #f1f5f9; text-align: right;
  }
  table.responsive-table td:last-child { border-bottom: none; }
  table.responsive-table td::before {
    content: attr(data-label);
    font-weight: 700; color: var(--text-gray); font-size: 10.5px; text-transform: uppercase;
    letter-spacing: 0.05em; flex-shrink: 0; text-align: left;
  }
  table.responsive-table td.rt-no-label { justify-content: flex-end; flex-wrap: wrap; }
  table.responsive-table td.rt-no-label::before { content: none; }
}

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em; color: white;
}
.mono { font-family: 'SF Mono', Consolas, monospace; font-size: 12px; color: var(--text-gray); }
.empty-state { text-align: center; color: var(--text-gray); padding: 40px 0; font-size: 13.5px; }

footer.site-footer {
  text-align: center; color: var(--text-gray); font-size: 12px; margin-top: 8px;
}
footer.site-footer a { color: var(--text-gray); text-decoration: underline; }

/* Nav */
.nav-links { display: flex; gap: 16px; margin-left: auto; flex-wrap: wrap; }
.nav-links a {
  color: #c7d2fe; font-size: 13.5px; font-weight: 600; text-decoration: none;
  padding-bottom: 2px; border-bottom: 2px solid transparent;
}
.nav-links a:hover { text-decoration: none; color: white; }
.nav-links a.active { color: white; border-bottom-color: var(--brand); }
.nav-user { color: #a5b4fc; font-size: 12.5px; align-self: center; }
.nav-logout {
  background: none; border: none; font-family: inherit; cursor: pointer;
  color: #c7d2fe; font-size: 13.5px; font-weight: 600;
  padding: 0; padding-bottom: 2px; border-bottom: 2px solid transparent;
}
.nav-logout:hover { color: white; }
.brand-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 18px; width: 100%;
  flex-wrap: wrap; row-gap: 10px;
}
@media (max-width: 480px) {
  .nav-links { margin-left: 0; width: 100%; gap: 14px; }
}

/* API docs */
.endpoint-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.endpoint-path { overflow-wrap: anywhere; }
.method {
  display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: 0.03em;
  padding: 2px 8px; border-radius: 5px; color: white; min-width: 46px; text-align: center;
}
.method-get { background: #059669; }
.method-post { background: var(--brand); }
.endpoint-path { font-family: 'SF Mono', Consolas, monospace; font-size: 13.5px; color: var(--text-dark); font-weight: 600; }
.endpoint-desc { color: var(--text-gray); font-size: 13px; margin: 4px 0 18px; }

pre.code-block {
  background: #0f172a; color: #e2e8f0; padding: 16px 18px; border-radius: 10px;
  font-family: 'SF Mono', Consolas, monospace; font-size: 12.5px; line-height: 1.6;
  overflow-x: auto; margin: 10px 0 20px; white-space: pre;
}
pre.code-block .c1 { color: #94a3b8; } /* comentarios */
.docs-toc { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 4px; }
.docs-toc a { font-size: 13px; }
.field-table { width: 100%; font-size: 13px; margin-bottom: 6px; }
.field-table td { padding: 6px 8px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.field-table td:first-child { font-family: 'SF Mono', Consolas, monospace; font-weight: 600; white-space: nowrap; color: var(--brand-dark); }
@media (max-width: 480px) {
  .field-table tr { display: block; padding: 6px 0; border-bottom: 1px solid #f1f5f9; }
  .field-table td { display: block; padding: 1px 0; border-bottom: none; }
  .field-table td:first-child { white-space: normal; font-family: inherit; color: var(--text-gray); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
}

/* Cómo funciona: FAQ (acordeón nativo, sin JS) */
.faq-item {
  border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px;
  overflow: hidden;
}
.faq-item summary {
  padding: 14px 16px; cursor: pointer; font-weight: 600; font-size: 14px;
  color: var(--text-dark); list-style: none; display: flex; justify-content: space-between;
  align-items: center; gap: 10px; background: var(--bg);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 18px; color: var(--text-gray); flex-shrink: 0; }
.faq-item[open] summary::after { content: "−"; }
.faq-item[open] summary { border-bottom: 1px solid var(--border); }
.faq-item .faq-body { padding: 14px 16px; font-size: 13.5px; color: var(--text-dark); line-height: 1.7; }
.faq-item .faq-body p { margin-bottom: 8px; }
.faq-item .faq-body p:last-child { margin-bottom: 0; }

/* Referencias legales */
.legal-ref-list { list-style: none; }
.legal-ref-list li {
  padding: 12px 0; border-bottom: 1px solid #f1f5f9; display: flex; flex-direction: column; gap: 2px;
}
.legal-ref-list li:last-child { border-bottom: none; }
.legal-ref-list .ref-title { font-weight: 700; color: var(--text-dark); font-size: 13.5px; }
.legal-ref-list .ref-desc { color: var(--text-gray); font-size: 12.5px; }

.disclaimer-box {
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 14px 16px;
  font-size: 12.5px; color: #92400e; line-height: 1.6; margin-top: 16px;
}

.compare-table td, .compare-table th { text-align: center; }
.compare-table td:first-child, .compare-table th:first-child { text-align: left; }
