/* =====================================================================
   Digital Signature — Sistema de diseño (paleta Aqua)
   Compartido por todas las pantallas y por la página web.
   ===================================================================== */
/* --aqua es el color de marca. Es claro, así que no lleva texto blanco
   encima: los botones usan --accent, un aqua profundo que sí lo admite
   (contraste 5:1). --on-accent / --on-brand son el color del texto sobre
   cada botón, y se invierten en modo oscuro. */

:root {
  --bg: #F2F8F8;
  --surface: #FFFFFF;
  --surface-2: #E6F3F3;
  --surface-3: #DAEBEB;
  --border: #CFE3E3;
  --ink: #12292C;
  --ink-muted: #4A6266;
  --ink-faint: #728C8F;
  --aqua: #3CC6C0;
  --aqua-ink: #062A2D;
  --logo-ink: #0D1323;
  --logo-accent: #1FA8A2;
  --brand: #0E4A4F;
  --brand-strong: #0A383C;
  --brand-tint: #D2F0EE;
  --accent: #087A7D;
  --accent-strong: #065F63;
  --accent-tint: #D2F0EE;
  --on-accent: #FFFFFF;
  --on-brand: #FFFFFF;
  --info: #2F6A8F;
  --info-bg: #DDEDF5;
  --success: #3D8361;
  --success-bg: #E4F1E9;
  --warning: #93691E;
  --warning-bg: #F7EDDC;
  --critical: #B33A5B;
  --critical-bg: #F7E3E9;
  --shadow: 0 1px 2px rgba(18,41,44,0.07), 0 8px 24px -12px rgba(18,41,44,0.18);
  --scrim: rgba(6,42,45,0.55);
  --focus: #2F6FED;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C1617;
    --surface: #122021;
    --surface-2: #172A2B;
    --surface-3: #1E3536;
    --border: #2A4547;
    --ink: #E3F1F1;
    --ink-muted: #9DB8BA;
    --ink-faint: #6D8A8C;
    --aqua: #3CC6C0;
    --aqua-ink: #062A2D;
    --logo-ink: #E3F1F1;
    --logo-accent: #3CC6C0;
    --brand: #8BE0DC;
    --brand-strong: #B3ECE9;
    --brand-tint: #123A3B;
    --accent: #3CC6C0;
    --accent-strong: #6FD8D3;
    --accent-tint: #0F3637;
    --on-accent: #062A2D;
    --on-brand: #062A2D;
    --info: #8FC0DE;
    --info-bg: #17303D;
    --success: #74C39A;
    --success-bg: #1B3327;
    --warning: #E0B15E;
    --warning-bg: #3A2E14;
    --critical: #E28FA1;
    --critical-bg: #3A1E27;
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 12px 28px -14px rgba(0,0,0,0.6);
    --scrim: rgba(0,0,0,0.6);
    --focus: #6D97F5;
  }
}

:root[data-theme="dark"] {
  --bg: #0C1617;
  --surface: #122021;
  --surface-2: #172A2B;
  --surface-3: #1E3536;
  --border: #2A4547;
  --ink: #E3F1F1;
  --ink-muted: #9DB8BA;
  --ink-faint: #6D8A8C;
  --aqua: #3CC6C0;
  --aqua-ink: #062A2D;
  --logo-ink: #E3F1F1;
  --logo-accent: #3CC6C0;
  --brand: #8BE0DC;
  --brand-strong: #B3ECE9;
  --brand-tint: #123A3B;
  --accent: #3CC6C0;
  --accent-strong: #6FD8D3;
  --accent-tint: #0F3637;
  --on-accent: #062A2D;
  --on-brand: #062A2D;
  --info: #8FC0DE;
  --info-bg: #17303D;
  --success: #74C39A;
  --success-bg: #1B3327;
  --warning: #E0B15E;
  --warning-bg: #3A2E14;
  --critical: #E28FA1;
  --critical-bg: #3A1E27;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 12px 28px -14px rgba(0,0,0,0.6);
  --scrim: rgba(0,0,0,0.6);
  --focus: #6D97F5;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0;
  color: var(--ink);
}

