/* Portal del cliente — identidad PlanSec: navy #0f2138 + oro #c8a052,
   Georgia (títulos) + Bahnschrift (texto). Sin recursos externos (CSP). */
:root {
  --navy: #0f2138;
  --navy-2: #1a3557;
  --gold: #c8a052;
  --gold-soft: #e6d3ae;
  --paper: #f7f5f0;
  --ink: #1c2530;
  --muted: #5d6b7c;
  --line: #dcd6c8;
  --danger: #a33a2e;
  --ok: #2e7d4f;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: Bahnschrift, 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  display: flex;
  flex-direction: column;
}
#app { display: flex; flex-direction: column; min-height: 100vh; }

h1 { font-family: var(--serif); color: var(--navy); font-weight: 600; margin: 0 0 .35rem; font-size: 1.55rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
code { font-family: Consolas, monospace; font-size: .9em; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------- Cabecera */
.topbar {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .8rem 1.4rem;
  border-bottom: 3px solid var(--gold);
}
.brand-mark { font-family: var(--serif); font-size: 1.3rem; letter-spacing: .02em; }
.brand-mark strong { color: var(--gold); font-weight: 700; }
.brand-sub { margin-left: .8rem; font-size: .8rem; color: var(--gold-soft); text-transform: uppercase; letter-spacing: .14em; }
.topbar-user { display: flex; align-items: center; gap: 1rem; font-size: .9rem; }
.user-org { color: var(--gold-soft); font-weight: 600; }
.user-email { color: #b9c4d2; }

/* ------------------------------------------------------------- Layout */
#main { flex: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 2.2rem 1.2rem; }
.footer {
  text-align: center;
  padding: 1rem;
  font-size: .78rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

/* ------------------------------------------------------------- Tarjetas auth */
.auth-card {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(15, 33, 56, .08);
  max-width: 420px;
  margin: 7vh auto 0;
  padding: 2rem 2.2rem;
}
.auth-card.wide { max-width: 620px; }
.auth-card form { display: flex; flex-direction: column; gap: .95rem; margin-top: 1.2rem; }
.auth-card label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; color: var(--navy); font-weight: 600; }
.auth-card input {
  font: inherit;
  font-weight: 400;
  padding: .55rem .7rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fcfbf9;
}
.auth-card input:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }

.enroll-grid { display: flex; gap: 1.6rem; align-items: flex-start; margin-top: 1rem; flex-wrap: wrap; }
.enroll-qr { width: 190px; height: 190px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.enroll-secret { display: block; margin: .3rem 0 .6rem; padding: .45rem .6rem; background: var(--paper); border: 1px dashed var(--line); border-radius: 5px; word-break: break-all; }

/* ------------------------------------------------------------- Botones */
.btn {
  font: inherit;
  font-weight: 600;
  padding: .55rem 1.1rem;
  border-radius: 5px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { filter: none; background: var(--navy-2); }
.btn-secondary { background: var(--gold); color: var(--navy); }
.btn-ghost { background: transparent; color: inherit; border-color: rgba(255, 255, 255, .4); }
.btn-sm { padding: .3rem .7rem; font-size: .85rem; }
.btn-link { background: none; border: none; color: var(--muted); text-decoration: underline; cursor: pointer; margin-top: 1rem; font: inherit; font-size: .85rem; }
.form-error { color: var(--danger); font-size: .87rem; margin: .8rem 0 0; }

/* ------------------------------------------------------------- Informes */
.page-head { margin-bottom: 1.4rem; }
.tabla-informes {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(15, 33, 56, .06);
}
.tabla-informes th {
  font-family: var(--serif);
  text-align: left;
  background: var(--navy);
  color: var(--gold-soft);
  font-weight: 600;
  font-size: .82rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .7rem .9rem;
}
.tabla-informes td { padding: .75rem .9rem; border-top: 1px solid var(--line); font-size: .92rem; vertical-align: middle; }
.tabla-informes tr:hover td { background: #fbf9f4; }
.doc-titulo { font-weight: 600; color: var(--navy); }
.doc-meta { color: var(--muted); font-size: .82rem; }

.estado-vacio {
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

/* ------------------------------------------------------------- Varios */
.splash { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.spinner {
  width: 26px; height: 26px;
  border: 3px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 50%;
  display: inline-block;
  animation: girar .8s linear infinite;
}
.btn .spinner { width: 13px; height: 13px; border-width: 2px; margin-right: .45rem; vertical-align: -2px; }
@keyframes girar { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .topbar { flex-direction: column; gap: .5rem; }
  .auth-card { padding: 1.4rem 1.2rem; margin-top: 3vh; }
  .tabla-informes .col-opcional { display: none; }
}
