/* GoldenPass — identidad visual GoldenTrust (misma paleta, tipografía y estructura que GoldenAgencies) */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('fonts/inter.woff2') format('woff2-variations'), url('fonts/inter.woff2') format('woff2');
}

:root {
  /* Paleta corporativa GoldenTrust */
  --gt-primary: #022893;        /* azul corporativo */
  --gt-primary-600: #001f73;
  --gt-primary-light: #e7ecfa;
  --gt-navy: #001a5e;           /* sidebar */
  --gt-accent: #fcb931;         /* dorado acento */
  --gt-accent-600: #e0a41f;
  --gt-accent-light: #fff6e0;
  --gt-accent-ink: #3a2c00;

  --gt-bg: #f5f7fb;
  --gt-surface: #ffffff;
  --gt-border: #e6e9f2;
  --gt-border-soft: #f0f2f7;
  --gt-title: #071437;
  --gt-text: #1a2233;
  --gt-muted: #6b7280;
  --gt-muted-2: #99a1b7;
  --gt-side-text: #cdd6ef;
  --gt-side-label: #6f80b8;

  /* Estados */
  --ok: #1f9d55;   --ok-soft: #e5f5ec;
  --warn: #b7791f; --warn-soft: #fff6e0;
  --bad: #d64545;  --bad-soft: #fdecec;
  --info: #2f6fed; --info-soft: #e9f0fe;

  --radius: 12px;
  --shadow: 0 3px 4px rgba(7, 20, 55, .03);
  --shadow-pop: 0 12px 40px rgba(7, 20, 55, .12);
  --side-w: 265px;
  --header-h: 60px;
  color-scheme: light;
}

* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--gt-bg); color: var(--gt-text); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.25; color: var(--gt-title); font-weight: 700; }
h1 { font-size: 20px; } h2 { font-size: 16px; margin-top: 8px; } h3 { font-size: 15px; }
a { color: var(--gt-primary); text-decoration: none; }
a:hover { color: var(--gt-primary-600); }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--gt-border); border-radius: 10px; background: #f9fafc; color: var(--gt-title); }
textarea { height: auto; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gt-primary); background: #fff; box-shadow: 0 0 0 3px rgba(2, 40, 147, .08); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--gt-primary); outline-offset: 2px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 13px; color: var(--gt-title); }
label small { font-weight: 400; color: var(--gt-muted); }

