/* Firmador additions on top of the inventory's styles.css + themes.css (same variables, so light/dark follow along).
   Only what the inventory has no equivalent for: the PDF viewer, signature boxes, the upload drop zone. */
html[data-estilo] { --client: #2563eb; --client-soft: rgb(37 99 235 / 0.13); }
html[data-estilo][data-theme='dark'] { --client: #60a5fa; --client-soft: rgb(96 165 250 / 0.16); }

main.wide { max-width: 1440px; }
h1 .badge { vertical-align: middle; margin-left: 4px; }
h2 { font-family: var(--display); }
.panel h2 { margin-top: 0; font-size: 1rem; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush table th:first-child, .panel.flush table td:first-child { padding-left: 16px; }
.panel.empty { text-align: center; padding: 40px 20px; display: grid; gap: 10px; justify-items: center; }
.panel.empty h2 { margin: 0; }
table.docs td a { color: var(--text); text-decoration: none; }
table.docs td a:hover { color: var(--accent); }
.back { display: inline-block; font-size: .85rem; color: var(--muted); text-decoration: none; margin-bottom: 6px; }
.back:hover { color: var(--accent); }
.eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 0 0 4px; }
.stack { display: grid; gap: 8px; margin: 12px 0 6px; }
.status-msg { font-size: .88rem; min-height: 1.3em; margin: 6px 0 0; }
.status-msg[data-kind='error'] { color: var(--danger); font-weight: 600; }
.login-error:empty { display: none; }
.form-error { margin: 0 0 12px; }
.danger-link { color: var(--danger); margin-top: 10px; }
.menu form { margin: 0; }
.page-head > div { min-width: 0; }

/* Login extras: second-factor enrolment and the "link expired" card share the login panel */
.totp-qr { width: 190px; margin: 4px auto 10px; background: #fff; padding: 6px; border-radius: var(--radius); border: 1px solid var(--border); }
.totp-qr svg { display: block; width: 100%; height: auto; }
.totp-secret { text-align: center; word-break: break-all; margin-bottom: 14px; }
.login.msg { text-align: center; }

/* Upload */
.drop { position: relative; display: grid; gap: 4px; justify-items: center; text-align: center; padding: 36px 16px; margin-bottom: 16px;
  border: 2px dashed var(--border); border-radius: var(--radius-lg); background: var(--surface-soft); cursor: pointer; font-weight: 400;
  transition: border-color .15s ease, background-color .15s ease; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop:hover, .drop.is-over { border-color: var(--accent); }
.drop.has-file { border-style: solid; border-color: var(--ok); }
.drop-title { font: 700 1rem var(--display); }
.drop-file { font-weight: 700; color: var(--ok); }

/* Document page */
.doc-grid { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 18px; align-items: start; }
.side { position: sticky; top: 70px; max-height: calc(100vh - 86px); overflow-y: auto; scrollbar-width: thin; }
.side .panel { margin-bottom: 12px; }
.side .btn { width: 100%; }
.who-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 8px; }
.who-tool { font: inherit; font-weight: 700; font-size: .88rem; min-height: 36px; border-radius: var(--radius); cursor: pointer;
  background: var(--surface); border: 2px solid var(--border); color: var(--muted); }
.who--esitel.is-on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.who--client.is-on { border-color: var(--client); color: var(--client); background: var(--client-soft); }
.link-box { display: flex; gap: 6px; margin-top: 10px; }
.link-box[hidden] { display: none; }
.link-box input { font-size: .82rem; }
.link-box .btn { width: auto; flex: none; }
.files { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.signers { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 10px 0 14px; }
.signers dt { font-weight: 700; }
.signers dd { margin: 0; color: var(--muted); }
.audit-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; font-size: .88rem; }
.audit-list li { display: grid; gap: 1px; border-left: 2px solid var(--border); padding-left: 10px; }
.audit-list time { font-size: .76rem; color: var(--muted); }
.audit-list .note { font-size: .78rem; word-break: break-word; }
.how { margin: 0 0 4px; padding-left: 20px; display: grid; gap: 6px; }
.swatch { display: inline-block; width: 18px; height: 11px; vertical-align: -1px; border: 2px solid var(--client); background: var(--client-soft); }

.viewer { display: grid; gap: 22px; min-width: 0; padding-bottom: 20px; }
.loading { padding: 40px; text-align: center; }
.page { position: relative; width: 100%; max-width: 900px; margin-inline: auto; background: #fff; border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,.1), 0 8px 24px rgba(0,0,0,.06); }
.page canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.overlay { position: absolute; inset: 0; touch-action: pan-y; }
.overlay.is-editable { cursor: crosshair; touch-action: none; }
.page-no { position: absolute; right: 0; bottom: -18px; font-size: 11px; color: var(--muted); }
.box { position: absolute; border: 2px solid; display: flex; align-items: flex-start; justify-content: space-between; user-select: none; border-radius: 2px; }
.box--esitel { border-color: #d5121c; background: rgb(213 18 28 / .1); }
.box--client { border-color: #2563eb; background: rgb(37 99 235 / .12); }
.box.is-ghost { border-style: dashed; pointer-events: none; }
.box-label { font: 700 11px var(--font); color: #fff; padding: 1px 6px; white-space: nowrap; }
.box--esitel .box-label { background: #d5121c; }
.box--client .box-label { background: #2563eb; }
.is-editable .box { cursor: move; }
.box-del { border: 0; background: rgba(0,0,0,.65); color: #fff; width: 22px; height: 22px; line-height: 1; font-size: 16px; cursor: pointer; padding: 0; }
.box-del:hover { background: #d5121c; }
.box-resize { position: absolute; right: -5px; bottom: -5px; width: 12px; height: 12px; background: #fff; border: 2px solid currentColor; cursor: nwse-resize; }
.box--esitel .box-resize { color: #d5121c; }
.box--client .box-resize { color: #2563eb; }
.page-client .box--client { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { background: rgb(37 99 235 / .24); } }

@media (max-width: 900px) {
  .doc-grid { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 640px) { .hide-sm { display: none; } }
@media (prefers-reduced-motion: reduce) { .page-client .box--client { animation: none; } }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.info { background: var(--client-soft); color: var(--client); }
.overlay .box .box-label { color: #fff; }
.side .link-btn { margin-top: 2px; }
/* themes.css paints text with html[data-estilo] :is(p, span, dd, li…) { color: inherit } (specificity 0,2,1): colour rules on
   those elements need the same prefix to win. */
html[data-estilo] .eyebrow { color: var(--accent); }
html[data-estilo] .status-msg[data-kind='error'], html[data-estilo] .login-error, html[data-estilo] .danger-link { color: var(--danger); }
html[data-estilo] .drop-file { color: var(--ok); }
html[data-estilo] .signers dd, html[data-estilo] .page-no, html[data-estilo] .note { color: var(--muted); }
html[data-estilo] .badge.ok { color: var(--ok); } html[data-estilo] .badge.warn { color: var(--warn); } html[data-estilo] .badge.info { color: var(--client); }
