/* =============================================================
   iFlow QBO Admin · layout on top of the design's tokens.css
   (admin/design, "Opción A": CSS only). Colours come from tokens;
   the only literals are the design's state colours (section 4).
   ============================================================= */

/* State colours, per theme (README section 4). */
:root {
  --ok: 74 222 128;
  --bad: 248 113 113;
}
html.light {
  --ok: 22 163 74;
  --bad: 220 38 38;
}
/* tokens.css gives .pf-panel only the dark theme's shadow; on light
   surfaces the design uses a much softer one (README 6.3). */
html.light .pf-panel { box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08); }
html.light .toast { box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08); }

.pf-green { color: rgb(var(--ok)); }
.pf-red { color: rgb(var(--bad)); }

body {
  display: flex;
  flex-direction: column;
  font-size: 14px;
  line-height: 1.5;
}

.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;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 10;
  padding: 8px 12px; border-radius: var(--radius-btn);
  background: rgb(var(--panel)); border: 1px solid rgb(var(--accent));
  color: rgb(var(--text-strong));
}
.skip-link:focus { top: 12px; }

/* Visible focus everywhere (README section 14, rule 5). */
.btn:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgb(var(--accent) / 0.6);
}
.btn { border: 1px solid transparent; font-family: inherit; line-height: 1.2; }
.btn-sm { padding: 0.375rem 0.7rem; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-icon { padding: 0.45rem; }
.btn-icon svg { display: block; }
.field-sm { width: auto; padding-top: 0.375rem; padding-bottom: 0.375rem; font-size: 12.5px; }

/* ===== Top bar (site pattern, README section 16) ===== */
.topbar {
  position: sticky; top: 0; z-index: 5;
  border-bottom: 1px solid rgb(var(--overlay) / 0.1);
  background: rgb(var(--bg) / 0.72);
}
.topbar-inner {
  display: flex; align-items: center; gap: 1.5rem;
  min-height: 64px; flex-wrap: wrap; padding-block: 10px;
}
.brand { display: inline-flex; align-items: center; gap: 0.75rem; color: inherit; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; }
.brand-text { display: grid; line-height: 1.15; }
.brand-name { font-weight: 800; letter-spacing: -0.02em; color: rgb(var(--text-strong)); font-size: 15px; }
.topnav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.topnav-link {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  color: rgb(var(--muted)); text-decoration: none;
  padding: 0.5rem 0.75rem; border-radius: 12px;
}
.topnav-link:hover { background: rgb(var(--overlay) / 0.05); color: rgb(var(--text)); }
.topnav-link[aria-current="page"] {
  color: rgb(var(--text-strong));
  background: linear-gradient(90deg, rgb(var(--accent) / 0.2), rgb(var(--accent-2) / 0.12));
  box-shadow: inset 0 0 0 1px rgb(var(--overlay) / 0.1);
}
.topbar-tools { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; flex-wrap: wrap; }
.who { display: inline-flex; align-items: center; gap: 0.5rem; margin-right: 0.25rem; }
.who-email { font-size: 12px; color: rgb(var(--muted)); }
.inline-form { display: inline; margin: 0; }

/* ===== Page ===== */
.page { flex: 1; display: flex; flex-direction: column; gap: 20px; padding-block: 32px 56px; }
.page-head { display: grid; gap: 0.75rem; justify-items: start; margin-bottom: 4px; }
.page-title { font-size: 2rem; line-height: 1.1; color: rgb(var(--text-strong)); }
@media (min-width: 768px) { .page-title { font-size: 2.25rem; } }
.kicker-link { color: inherit; text-decoration: none; }
.kicker-link:hover { color: rgb(var(--accent)); }
.tags { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: 0; }

.card { padding: 20px; display: grid; gap: 14px; }
.card-title { margin: 0; display: flex; align-items: center; gap: 0.5rem; }
.count {
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 10px;
  padding: 1px 7px; border-radius: 999px; border: 1px solid rgb(var(--line));
  color: rgb(var(--muted));
}
.hint { margin: 0; font-size: 12.5px; color: rgb(var(--muted)); }
.empty { margin: 0; color: rgb(var(--muted)); }
.spacer { flex: 1; }
.card .pf-rule, .auth-card .pf-rule { margin: 4px 0; }

/* ===== Forms ===== */
.stack { display: grid; gap: 0.5rem; margin: 0.5rem 0 0; }
.stack .btn { margin-top: 0.75rem; }
.form-row { display: flex; flex-wrap: wrap; align-items: end; gap: 0.75rem; margin: 0; }
.form-tight { gap: 0.4rem; align-items: center; }
.form-tight .field { width: auto; }
.labelled { display: grid; gap: 0.35rem; min-width: 14rem; flex: 1 1 14rem; }
.form-row > .btn { flex: 0 0 auto; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.75rem; align-items: end; }
.filters .labelled { min-width: 0; }
.filter-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ===== Tables (README section 8.8) ===== */
.table-wrap { overflow-x: auto; border: 1px solid rgb(var(--line)); border-radius: 12px; }
.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data th {
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 9.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.12em; color: rgb(var(--muted));
  text-align: left; white-space: nowrap;
  background: rgb(var(--panel-2) / 0.85); border-bottom: 1px solid rgb(var(--line));
  padding: 10px 12px;
}
.data td { padding: 10px 12px; vertical-align: top; border-top: 1px solid rgb(var(--overlay) / 0.04); }
.data tbody tr:nth-child(even) td { background: rgb(var(--line) / 0.16); }
.data tbody tr:hover td { background: rgb(var(--accent) / 0.06); }
.row-link { color: rgb(var(--text-strong)); font-weight: 600; text-decoration: none; }
.row-link:hover { color: rgb(var(--accent)); }
.cell-dim { color: rgb(var(--muted)); }
.cell-note { margin-top: 4px; font-size: 11.5px; color: rgb(var(--muted)); max-width: 28rem; }
.cell-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: flex-end; }
.pager { margin: 0; display: flex; justify-content: flex-end; }