/* Botones */
.btn { height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--gt-border); background: var(--gt-surface); color: var(--gt-title); font-weight: 600; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { background: var(--gt-primary-light); border-color: var(--gt-primary-light); color: var(--gt-primary); }
.btn.primary { background: var(--gt-primary); border-color: var(--gt-primary); color: #fff; }
.btn.primary:hover { background: var(--gt-primary-600); border-color: var(--gt-primary-600); color: #fff; }
.btn.accent { background: var(--gt-accent); border-color: var(--gt-accent); color: var(--gt-accent-ink); }
.btn.accent:hover { background: var(--gt-accent-600); border-color: var(--gt-accent-600); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad-soft); color: var(--bad); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }

/* Marca */
.gt-brand { font-weight: 800; letter-spacing: .3px; font-size: 20px; color: var(--gt-title); }
.gt-brand span { color: var(--gt-accent); }
.gt-brand.on-dark { color: #fff; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark { width: 36px; height: 36px; flex: none; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 500px at 50% -10%, #0a3bbf 0%, var(--gt-primary) 35%, var(--gt-navy) 100%); }
.login-card { width: 100%; max-width: 400px; background: var(--gt-surface); border-radius: 16px; padding: 32px; box-shadow: 0 24px 60px rgba(0, 10, 40, .35); display: grid; gap: 14px; border-top: 4px solid var(--gt-accent); }
.login-card .muted { font-size: 13px; }
.login-card .btn.primary { height: 44px; font-size: 15px; }
.login-card a.muted { justify-self: center; font-size: 12.5px; }
.login-card a.muted:hover { color: var(--gt-primary); }
.login-foot { color: rgba(255, 255, 255, .7); font-size: 12px; text-align: center; margin-top: 16px; }
.qr { display: block; margin: 0 auto; width: 180px; height: 180px; border-radius: 8px; background: #fff; padding: 6px; border: 1px solid var(--gt-border); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; word-break: break-all; }
.err { color: var(--bad); min-height: 1em; font-size: 13px; }

/* Layout: sidebar azul marino + header blanco */
.shell { min-height: 100vh; }
.side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--gt-navy); color: var(--gt-side-text); display: flex; flex-direction: column; z-index: 100; }
.side-brand { height: var(--header-h); display: flex; align-items: center; gap: 10px; padding: 0 20px; border-bottom: 1px solid rgba(255, 255, 255, .08); flex: none; }
.side-menu { padding: 16px 12px; flex: 1; overflow-y: auto; }
.side-label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--gt-side-label); padding: 12px 14px 6px; font-weight: 600; }
.nav { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 8px; color: var(--gt-side-text); font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.nav svg { width: 20px; height: 20px; flex: none; }
.nav:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav.active { background: var(--gt-primary); color: #fff; }
.nav.active svg { color: var(--gt-accent); }
.side-foot { padding: 14px 20px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 12px; color: var(--gt-side-label); }

.topbar { position: fixed; top: 0; left: var(--side-w); right: 0; height: var(--header-h); background: var(--gt-surface); border-bottom: 1px solid var(--gt-border); display: flex; align-items: center; gap: 14px; padding: 0 24px; z-index: 90; }
.topbar .title { font-weight: 700; color: var(--gt-title); font-size: 18px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.user { display: flex; align-items: center; gap: 10px; }
.user-info { text-align: right; line-height: 1.25; }
.user-info .n { font-weight: 600; color: var(--gt-title); font-size: 13px; }
.user-info .r { font-size: 11px; color: var(--gt-muted); text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
.avatar { width: 40px; height: 40px; border-radius: 10px; background: var(--gt-primary); color: #fff; font-weight: 700; display: grid; place-items: center; flex: none; }
.iconbtn { width: 40px; height: 40px; border: 0; background: #f1f3f9; border-radius: 10px; display: grid; place-items: center; cursor: pointer; color: #4b5675; }
.iconbtn:hover { background: var(--gt-primary-light); color: var(--gt-primary); }
.iconbtn svg { width: 18px; height: 18px; }
.hamburger { display: none; }
.side-backdrop { display: none; }

.main { margin-left: var(--side-w); padding: calc(var(--header-h) + 24px) 24px 32px; min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.head h1 { margin: 0; }
.head > div { display: flex; gap: 8px; flex-wrap: wrap; }

/* Tarjetas y tablas */
.card { background: var(--gt-surface); border: 1px solid var(--gt-border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.card.muted { padding: 14px 18px; font-size: 13px; border-left: 4px solid var(--gt-accent); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--gt-border-soft); vertical-align: middle; font-size: 14px; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--gt-muted-2); font-weight: 700; background: #fafbfd; }
tbody tr:hover td { background: #fafbfe; }
tr:last-child td { border-bottom: 0; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn + .btn { margin-left: 6px; }
.muted { color: var(--gt-muted); }
.empty { padding: 32px; text-align: center; color: var(--gt-muted); }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef1fb; color: var(--gt-primary); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

/* Indicadores del resumen */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { padding: 18px 20px; margin: 0; position: relative; overflow: hidden; }
.stat::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--gt-primary); }
.stat .n { font-size: 28px; font-weight: 800; color: var(--gt-title); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .l { color: var(--gt-muted); font-size: 13px; margin-top: 4px; }
.stat.warn::before { background: var(--gt-accent); } .stat.warn .n { color: var(--warn); }
.stat.bad::before { background: var(--bad); } .stat.bad .n { color: var(--bad); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters > * { width: auto; min-width: 180px; }
.note { padding: 12px 14px; border-radius: 10px; background: var(--gt-accent-light); margin-bottom: 16px; }

/* Modal */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(540px, calc(100vw - 32px)); background: var(--gt-surface); color: var(--gt-text); box-shadow: var(--shadow-pop); }
dialog::backdrop { background: rgba(7, 20, 55, .45); }
#modal-form { padding: 0 24px 22px; display: grid; gap: 14px; }
#modal-form > h2 { margin: 0 -24px 4px; padding: 16px 24px; background: var(--gt-primary); color: #fff; font-size: 16px; border-radius: 14px 14px 0 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.checks { max-height: 260px; overflow: auto; border: 1px solid var(--gt-border); border-radius: 10px; padding: 10px; display: grid; gap: 6px; }
.checks label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.checks input { width: auto; height: auto; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.reveal { padding: 12px; border-radius: 10px; background: var(--gt-accent-light); border: 1px solid #f7dfa6; }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--gt-title); color: #fff; padding: 11px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100vw - 32px); box-shadow: var(--shadow-pop); border-left: 4px solid var(--gt-accent); }
#toast.show { opacity: 1; }

@media (max-width: 900px) {
  .side { transform: translateX(-100%); transition: transform .22s ease; z-index: 1000; box-shadow: 2px 0 20px rgba(0, 0, 0, .25); }
  .side.open { transform: translateX(0); }
  .side-backdrop.on { display: block; position: fixed; inset: 0; background: rgba(7, 20, 55, .45); z-index: 900; }
  .topbar { left: 0; padding: 0 14px; gap: 10px; }
  .topbar .title { font-size: 16px; }
  .hamburger { display: grid; }
  .user-info { display: none; }
  .main { margin-left: 0; padding: calc(var(--header-h) + 16px) 14px 28px; }
  .row { grid-template-columns: 1fr; }
  html, body { overflow-x: hidden; }
}

td.mono { word-break: normal; }
td.mono strong { white-space: nowrap; }
.head { justify-content: flex-end; }
.head > div:empty { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.m0 { margin: 0; }
.login > div { width: 100%; max-width: 400px; }
.nowrap { white-space: nowrap; }

/* Páginas legales */
.legal { max-width: 760px; margin: 0 auto; padding: 40px 20px 56px; }
.legal .logo { margin-bottom: 28px; }
.legal h1 { font-size: 26px; margin-bottom: 4px; }
.legal h2 { font-size: 17px; margin-top: 28px; color: var(--gt-primary); }
.legal p, .legal li { line-height: 1.65; }
.legal ul { padding-left: 20px; }
.legal-foot { margin-top: 40px; border-top: 1px solid var(--gt-border); padding-top: 16px; font-size: 12px; }

/* Selector de agencias con buscador */
.agency-picker { display: grid; gap: 8px; }
.agency-picker .checks { max-height: 280px; }
.agency-picker .checks label[hidden] { display: none; }
.checks.inline { border: 0; padding: 0; max-height: none; align-self: center; }
.checks.inline label, label.checks.inline { font-weight: 500; }
.picker-tools { display: flex; align-items: center; gap: 8px; }
.picker-tools small { margin-left: auto; }