.mono {
  font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- marca ---------- */
/* El logo registrado: arcos concéntricos y el nombre en mayúsculas.
   Los arcos se dibujan con máscaras para que tomen los colores del tema
   (oscuros sobre fondo claro, claros sobre fondo oscuro). El "DS" que
   trae el HTML queda oculto; solo lo leen los lectores de pantalla. */
/* Es un enlace a la página de presentación: el camino de vuelta desde
   cualquier pantalla del sistema. */
.brand-mark { display: flex; align-items: center; gap: 10px; text-decoration: none; }
a.brand-mark:hover .wordmark { color: var(--accent-strong); }
.brand-mark .seal {
  position: relative; width: 36px; height: 36px; flex: none;
  font-size: 0; color: transparent;
}
.brand-mark .seal::before,
.brand-mark .seal::after { content: ""; position: absolute; inset: 0; }
.brand-mark .seal::before {
  background: var(--logo-ink);
  -webkit-mask: url("logo-arcos.svg") center / contain no-repeat;
          mask: url("logo-arcos.svg") center / contain no-repeat;
}
.brand-mark .seal::after {
  background: var(--logo-accent);
  -webkit-mask: url("logo-acento.svg") center / contain no-repeat;
          mask: url("logo-acento.svg") center / contain no-repeat;
}
.brand-mark .wordmark {
  font-family: Arial, Helvetica, sans-serif; font-weight: 700;
  font-size: 15px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--logo-ink);
}
.compliance-note { font-size: 11px; color: var(--ink-faint); letter-spacing: 0.02em; }

/* ---------- superficies ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 9px; border: 1px solid transparent;
  padding: 9px 16px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-accent:hover:not(:disabled) { background: var(--accent-strong); }
.btn-brand { background: var(--brand); color: var(--on-brand); }
.btn-brand:hover:not(:disabled) { background: var(--brand-strong); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.full-width-btn { width: 100%; padding: 12px; font-size: 14px; }

/* ---------- estados ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  padding: 3px 10px 3px 8px; border-radius: 999px; white-space: nowrap;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.chip-success  { background: var(--success-bg);  color: var(--success); }
.chip-success::before  { background: var(--success); }
.chip-info     { background: var(--info-bg);     color: var(--info); }
.chip-info::before     { background: var(--info); }
.chip-warning  { background: var(--warning-bg);  color: var(--warning); }
.chip-warning::before  { background: var(--warning); }
.chip-critical { background: var(--critical-bg); color: var(--critical); }
.chip-critical::before { background: var(--critical); }
/* Nombres cortos que usan el panel de operador y el de observaciones. */
.chip.ok  { background: var(--success-bg);  color: var(--success); }
.chip.ok::before  { background: var(--success); }
.chip.bad { background: var(--critical-bg); color: var(--critical); }
.chip.bad::before { background: var(--critical); }
.chip-neutral  { background: var(--surface-3);   color: var(--ink-muted); }
.chip-neutral::before  { background: var(--ink-faint); }

/* ---------- formularios ---------- */
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field label { font-size: 12.5px; font-weight: 600; color: var(--ink-muted); }
.form-field input {
  border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 9px; padding: 10px 12px; font-size: 14px; color: var(--ink);
  width: 100%;
}
.form-field input:focus { border-color: var(--brand); background: var(--surface); }
.form-field input::placeholder { color: var(--ink-faint); }

.password-wrap { position: relative; display: flex; }
.password-wrap input { padding-right: 68px; letter-spacing: 0.03em; }
.password-wrap.invalid input { border-color: var(--critical); }
.toggle-visibility {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; color: var(--brand);
  font-size: 11.5px; font-weight: 600; padding: 6px 8px; cursor: pointer; border-radius: 6px;
}
.toggle-visibility:hover { background: var(--surface-3); }

