/* ==========================================================================
   Biblioteca Saint Joseph School — Estilos
   ========================================================================== */
:root {
  --navy-950: #041a31;
  --navy-900: #062849;
  --navy-800: #073a69;
  --navy-700: #0f4c85;
  --navy-600: #2563a3;
  --navy-100: #e1ebf6;
  --navy-50: #eff4fa;
  --silver: #a7abb3;
  --gold: #f0b429;
  --gold-600: #d99a0f;
  --gold-100: #fdf1d3;
  --paper: #f7f5f0;
  --card: #ffffff;
  --ink: #1a1f36;
  --ink-2: #4a5173;
  --ink-3: #8a90ab;
  --line: #e7e4dc;
  --line-2: #efede7;
  --green: #16a36a;
  --green-50: #e5f7ee;
  --red: #e5484d;
  --red-50: #fdecec;
  --amber: #e8900c;
  --amber-50: #fff4e0;
  --blue: #3867d6;
  --blue-50: #e9effc;
  --violet: #7c5cd6;
  --violet-50: #f0ebfd;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(4, 26, 49, .06), 0 1px 1px rgba(4, 26, 49, .04);
  --shadow: 0 2px 4px rgba(4, 26, 49, .04), 0 8px 24px -6px rgba(4, 26, 49, .10);
  --shadow-lg: 0 24px 60px -12px rgba(4, 26, 49, .35);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sidebar: 256px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--ink); background: var(--paper);
  font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy-600); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
.serif { font-family: var(--serif); }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ Layout */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-950) 100%);
  color: #d3deea; padding: 22px 16px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 26px; }
