:root {
  /* Tema Kietol + azul marino */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --ink: #13233a;
  --ink-2: #44546b;
  --muted: #6f7c8f;
  --line: #e2e6ec;
  --line-strong: #cdd4de;
  --accent: #f07415;          /* naranja Kietol: acciones e importes clave */
  --accent-deep: #b4540b;     /* naranja oscuro para texto pequeño sobre blanco */
  --accent-ink: #ffffff;
  --accent-soft: #fdebdc;
  --navy: #102339;            /* superficies oscuras */
  --navy-2: #1a3655;
  --blue: #2c6493;            /* datos: barras y categorías */
  --blue-soft: #e4eef7;
  --bar: var(--blue);
  --bar-track: #e7edf3;
  --warn-bg: #fff4ea;
  --warn-ink: #8a4508;
  --radius: 12px;
  /* Tokens que cada tema puede cambiar (ver themes.css) */
  --btn-bg: var(--accent);
  --btn-bg-hover: #e0660c;
  --btn-ink: #ffffff;
  --btn-shadow: 0 8px 18px rgba(240, 116, 21, .28);
  --total-value: #ffffff;
  --total-note: #ffb27a;
  --grand: var(--accent);
  --heading-accent: var(--accent);
  --brand-glow: 0 0 22px rgba(240, 116, 21, .35);
  --font: "Rajdhani", "Noto Sans TC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: var(--font);
}
html[lang^="zh"] { --font: "Noto Sans TC", "Rajdhani", system-ui, sans-serif; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
}
html[lang^="zh"] body { font-size: 15px; font-weight: 400; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; }
.brand { font-weight: 700; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.lang-switch { display: inline-flex; background: var(--bar-track); border-radius: 999px; padding: 3px; }
.lang-switch button {
  border: 0; background: transparent; color: var(--ink-2);
  font: 700 14px/1 var(--font); padding: 7px 13px; border-radius: 999px; cursor: pointer;
}
.lang-switch button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.btn-print {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  font: 600 14px/1 var(--font); padding: 9px 14px; border-radius: 999px; cursor: pointer;
}
.btn-print:hover { border-color: var(--accent); color: var(--accent-deep); }
.lang-switch button:focus-visible, .btn-print:focus-visible, .chip:focus-visible, .sort:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* Hero */
.hero { padding: 40px 0 24px; }
.hero h1 { font-family: var(--serif); font-weight: 700; font-size: clamp(30px, 4.6vw, 44px); line-height: 1.08; margin: 0 0 8px; }
.subtitle { margin: 0; color: var(--ink-2); font-size: 19px; }
.meta { margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.meta strong { color: var(--ink); font-weight: 600; }

/* Summary tiles */
.summary { display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: 12px; margin-bottom: 40px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; display: flex; gap: 14px; align-items: center; position: relative; overflow: hidden; }
.tile-ic { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 19px; flex-shrink: 0; }
.tile .label { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.tile .value { font-size: clamp(26px, 3.4vw, 30px); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile .note { font-size: 13px; color: var(--muted); margin-top: 2px; }
.tile.total { background: linear-gradient(120deg, var(--navy), var(--navy-2)); border-color: transparent; color: #fff; }
.tile.total .tile-ic { background: var(--btn-bg); color: var(--btn-ink); }
.tile.total .label { color: rgba(255, 255, 255, .72); }
.tile.total .value { color: var(--total-value); }
.tile.total .note { color: var(--total-note); }

/* Blocks */
.block { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; margin-bottom: 24px; }
.block-head { margin-bottom: 20px; }
.block h2 { font-family: var(--serif); font-weight: 700; font-size: 27px; line-height: 1.2; margin: 0 0 6px; }
.block h2 .k { color: var(--heading-accent); }
.lead { margin: 0; color: var(--ink-2); }
.sub { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin: 0 0 12px; }
html[lang^="zh"] .sub { text-transform: none; letter-spacing: .02em; font-size: 14px; }

/* Category bars */
.bars { list-style: none; margin: 0 0 28px; padding: 0; display: grid; gap: 6px; }
.bar-row {
  display: grid; grid-template-columns: minmax(150px, 220px) 1fr auto; gap: 12px; align-items: center;
  padding: 4px 6px; margin: 0 -6px; border-radius: 6px; cursor: pointer; border: 0; background: none;
  font: inherit; color: inherit; text-align: left; width: calc(100% + 12px);
}
.bar-row:hover, .bar-row[aria-pressed="true"] { background: var(--blue-soft); }
.bar-name { font-size: 15px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { display: block; height: 9px; background: var(--bar-track); border-radius: 5px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--bar); border-radius: 0 5px 5px 0; min-width: 2px; }
.bar-val { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 92px; text-align: right; }

/* Filters */
.filters { display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; }
.filters input {
  width: 100%; max-width: 420px; font: 500 16px var(--font); color: var(--ink);
  padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg);
}
.filters input:focus { border-color: var(--accent); background: var(--surface); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  font: 600 14px/1 var(--font); padding: 7px 12px; border-radius: 999px; cursor: pointer;
}
.chip:hover { border-color: var(--blue); }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.showing { font-size: 13px; color: var(--muted); margin: 8px 0 12px; }

/* Ledger table */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ledger { width: 100%; border-collapse: collapse; }
.ledger th {
  text-align: left; font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .1em; padding: 10px 14px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
html[lang^="zh"] .ledger th { text-transform: none; letter-spacing: 0; font-size: 13px; }
.ledger th.num { text-align: right; }
.ledger td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 15px; }
.ledger tbody tr:last-child td { border-bottom: 0; }
.ledger tbody tr:hover td { background: #f8fafc; }
.ledger td.date { white-space: nowrap; color: var(--ink-2); }
.ledger td.receipt { font-size: 14px; letter-spacing: .04em; color: var(--ink-2); white-space: nowrap; }
.ledger td.amount { font-weight: 700; }
.ledger td.cat span { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 6px; background: var(--blue-soft); color: #24557f; white-space: nowrap; }
.sort { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.sort i { font-style: normal; font-size: 10px; opacity: .35; }
.sort[data-dir] i { opacity: 1; }
.sort[data-dir="asc"] i::after { content: "▲"; }
.sort[data-dir="desc"] i::after, .sort:not([data-dir]) i::after { content: "▼"; }
.empty td { text-align: center; color: var(--muted); padding: 28px; }

/* Claims */
.claims { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.claim { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.claim.wide { grid-column: 1 / -1; }
.claim-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.claim h4 { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; }
.claim .amt { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.claim .calc { font-size: 14px; color: var(--ink-2); background: var(--bg); border-radius: 8px; padding: 5px 10px; align-self: flex-start; }
.claim .calc b { font-weight: 700; color: var(--muted); margin-right: 6px; }
.claim ul { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 15px; }
.claim.wide ul { columns: 2; column-gap: 32px; }
.claim li { margin: 2px 0; break-inside: avoid; }
.claim a { color: var(--accent-deep); font-weight: 600; font-size: 15px; }

.pending { margin-top: 28px; padding: 18px 20px; background: var(--warn-bg); border-radius: var(--radius); }
.pending .sub { color: var(--warn-ink); }
.pending .lead { font-size: 14px; color: var(--warn-ink); }
.pending ul { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 24px; }
.pending li { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; padding: 6px 0; border-bottom: 1px dashed rgba(138, 69, 8, .25); }
.pending li em { font-style: normal; color: var(--warn-ink); font-weight: 500; white-space: nowrap; }

/* Totals */
.totals { background: var(--navy); color: #fff; border-radius: 16px; padding: 24px 28px; margin-bottom: 24px; }
.totals dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; }
.totals dt { color: rgba(255, 255, 255, .72); }
.totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.totals .grand { border-top: 1px solid rgba(255, 255, 255, .18); padding-top: 12px; margin-top: 4px; font-size: 26px; color: #fff; font-weight: 700; }
.totals dd.grand { color: var(--grand); }
.totals .pnote { grid-column: 1 / -1; font-size: 13px; color: rgba(255, 255, 255, .65); }

.foot { color: var(--muted); font-size: 13px; padding: 0 0 48px; }

a.btn-print { text-decoration: none; display: inline-block; }

/* Login */
.login-page {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 32px 16px;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='900' viewBox='0 0 1200 900' fill='none' stroke='%232c6493' stroke-opacity='.16' stroke-width='1.5'%3E%3Cpolygon points='-60,120 380,40 470,470 60,560'/%3E%3Cpolygon points='760,-30 1180,90 1060,420 820,330'/%3E%3Cpolygon points='-40,700 420,600 640,880 160,1000'/%3E%3Cpolygon points='900,560 1260,470 1240,960 1000,960'/%3E%3Cpolyline points='0,320 1200,430'/%3E%3Cpolyline points='540,0 700,900'/%3E%3C/svg%3E");
  background-size: cover; background-position: center;
}
.login-page[data-brand]::before {
  content: attr(data-brand); font-weight: 700; font-size: clamp(22px, 5vw, 44px); letter-spacing: .28em; text-indent: .28em;
  color: var(--heading-accent); text-shadow: var(--brand-glow); text-align: center;
}
.login-card {
  width: 100%; max-width: 400px; background: rgba(255, 255, 255, .94); border: 1px solid var(--line);
  border-radius: 18px; padding: 30px 28px; text-align: center; box-shadow: 0 18px 44px rgba(16, 35, 57, .10);
}
.login-icon { width: 44px; height: 44px; border-radius: 11px; background: var(--btn-bg); color: var(--btn-ink); display: grid; place-items: center; margin: 0 auto 14px; }
.login-card h1 { margin: 0 0 22px; font-size: 22px; font-weight: 700; display: flex; flex-direction: column; gap: 0; }
.login-card h1 span + span { font-size: 15px; font-weight: 500; color: var(--muted); }
.login-card form { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.login-card label { font-size: 13px; color: var(--ink-2); font-weight: 700; letter-spacing: .03em; margin-top: 4px; }
.login-card input {
  font: 600 18px var(--font); letter-spacing: .15em; padding: 11px 14px; border: 0; border-bottom: 2px solid var(--accent);
  border-radius: 9px; background: var(--bar-track); color: var(--ink); width: 100%;
}
.login-card input.plain { letter-spacing: 0; font-size: 16px; }
.login-card input:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.login-card button {
  margin-top: 14px; border: 0; border-radius: 10px; padding: 13px; background: var(--btn-bg); color: var(--btn-ink);
  font: 700 17px var(--font); cursor: pointer; box-shadow: var(--btn-shadow);
}
.login-card button:hover { background: var(--btn-bg-hover); }
.login-card button:disabled, .login-card input:disabled { opacity: .5; cursor: not-allowed; }
.login-opt { display: block; font-weight: 400; color: var(--muted); }
.login-note { margin: 12px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); text-align: center; }
.login-error { margin: 0; font-size: 13px; color: #9b2c1f; background: #fbeae7; border-radius: 6px; padding: 8px 10px; }

/* Responsive */
@media (max-width: 820px) {
  .summary { grid-template-columns: 1fr 1fr; }
  .tile.total { grid-column: 1 / -1; }
  .claims { grid-template-columns: 1fr; }
  .claim.wide ul { columns: 1; }
  .pending ul { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .brand { display: none; }
  .topbar-inner { justify-content: flex-end; }
  .hero { padding-top: 28px; }
  .summary { grid-template-columns: 1fr; }
  .block { padding: 20px 16px; border-radius: 12px; }
  .bar-row { grid-template-columns: 1fr auto; row-gap: 4px; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .table-wrap { border: 0; border-radius: 0; }
  .ledger thead { display: none; }
  .ledger, .ledger tbody, .ledger tr, .ledger td { display: block; width: 100%; }
  .ledger tr { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
  .ledger td { padding: 0; border: 0; }
  .ledger tbody tr:last-child td { border: 0; }
  .ledger td.date { grid-column: 1; grid-row: 1; font-size: 13px; }
  .ledger td.amount { grid-column: 2; grid-row: 1 / span 2; text-align: right; font-size: 16px; }
  .ledger td.desc { grid-column: 1; grid-row: 2; }
  .ledger td.cat { grid-column: 1; grid-row: 3; }
  .ledger td.receipt { grid-column: 2; grid-row: 3; text-align: right; align-self: center; font-size: 12px; }
  .ledger td.receipt:empty { display: none; }
  .empty td { display: block; }
  .totals { padding: 20px 16px; }
}

/* Print: everything visible, no controls */
@media print {
  body { background: #fff; font-size: 10pt; }
  .wrap { max-width: none; padding: 0; }
  .hero { padding: 0 0 12px; }
  .hero h1 { font-size: 20pt; }
  .summary { margin-bottom: 16px; gap: 8px; }
  .tile { padding: 10px 14px; }
  .tile .value { font-size: 16pt; }
  .block { margin-bottom: 18px; }
  .block h2 { font-size: 15pt; }
  .bars { margin-bottom: 14px; gap: 2px; }
  .bar-row { padding: 1px 6px; }
  .ledger th, .ledger td { padding: 5px 8px; font-size: 9pt; }
  .ledger td.cat span { font-size: 8pt; padding: 1px 5px; }
  .claim { padding: 10px 12px; gap: 4px; }
  .claim ul { font-size: 9pt; }
  .totals { padding: 14px 18px; }
  .foot { padding-bottom: 0; }
  .ledger thead { display: table-header-group; }
  .block h2, .sub { break-after: avoid; }
  .topbar, .filters, .showing { display: none !important; }
  .tile, .claim, .pending, .totals { break-inside: avoid-page; }
  .summary { grid-template-columns: 1fr 1fr 1.25fr; }
  .claims { grid-template-columns: repeat(2, 1fr); }
  .block { padding: 0; border: 0; }
  .ledger tr { break-inside: avoid; }
  .tile.total, .totals, .tile-ic, .bar-fill, .bar-track, .ledger td.cat span, .pending { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .bar-row { pointer-events: none; }
  a { color: inherit; text-decoration: none; }
}
@media print {
  .summary { grid-template-columns: 1fr 1fr 1.25fr !important; }
  .tile.total { grid-column: auto !important; }
  #part2 { break-before: page; }
  .claim.wide ul { columns: 2; }
}
/* Horizontal: tramo 2 en tres columnas */
@media print { body.print-landscape .claims { grid-template-columns: repeat(3, 1fr); } body.print-landscape .claim.wide { grid-column: 1 / -1; } }

/* Barra del modo PDF (solo en pantalla) */
.print-bar {
  position: sticky; top: 0; z-index: 30; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap;
  background: var(--navy); color: #fff; padding: 10px 16px; font-size: 15px;
}
.print-bar button { border: 0; border-radius: 8px; padding: 9px 16px; background: var(--btn-bg); color: var(--btn-ink); font: 700 15px var(--font); cursor: pointer; }
body[class*="print-"] .topbar { display: none; }
@media print { .print-bar { display: none !important; } }

/* Protección de la página (lock.js) */
html.lock-copy body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html.lock-copy input, html.lock-copy textarea { -webkit-user-select: text; user-select: text; }
html.lock-print #printBtn { display: none; }
@media print {
  html.lock-print body > * { display: none !important; }
  html.lock-print body::after { content: "—"; display: block; text-align: center; padding-top: 40vh; color: #999; }
}

@media print { .bar-row:hover, .bar-row[aria-pressed="true"] { background: none; } }


/* Acceso al panel */
.btn-print.btn-admin { border-color: var(--accent); color: var(--accent-deep); font-weight: 700; }
.login-admin { display: inline-block; margin-top: 16px; font-size: 12px; color: var(--muted); text-decoration: none; letter-spacing: .04em; }
.login-admin:hover { color: var(--accent-deep); text-decoration: underline; }
@media print { .btn-admin { display: none !important; } }

/* Sin documento publicado */
.empty-state { text-align: center; padding: 18vh 16px; color: var(--ink-2); font-size: 18px; }
.empty-ic { width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 26px; font-weight: 700; }

/* Elegir caso */
.case-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; padding-bottom: 48px; }
.case-card {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; transition: border-color .15s, box-shadow .15s;
}
.case-card:hover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(16, 35, 57, .08); }
.case-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.case-card-ic { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 20px; }
.case-card strong { display: block; font-size: 18px; line-height: 1.25; }
.case-card small { display: block; color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.case-card em { display: block; font-style: normal; color: var(--muted); font-size: 13px; margin-top: 4px; }
.case-card-go { color: var(--muted); font-size: 20px; }
.case-card:hover .case-card-go { color: var(--accent); }
.case-switch {
  font: 600 14px var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 7px 12px; max-width: 260px; cursor: pointer;
}
.case-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 640px) {
  .topbar-inner { height: auto; min-height: 56px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .case-switch { max-width: 100%; order: 10; flex: 1 1 100%; }
}
@media print { .case-switch { display: none !important; } }

/* Adjuntos */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.clip {
  display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; padding: 1px 8px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font: 600 12px var(--font); vertical-align: 1px;
}
.clip:hover { border-color: var(--accent); color: var(--accent-deep); }
.clip:focus-visible, .thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.thumb { width: 64px; height: 64px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); padding: 0; cursor: pointer; background: var(--bar-track); display: grid; place-items: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover { border-color: var(--accent); }
.thumb-pdf { font: 700 13px var(--font); color: #fff; background: #c0392b; border-radius: 6px; padding: 5px 7px; }
.thumb-pdf.big { font-size: 22px; padding: 14px 18px; border-radius: 10px; }

.viewer { position: fixed; inset: 0; z-index: 100; background: rgba(8, 14, 24, .97); display: flex; flex-direction: column; }
.viewer[hidden] { display: none; }
html.viewer-open { overflow: hidden; }
.viewer-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; color: #fff; }
.viewer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.viewer-count { color: rgba(255,255,255,.7); font-variant-numeric: tabular-nums; }
.viewer-btn { color: #fff; background: rgba(255,255,255,.12); border: 0; border-radius: 8px; padding: 8px 12px; font: 600 14px var(--font); cursor: pointer; text-decoration: none; }
.viewer-btn:hover { background: rgba(255,255,255,.22); }
.viewer-body { flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 56px 24px; }
.viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.viewer-pdf { text-align: center; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.viewer-open { color: #fff; background: var(--btn-bg); padding: 12px 20px; border-radius: 10px; font-weight: 700; text-decoration: none; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0; border-radius: 10px; background: rgba(255,255,255,.12); color: #fff; font-size: 34px; cursor: pointer; }
.viewer-nav:hover:not(:disabled) { background: rgba(255,255,255,.25); }
.viewer-nav:disabled { opacity: .25; cursor: default; }
.viewer-nav.prev { left: 8px; }
.viewer-nav.next { right: 8px; }
@media (max-width: 640px) {
  .viewer-body { padding: 0 8px 16px; }
  .viewer-nav { top: auto; bottom: 16px; transform: none; }
  .viewer-btn { padding: 7px 10px; font-size: 13px; }
}
@media print { .viewer { display: none !important; } .clip { border: 0; padding: 0; } }
