:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --surface-strong: #0f172a;
    --text: #172033;
    --muted: #64748b;
    --line: #e2e8f0;
    --primary: #1d4ed8;
    --primary-soft: #dbeafe;
    --primary-dark: #1e3a8a;
    --success: #15803d;
    --warning: #b45309;
    --danger: #b91c1c;
    --danger-soft: #fee2e2;
    --shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: inherit; text-decoration: none; }

button, input, select, textarea {
    font: inherit;
}

button { cursor: pointer; }

.hidden { display: none !important; }

.badge,
.status-pill,
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    border-radius: 999px;
    padding: 7px 11px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .01em;
}

.status-pill.ok { background: #dcfce7; color: #166534; }
.status-pill.warn { background: #fef3c7; color: #92400e; }
.status-pill.error { background: var(--danger-soft); color: var(--danger); }

.btn {
    border: 0;
    border-radius: 12px;
    padding: 11px 15px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #e2e8f0;
    color: var(--text);
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(15, 23, 42, .10); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #1e40af; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-success { background: #dcfce7; color: var(--success); }
.btn-warning { background: #fef3c7; color: var(--warning); }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn-small { padding: 7px 10px; border-radius: 10px; font-size: 12px; }
.btn-full { width: 100%; }
.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}

/* Landing */
.landing-page {
    background:
        radial-gradient(circle at top left, rgba(29,78,216,.18), transparent 35%),
        radial-gradient(circle at bottom right, rgba(34,197,94,.14), transparent 35%),
        var(--bg);
}
.landing {
    width: min(1160px, calc(100% - 40px));
    min-height: 100vh;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: 28px;
    align-items: center;
}
.landing-copy h1 {
    font-size: clamp(38px, 6vw, 72px);
    line-height: .96;
    margin: 18px 0;
    letter-spacing: -0.05em;
}
.landing-copy p {
    max-width: 680px;
    color: var(--muted);
    font-size: 19px;
    line-height: 1.7;
}
.landing-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.landing-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.landing-card-grid article {
    min-height: 160px;
    background: rgba(255,255,255,.78);
    border: 1px solid rgba(226,232,240,.9);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}
.landing-card-grid strong { display: block; font-size: 22px; margin-bottom: 10px; }
.landing-card-grid span { color: var(--muted); line-height: 1.6; }

/* Login */
.login-page {
    display: grid;
    place-items: center;
    padding: 32px;
    background:
        linear-gradient(135deg, rgba(15,23,42,.94), rgba(30,64,175,.88)),
        var(--surface-strong);
}
.login-wrap {
    width: min(1100px, 100%);
    display: grid;
    grid-template-columns: 1fr 430px;
    gap: 28px;
    align-items: stretch;
}
.login-hero,
.login-card {
    border-radius: 28px;
    padding: 32px;
    box-shadow: 0 30px 80px rgba(0,0,0,.26);
}
.login-hero {
    min-height: 560px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background:
        radial-gradient(circle at 15% 15%, rgba(96,165,250,.34), transparent 30%),
        rgba(255,255,255,.08);
    color: #fff;
    border: 1px solid rgba(255,255,255,.16);
}
.login-hero .badge { background: rgba(255,255,255,.16); color: #eff6ff; }
.login-hero h1 { font-size: clamp(34px, 5vw, 62px); line-height: .98; margin: 22px 0; letter-spacing: -0.045em; }
.login-hero p { color: #dbeafe; font-size: 18px; line-height: 1.7; max-width: 720px; }
.hero-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}
.hero-grid div {
    padding: 16px;
    border-radius: 18px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.14);
}
.hero-grid strong, .hero-grid span { display: block; }
.hero-grid span { color: #bfdbfe; margin-top: 6px; font-size: 13px; }
.login-card { background: #fff; }
.login-card-header h2 { margin: 0 0 8px; font-size: 30px; }
.login-card-header p { color: var(--muted); margin: 0 0 20px; line-height: 1.6; }
.stack-form { display: grid; gap: 16px; }
.stack-form label, .form-field { display: grid; gap: 7px; font-weight: 800; color: #334155; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 11px 12px;
    background: #fff;
    color: var(--text);
    outline: none;
}
textarea { min-height: 104px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(96,165,250,.18);
}
.form-message { min-height: 22px; color: var(--muted); }
.form-message.error { color: var(--danger); }
.form-message.ok { color: var(--success); }
.hint-box {
    margin-top: 22px;
    padding: 14px;
    border-radius: 16px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    display: grid;
    gap: 5px;
    color: var(--muted);
}
.hint-box strong { color: var(--text); }

/* App layout */
.layout {
    display: grid;
    grid-template-columns: 292px 1fr;
    min-height: 100vh;
}
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: #0b1220;
    color: #e5e7eb;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
}
.brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 15px;
    background: linear-gradient(135deg, #60a5fa, #22c55e);
    display: grid;
    place-items: center;
    font-weight: 1000;
    color: #fff;
}
.brand strong, .brand span { display: block; }
.brand span { color: #94a3b8; font-size: 12px; margin-top: 3px; }
.menu {
    overflow-y: auto;
    display: grid;
    gap: 5px;
    padding-right: 4px;
}
.menu-group-title {
    margin: 16px 10px 6px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.menu-btn {
    width: 100%;
    border: 0;
    border-radius: 13px;
    background: transparent;
    color: #cbd5e1;
    text-align: left;
    padding: 11px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
}
.menu-btn:hover, .menu-btn.active { background: rgba(255,255,255,.10); color: #fff; }
.menu-icon { width: 22px; text-align: center; }
.sidebar-footer { margin-top: auto; }
.session-card {
    border-radius: 18px;
    padding: 14px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.10);
    display: grid;
    gap: 4px;
}
.session-card small { color: #94a3b8; }
.session-card span { color: #cbd5e1; font-size: 12px; }
.workspace { min-width: 0; padding: 22px; }
.topbar {
    background: rgba(255,255,255,.82);
    border: 1px solid rgba(226,232,240,.95);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 16px;
    z-index: 20;
}
.eyebrow {
    margin: 0 0 4px;
    color: var(--primary);
    font-weight: 900;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.topbar h1 { margin: 0; font-size: 28px; letter-spacing: -0.03em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.content-area { margin-top: 22px; display: grid; gap: 18px; }
.notice {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    box-shadow: 0 12px 28px rgba(15,23,42,.06);
}
.notice.error { border-color: #fecaca; background: #fff1f2; color: var(--danger); }
.notice.ok { border-color: #bbf7d0; background: #f0fdf4; color: var(--success); }
.notice.warn { border-color: #fde68a; background: #fffbeb; color: var(--warning); }

.module-card, .panel-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.panel-card { padding: 20px; }
.module-head {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #fff, #f8fafc);
}
.module-head h2 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
.module-head p { margin: 5px 0 0; color: var(--muted); }
.toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.toolbar input, .toolbar select { width: auto; min-width: 190px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}
th {
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
}
td { color: #334155; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty-state {
    padding: 42px 24px;
    text-align: center;
    color: var(--muted);
}
.empty-state strong { display: block; color: var(--text); font-size: 19px; margin-bottom: 8px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.stat-card {
    padding: 18px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: 0 12px 30px rgba(15,23,42,.06);
}
.stat-card span { color: var(--muted); font-weight: 800; font-size: 13px; }
.stat-card strong { display: block; margin-top: 10px; font-size: 34px; letter-spacing: -0.04em; }
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.35fr .65fr;
    gap: 18px;
}
.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.activity-list { display: grid; gap: 10px; }
.activity-item {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    background: var(--surface-soft);
}
.activity-item strong { display: block; }
.activity-item span { display: block; color: var(--muted); margin-top: 4px; font-size: 13px; }

.drawer {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: 1fr min(720px, 100%);
}
.drawer-backdrop { background: rgba(15,23,42,.45); }
.drawer-panel {
    background: #fff;
    min-height: 100vh;
    padding: 22px;
    overflow: auto;
    box-shadow: -30px 0 60px rgba(15,23,42,.18);
}
.drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 14px;
    margin-bottom: 18px;
}
.drawer-header h2 { margin: 0; font-size: 25px; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid var(--line);
    padding-top: 16px;
}
.field-hint { color: var(--muted); font-size: 12px; font-weight: 600; }
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 8px;
    max-height: 440px;
    overflow: auto;
    padding: 6px;
}
.checkbox-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}
.checkbox-item input { width: auto; margin-top: 2px; }
.checkbox-item span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }

.code-box, pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 16px;
    overflow: auto;
    white-space: pre-wrap;
}
.api-console {
    display: grid;
    grid-template-columns: 160px 1fr auto;
    gap: 10px;
}
.api-console-result { margin-top: 14px; }

.mobile-only { display: none; }

@media (max-width: 1120px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid, .landing, .login-wrap { grid-template-columns: 1fr; }
    .login-hero { min-height: auto; }
}

@media (max-width: 820px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        z-index: 50;
        width: 290px;
        transform: translateX(-105%);
        transition: transform .2s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .workspace { padding: 14px; }
    .topbar { position: static; align-items: flex-start; flex-direction: column; }
    .topbar-actions { justify-content: flex-start; }
    .mobile-only { display: inline-flex; }
    .form-grid, .checkbox-grid, .hero-grid, .landing-card-grid, .quick-actions, .api-console { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
    .drawer { grid-template-columns: 1fr; }
    .drawer-backdrop { display: none; }
    .toolbar input, .toolbar select { width: 100%; min-width: 0; }
}
.muted { color: var(--muted); }

/* Fase 12: ajustes de interfaz por rol */
.sidebar { overflow: hidden; }
.menu { flex: 1; min-height: 0; scrollbar-width: thin; scrollbar-color: rgba(148,163,184,.7) transparent; }
.menu::-webkit-scrollbar { width: 8px; }
.menu::-webkit-scrollbar-thumb { background: rgba(148,163,184,.55); border-radius: 999px; }
.sidebar-footer { flex-shrink: 0; }
.reader-hero h2 { margin: 0 0 10px; font-size: clamp(26px, 4vw, 42px); letter-spacing: -0.04em; }
.reader-hero p:not(.eyebrow) { color: var(--muted); line-height: 1.7; max-width: 920px; }
.reader-hero .quick-actions { margin-top: 18px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 920px) { .reader-hero .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .reader-hero .quick-actions { grid-template-columns: 1fr; } }

/* Fase 13: selectores inteligentes e importación masiva */
.multi-select {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  padding: 10px;
}
.selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.select-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #1e3a8a;
  font-weight: 800;
  font-size: 12px;
}
.chip-remove {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-weight: 900;
  color: inherit;
}
.multi-filter {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  margin-bottom: 8px;
}
.multi-options {
  max-height: 180px;
  overflow-y: auto;
  display: grid;
  gap: 6px;
}
.multi-option {
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 9px 12px;
  cursor: pointer;
}
.multi-option:hover,
.multi-option.selected {
  border-color: #2563eb;
  background: #eff6ff;
}
.import-help pre {
  white-space: pre-wrap;
  background: #0f172a;
  color: #dbeafe;
  border-radius: 14px;
  padding: 14px;
  overflow-x: auto;
}

/* Fase 14: catálogo público e identidad visual */
:root { --sidebar-bg: var(--surface-strong); }
.sidebar { background: var(--sidebar-bg); }
.brand-logo.has-image {
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #fff;
}
.public-header {
  width: min(1180px, calc(100% - 32px));
  margin: 18px auto 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.86);
  box-shadow: var(--shadow);
  border-radius: 22px;
  position: sticky;
  top: 12px;
  z-index: 10;
  backdrop-filter: blur(12px);
}
.public-brand { display: inline-flex; align-items: center; gap: 12px; }
.public-brand span:last-child { display: grid; gap: 2px; }
.public-brand small { color: var(--muted); }
.public-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.catalog-wrap { width: min(1180px, calc(100% - 32px)); margin: 28px auto 60px; display: grid; gap: 22px; }
.catalog-hero {
  border-radius: 30px;
  padding: clamp(24px, 5vw, 54px);
  background: radial-gradient(circle at top left, rgba(29,78,216,.14), transparent 34%), var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.catalog-hero h1 { max-width: 820px; font-size: clamp(34px, 5vw, 64px); line-height: .98; margin: 8px 0 14px; letter-spacing: -0.05em; }
.catalog-hero p:not(.eyebrow) { max-width: 780px; color: var(--muted); font-size: 18px; line-height: 1.7; }
.catalog-searchbar { display: grid; grid-template-columns: 1fr 180px 180px auto; gap: 10px; margin-top: 22px; }
.catalog-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.catalog-card { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; overflow: hidden; box-shadow: 0 14px 36px rgba(15,23,42,.07); display: grid; }
.catalog-card-image { width: 100%; height: 190px; object-fit: cover; background: var(--surface-soft); display: grid; place-items: center; }
.catalog-card-placeholder { color: var(--primary-dark); font-size: 34px; font-weight: 1000; background: linear-gradient(135deg, var(--primary-soft), #fff); }
.catalog-card-body { padding: 18px; display: grid; gap: 10px; }
.catalog-card-body h2 { margin: 0; font-size: 21px; line-height: 1.2; }
.catalog-card-body p { margin: 0; color: var(--muted); line-height: 1.55; }
.catalog-card-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.catalog-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.catalog-card-footer span { color: var(--muted); font-size: 13px; font-weight: 700; }
.catalog-detail { display: grid; grid-template-columns: 330px 1fr; gap: 26px; padding: 24px; }
.catalog-detail h2 { font-size: clamp(30px, 4vw, 52px); line-height: 1; margin: 4px 0 12px; letter-spacing: -0.04em; }
.catalog-detail .lead { color: var(--muted); font-size: 18px; line-height: 1.7; }
.resource-cover { width: 100%; min-height: 420px; object-fit: cover; border-radius: 22px; border: 1px solid var(--line); background: var(--surface-soft); }
.resource-cover-placeholder { display: grid; place-items: center; color: var(--primary-dark); font-size: 52px; font-weight: 1000; background: linear-gradient(135deg, var(--primary-soft), #fff); }
.detail-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin: 18px 0; }
.detail-list div { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--surface-soft); }
.detail-list dt { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 900; }
.detail-list dd { margin: 5px 0 0; color: var(--text); font-weight: 800; }
.catalog-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0; }
.branding-grid { padding: 20px; display: grid; grid-template-columns: .8fr 1.2fr; gap: 18px; }
.branding-grid .span-2 { grid-column: 1 / -1; }
.color-text { margin-top: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.preview-shell { display: grid; grid-template-columns: 220px 1fr; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; background: var(--surface); }
.preview-shell aside { color: #fff; padding: 20px; display: grid; gap: 14px; align-content: start; }
.preview-shell main { padding: 24px; }
.resource-image-preview { max-width: 100%; max-height: 280px; border-radius: 18px; border: 1px solid var(--line); object-fit: contain; background: var(--surface-soft); }
.multi-select, .multi-filter, .multi-option { border-color: var(--line); }
@media (max-width: 980px) {
  .catalog-searchbar, .catalog-grid, .catalog-detail, .branding-grid, .preview-shell { grid-template-columns: 1fr; }
  .public-header { align-items: flex-start; flex-direction: column; }
}

/* Fase 15: paginación, configuraciones amigables, paletas y portada integrada */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--line);
}
.pagination-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pagination-actions button:disabled { opacity: .45; cursor: not-allowed; }
.pager-size {
  min-height: 36px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 6px 10px;
  background: var(--surface);
}
.settings-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 20px; }
.settings-summary article { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: 0 12px 26px rgba(15,23,42,.05); }
.settings-summary span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 900; }
.settings-summary strong { display: flex; align-items: center; gap: 8px; margin-top: 7px; color: var(--text); }
.settings-summary i { display: inline-block; width: 22px; height: 22px; border-radius: 999px; border: 1px solid var(--line); }
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; padding: 0 20px 20px; }
.settings-card { display: grid; gap: 10px; align-content: start; }
.settings-card h3 { margin: 0; }
.settings-card p { color: var(--muted); margin: 0; line-height: 1.55; }
.settings-card ul { margin: 0; padding-left: 18px; color: var(--muted); line-height: 1.7; }
.settings-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 16px; background: var(--primary-soft); font-size: 24px; }
.palette-grid { display: grid; gap: 10px; }
.palette-card { border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 12px; display: grid; gap: 9px; cursor: pointer; text-align: left; font-weight: 900; color: var(--text); }
.palette-card:hover { border-color: var(--primary); box-shadow: 0 10px 24px rgba(15,23,42,.08); }
.palette-card em { display: flex; gap: 5px; font-style: normal; }
.palette-card i { width: 24px; height: 24px; border-radius: 999px; border: 1px solid rgba(0,0,0,.08); display: inline-block; }
.resource-image-current { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; padding: 10px; border: 1px dashed var(--line); border-radius: 16px; background: var(--surface-soft); }
.resource-image-current img { width: 82px; height: 82px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); }
.resource-image-current span { color: var(--muted); font-weight: 800; }
.catalog-section-head { display: flex; justify-content: space-between; align-items: end; gap: 10px; flex-wrap: wrap; }
.catalog-section-head h2 { margin: 0; font-size: 28px; }
.catalog-section-head p { margin: 0; color: var(--muted); }
@media (max-width: 980px) {
  .settings-summary, .settings-grid { grid-template-columns: 1fr; }
  .pagination-bar { align-items: flex-start; flex-direction: column; }
}

/* Fase 16: acciones reales de catálogo, lectura y reserva */
.private-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 16px;
}

.private-catalog-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 22px;
  background: var(--surface, #fff);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.06);
}

.private-catalog-cover img,
.resource-thumb-placeholder {
  width: 96px;
  height: 132px;
  border-radius: 18px;
  object-fit: cover;
  background: linear-gradient(145deg, var(--primary-soft, #dbeafe), #fff);
  border: 1px solid var(--line, #e2e8f0);
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 900;
  color: var(--primary-dark, #1e3a8a);
}

.private-catalog-body h3 {
  margin: 10px 0 8px;
  font-size: 20px;
  line-height: 1.18;
}

.private-catalog-body p {
  color: var(--muted, #64748b);
  margin: 0 0 10px;
}

.resource-mini-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
  font-size: 13px;
  color: var(--muted, #64748b);
}

.catalog-actions.compact {
  gap: 8px;
  align-items: center;
}

.reader-box {
  margin-top: 18px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 22px;
  overflow: hidden;
  background: var(--surface, #fff);
}

.reader-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line, #e2e8f0);
  background: #f8fafc;
}

.reader-box iframe {
  display: block;
  width: 100%;
  height: min(72vh, 780px);
  border: 0;
  background: #fff;
}

.reader-preview {
  padding: 24px;
}

.private-detail-card {
  margin-top: 10px;
}

.notice.info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.notice.ok {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #15803d;
}

@media (max-width: 720px) {
  .private-catalog-card {
    grid-template-columns: 1fr;
  }
  .private-catalog-cover img,
  .resource-thumb-placeholder {
    width: 100%;
    height: 220px;
  }
}

/* Fase 20: login institucional y autoregistro */
.login-wrap-institutional { align-items: stretch; }
.institutional-hero { display: flex; flex-direction: column; justify-content: space-between; gap: 24px; }
.login-brand-block { display: flex; align-items: center; gap: 16px; }
.login-logo { width: 76px; height: 76px; border-radius: 22px; background-size: contain; background-position: center; background-repeat: no-repeat; background-color: rgba(255,255,255,.16); color: #fff; display:flex; align-items:center; justify-content:center; font-weight:900; }
.login-logo.has-image { background-color: #fff; border: 1px solid rgba(255,255,255,.35); }
.brand-subtitle { margin: 8px 0 0; opacity: .82; }
.login-welcome { max-width: 720px; }
.login-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn-light { color: #fff; border-color: rgba(255,255,255,.32); background: rgba(255,255,255,.10); }
.btn-light:hover { background: rgba(255,255,255,.18); }
.auth-card { min-width: min(540px, 100%); }
.auth-tabs-head { display: flex; gap: 18px; justify-content: space-between; align-items: flex-start; }
.auth-tabs { display: inline-flex; gap: 6px; background: var(--bg, #f5f7fb); border: 1px solid var(--line, #e2e8f0); padding: 5px; border-radius: 16px; }
.auth-tab { border: 0; background: transparent; padding: 10px 14px; border-radius: 12px; font-weight: 800; color: var(--muted, #64748b); cursor: pointer; }
.auth-tab.active { color: #fff; background: var(--primary, #1d4ed8); }
.auth-panel { display: none; }
.auth-panel.active { display: block; }
.form-grid { display: grid; gap: 12px; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.institutional-extra { border: 1px dashed var(--line, #e2e8f0); background: rgba(29,78,216,.04); border-radius: 18px; padding: 14px; }
.hidden { display: none !important; }
.verification-card { display: grid; gap: 12px; }
.verification-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.verification-note { width: 100%; min-height: 72px; }
@media (max-width: 860px) {
  .auth-tabs-head { flex-direction: column; }
  .form-grid-2 { grid-template-columns: 1fr; }
}
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.data-grid.compact { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.data-grid.compact div { border: 1px solid var(--line, #e2e8f0); border-radius: 14px; padding: 10px; background: rgba(248,250,252,.7); }
.data-grid.compact span { display:block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted, #64748b); font-weight: 800; }
.data-grid.compact strong { display:block; margin-top: 4px; }

/* Fase 21: login simple, sesión en catálogo público y footer institucional */
.login-page-simple {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(29,78,216,.22), transparent 34%),
    linear-gradient(135deg, rgba(15,23,42,.96), rgba(30,64,175,.9)),
    var(--surface-strong);
}
.login-simple-wrap {
  width: min(480px, 100%);
  margin: auto;
}
.login-simple-card {
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(226,232,240,.82);
  border-radius: 28px;
  padding: clamp(22px, 5vw, 34px);
  box-shadow: 0 30px 80px rgba(0,0,0,.24);
}
.login-simple-header {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 14px;
  margin-bottom: 24px;
}
.login-logo-simple {
  width: 92px;
  height: 92px;
  border-radius: 24px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  display: grid;
  place-items: center;
  font-size: 28px;
  color: #fff;
  font-weight: 1000;
  box-shadow: 0 16px 36px rgba(15,23,42,.16);
}
.login-logo-simple.has-image {
  background-color: #fff;
  border: 1px solid var(--line);
}
.login-simple-header h1 {
  margin: 0;
  font-size: clamp(23px, 4vw, 32px);
  line-height: 1.12;
  letter-spacing: -.03em;
}
.login-simple-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 800;
}
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
}
.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,.58);
  backdrop-filter: blur(8px);
}
.auth-modal-card {
  position: relative;
  width: min(720px, 100%);
  max-height: min(88vh, 850px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 30px 80px rgba(0,0,0,.28);
}
.catalog-user {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 900;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.public-footer,
.panel-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,255,255,.82);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  box-shadow: 0 12px 30px rgba(15,23,42,.06);
}
.public-footer strong,
.public-footer span,
.public-footer small,
.panel-footer span {
  display: inline-block;
}
.public-footer div {
  display: grid;
  gap: 2px;
}
.public-footer strong {
  color: var(--text);
}
.public-footer nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-weight: 800;
}
.public-footer nav a:hover {
  color: var(--primary);
}
.public-footer small,
.panel-footer {
  font-size: 12px;
}
.login-footer {
  color: rgba(255,255,255,.78);
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.18);
  box-shadow: none;
}
.login-footer strong { color: #fff; }
.login-footer a:hover { color: #fff; }
.panel-footer {
  width: 100%;
  margin: 24px 0 0;
  box-shadow: none;
}
@media (max-width: 700px) {
  .public-footer,
  .panel-footer {
    align-items: flex-start;
    flex-direction: column;
  }
  .public-nav { width: 100%; }
  .catalog-user { max-width: 100%; }
}