.req-list { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.req-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-faint); transition: color 0.15s ease; }
.req-item .req-dot {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 1.5px solid var(--ink-faint);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.req-item.met { color: var(--success); }
.req-item.met .req-dot { background: var(--success); border-color: var(--success); color: var(--surface); }

.match-note { font-size: 12px; color: var(--ink-faint); margin-top: 6px; }
.match-note.ok  { color: var(--success);  font-weight: 600; }
.match-note.bad { color: var(--critical); font-weight: 600; }

.consent-line {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 12.5px; color: var(--ink-muted); line-height: 1.5;
}
.consent-line input { margin-top: 3px; accent-color: var(--accent); flex: none; }

/* ---------- avisos ---------- */
.legal-callout {
  display: flex; gap: 10px;
  background: var(--accent-tint);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  padding: 13px 14px; font-size: 12.5px; color: var(--ink); line-height: 1.55;
}
.legal-callout strong { color: var(--accent-strong); }

.alert {
  padding: 11px 14px; border-radius: 10px; font-size: 13px; line-height: 1.5;
  display: none;
}
.alert.visible { display: block; }
.alert-error   { background: var(--critical-bg); color: var(--critical); }
.alert-success { background: var(--success-bg);  color: var(--success); }
.alert-info    { background: var(--info-bg);     color: var(--info); }

.security-note {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 11.5px; color: var(--ink-faint); line-height: 1.5;
}
.security-note .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-faint); margin-top: 6px; flex: none; }

/* ---------- identidad ---------- */
.identity-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--surface-2); border-radius: 12px;
}
.identity-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--brand-tint); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex: none;
}
.identity-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.identity-name { font-size: 14px; font-weight: 600; }
.identity-meta { font-size: 12px; color: var(--ink-faint); }

/* ---------- recibo ---------- */
.receipt-lines { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.receipt-line {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px;
}
.receipt-line .concepto { color: var(--ink-muted); }
.receipt-line .monto { font-variant-numeric: tabular-nums; }
.receipt-line.descuento .monto { color: var(--critical); }
.receipt-line.total {
  border-bottom: none; border-top: 1.5px solid var(--ink);
  padding-top: 12px; margin-top: 4px; font-weight: 700; font-size: 16px;
}
.receipt-line.total .monto { font-family: Georgia, serif; }

/* ---------- tablas ---------- */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-faint); font-weight: 600; padding: 10px 16px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 12px 16px; font-size: 13.5px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand-tint); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex: none;
}
.empleado-cell { display: flex; align-items: center; gap: 10px; }
.empleado-cell .nombre { font-weight: 600; }
.empleado-cell .cuil { font-size: 12px; color: var(--ink-faint); }

.icon-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-muted);
  border-radius: 7px; padding: 6px 10px; font-size: 12px; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:disabled { opacity: 0.55; cursor: default; }

/* ---------- invitaciones de administrador ---------- */
.inv-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; background: var(--surface-2); border-radius: 10px;
}
.inv-datos { min-width: 0; }
.inv-nombre { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.inv-meta { font-size: 11.5px; color: var(--ink-faint); overflow-wrap: anywhere; }
.inv-acciones { display: flex; gap: 6px; flex: none; }

/* ---------- utilidades ---------- */
.stack { display: flex; flex-direction: column; }
.gap-s  { gap: 8px; }
.gap-m  { gap: 14px; }
.gap-l  { gap: 20px; }
.muted  { color: var(--ink-muted); }
.faint  { color: var(--ink-faint); }
.center { text-align: center; }
.hidden { display: none !important; }

.check-seal {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--success-bg); color: var(--success);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}

.audit-box {
  width: 100%; text-align: left; background: var(--surface-2);
  border-radius: 10px; padding: 12px 14px; font-size: 11.5px;
  color: var(--ink-faint); display: flex; flex-direction: column; gap: 5px;
}
.audit-box .row { display: flex; justify-content: space-between; gap: 12px; }
.audit-box .row span:last-child { color: var(--ink-muted); text-align: right; word-break: break-all; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: girar 0.7s linear infinite; display: inline-block;
}
@keyframes girar { to { transform: rotate(360deg); } }