.brand .crest { height: 54px; width: auto; flex: none; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .35)); }
.brand b { display: block; color: #fff; font-family: var(--serif); font-size: 17px; font-weight: 600; letter-spacing: .01em; line-height: 1.15; }
.brand span { font-size: 11.5px; color: var(--gold); letter-spacing: .14em; text-transform: uppercase; font-weight: 700; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #6f8db0; font-weight: 700; margin: 18px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
  color: #bccbdd; font-weight: 600; font-size: 14px; transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: rgba(240, 180, 41, .14); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav a.active svg { color: var(--gold); }
.nav a .count { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; padding: 1px 8px; border-radius: 99px; font-weight: 700; }
.sidebar-foot { margin-top: auto; padding-top: 20px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, .05); }
.user-chip .avatar { width: 36px; height: 36px; font-size: 13px; }
.user-chip b { color: #fff; font-size: 13.5px; display: block; }
.user-chip small { color: #8aa2bf; font-size: 11.5px; text-transform: capitalize; }
.user-chip button { margin-left: auto; background: none; border: 0; color: #98acc6; cursor: pointer; padding: 6px; border-radius: 8px; }
.user-chip button:hover { color: #fff; background: rgba(255, 255, 255, .08); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 14px 32px; background: rgba(247, 245, 240, .85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-2);
}
.topbar .menu-btn { display: none; }
.search-global { position: relative; flex: 1; max-width: 520px; }
.search-global input {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 11px 14px 11px 42px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.search-global input:focus { border-color: var(--navy-600); box-shadow: 0 0 0 4px rgba(37, 99, 163, .14); }
.search-global > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: #fff; border-radius: 16px;
  box-shadow: var(--shadow-lg); border: 1px solid var(--line); padding: 8px; max-height: 70vh; overflow: auto; z-index: 30;
}
.search-results .group { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); font-weight: 700; padding: 10px 10px 4px; }
.search-results .item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.search-results .item:hover, .search-results .item.sel { background: var(--navy-50); }
.scan-results .item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.scan-results .item:hover, .scan-results .item.sel { background: var(--navy-50); }
.scanner-status {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  background: #fff; border: 1px solid var(--line); padding: 8px 14px; border-radius: 99px; margin-left: auto;
}
.scanner-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(22, 163, 106, .5); animation: pulse 2s infinite; }
.scanner-status.flash { border-color: var(--green); color: var(--green); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(22, 163, 106, .45); } 70% { box-shadow: 0 0 0 8px rgba(22, 163, 106, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 163, 106, 0); } }
.today { font-size: 13px; color: var(--ink-2); font-weight: 600; text-transform: capitalize; white-space: nowrap; }

.page { padding: 28px 32px 60px; max-width: 1480px; width: 100%; animation: fadeUp .25s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--serif); font-size: 30px; font-weight: 600; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); }
.page-head .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line);
  background: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 650; cursor: pointer; font-size: 14px;
  transition: transform .06s, box-shadow .15s, background .15s, border-color .15s; white-space: nowrap; color: var(--ink);
}
.btn:hover { border-color: #d4d0c4; box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.btn.primary:hover { background: var(--navy-700); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--navy-950); }
.btn.gold:hover { background: #f5c04a; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-50); border-color: #f5c2c3; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(4, 26, 49, .05); box-shadow: none; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 10px; }
.btn.lg { padding: 14px 22px; font-size: 15.5px; border-radius: 14px; }
.btn.icon { padding: 8px; }
.btn-group { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.btn-group button { border: 0; background: none; padding: 7px 12px; border-radius: 9px; cursor: pointer; color: var(--ink-2); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.btn-group button.on { background: var(--navy-800); color: #fff; }

/* ---------------------------------------------------------------- Tarjetas */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(231, 228, 220, .7); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 0; }
.card-head h3 { font-size: 16px; font-weight: 700; }
.card-head .sub { color: var(--ink-3); font-size: 13px; }
.card-head .right { margin-left: auto; }
.grid { display: grid; gap: 20px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }

/* KPIs */
.kpi { padding: 20px 22px; position: relative; overflow: hidden; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(4, 26, 49, .05), 0 16px 32px -8px rgba(4, 26, 49, .16); }
.kpi .ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 16px; }
.kpi .ic svg { width: 22px; height: 22px; }
.kpi .val { font-size: 34px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.kpi .lbl { color: var(--ink-2); font-weight: 600; margin-top: 6px; }
.kpi .foot { font-size: 12.5px; color: var(--ink-3); margin-top: 10px; }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: currentColor; opacity: .05; }
.t-navy { color: var(--navy-700); } .t-navy .ic { background: var(--navy-100); }
.t-green { color: var(--green); } .t-green .ic { background: var(--green-50); }
.t-amber { color: var(--amber); } .t-amber .ic { background: var(--amber-50); }
.t-red { color: var(--red); } .t-red .ic { background: var(--red-50); }
.t-violet { color: var(--violet); } .t-violet .ic { background: var(--violet-50); }
.kpi .val, .kpi .lbl { color: var(--ink); }

/* Bienvenida */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 30px 34px; color: #fff; margin-bottom: 22px;
  background: radial-gradient(1200px 400px at 90% -40%, rgba(240, 180, 41, .35), transparent 60%),
              linear-gradient(120deg, var(--navy-800), var(--navy-950));
  display: flex; align-items: center; gap: 24px; box-shadow: var(--shadow);
}
.hero h1 { font-family: var(--serif); font-size: 30px; font-weight: 600; }
.hero p { margin: 6px 0 0; color: #c3d2e4; max-width: 560px; }
.hero .actions { margin-left: auto; display: flex; gap: 10px; position: relative; z-index: 1; }
.hero .books-deco { position: absolute; right: 250px; bottom: -8px; opacity: .18; }

/* Pills / badges */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.green { background: var(--green-50); color: var(--green); }
.pill.red { background: var(--red-50); color: var(--red); }
.pill.amber { background: var(--amber-50); color: var(--amber); }
.pill.blue { background: var(--blue-50); color: var(--blue); }
.pill.navy { background: var(--navy-100); color: var(--navy-700); }
.pill.gray { background: #f0efeb; color: var(--ink-2); }
.pill.violet { background: var(--violet-50); color: var(--violet); }
.pill .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.avatar {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800;
  font-size: 14px; flex: none; letter-spacing: .02em;
}
.avatar.xl { width: 76px; height: 76px; border-radius: 22px; font-size: 26px; }
.avatar.round { border-radius: 50%; }

/* ---------------------------------------------------------------- Tablas */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fcfbf8; }
table.t td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr { transition: background .12s; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr:hover { background: #fbfaf6; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main b { display: block; font-weight: 650; }
table.t .cell-main { min-width: 210px; }
.cell-main small { color: var(--ink-3); font-size: 12.5px; }
.code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; background: #f3f1ec; padding: 2px 7px; border-radius: 6px; color: var(--ink-2); }
.empty { text-align: center; padding: 50px 20px; color: var(--ink-3); }
.empty svg { width: 42px; height: 42px; stroke-width: 1.5; color: #c9c5b8; margin-bottom: 8px; }
.empty b { display: block; color: var(--ink-2); font-size: 15px; margin-bottom: 4px; }

/* ---------------------------------------------------------------- Filtros */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.input, select.input, textarea.input {
  border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 13px; outline: none; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--navy-600); box-shadow: 0 0 0 4px rgba(37, 99, 163, .14); }
.toolbar .input { width: auto; }
.search-box { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.search-box input { padding-left: 40px; width: 100%; }
.search-box svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.tabs { display: flex; gap: 4px; background: #fff; padding: 4px; border-radius: 14px; border: 1px solid var(--line); flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: 8px 14px; border-radius: 10px; font-weight: 650; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.tabs button .n { background: #f0efeb; color: var(--ink-2); font-size: 11.5px; padding: 0 7px; border-radius: 99px; }
.tabs button.on { background: var(--navy-800); color: #fff; }
.tabs button.on .n { background: rgba(255, 255, 255, .18); color: #fff; }

/* ---------------------------------------------------------------- Formularios */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.field .with-btn { display: flex; gap: 8px; }
.field .with-btn .input { flex: 1; }
.field.req label::after { content: " *"; color: var(--red); }
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.field label.switch { display: flex; font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 0; }
.switch input { display: none; }
.switch .tr { width: 42px; height: 24px; border-radius: 99px; background: #d9d6cc; position: relative; transition: background .2s; flex: none; }
.switch .tr::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch input:checked + .tr { background: var(--green); }
.switch input:checked + .tr::after { transform: translateX(18px); }

/* ---------------------------------------------------------------- Portadas */
.cover {
  position: relative; aspect-ratio: 2 / 3; border-radius: 6px 12px 12px 6px; overflow: hidden; flex: none;
  box-shadow: inset 4px 0 0 rgba(0, 0, 0, .18), inset 7px 0 0 rgba(255, 255, 255, .12), 0 6px 16px -4px rgba(4, 26, 49, .35);
  display: flex; flex-direction: column; justify-content: space-between; padding: 1.1em .85em .9em 1.25em; color: #fff;
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover .ct { font-family: var(--serif); font-weight: 600; line-height: 1.12; font-size: 1em; text-shadow: 0 1px 2px rgba(0, 0, 0, .2); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.cover .ca { font-size: .62em; opacity: .85; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.cover .orn { position: absolute; inset: 0; opacity: .16; pointer-events: none; }
.cover.sm { width: 38px; font-size: 5px; border-radius: 3px 6px 6px 3px; }
.cover.sm .ca { display: none; }
.cover.md { width: 64px; font-size: 8px; }
.cover.lg { width: 150px; font-size: 16px; }

.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 26px 22px; }
.book-card { cursor: pointer; transition: transform .18s; }
.book-card:hover { transform: translateY(-4px); }
.book-card .cover { width: 100%; font-size: 17px; }
.book-card:hover .cover { box-shadow: inset 4px 0 0 rgba(0, 0, 0, .18), inset 7px 0 0 rgba(255, 255, 255, .12), 0 18px 30px -8px rgba(4, 26, 49, .45); }
.book-card .meta { padding: 12px 2px 0; }
.book-card .meta b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; line-height: 1.3; }
.book-card .meta small { color: var(--ink-3); display: block; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-card .meta .row { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.book-card .status-flag { position: absolute; top: 10px; right: -2px; z-index: 2; font-size: 10.5px; font-weight: 800; padding: 3px 9px 3px 8px; border-radius: 6px 0 0 6px; text-transform: uppercase; letter-spacing: .05em; text-shadow: none; }
.book-card .status-flag.prestado { background: var(--gold); color: var(--navy-950); }
.book-card .status-flag.reparacion, .book-card .status-flag.extraviado { background: var(--red); color: #fff; }

/* ---------------------------------------------------------------- Gráfico */
.chart { padding: 10px 22px 18px; }
.chart svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.bar-list { padding: 8px 22px 20px; display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 36px; gap: 12px; align-items: center; font-size: 13.5px; }
.bar-row .track { height: 10px; background: #f1efe9; border-radius: 99px; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--navy-600), var(--navy-800)); }
.bar-row b { text-align: right; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.list-item:hover { background: #fbfaf6; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .grow b { display: block; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .grow small { color: var(--ink-3); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
.rank { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 12.5px; background: var(--gold-100); color: var(--gold-600); flex: none; }

/* ---------------------------------------------------------------- Mostrador */
.desk { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 22px; align-items: start; }
.scan-zone {
  position: relative; border-radius: 24px; padding: 30px; color: #fff; overflow: hidden;
  background: radial-gradient(700px 300px at 100% 0%, rgba(240, 180, 41, .28), transparent 60%), linear-gradient(135deg, var(--navy-800), var(--navy-950));
  box-shadow: var(--shadow);
}
.scan-zone h2 { font-family: var(--serif); font-weight: 600; font-size: 24px; }
.scan-zone p { color: #b6c7db; margin: 6px 0 20px; }
.scan-input { position: relative; }
.scan-input input {
  width: 100%; font-size: 20px; font-weight: 600; padding: 20px 20px 20px 64px; border-radius: 18px; border: 2px solid transparent;
  background: #fff; color: var(--ink); outline: none; letter-spacing: .01em; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .4);
}
.scan-input input:focus { border-color: var(--gold); box-shadow: 0 0 0 6px rgba(240, 180, 41, .25), 0 10px 30px -10px rgba(0, 0, 0, .4); }
.scan-input > svg { position: absolute; left: 22px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; color: var(--navy-600); }
.scan-input .beam { position: absolute; left: 64px; right: 20px; top: 50%; height: 2px; background: linear-gradient(90deg, transparent, var(--red), transparent); opacity: 0; pointer-events: none; }
.scan-input.scanning .beam { animation: beam .5s ease; }
@keyframes beam { 0% { opacity: 0; transform: scaleX(.2); } 40% { opacity: 1; transform: scaleX(1); } 100% { opacity: 0; } }
.scan-help { display: flex; gap: 18px; margin-top: 16px; font-size: 12.5px; color: #9bb0c9; flex-wrap: wrap; }
.scan-help span { display: flex; align-items: center; gap: 6px; }
.kbd { background: rgba(255, 255, 255, .12); border-radius: 6px; padding: 1px 7px; font-size: 11.5px; font-weight: 700; color: #fff; }
.scan-results { position: absolute; left: 30px; right: 30px; z-index: 5; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); color: var(--ink); padding: 8px; margin-top: 8px; max-height: 360px; overflow: auto; }

.steps { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 22px; }
.slot { border-radius: 20px; background: #fff; border: 2px dashed #dcd8cc; min-height: 170px; padding: 20px; position: relative; transition: border-color .2s, background .2s; }
.slot.filled { border-style: solid; border-color: transparent; box-shadow: var(--shadow); }
.slot .slot-title { display: flex; align-items: center; gap: 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; color: var(--ink-3); margin-bottom: 14px; }
.slot .slot-title .num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--navy-100); color: var(--navy-700); font-size: 11.5px; letter-spacing: 0; }
.slot.filled .slot-title .num { background: var(--green); color: #fff; }
.slot .placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--ink-3); height: 100px; gap: 6px; }
.slot .placeholder svg { width: 34px; height: 34px; stroke-width: 1.5; color: #c9c5b8; }
.slot .clear { position: absolute; top: 14px; right: 14px; }
.lector-card { display: flex; gap: 14px; align-items: center; }
.lector-card b { font-size: 17px; display: block; line-height: 1.25; }
.lector-card .avatar.xl { width: 64px; height: 64px; font-size: 22px; border-radius: 18px; }
#prev .cover { width: 100%; font-size: 17px; }
.warn-box { margin-top: 14px; padding: 10px 12px; border-radius: 12px; font-size: 13px; font-weight: 600; display: flex; gap: 8px; align-items: flex-start; }
.warn-box.red { background: var(--red-50); color: #b4262b; }
.warn-box.amber { background: var(--amber-50); color: #9a5b00; }
.warn-box.green { background: var(--green-50); color: #0d7a4d; }
.mini-loans { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.mini-loans div { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; background: #faf9f5; padding: 6px 10px; border-radius: 8px; }
.mini-loans div span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart { display: flex; flex-direction: column; gap: 10px; }
.cart-item { display: flex; gap: 12px; align-items: center; background: #faf9f5; border-radius: 12px; padding: 8px 10px; animation: pop .25s ease; }
.cart-item .grow { flex: 1; min-width: 0; }
.cart-item .grow b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item .grow small { color: var(--ink-3); font-size: 12px; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.confirm-bar { display: flex; align-items: center; gap: 12px; margin-top: 16px; padding: 16px 18px; background: #fff; border-radius: 18px; box-shadow: var(--shadow); flex-wrap: wrap; }
.confirm-bar .due { display: flex; align-items: center; gap: 10px; }
.confirm-bar .due .input { width: auto; padding: 8px 10px; }
.confirm-bar .btn { margin-left: auto; }

.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); animation: pop .3s ease; }
.feed-item:last-child { border-bottom: 0; }
.feed-item .fi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.feed-item .fi.out { background: var(--blue-50); color: var(--blue); }
.feed-item .fi.in { background: var(--green-50); color: var(--green); }
.feed-item .fi.late { background: var(--red-50); color: var(--red); }
.feed-item .grow { flex: 1; min-width: 0; font-size: 13.5px; }
.feed-item .grow b { font-weight: 650; }
.feed-item time { font-size: 12px; color: var(--ink-3); white-space: nowrap; }

.result-banner { margin-top: 18px; border-radius: 20px; padding: 18px 20px; display: flex; gap: 16px; align-items: center; animation: pop .3s ease; box-shadow: var(--shadow); }
.result-banner.ok { background: linear-gradient(135deg, #e9f9f0, #d6f3e4); }
.result-banner.late { background: linear-gradient(135deg, #fff1e6, #ffe3cc); }
.result-banner .big-ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex: none; }
.result-banner.ok .big-ic { background: var(--green); color: #fff; }
.result-banner.late .big-ic { background: var(--amber); color: #fff; }
.result-banner .big-ic svg { width: 28px; height: 28px; stroke-width: 2.5; }
.result-banner h3 { font-size: 17px; }

/* ---------------------------------------------------------------- Modal / Drawer */
.overlay { position: fixed; inset: 0; background: rgba(4, 26, 49, .45); backdrop-filter: blur(3px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 22px; box-shadow: var(--shadow-lg); width: 100%; max-width: 720px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; animation: modalIn .22s cubic-bezier(.2, .9, .3, 1.2); }
.modal.sm { max-width: 440px; }
.modal.lg { max-width: 920px; }
@keyframes modalIn { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 22px 26px 16px; }
.modal-head h2 { font-size: 20px; font-family: var(--serif); font-weight: 600; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 4px 26px 20px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 26px 22px; border-top: 1px solid var(--line-2); }
.modal-foot .left { margin-right: auto; }

.drawer-overlay { justify-content: flex-end; padding: 0; }
.drawer { background: var(--paper); width: 100%; max-width: 620px; height: 100vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: drawerIn .25s cubic-bezier(.2, .9, .3, 1); }
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } }
.drawer-hero { padding: 26px 28px; background: linear-gradient(135deg, var(--navy-800), var(--navy-950)); color: #fff; display: flex; gap: 22px; align-items: flex-end; position: relative; }
.drawer-hero h2 { font-family: var(--serif); font-size: 24px; font-weight: 600; }
.drawer-hero p { margin: 4px 0 0; color: #c3d2e4; }
.drawer-hero .x { position: absolute; top: 16px; right: 16px; color: #fff; }
.drawer-hero .x:hover { background: rgba(255, 255, 255, .1); }
.drawer-body { padding: 22px 28px 40px; display: flex; flex-direction: column; gap: 18px; }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line-2); border-radius: 16px; overflow: hidden; border: 1px solid var(--line-2); }
.facts div { background: #fff; padding: 12px 16px; }
.facts small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); font-weight: 700; }
.facts b { font-weight: 650; }
.timeline { display: flex; flex-direction: column; }
.timeline .ti { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line-2); align-items: center; }
.timeline .ti:last-child { border-bottom: 0; }
.timeline .ti .grow { flex: 1; min-width: 0; }
.timeline .ti .grow b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline .ti .grow small { color: var(--ink-3); font-size: 12px; }

/* ---------------------------------------------------------------- Toasts */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 12px; background: var(--navy-950); color: #fff; padding: 14px 18px; border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 600; max-width: 420px; animation: toastIn .3s cubic-bezier(.2, .9, .3, 1.3); }
.toast .ti { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.toast.ok .ti { background: var(--green); }
.toast.err .ti { background: var(--red); }
.toast.info .ti { background: var(--navy-600); }
.toast.warn .ti { background: var(--amber); }
.toast.out { animation: toastOut .25s ease forwards; }
@keyframes toastIn { from { transform: translateY(16px) scale(.95); opacity: 0; } }
@keyframes toastOut { to { transform: translateX(30px); opacity: 0; } }

/* ---------------------------------------------------------------- Login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art {
  position: relative; overflow: hidden; color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(900px 500px at 110% 110%, rgba(240, 180, 41, .35), transparent 60%), linear-gradient(150deg, var(--navy-800), var(--navy-950));
}
.login-art h1 { font-family: var(--serif); font-size: 46px; font-weight: 600; line-height: 1.08; max-width: 520px; }
.login-art h1 em { color: var(--gold); font-style: italic; }
.login-art p { color: #b6c7db; font-size: 16px; max-width: 460px; }
.shelf { display: flex; align-items: flex-end; gap: 8px; margin-top: 40px; }
.shelf .spine { border-radius: 4px 4px 2px 2px; box-shadow: inset -3px 0 0 rgba(0, 0, 0, .15), inset 3px 0 0 rgba(255, 255, 255, .1); animation: rise .8s cubic-bezier(.2, .9, .3, 1.1) both; }
.shelf .spine::after { content: ""; display: block; margin: 14px auto 0; width: 60%; height: 3px; background: rgba(255, 255, 255, .45); border-radius: 2px; }
.shelf-board { height: 10px; border-radius: 4px; background: linear-gradient(#b27a3b, #8a5a26); margin-top: -1px; box-shadow: 0 8px 20px rgba(0, 0, 0, .35); }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-form form { width: 100%; max-width: 380px; }
.login-form h2 { font-family: var(--serif); font-size: 30px; font-weight: 600; margin: 18px 0 6px; }
.login-form .field { margin-bottom: 16px; }
.login-form .input { padding: 13px 15px; font-size: 15px; }
.login-err { background: var(--red-50); color: #b4262b; padding: 10px 14px; border-radius: 12px; font-weight: 600; font-size: 13.5px; margin-bottom: 14px; }

/* ---------------------------------------------------------------- Etiquetas */
.label-sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.lbl-book { border: 1px dashed #cfcabd; border-radius: 10px; padding: 10px 12px 8px; background: #fff; text-align: center; break-inside: avoid; page-break-inside: avoid; }
.lbl-book .school { font-size: 9px; letter-spacing: .14em; text-transform: uppercase; font-weight: 800; color: var(--navy-700); }
.lbl-book .tt { font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 2px 0 4px; }
.lbl-book svg { width: 100%; height: 46px; display: block; }
.lbl-book .cd { font-family: ui-monospace, Consolas, monospace; font-size: 11px; letter-spacing: .12em; }
.carnet-sheet { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-start; }
.carnet-sheet .carnet { width: calc(50% - 7px); }
.carnet-sheet .carnet.vertical { width: calc(33.33% - 10px); }
.carnet { width: 100%; aspect-ratio: 85.6 / 54; border-radius: 14px; overflow: hidden; background: #fff; border: 1px solid #ddd8cb; display: flex; flex-direction: column; break-inside: avoid; page-break-inside: avoid; }
.carnet .top { background: linear-gradient(120deg, var(--navy-800), var(--navy-950)); color: #fff; padding: 8px 12px; display: flex; align-items: center; gap: 8px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.carnet .top .crest { height: 30px; width: auto; }
.carnet .top b { font-family: var(--serif); font-size: 13px; font-weight: 600; display: block; line-height: 1.1; }
.carnet .top small { font-size: 8px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-weight: 800; }
.carnet .mid { flex: 1; display: flex; gap: 12px; align-items: center; padding: 8px 12px; }
.carnet .mid .avatar { -webkit-print-color-adjust: exact; print-color-adjust: exact; width: 48px; height: 48px; font-size: 17px; }
.carnet .mid b { font-size: 14px; display: block; line-height: 1.15; }
.carnet .mid small { font-size: 11px; color: var(--ink-2); }
.carnet .bc { padding: 0 12px 6px; text-align: center; }
.carnet .bc svg { width: 100%; height: 34px; display: block; }
.carnet .bc span { font-family: ui-monospace, Consolas, monospace; font-size: 9px; letter-spacing: .14em; }
.carnet .stripe { height: 5px; background: var(--gold); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
/* Credencial con imagen de fondo (diseño por ciclo) */
.carnet.con-fondo { position: relative; display: block; container-type: inline-size; }
.carnet.con-fondo.vertical { aspect-ratio: 54 / 85.6; }
.carnet.con-fondo .fondo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.carnet.con-fondo .mid { position: absolute; left: 5%; right: 5%; top: 40%; height: 23%; padding: 0 3cqw; gap: 3cqw;
  background: rgba(255, 255, 255, .93); border-radius: 2.5cqw; box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.carnet.con-fondo .mid .avatar { width: 11cqw; height: 11cqw; font-size: 4cqw; }
.carnet.con-fondo .mid b { font-size: 4.3cqw; }
.carnet.con-fondo .mid small { font-size: 3.2cqw; }
.carnet.con-fondo .bc { position: absolute; left: 5%; right: 5%; top: 66%; height: 29%; padding: 1.5cqw 3cqw 1cqw;
  background: #fff; border-radius: 2cqw; display: flex; flex-direction: column; justify-content: center; box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.carnet.con-fondo .bc svg { height: 100%; min-height: 0; flex: 1; }
.carnet.con-fondo .bc span { font-size: 2.6cqw; }
.carnet.con-fondo.vertical .mid { top: 46%; height: 25%; flex-direction: column; justify-content: center; text-align: center; gap: 1.2cqw; padding: 0 4cqw; }
.carnet.con-fondo.vertical .mid .avatar { width: 13cqw; height: 13cqw; font-size: 5cqw; }
.carnet.con-fondo.vertical .mid b { font-size: 5.6cqw; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.carnet.con-fondo.vertical .mid small { font-size: 4.2cqw; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.carnet.con-fondo.vertical .bc { top: 74%; height: 21%; }
.carnet.con-fondo.vertical .bc span { font-size: 4cqw; }
.carnet.con-fondo .mid > div { min-width: 0; }
.carnet.con-fondo .top { position: absolute; left: 0; right: 0; top: 0; height: 20%; padding: 0 3.5cqw; gap: 2.5cqw; z-index: 1; }
.carnet.con-fondo .top .crest { height: 10.5cqw; }
.carnet.con-fondo .top b { font-size: 4.6cqw; line-height: 1.15; }
.carnet.con-fondo .top small { font-size: 2.8cqw; display: block; line-height: 1.4; margin-top: .4cqw; }
.carnet.con-fondo.vertical .top { height: 15%; padding: 0 5cqw; gap: 3cqw; }
.carnet.con-fondo.vertical .top .crest { height: 14cqw; }
.carnet.con-fondo.vertical .top b { font-size: 5.6cqw; }
.carnet.con-fondo.vertical .top small { font-size: 3.3cqw; letter-spacing: .12em; }
.carnet.con-fondo:not(.vertical) .mid b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.diseno-prev .carnet { width: 100%; max-width: 360px; margin: 0 auto; }
.diseno-prev .carnet.vertical { max-width: 210px; }
.diseno-prev { background: repeating-conic-gradient(#f3f1ec 0 25%, #fbfaf7 0 50%) 0 0 / 16px 16px; border-radius: 12px; padding: 16px; }
.pick-list { max-height: 460px; overflow: auto; }
.pick-list label { display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.pick-list label:hover { background: #fbfaf6; }
.pick-list input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--navy-800); }

.dropzone { display: block; border: 2px dashed #d7d2c4; border-radius: 16px; padding: 28px; text-align: center; color: var(--ink-2); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--navy-600); background: var(--navy-50); }
.dropzone svg { width: 34px; height: 34px; color: var(--navy-600); margin-bottom: 6px; }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1200px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main, .desk { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 90; width: var(--sidebar); transform: translateX(-100%); transition: transform .25s; }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .topbar { padding: 12px 16px; }
  .topbar .menu-btn { display: inline-flex; }
  .today, .scanner-status .txt { display: none; }
  .page { padding: 20px 16px 50px; }
  .g-3, .g-2 { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .hero { flex-direction: column; align-items: flex-start; }
  .hero .actions { margin-left: 0; }
  .label-sheet { grid-template-columns: repeat(2, 1fr); }
  .carnet-sheet .carnet { width: 100%; }
  .carnet-sheet .carnet.vertical { width: calc(50% - 7px); }
}

/* ---------------------------------------------------------------- Impresión */
.print-area { display: none; }
@media print {
  @page { margin: 10mm; }
  body { background: #fff; }
  body > *:not(.print-area) { display: none !important; }
  .print-area { display: block !important; }
  .lbl-book { border: 1px dashed #bbb; }
  .label-sheet { grid-template-columns: repeat(3, 1fr); gap: 4mm; }
  .carnet-sheet { display: flex; flex-wrap: wrap; gap: 5mm; }
  .carnet-sheet .carnet, .carnet { width: 85.6mm; height: 54mm; }
  .carnet-sheet .carnet.vertical, .carnet.vertical { width: 54mm; height: 85.6mm; }
  .carnet.con-fondo .fondo { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-list h2 { font-family: var(--serif); margin-bottom: 4px; }
  .print-list table { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 10px; }
  .print-list th, .print-list td { border-bottom: 1px solid #ddd; padding: 5px 6px; text-align: left; }
}

/* ================================================================ Login con dos modos */
.login-box { width: 100%; max-width: 400px; }
.login-box form { max-width: none; }
.login-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--navy-50); border: 1px solid var(--navy-100); border-radius: 14px; padding: 4px; margin-top: 22px; }
.login-tabs button { border: 0; background: none; border-radius: 10px; padding: 10px 8px; font: inherit; font-size: 13px; font-weight: 700; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: background .15s, color .15s; }
.login-tabs button svg { width: 16px; height: 16px; flex: none; }
.login-tabs button { white-space: nowrap; font-size: 12.5px; }
.login-tabs button.on { background: #fff; color: var(--navy-800); box-shadow: var(--shadow-sm); }
.codigo-input { text-align: center; font-size: 28px !important; letter-spacing: .5em; font-weight: 800; font-variant-numeric: tabular-nums; padding-left: calc(15px + .5em) !important; }
.login-err.hidden { display: none; }

/* ================================================================ Portal de alumnos y funcionarios */
.pill.violet .d { background: var(--violet); }
.warn-box.violet { background: var(--violet-50); color: #5b3fb3; }
.portal { min-height: 100vh; background: var(--paper); }
.p-wrap { max-width: 1180px; margin: 0 auto; padding: 0 28px; }
main.p-wrap { padding-top: 26px; padding-bottom: 60px; }
.p-top { position: sticky; top: 0; z-index: 20; background: linear-gradient(180deg, var(--navy-900), var(--navy-950)); box-shadow: 0 6px 24px -10px rgba(4, 26, 49, .5); }
.p-top-in { display: flex; align-items: center; gap: 22px; height: 72px; }
.p-brand { display: flex; align-items: center; gap: 11px; color: #fff; }
.p-brand .crest { height: 46px; width: auto; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, .35)); }
.p-brand b { display: block; font-family: var(--serif); font-size: 18px; font-weight: 600; line-height: 1.1; }
.p-brand span { font-size: 10.5px; color: var(--gold); letter-spacing: .14em; text-transform: uppercase; font-weight: 700; }
.p-nav { display: flex; gap: 6px; margin-left: 18px; }
.p-nav a { display: inline-flex; align-items: center; gap: 8px; color: #c5d3e4; font-weight: 700; font-size: 14px; padding: 10px 16px; border-radius: 12px; transition: background .15s, color .15s; }
.p-nav a svg { width: 18px; height: 18px; }
.p-nav a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.p-nav a.on { color: #fff; background: rgba(240, 180, 41, .16); box-shadow: inset 0 -3px 0 var(--gold); }
.p-nav a.on svg { color: var(--gold); }
.p-nav .count { background: var(--gold); color: var(--navy-950); font-size: 11px; font-weight: 800; min-width: 20px; height: 20px; border-radius: 99px; display: inline-grid; place-items: center; padding: 0 6px; }
.p-nav .count.hidden { display: none; }
.p-user { margin-left: auto; display: flex; align-items: center; gap: 10px; color: #fff; }
.p-user-txt b { display: block; font-size: 14px; line-height: 1.2; }
.p-user-txt small { color: #9fb2c9; font-size: 12px; }
.p-user .btn.ghost { color: #c5d3e4; border-color: transparent; background: transparent; }
.p-user .btn.ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; box-shadow: none; }

.p-hero { position: relative; overflow: hidden; border-radius: 26px; padding: 38px 40px 30px; margin-bottom: 22px; color: #fff;
  background: radial-gradient(circle at 88% 12%, rgba(240, 180, 41, .30), transparent 42%),
              radial-gradient(circle at 8% 110%, rgba(124, 92, 214, .35), transparent 45%),
              linear-gradient(125deg, var(--navy-800), var(--navy-950)); box-shadow: var(--shadow); }
.p-hero::after { content: ""; position: absolute; right: -40px; bottom: -60px; width: 260px; height: 260px; border-radius: 50%; border: 36px solid rgba(255, 255, 255, .04); pointer-events: none; }
.p-hero h1 { font-family: var(--serif); font-size: 34px; font-weight: 600; margin: 0 0 6px; }
.p-hero p { color: #c5d3e4; margin: 0 0 22px; font-size: 15.5px; max-width: 640px; }
.p-search { position: relative; max-width: 680px; }
.p-search svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 20px; height: 20px; }
.p-search input { width: 100%; border: 0; border-radius: 16px; padding: 17px 18px 17px 52px; font: inherit; font-size: 16px; color: var(--ink); background: #fff; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .45); outline: none; }
.p-search input:focus { box-shadow: 0 0 0 4px rgba(240, 180, 41, .45), 0 10px 30px -10px rgba(0, 0, 0, .45); }
.p-chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 18px; position: relative; z-index: 1; }
.p-disp { color: #fff; font-size: 13.5px; font-weight: 700; margin-right: 8px; background: rgba(255, 255, 255, .08); padding: 6px 12px 6px 6px; border-radius: 99px; }
.p-disp .tr { width: 36px; height: 21px; } .p-disp .tr::after { width: 15px; height: 15px; }
.p-disp input:checked + .tr::after { transform: translateX(15px); }
.chip { border: 1px solid rgba(255, 255, 255, .22); background: transparent; color: #dbe5f1; font: inherit; font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 99px; cursor: pointer; transition: background .15s, color .15s; }
.chip:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.chip.on { background: var(--gold); border-color: var(--gold); color: var(--navy-950); }

.p-resumen { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--violet); border-radius: 16px; padding: 14px 18px; margin-bottom: 24px; color: var(--ink-2); box-shadow: var(--shadow-sm); }
.p-resumen > svg:first-child { color: var(--violet); }
.p-resumen > svg:last-child { margin-left: auto; color: var(--ink-3); }
.p-resumen:hover { border-color: var(--violet); }
.p-grid .book-card .meta .row { min-height: 24px; }
.p-reservar { margin-top: 10px; width: 100%; }
.p-detalle { display: grid; grid-template-columns: 190px 1fr; gap: 26px; align-items: start; }
.p-detalle .cover { width: 100%; font-size: 20px; }

@media (max-width: 900px) {
  .p-wrap { padding: 0 16px; }
  .p-top-in { height: auto; flex-wrap: wrap; gap: 8px 12px; padding-top: 10px; padding-bottom: 8px; }
  .p-brand .crest { height: 38px; }
  .p-nav { order: 3; width: 100%; margin: 0; }
  .p-nav a { flex: 1; justify-content: center; padding: 9px 10px; }
  .p-user-txt { display: none; }
  .p-hero { padding: 26px 20px 22px; border-radius: 20px; }
  .p-hero h1 { font-size: 26px; }
  .p-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 20px 14px; }
  .p-chips { flex-wrap: nowrap; overflow-x: auto; margin: 16px -20px 0; padding: 0 20px 4px; scrollbar-width: none; }
  .p-chips::-webkit-scrollbar { display: none; }
  .p-chips > * { flex: none; }
  .p-detalle { grid-template-columns: 1fr; }
  .p-detalle > .cover { max-width: 170px; margin: 0 auto; }
  .login-form { padding: 28px 16px; }
}

/* ================================================================ Préstamo / Devolución separados */
.modo-switch { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 4px; box-shadow: var(--shadow-sm); }
.modo-switch a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--ink-2); transition: background .15s, color .15s; }
.modo-switch a svg { width: 17px; height: 17px; }
.modo-switch a:hover { color: var(--ink); background: var(--navy-50); }
.modo-switch a.on { background: var(--navy-800); color: #fff; }
.modo-switch a.dev.on { background: var(--green); color: #fff; }

.scan-zone.dev { background: radial-gradient(700px 300px at 100% 0%, rgba(52, 211, 153, .30), transparent 60%), linear-gradient(135deg, #0b5a44, #06291f); }
.scan-zone.dev p { color: #b5dccd; }
.scan-zone.dev .scan-input input:focus { border-color: #34d399; box-shadow: 0 0 0 6px rgba(52, 211, 153, .28), 0 10px 30px -10px rgba(0, 0, 0, .4); }
.scan-zone.dev .scan-input > svg { color: var(--green); }
.dev-danado { font-size: 13px; font-weight: 600; color: #d8efe6; gap: 10px; }
.dev-danado .tr { width: 36px; height: 21px; } .dev-danado .tr::after { width: 15px; height: 15px; }
.dev-danado input:checked + .tr { background: var(--red); }
.dev-danado input:checked + .tr::after { transform: translateX(15px); }
.dev-danado:has(input:checked) { color: #ffd0d0; }

.dev-espera { margin-top: 18px; display: flex; align-items: center; gap: 16px; padding: 22px; border: 2px dashed #cfe3da; border-radius: 20px; background: #fff; color: var(--ink-3); }
.dev-espera > svg { width: 38px; height: 38px; color: #9fd1bb; flex: none; }
.dev-espera b { display: block; color: var(--ink-2); font-size: 16px; }
.dev-ok { margin-top: 18px; display: flex; gap: 22px; align-items: flex-start; padding: 22px; border-radius: 22px; background: linear-gradient(135deg, #e9f9f0, #d3f1e2); box-shadow: var(--shadow); animation: pop .3s ease; }
.dev-ok.late { background: linear-gradient(135deg, #fff4e8, #ffe2c7); }
.dev-ok > .cover { width: 96px; flex: none; }
.dev-ok h3 { font-family: var(--serif); font-size: 22px; font-weight: 600; margin: 8px 0 2px; }
.dev-tag { display: inline-flex; align-items: center; gap: 7px; background: var(--green); color: #fff; font-weight: 800; font-size: 13px; padding: 6px 12px; border-radius: 99px; }
.dev-tag svg { width: 16px; height: 16px; stroke-width: 2.6; }
.dev-ok.late .dev-tag { background: var(--amber); }
.dev-datos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.dev-datos div { background: rgba(255, 255, 255, .7); border-radius: 12px; padding: 10px 12px; }
.dev-datos small { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); font-weight: 700; }
.dev-datos b { display: block; font-size: 14px; }
.dev-datos span { font-size: 12px; color: var(--ink-3); }
.dev-aviso { margin-top: 18px; display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; border-radius: 20px; animation: pop .3s ease; box-shadow: var(--shadow-sm); }
.dev-aviso > svg { width: 26px; height: 26px; flex: none; }
.dev-aviso b { display: block; font-size: 16px; margin-bottom: 4px; }
.dev-aviso.amber { background: var(--amber-50); color: #7a4800; }
.dev-aviso.red { background: var(--red-50); color: #9b1f24; }
.dev-lector { margin-top: 18px; }
.dev-lector .card-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; }
.dev-pend { padding: 4px 12px 14px; }
.dev-pend-i { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; }
.dev-pend-i:hover { background: var(--paper); }
.dev-pend-i b { display: block; font-size: 14px; }
.dev-pend-i small { color: var(--ink-3); }
@media (max-width: 900px) {
  .dev-ok { flex-direction: column; }
  .dev-datos { grid-template-columns: 1fr; }
  .modo-switch a { padding: 8px 12px; }
}

/* ================================================================ Portal: vitrinas por categoría */
.p-buscar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; position: relative; z-index: 1; }
.p-buscar .p-search { flex: 1; min-width: 260px; }
.p-buscar .p-disp { margin: 0; }
.p-sec-head { display: flex; align-items: baseline; gap: 12px; margin: 0 0 14px; }
.p-sec-head h2 { font-family: var(--serif); font-size: 22px; font-weight: 600; margin: 0; }
.p-flechas { margin-left: auto; display: flex; gap: 6px; align-self: center; }
.p-flechas .btn { width: 36px; height: 36px; padding: 0; border-radius: 50%; }
.p-flechas #cat-izq svg { transform: rotate(180deg); }
.p-cats-sec { margin-bottom: 30px; }
.p-cats { display: flex; gap: 18px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 6px 4px 12px; margin: 0 -4px; scrollbar-width: none; }
.p-cats::-webkit-scrollbar { display: none; }
.p-cat { flex: none; width: 230px; scroll-snap-align: start; border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.p-cat .stage {
  position: relative; height: 200px; border-radius: 22px; overflow: hidden; transition: box-shadow .25s, transform .25s;
  background:
    radial-gradient(120% 60% at 50% 100%, rgba(255, 255, 255, .9), transparent 60%),
    linear-gradient(180deg, #f7f5ef 0%, #efece3 64%, #e6e1d5 64.4%, #f1eee6 100%);
  box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(4, 26, 49, .06), 0 10px 26px -14px rgba(4, 26, 49, .35);
}
.p-cat .stage::before { content: ""; position: absolute; left: 12%; right: 12%; top: 14px; bottom: 36%; border-radius: 10px; background: linear-gradient(180deg, rgba(255, 255, 255, .7), rgba(255, 255, 255, .15)); }
.p-cat .fan { position: absolute; inset: 0; }
.p-cat .fan-i { position: absolute; left: 50%; bottom: 34px; width: 78px; margin-left: -39px; transform: translate(calc(var(--x) * var(--k, 1)), calc(var(--y) * -1)) rotate(var(--r)); transition: transform .35s cubic-bezier(.2, .9, .3, 1.2); }
.p-cat .fan-i .cover { width: 100%; font-size: 8.5px; box-shadow: inset 4px 0 0 rgba(0, 0, 0, .18), 0 14px 22px -8px rgba(4, 26, 49, .5); }
.p-cat:hover .fan-i { transform: translate(calc(var(--x) * var(--k, 1) * 1.18), calc(var(--y) * -1 - 8px)) rotate(calc(var(--r) * 1.4)); }
.p-cat .fan-vacio { position: absolute; inset: 0; display: grid; place-items: center; color: #cfc9b9; }
.p-cat .fan-vacio svg { width: 44px; height: 44px; }
.p-cat .ring { position: absolute; left: 50%; bottom: 16px; width: 150px; height: 34px; margin-left: -75px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .95); box-shadow: 0 0 16px 4px rgba(96, 170, 255, .55), inset 0 0 12px 2px rgba(96, 170, 255, .45);
  opacity: 0; transform: scale(.8); transition: opacity .3s, transform .3s; }
.p-cat:hover .ring { opacity: .6; transform: scale(.95); }
.p-cat.on .ring { opacity: 1; transform: scale(1); }
.p-cat.on .stage { box-shadow: 0 0 0 3px var(--navy-800), 0 16px 30px -14px rgba(4, 26, 49, .5); }
.p-cat:focus-visible { outline: none; }
.p-cat:focus-visible .stage { box-shadow: 0 0 0 3px var(--gold); }
.p-cat .lbl { padding: 12px 6px 0; }
.p-cat .lbl b { display: block; font-size: 15px; font-weight: 800; }
.p-cat .lbl small { color: var(--ink-3); font-size: 12.5px; }
.p-cat.on .lbl b { color: var(--navy-800); }
.p-cat.on .lbl b::after { content: ""; display: block; width: 28px; height: 3px; border-radius: 3px; background: var(--gold); margin-top: 5px; }
#plibros-head { flex-wrap: wrap; }
@media (max-width: 900px) {
  .p-flechas { display: none; }
  .p-cat { width: 176px; }
  .p-cat .stage { height: 160px; }
  .p-cat .fan-i { width: 68px; margin-left: -34px; bottom: 28px; }
  .p-cat .fan-i { --k: .72; }
  .p-cat .ring { width: 120px; margin-left: -60px; bottom: 12px; }
  .p-buscar .p-search { min-width: 0; flex-basis: 100%; }
}

/* ================================================================ Logo del colegio y ciclos */
.crest.con-fondo { background: #fff; border-radius: 12px; padding: 4px; box-sizing: content-box; }
.carnet .top .crest.con-fondo { border-radius: 6px; padding: 2px; }
.logo-prev { display: flex; gap: 12px; flex-wrap: wrap; }
.logo-prev .lp-osc { flex: 1; min-width: 220px; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; background: linear-gradient(180deg, var(--navy-900), var(--navy-950)); color: #fff; }
.logo-prev .lp-osc .crest { height: 48px; width: auto; }
.logo-prev .lp-osc b { display: block; font-family: var(--serif); font-size: 16px; }
.logo-prev .lp-osc span { font-size: 10.5px; color: var(--gold); letter-spacing: .14em; text-transform: uppercase; font-weight: 700; }
.logo-prev .lp-cla { display: grid; place-items: center; padding: 14px 18px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); }
.logo-prev .lp-cla .crest { height: 48px; width: auto; }
.ed-ciclos { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.ed-ciclos > .btn { align-self: flex-start; margin-top: 4px; }
.ed-ciclo { display: flex; align-items: center; gap: 10px; }
.ed-ciclo .input { flex: 1; }
.ed-num { width: 26px; height: 26px; border-radius: 50%; background: var(--navy-100); color: var(--navy-700); display: grid; place-items: center; font-weight: 800; font-size: 12px; flex: none; }