/* ===== Notices: toasts after an action (README 8.6), inline errors in forms ===== */
.toast {
  display: grid; gap: 2px; padding: 12px 16px; border-radius: 12px;
  background: rgb(var(--panel)); border: 1px solid rgb(var(--overlay) / 0.1);
  border-left-width: 4px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.toast-ok { border-left-color: rgb(var(--ok)); }
.toast-error { border-left-color: rgb(var(--bad)); }
.toast-title { color: rgb(var(--text-strong)); font-weight: 600; }
.toast-text { font-size: 12.5px; color: rgb(var(--muted)); }
.notice { margin: 0; padding: 10px 14px; border-radius: 7px; font-size: 13px; }
.notice-error { border: 1px solid rgb(var(--bad) / 0.5); background: rgb(var(--bad) / 0.1); color: rgb(var(--text-strong)); }

/* ===== Health stats ===== */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 16px; }
.stat { padding: 20px; display: grid; gap: 8px; }
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1; color: rgb(var(--text-strong)); }
.stat-value.pf-red { color: rgb(var(--bad)); }

/* ===== Sign-in, setup and other single cards ===== */
.auth { position: relative; display: grid; place-items: center; padding-block: 24px 40px; }
.auth-card { position: relative; width: 100%; max-width: 440px; padding: 28px; display: grid; gap: 14px; }
.auth-card-wide { max-width: 600px; }
.auth-title { font-size: 1.75rem; line-height: 1.15; color: rgb(var(--text-strong)); }
.auth-card p { margin: 0; }
.card-danger { border-color: rgb(var(--bad) / 0.45); }
/* Corporate glows behind the card (README 7.3). */
.glow { position: absolute; border-radius: 50%; pointer-events: none; }
.glow-a { width: 480px; height: 480px; left: -12%; top: -30%; background: radial-gradient(circle, rgb(var(--accent) / 0.12), transparent 60%); }
.glow-b { width: 420px; height: 420px; right: -8%; bottom: -35%; background: radial-gradient(circle, rgb(var(--accent-2) / 0.1), transparent 60%); }

/* TOTP enrollment: the QR code stays dark-on-white in both themes, for scanners. */
.totp { display: grid; grid-template-columns: 11rem 1fr; gap: 1.25rem; align-items: center; margin: 0.5rem 0; }
.totp-text { display: grid; gap: 0.4rem; }
.totp-text p { margin: 0; }
.qr-frame { padding: 8px; border-radius: 10px; background: #fff; border: 1px solid rgb(var(--line)); }
.qr-frame .qr { display: block; width: 100%; height: auto; }
.secret-key { font-size: 15px; letter-spacing: 0.06em; color: rgb(var(--text-strong)); word-break: break-all; user-select: all; }
@media (max-width: 520px) { .totp { grid-template-columns: 1fr; } .qr-frame { max-width: 13rem; } }

/* ===== Footer ===== */
.footer { padding-block: 0 28px; display: grid; gap: 12px; }
.footer p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .btn, .field, .topnav-link { transition: none; }
}
