/* The workspace page (index.html) and Buzones SOL's tab; the admin page (admin.html) uses it too. Light theme by default;
   dark when <html data-theme="dark"> (the toggle in the bar). The page's base lives at the top level: tokens (the active
   profile's accent on <html>), fonts, body and the workspace bar (at the end). Every Buzones SOL rule is scoped to
   .t-buzones (the tab, its sign-in card, its dialogs; the admin page's wrapper), so it never reaches another tool's tab;
   each tool brings its own stylesheet scoped to its own container (renta.css: .t-renta).
   Shape rule: controls (buttons, inputs, selects) 8px; containers (cards, tables, dialogs) 12px; badges and pills fully round. */
@font-face { font-family: "Geist"; src: url("/fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #f5f6f8; --surface: #fcfcfd; --surface-2: #f0f2f5; --border: #e2e5ea; --border-strong: #cfd4dc;
  --text: #14181e; --muted: #5a6371; --accent: #1d4ed8; --accent-hover: #1e40af; --accent-ink: #ffffff; --accent-soft: #e8eefc;
  --danger: #b42318; --danger-soft: #fdeceb; --warn: #9a5800; --warn-soft: #fff3df; --ok: #17803d; --ok-soft: #e6f4ea;
  --shadow: 0 1px 2px rgb(20 30 45 / .05), 0 2px 6px rgb(20 30 45 / .04);
  --r-control: 8px; --r-box: 12px;
  --skeleton: #e9ecf0;
  --toast-act: #8fb4ff;   /* accent readable on the (inverted) toast */
  /* Profile colors (the dots in the profile strip and the swatches); the active profile's palette becomes --accent below.
     The accent above is the brand (cobalto), the same palette as the azul profile; the login and the admin page use it. */
  --p-teal: #0f766e; --p-azul: #1d4ed8; --p-violeta: #6b3fd1; --p-rosa: #c0267a; --p-verde: #15803d; --p-celeste: #0369a1; --p-indigo: #4338ca; --p-fucsia: #a21caf; --p-rojo: #c81e3c; --p-naranja: #ea580c; --p-ambar: #b45309;
  color-scheme: light;
}
:root[data-accent="teal"] { --accent: #0f766e; --accent-hover: #0d6961; --accent-ink: #f7fffd; --accent-soft: #e3f3f1; --toast-act: #6fdccb; }
:root[data-accent="azul"] { --accent: #1d4ed8; --accent-hover: #1e40af; --accent-ink: #ffffff; --accent-soft: #e8eefc; --toast-act: #8fb4ff; }
:root[data-accent="violeta"] { --accent: #6b3fd1; --accent-hover: #5c34b8; --accent-ink: #f8f5ff; --accent-soft: #ece6fb; --toast-act: #c0a9ff; }
:root[data-accent="rosa"] { --accent: #c0267a; --accent-hover: #a81f6a; --accent-ink: #fff5fa; --accent-soft: #fbe4ef; --toast-act: #ff9ccd; }
:root[data-accent="verde"] { --accent: #15803d; --accent-hover: #166534; --accent-ink: #f0fdf4; --accent-soft: #dcfce7; --toast-act: #86efac; }
:root[data-accent="celeste"] { --accent: #0369a1; --accent-hover: #075985; --accent-ink: #f0f9ff; --accent-soft: #e0f2fe; --toast-act: #7dd3fc; }
:root[data-accent="indigo"] { --accent: #4338ca; --accent-hover: #3730a3; --accent-ink: #eef2ff; --accent-soft: #e0e7ff; --toast-act: #a5b4fc; }
:root[data-accent="fucsia"] { --accent: #a21caf; --accent-hover: #86198f; --accent-ink: #fdf4ff; --accent-soft: #fae8ff; --toast-act: #f0abfc; }
:root[data-accent="rojo"] { --accent: #c81e3c; --accent-hover: #a81932; --accent-ink: #fff3f5; --accent-soft: #fde4e8; --toast-act: #ff9fb0; }
:root[data-accent="naranja"] { --accent: #ea580c; --accent-hover: #c2410c; --accent-ink: #fff7ed; --accent-soft: #ffedd5; --toast-act: #fdba74; }
:root[data-accent="ambar"] { --accent: #b45309; --accent-hover: #92400e; --accent-ink: #fffbeb; --accent-soft: #fef3c7; --toast-act: #fcd34d; }
:root[data-theme="dark"] {
  --bg: #0e1115; --surface: #151a20; --surface-2: #1c222a; --border: #283039; --border-strong: #36404b;
  --text: #e7eaee; --muted: #98a2af; --accent: #7ea6ff; --accent-hover: #97b8ff; --accent-ink: #0b1a40; --accent-soft: #16223d;
  --danger: #f2766b; --danger-soft: #3a1b19; --warn: #f0ad4e; --warn-soft: #382910; --ok: #4cc97a; --ok-soft: #12301e;
  --shadow: 0 1px 2px rgb(0 0 0 / .35);
  --skeleton: #222932;
  --toast-act: #1d4ed8;
  --p-teal: #2bc4b0; --p-azul: #7ea6ff; --p-violeta: #b094ff; --p-rosa: #ff85c2; --p-verde: #4ade80; --p-celeste: #38bdf8; --p-indigo: #a5b4fc; --p-fucsia: #e879f9; --p-rojo: #ff8a9a; --p-naranja: #fb923c; --p-ambar: #fbbf24;
  color-scheme: dark;
}
:root[data-theme="dark"][data-accent="teal"] { --accent: #2bc4b0; --accent-hover: #3fd3bf; --accent-ink: #052b26; --accent-soft: #11302c; --toast-act: #0f766e; }
:root[data-theme="dark"][data-accent="azul"] { --accent: #7ea6ff; --accent-hover: #97b8ff; --accent-ink: #0b1a40; --accent-soft: #16223d; --toast-act: #1d4ed8; }
:root[data-theme="dark"][data-accent="violeta"] { --accent: #b094ff; --accent-hover: #c0a9ff; --accent-ink: #22124d; --accent-soft: #261c40; --toast-act: #6b3fd1; }
:root[data-theme="dark"][data-accent="rosa"] { --accent: #ff85c2; --accent-hover: #ff9ccd; --accent-ink: #4a0e2d; --accent-soft: #3d1a2d; --toast-act: #c0267a; }
:root[data-theme="dark"][data-accent="verde"] { --accent: #4ade80; --accent-hover: #6ee7a0; --accent-ink: #052e16; --accent-soft: #12301e; --toast-act: #15803d; }
:root[data-theme="dark"][data-accent="celeste"] { --accent: #38bdf8; --accent-hover: #5ccbfa; --accent-ink: #082f49; --accent-soft: #11283a; --toast-act: #0369a1; }
:root[data-theme="dark"][data-accent="indigo"] { --accent: #a5b4fc; --accent-hover: #b8c3fd; --accent-ink: #1e1b4b; --accent-soft: #22243f; --toast-act: #4338ca; }
:root[data-theme="dark"][data-accent="fucsia"] { --accent: #e879f9; --accent-hover: #ee95fa; --accent-ink: #4a044e; --accent-soft: #3b1a3f; --toast-act: #a21caf; }
:root[data-theme="dark"][data-accent="rojo"] { --accent: #ff8a9a; --accent-hover: #ffa1ae; --accent-ink: #4c0519; --accent-soft: #3d1a22; --toast-act: #c81e3c; }
:root[data-theme="dark"][data-accent="naranja"] { --accent: #fb923c; --accent-hover: #fca862; --accent-ink: #431407; --accent-soft: #3d2314; --toast-act: #ea580c; }
:root[data-theme="dark"][data-accent="ambar"] { --accent: #fbbf24; --accent-hover: #fcd34d; --accent-ink: #451a03; --accent-soft: #3a2a0c; --toast-act: #b45309; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 "Geist", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1; }
[hidden] { display: none !important; }
.t-buzones h1 { font-size: 24px; line-height: 1.2; font-weight: 650; letter-spacing: -.02em; margin: 0 0 4px; }
.t-buzones h2 { font-size: 18px; font-weight: 650; letter-spacing: -.01em; margin: 0; }
.t-buzones .muted { color: var(--muted); }
.t-buzones small { display: block; color: var(--muted); font-size: 12px; }
.t-buzones .mono { font-family: "Geist Mono", ui-monospace, monospace; font-size: 12px; }
.t-buzones .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.t-buzones .i { width: 18px; height: 18px; fill: currentColor; flex: none; }

/* Brand */
.t-buzones .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.t-buzones .brand strong { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.t-buzones .logo { width: 32px; height: 32px; border-radius: var(--r-control); background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.t-buzones .logo .i { width: 19px; height: 19px; }
.t-buzones .logo .mark { width: 100%; height: 100%; fill: currentColor; }
.t-buzones .brand-lg .logo { width: 42px; height: 42px; }
.t-buzones .brand-lg strong { font-size: 20px; }

/* Buttons */
.t-buzones .btn { appearance: none; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: var(--r-control); padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; text-decoration: none; transition: background-color .15s, border-color .15s, transform .1s; }
.t-buzones .btn:hover { background: var(--surface-2); }
.t-buzones .btn:active { transform: translateY(1px); }
.t-buzones .btn:disabled { opacity: .65; cursor: progress; }
.t-buzones .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.t-buzones .btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.t-buzones .btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.t-buzones .btn.danger:hover { filter: brightness(.92); }
.t-buzones .btn.danger:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.t-buzones .btn.ghost { background: transparent; border-color: transparent; }
.t-buzones .btn.ghost:hover { background: var(--surface-2); }
.t-buzones .btn.block { width: 100%; }
.t-buzones .icon-btn { appearance: none; border: 0; background: transparent; color: var(--muted); width: 36px; height: 36px; border-radius: var(--r-control); cursor: pointer; display: inline-grid; place-items: center; transition: background-color .15s, color .15s; }
.t-buzones .icon-btn:hover { background: var(--surface-2); color: var(--text); }
.t-buzones .icon-btn:active { transform: translateY(1px); }
.t-buzones .icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.t-buzones .icon-btn:disabled { opacity: .5; cursor: progress; }
.t-buzones .spinning .i { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Forms */
.t-buzones input, .t-buzones select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-control); padding: 9px 11px; min-width: 0; width: 100%; }
.t-buzones input::placeholder { color: var(--muted); opacity: 1; }
.t-buzones input[type="checkbox"] { appearance: auto; width: 16px; height: 16px; padding: 0; margin: 0; border: 0; background: none; accent-color: var(--accent); cursor: pointer; display: block; }
.t-buzones input[type="checkbox"]:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.t-buzones :is(input, select, .btn, .icon-btn, .tab, .seg button, .link, .kpi):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.t-buzones input:focus, .t-buzones select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.t-buzones .field { display: grid; gap: 6px; font-weight: 600; font-size: 13px; margin-bottom: 14px; }
.t-buzones .field input { font-weight: 400; font-size: 15px; }
.t-buzones .field .hint { margin: 0; font-weight: 400; }
.t-buzones .form-error { color: var(--danger); min-height: 1.2em; margin: 0 0 12px; font-size: 13px; }
.t-buzones .hint { color: var(--muted); font-size: 12.5px; margin: -4px 0 12px; display: flex; gap: 6px; align-items: flex-start; }
.t-buzones .hint .i { width: 15px; height: 15px; margin-top: 2px; }
.t-buzones .hint-danger { color: var(--danger); background: var(--danger-soft); padding: 8px 10px; border-radius: var(--r-control); margin: 0 0 14px; }
.t-buzones .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.t-buzones .row2 > [hidden] { display: none; }
.t-buzones .row2:has(> [hidden]) { grid-template-columns: 1fr; }   /* DNI login: the Clave SOL takes the whole row */

/* Login */
.t-buzones .login { min-height: 100dvh; display: grid; place-items: start center; padding: clamp(48px, 12vh, 120px) 16px 32px; position: relative; }
.t-buzones .login-theme { position: absolute; top: 16px; right: 16px; }
.t-buzones .login-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-box); padding: 32px 28px 28px; box-shadow: var(--shadow); }
.t-buzones .login-lead { margin: 16px 0 22px; text-wrap: balance; }
.t-buzones .login-tabs { display: grid; width: 100%; margin: 0 0 18px; }
.t-buzones .login-tabs button { padding: 8px 12px; }
.t-buzones .seg.login-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }   /* the submit stays the card's only accent fill */
.t-buzones .login .btn.block { min-height: 44px; }
/* Google's own sign-in button: the four-colour G on its neutral fill (light), its dark variant in dark */
.t-buzones .btn-google { background: #fff; border-color: #747775; color: #1f1f1f; }
.t-buzones .btn-google img { width: 18px; height: 18px; flex: none; }
:root[data-theme="dark"] .t-buzones .btn-google { background: #131314; border-color: #8e918f; color: #e3e3e3; }
@media (hover: hover) and (pointer: fine) {
  .t-buzones .btn-google:hover { background: #f3f4f6; }
  :root[data-theme="dark"] .t-buzones .btn-google:hover { background: #1f2023; }
}
.t-buzones .or { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--muted); font-size: 12.5px; }
.t-buzones .or::before, .t-buzones .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.t-buzones .field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.t-buzones .field-head .link-accent { color: var(--accent); font-weight: 500; font-size: 13px; }
.t-buzones .field-head .link-accent:hover { text-decoration: underline; text-underline-offset: 3px; }
.t-buzones .login .form-error:empty { min-height: 0; margin-bottom: 6px; }
.t-buzones .login-alt { margin: 14px 0 0; text-align: center; font-size: 13.5px; color: var(--muted); }
.t-buzones .login-alt .link { color: var(--accent); font-weight: 500; }
.t-buzones .login-alt .link:hover { text-decoration: underline; text-underline-offset: 3px; }
.t-buzones .form-lead { margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.t-buzones .field[hidden] { display: none; }

/* Layout */
.t-buzones .topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; height: 64px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.t-buzones .topbar-right { display: flex; align-items: center; gap: 2px; }
.t-buzones .topbar-right .me { margin-right: 10px; font-size: 13px; }
/* Archived account: a bar under the top bar states the deactivation and the retention date; every control that
   would reach SUNAT (refresh, add a client) is gone, reading and downloading the cache keep working. */
.t-buzones .archive-bar { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 9px 24px; background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 600; line-height: 1.35; border-bottom: 1px solid var(--border); position: sticky; top: 64px; z-index: 9; }
.t-buzones .archive-bar .i { width: 18px; height: 18px; flex: none; }
.is-archived .t-buzones .hero-actions, .is-archived .t-buzones [data-act="refresh"] { display: none; }
.t-buzones .wrap { max-width: 1240px; margin: 0 auto; padding: 24px 24px 40px; }

/* A profile's own color, by attribute (the CSP in _headers blocks inline style attributes, so never style="--c: …") */
.t-buzones [data-color="teal"] { --c: var(--p-teal); } .t-buzones [data-color="azul"] { --c: var(--p-azul); } .t-buzones [data-color="violeta"] { --c: var(--p-violeta); }
.t-buzones [data-color="rosa"] { --c: var(--p-rosa); }
.t-buzones [data-color="verde"] { --c: var(--p-verde); } .t-buzones [data-color="celeste"] { --c: var(--p-celeste); } .t-buzones [data-color="indigo"] { --c: var(--p-indigo); } .t-buzones [data-color="fucsia"] { --c: var(--p-fucsia); } .t-buzones [data-color="rojo"] { --c: var(--p-rojo); } .t-buzones [data-color="naranja"] { --c: var(--p-naranja); } .t-buzones [data-color="ambar"] { --c: var(--p-ambar); }

/* Profile strip: one pill per profile with its own color dot; the active one is filled with the page accent */
.t-buzones .profiles { display: flex; align-items: center; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.t-buzones .ppill { appearance: none; display: inline-flex; align-items: center; gap: 8px; max-width: 260px; padding: 6px 12px 6px 9px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; transition: border-color .15s, background-color .15s, color .15s; }
.t-buzones .ppill:hover { color: var(--text); border-color: var(--border-strong); }
.t-buzones .ppill .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.t-buzones .ppill .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-buzones .ppill b { font-weight: 650; font-size: 12px; line-height: 18px; padding: 0 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.t-buzones .ppill.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.t-buzones .ppill.active b { background: var(--accent); color: var(--accent-ink); }
.t-buzones .ppill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.t-buzones .profiles .icon-btn { width: 32px; height: 32px; margin-left: -2px; }
.t-buzones .profiles .add { margin-left: auto; }
.t-buzones .profiles .add .i { width: 16px; height: 16px; }

/* Profile dialog: color swatches */
.t-buzones .swatches-field { border: 0; padding: 0; margin: 0 0 14px; }
.t-buzones .swatches-field legend { padding: 0; margin-bottom: 8px; }
.t-buzones .swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.t-buzones .swatch { display: grid; justify-items: center; gap: 5px; cursor: pointer; font-weight: 500; width: 56px; }
.t-buzones .swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.t-buzones .swatch span { width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); transition: box-shadow .15s, transform .1s; }
.t-buzones .swatch:hover span { transform: scale(1.06); }
.t-buzones .swatch input:checked + span { box-shadow: 0 0 0 2px var(--c); }
.t-buzones .swatch input:focus-visible + span { box-shadow: 0 0 0 2px var(--c), 0 0 0 5px var(--accent-soft); }
.t-buzones .swatch small { font-size: 11.5px; text-align: center; line-height: 1.2; }
.t-buzones .dialog-actions .spacer { flex: 1; }
.t-buzones .btn.danger-text { color: var(--danger); }
.t-buzones .btn.danger-text:hover { background: var(--danger-soft); }
.t-buzones .hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.t-buzones .hero p { margin: 0; }
.t-buzones .hero-actions { display: flex; gap: 8px; }

/* Refresh run panel: shown while "Actualizar todos" works. Bar = clients finished, one chip per client. */
.t-buzones .run { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-box); box-shadow: var(--shadow); padding: 14px 16px 16px; margin: -4px 0 22px; }
.t-buzones .run-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.t-buzones .run-head .run-time { margin-left: auto; }
.t-buzones .run-track { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.t-buzones .run-track span { position: relative; display: block; height: 100%; border-radius: inherit; background: var(--accent); overflow: hidden;
  transform: translateX(calc(var(--p, 0) * 100% - 100%)); transition: transform .5s cubic-bezier(.16, 1, .3, 1); }
.t-buzones .run-chips { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.t-buzones .run-chips:empty { display: none; }
.t-buzones .chip { position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 5px; max-width: 230px; font-size: 12px; font-weight: 600; line-height: 18px;
  padding: 3px 10px 3px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); transition: background-color .25s, color .25s; }
.t-buzones .chip .i { width: 14px; height: 14px; }
.t-buzones .chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-buzones .chip b { flex: none; font-weight: 650; }
.t-buzones .chip.is-run { background: var(--accent-soft); color: var(--accent); }
.t-buzones .chip.is-ok { background: var(--ok-soft); color: var(--ok); }
.t-buzones .chip.is-err { background: var(--warn-soft); color: var(--warn); }
/* A light band sweeps across whatever is working right now (bar, chip, row status). */
.t-buzones .run-track span::after, .t-buzones .chip.is-run::after, .t-buzones .st-running::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); pointer-events: none;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 24%, transparent), transparent); }
.t-buzones .run-track span::after { background: linear-gradient(90deg, transparent, rgb(255 255 255 / .38), transparent); }
@media (prefers-reduced-motion: no-preference) {
  .t-buzones .run { animation: run-in .3s cubic-bezier(.16, 1, .3, 1); }
  .t-buzones .run.leaving { opacity: 0; transition: opacity .3s; }
  .t-buzones .run:not(.done) .run-track span::after, .t-buzones .chip.is-run::after, .t-buzones .st-running::after { animation: sweep 1.5s ease-in-out infinite; }
  .t-buzones .chip.is-ok, .t-buzones .chip.is-err { animation: chip-done .35s cubic-bezier(.16, 1, .3, 1); }
  @keyframes sweep { to { transform: translateX(100%); } }
  @keyframes run-in { from { opacity: 0; transform: translateY(-6px); } }
  @keyframes chip-done { from { transform: scale(.9); } }
}

/* KPIs */
.t-buzones .kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 26px; }
.t-buzones .kpi { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-box); padding: 14px 16px; box-shadow: var(--shadow); }
.t-buzones button.kpi { cursor: pointer; transition: border-color .15s, transform .1s; }
.t-buzones button.kpi:hover { border-color: var(--accent); }
.t-buzones button.kpi:active { transform: translateY(1px); }
.t-buzones .kpi .v { font-size: 28px; font-weight: 650; letter-spacing: -.03em; line-height: 1.15; }
.t-buzones .kpi .k { color: var(--muted); font-size: 12.5px; font-weight: 550; line-height: 1.3; }
.t-buzones .kpi.alert { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); background: var(--danger-soft); }
.t-buzones .kpi.alert .v { color: var(--danger); }
.t-buzones .kpi.warn .v { color: var(--warn); }

/* Tabs */
.t-buzones .tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.t-buzones .tab { appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 12px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 7px; }
.t-buzones .tab .i { width: 17px; height: 17px; }
.t-buzones .tab:hover { color: var(--text); }
.t-buzones .tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.t-buzones .count { background: var(--surface-2); border-radius: 999px; padding: 0 8px; font-size: 12px; line-height: 20px; }
.t-buzones .tab.active .count { background: var(--accent-soft); color: var(--accent); }
.t-buzones .tab #errors-count:not(:empty) { background: var(--warn-soft); color: var(--warn); }   /* new errors since the last visit */

/* Filters */
.t-buzones .filters-area { position: relative; margin-bottom: 12px; }
.t-buzones .filters { display: grid; grid-template-columns: auto minmax(150px, 1fr) minmax(130px, .9fr) minmax(130px, .9fr) minmax(200px, 1.4fr); gap: 8px; align-items: center; }
/* Selection bar: covers the filter row while messages are checked (desktop); a bottom bar on smaller screens */
.t-buzones .selbar { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 0 2px; background: var(--bg); }
.t-buzones .selbar strong { font-weight: 600; white-space: nowrap; }
.t-buzones .selbar-actions { display: flex; gap: 8px; }
.t-buzones .selbar .icon-btn { margin-left: -8px; }
.t-buzones .sel-all-btn { display: none; }   /* phones only: the table header (with its checkbox) is hidden there */
@media (prefers-reduced-motion: no-preference) { .t-buzones .selbar { animation: run-in .2s cubic-bezier(.16, 1, .3, 1); } }
.t-buzones .seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-control); padding: 3px; }
.t-buzones .seg button { appearance: none; border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); padding: 6px 12px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.t-buzones .seg button:hover { color: var(--text); }
.t-buzones .seg button:disabled { opacity: .45; cursor: not-allowed; }
.t-buzones .seg-block { display: grid; width: 100%; margin: 0 0 18px; }   /* full-width choice inside a form (client dialog: RUC / DNI), accent on the pick */
.t-buzones .seg-block button { padding: 8px 12px; }
.t-buzones .seg button.active { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); }
.t-buzones .search { position: relative; display: block; }
.t-buzones .search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; pointer-events: none; }
.t-buzones .search input { padding-left: 34px; }

/* Tables */
.t-buzones .table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-box); overflow: hidden; box-shadow: var(--shadow); }
.t-buzones table.grid { width: 100%; border-collapse: collapse; }
.t-buzones .grid th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.t-buzones .grid td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.t-buzones .grid tbody tr:last-child td { border-bottom: 0; }
.t-buzones .grid tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.t-buzones .num { text-align: right; }
.t-buzones .nowrap { white-space: nowrap; }
.t-buzones .c-dot { width: 18px; padding-right: 0 !important; }
.t-buzones .c-sel { width: 16px; padding-right: 4px !important; }
.t-buzones .c-sel input { margin-top: 3px; }
.t-buzones .grid th.c-sel input { margin-top: 0; }
.t-buzones .c-pin { width: 32px; padding: 7px 8px 7px 0 !important; text-align: right; }
.t-buzones .pin-btn { width: 32px; height: 32px; }
.t-buzones .pin-btn.on { color: var(--accent); }
.t-buzones .pin-btn.on:hover { color: var(--accent-hover); background: var(--accent-soft); }
/* With a mouse the pin of an unpinned row only shows on hover or focus; on touch screens it is always there */
@media (hover: hover) { .t-buzones .msgs tbody tr:not(:hover):not(.selected) .pin-btn:not(.on):not(:focus-visible) { opacity: 0; } }
.t-buzones .grid tbody tr.selected td { background: color-mix(in srgb, var(--accent-soft) 75%, var(--surface)); }
.t-buzones .unread td { font-weight: 600; }
.t-buzones .unread-mark { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--accent); margin-top: 7px; }
.t-buzones .unread-mark.local { background: transparent; border: 1.5px solid var(--muted); box-sizing: border-box; }   /* read here, still unread in SUNAT */
.t-buzones .client-cell strong { font-weight: 600; }
.t-buzones .client-cell small { font-weight: 400; }
.t-buzones .link { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.t-buzones .link:hover strong { color: var(--accent); }
.t-buzones .subject { display: block; }
.t-buzones .badges { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 6px; vertical-align: 1px; }
.t-buzones .attach { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); }
.t-buzones .attach .i { width: 15px; height: 15px; }
.t-buzones .empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.t-buzones .empty .i { width: 28px; height: 28px; display: block; margin: 0 auto 10px; color: var(--accent); }
.t-buzones .note { color: var(--muted); font-size: 12.5px; margin: 12px 2px 0; max-width: 80ch; }

/* Badges and statuses */
.t-buzones .badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; white-space: nowrap; line-height: 18px; }
.t-buzones .b-new { background: var(--accent-soft); color: var(--accent); }
.t-buzones .b-urg { background: var(--danger-soft); color: var(--danger); }
.t-buzones .b-folder { background: var(--warn-soft); color: var(--warn); }
.t-buzones .b-noti { background: var(--accent-soft); color: var(--accent); }
.t-buzones .b-msg { background: var(--surface-2); color: var(--muted); }
.t-buzones .status { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.t-buzones .status .i { width: 14px; height: 14px; }
.t-buzones .st-ok { background: var(--ok-soft); color: var(--ok); }
.t-buzones .st-nuevo { background: var(--surface-2); color: var(--muted); }
.t-buzones .st-error { background: var(--warn-soft); color: var(--warn); }
.t-buzones .st-credenciales { background: var(--danger-soft); color: var(--danger); }
.t-buzones .st-running { background: var(--accent-soft); color: var(--accent); position: relative; overflow: hidden; }
.t-buzones .err-text { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; max-width: 280px; font-weight: 400; }
.t-buzones .zero { color: var(--muted); font-weight: 400; }
.t-buzones .hot { color: var(--danger); font-weight: 650; }
.t-buzones .actions { white-space: nowrap; text-align: right; padding-top: 7px !important; padding-bottom: 7px !important; }

/* Skeleton rows while loading */
.t-buzones .sk { display: block; height: 12px; border-radius: 999px; background: var(--skeleton); }
.t-buzones .sk.w1 { width: 70%; } .t-buzones .sk.w2 { width: 40%; margin-top: 8px; } .t-buzones .sk.w3 { width: 90%; }
@media (prefers-reduced-motion: no-preference) {
  .t-buzones .sk { animation: pulse 1.4s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: .45; } }
}

/* Message documents */
.t-buzones .msg-dialog { width: min(560px, calc(100vw - 32px)); }
.t-buzones .md-meta { margin: -10px 0 16px; font-size: 13px; }
.t-buzones .callout { background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--border)); border-radius: var(--r-box); padding: 14px 16px; margin-bottom: 14px; }
.t-buzones .callout p { margin: 0 0 12px; }
.t-buzones .md-loading { display: grid; gap: 10px; padding: 6px 0 12px; }
.t-buzones .md-loading p { margin: 0; font-size: 13px; }
.t-buzones .doc-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.t-buzones .doc-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-box); background: var(--surface); }
.t-buzones .doc-list .doc-ico { width: 34px; height: 34px; border-radius: var(--r-control); background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.t-buzones .doc-list .doc-name { font-weight: 600; word-break: break-all; font-size: 13.5px; }
.t-buzones .doc-list small { margin-top: 2px; }
.t-buzones .md-body { background: var(--surface-2); border-radius: var(--r-box); padding: 16px 18px; margin: 0 0 12px; max-height: 50vh; overflow: auto; line-height: 1.6; overflow-wrap: anywhere; }
.t-buzones .md-body.plain { white-space: pre-wrap; }
.t-buzones .msg-dialog .doc-list:empty { display: none; }
.t-buzones .msg-dialog .form-error:empty { min-height: 0; margin: 0; }
.t-buzones .msg-dialog .doc-list { margin-top: 12px; }
.t-buzones .msg-dialog .md-body { margin-bottom: 0; }
.t-buzones .md-body strong { font-weight: 650; }
.t-buzones .md-body a { color: var(--accent); font-weight: 600; text-underline-offset: 2px; }
.t-buzones .subject-link { appearance: none; border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.t-buzones .subject-link:hover .subject { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* Events: the user's own errors in the app; every account's activity in /admin */
body:not(.is-admin) .t-buzones .admin-only { display: none !important; }
.t-buzones a.icon-btn { text-decoration: none; }
.t-buzones .events-bar { grid-template-columns: auto 1fr auto; }
.t-buzones .events-sum { margin: 0 0 10px; font-size: 13px; }
.t-buzones .events-sum:empty { display: none; }
.t-buzones .events td:nth-child(3) { max-width: 460px; word-break: break-word; }
.t-buzones .events .ev-ok { background: var(--ok-soft); color: var(--ok); }
.t-buzones .events .ev-err { background: var(--danger-soft); color: var(--danger); }
.t-buzones .events .ev-user { background: var(--warn-soft); color: var(--warn); }

/* Admin page (/admin) */
.admin-page .t-buzones .logo { background: #475569; }
.t-buzones .topbar-right .btn.ghost { margin-right: 6px; }
.t-buzones .tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.t-buzones .tool { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-box); padding: 18px 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.t-buzones .tool h3 { margin: 0; font-size: 15px; font-weight: 650; }
.t-buzones .tool p { margin: 0 0 6px; font-size: 13px; max-width: 60ch; }
.t-buzones .tool-row { display: flex; gap: 8px; width: 100%; }
.t-buzones .tool-row select { flex: 1; }
.t-buzones .tool-danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.t-buzones .tool-danger h3 { color: var(--danger); }
.t-buzones .users tr.is-disabled td:not(.actions) { opacity: .55; }
.t-buzones .check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; margin: 0 0 14px; cursor: pointer; }
.t-buzones .check input { margin-top: 2px; }
.t-buzones .btn.small { padding: 5px 10px; font-size: 12.5px; }
.t-buzones .detail-dialog { width: min(860px, calc(100vw - 32px)); }
.t-buzones .kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 0 0 12px; font-size: 13px; }
.t-buzones .kv dt { color: var(--muted); font-weight: 600; }
.t-buzones .kv dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: "Geist Mono", ui-monospace, monospace; font-size: 12px; }
.t-buzones .raw { margin: 0; background: var(--surface-2); border-radius: var(--r-box); padding: 12px 14px; max-height: 50vh; overflow: auto; font: 11.5px/1.5 "Geist Mono", ui-monospace, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.t-buzones .events.all td.actions { padding-top: 8px !important; }

/* Dialogs */
.t-buzones dialog { border: 1px solid var(--border); border-radius: var(--r-box); padding: 22px 24px 24px; width: min(460px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgb(10 20 35 / .22); }
.t-buzones dialog::backdrop { background: rgb(12 18 28 / .45); }
.t-buzones .dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.t-buzones .dialog-head .icon-btn { margin-right: -8px; }
.t-buzones .dialog-tools { display: flex; gap: 2px; margin-right: -8px; }
.t-buzones .dialog-tools .icon-btn { margin-right: 0; }
.t-buzones .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Toast */
.t-buzones .toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: var(--r-control); font-weight: 600; box-shadow: 0 8px 24px rgb(10 20 35 / .2); z-index: 30; width: max-content; max-width: calc(100vw - 32px); display: flex; align-items: center; gap: 16px; }
.t-buzones .toast-act { appearance: none; border: 0; background: none; padding: 0; font: inherit; font-weight: 650; color: var(--toast-act); cursor: pointer; white-space: nowrap; }
.t-buzones .toast-act:hover { text-decoration: underline; text-underline-offset: 3px; }
.t-buzones .toast-act:focus-visible { outline: 2px solid var(--toast-act); outline-offset: 3px; border-radius: 2px; }

@media (prefers-reduced-motion: reduce) {
  .t-buzones *, .t-buzones *::before, .t-buzones *::after { transition: none !important; animation: none !important; }
}

/* Tablet */
@media (max-width: 1024px) {
  .t-buzones .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .t-buzones .filters { grid-template-columns: 1fr 1fr 1fr; }
  .t-buzones .filters .seg { grid-column: 1 / -1; }
  .t-buzones .filters .search { grid-column: 1 / -1; }
  /* The filters take several rows here, so the selection bar sits at the bottom of the screen instead */
  .t-buzones .selbar { position: fixed; inset: auto 0 0 0; z-index: 20; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgb(10 20 35 / .06); }
  .t-buzones .selbar .icon-btn { margin-left: -4px; }
  .t-buzones .selbar-actions { margin-left: auto; }
  .has-selection .t-buzones .wrap { padding-bottom: 96px; }
  .has-selection .t-buzones .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

/* Phone: tables become cards, the two main actions sit in a fixed bottom bar */
@media (max-width: 767px) {
  .t-buzones { font-size: 15px; }
  .t-buzones .topbar { height: 56px; padding: 0 12px 0 16px; }
  .t-buzones .topbar .brand small, .t-buzones .topbar-right .me { display: none; }
  .t-buzones .archive-bar { top: 56px; padding: 8px 16px; font-size: 12.5px; justify-content: flex-start; }
  .t-buzones .wrap { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
  .is-archived .t-buzones .wrap { padding-bottom: 32px; }
  .is-archived .t-buzones .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
  .t-buzones .profiles { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 16px; padding: 2px 16px; scrollbar-width: none; }
  .t-buzones .profiles::-webkit-scrollbar { display: none; }
  .t-buzones .ppill { flex: none; max-width: 220px; }
  .t-buzones .profiles .add { margin-left: 0; }
  .t-buzones .swatch { width: 68px; }
  .t-buzones .dialog-actions .spacer { display: none; }
  .t-buzones h1 { font-size: 21px; }
  .t-buzones .hero { margin-bottom: 16px; }
  .t-buzones .hero-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgb(10 20 35 / .06); }
  .t-buzones .hero-actions .btn { padding: 12px 14px; }
  .t-buzones .run { margin: 0 0 16px; padding: 12px 14px 14px; }
  .t-buzones .run-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .t-buzones .chip { max-width: none; }
  .t-buzones .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }

  .t-buzones .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 20px; }
  .t-buzones .kpi { padding: 10px 12px; border-radius: var(--r-box); }
  .t-buzones .kpi .v { font-size: 22px; }
  .t-buzones .kpi .k { font-size: 11.5px; }

  .t-buzones .tabs { gap: 0; }
  .t-buzones .tabs .tab { flex: 1; justify-content: center; padding: 10px 4px; gap: 6px; }   /* the three tabs with their counts fit 360 px */
  .t-buzones .filters { grid-template-columns: 1fr 1fr; }
  .t-buzones .filters #f-client { grid-column: 1 / -1; }
  .t-buzones .seg button { padding: 8px 4px; font-size: 14px; }
  .t-buzones input, .t-buzones select { font-size: 16px; } /* avoids iOS zoom on focus */
  /* Selecting messages: the bar replaces the two main actions at the bottom; actions on their own row */
  .has-selection .t-buzones .hero-actions { display: none; }
  .t-buzones .selbar { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
  .t-buzones .sel-all-btn { display: inline-flex; }
  .t-buzones .selbar-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; margin: 0; }
  .t-buzones .selbar .btn { padding: 12px 10px; }
  .has-selection .t-buzones .wrap { padding-bottom: calc(136px + env(safe-area-inset-bottom)); }
  .has-selection .t-buzones .toast { bottom: calc(124px + env(safe-area-inset-bottom)); }

  .t-buzones .table-wrap { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .t-buzones .grid thead { display: none; }
  .t-buzones .grid tbody { display: grid; gap: 10px; }
  .t-buzones .grid tbody tr { display: grid; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-box); box-shadow: var(--shadow); padding: 14px; gap: 6px 10px; }
  .t-buzones .grid td { display: block; padding: 0; border: 0; }
  .t-buzones .grid tbody tr:hover td { background: none; }
  .t-buzones .empty { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-box); }

  /* Message card: checkbox, client and pin on the first row; the subject; then type, attachments and date */
  /* Type and date share the full-width bottom row (start and end), so neither sizes the columns of the first row. */
  .t-buzones .msgs tbody tr { grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "sel client adj pin" "asunto asunto asunto asunto" "meta meta meta meta"; align-items: center; }
  .t-buzones .msgs tbody tr.unread { border-left: 3px solid var(--accent); }
  .t-buzones .msgs tbody tr.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface)); }
  .t-buzones .msgs tbody tr.selected td { background: none; }
  .t-buzones .msgs td:nth-child(1) { grid-area: sel; }
  .t-buzones .msgs td:nth-child(2) { display: none; }
  .t-buzones .msgs td:nth-child(3) { grid-area: client; }
  .t-buzones .msgs td:nth-child(4) { grid-area: meta; justify-self: start; }
  .t-buzones .msgs td:nth-child(5) { grid-area: meta; justify-self: end; font-size: 12.5px; color: var(--muted); font-weight: 400; }
  .t-buzones .msgs .client-cell strong { font-size: 13.5px; color: var(--muted); font-weight: 600; }
  .t-buzones .msgs td:nth-child(6) { grid-area: asunto; font-size: 15px; line-height: 1.4; }
  .t-buzones .msgs td:nth-child(7) { grid-area: adj; }
  .t-buzones .msgs td:nth-child(8) { grid-area: pin; margin: -8px -8px -8px 0; }
  .t-buzones .msgs .c-sel input { margin: 0; width: 18px; height: 18px; }
  .t-buzones .msgs .badges { display: flex; margin: 6px 0 0; }
  .t-buzones .msgs .client-cell small { display: none; }

  /* Client card */
  .t-buzones .clients tbody tr { position: relative; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: "client client client client" "unread total op coact" "status status upd upd"; gap: 12px 8px; }
  .t-buzones .clients td:nth-child(1) { grid-area: client; padding-right: 116px; min-width: 0; }
  .t-buzones .clients td:nth-child(2) { display: none; }
  .t-buzones .clients td:nth-child(3) { grid-area: unread; }
  .t-buzones .clients td:nth-child(4) { grid-area: total; }
  .t-buzones .clients td:nth-child(5) { grid-area: op; }
  .t-buzones .clients td:nth-child(6) { grid-area: coact; }
  .t-buzones .clients td:nth-child(7) { grid-area: upd; text-align: right; align-self: center; font-size: 12.5px; }
  .t-buzones .clients td:nth-child(8) { grid-area: status; }
  .t-buzones .clients td:nth-child(9) { position: absolute; top: 8px; right: 8px; padding: 0 !important; }
  .t-buzones .clients td.num { text-align: left; background: var(--surface-2); border-radius: var(--r-control); padding: 8px 10px; font-size: 18px; font-weight: 650; min-width: 0; }
  .t-buzones .clients td.num::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .t-buzones .clients .zero { color: var(--text); font-weight: 650; }
  .t-buzones .err-text { max-width: none; }

  .t-buzones .events-bar { grid-template-columns: 1fr; }
  .t-buzones .events tbody tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "tipo fecha" "detalle detalle" "cliente ms"; }
  .t-buzones .events td:nth-child(1) { grid-area: fecha; font-size: 12.5px; color: var(--muted); text-align: right; }
  .t-buzones .events td:nth-child(2) { grid-area: tipo; }
  .t-buzones .events td:nth-child(3) { grid-area: detalle; max-width: none; }
  .t-buzones .events td:nth-child(4) { grid-area: cliente; font-size: 13px; }
  .t-buzones .events td:nth-child(5) { grid-area: ms; font-size: 12.5px; color: var(--muted); }
  /* Admin activity table keeps a user column */
  .t-buzones .events.all tbody tr { grid-template-areas: "tipo fecha" "detalle detalle" "usuario usuario" "cliente ms"; }
  .t-buzones .events.all td:nth-child(4) { grid-area: usuario; font-size: 13px; color: var(--muted); }
  .t-buzones .events.all td:nth-child(5) { grid-area: cliente; font-size: 13px; }
  .t-buzones .events.all td:nth-child(6) { grid-area: ms; font-size: 12.5px; color: var(--muted); }
  .t-buzones .events.all td.actions { grid-column: 1 / -1; padding: 0 !important; }
  .t-buzones .events.all td.actions:empty { display: none; }
  /* Admin page on a phone: icon-only back link, scrollable tabs, labeled user cards */
  .admin-page .t-buzones .topbar-right .btn.ghost { padding: 8px; margin: 0; }
  .admin-page .t-buzones .topbar-right .btn.ghost span { display: none; }
  .admin-page .t-buzones .tabs { overflow-x: auto; scrollbar-width: none; }
  .admin-page .t-buzones .tabs .tab { flex: none; }
  .admin-page .t-buzones .hero-actions { grid-template-columns: 1fr; }
  .t-buzones .users tbody tr { grid-template-columns: 1fr 1fr; gap: 10px 8px; }
  .t-buzones .users td:nth-child(1), .t-buzones .users td:nth-child(2), .t-buzones .users td:nth-child(7), .t-buzones .users td.actions { grid-column: 1 / -1; }
  .t-buzones .users td[data-label] { text-align: left; font-size: 14px; }
  .t-buzones .users td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
  .t-buzones .users td.actions { position: static; text-align: left; }
  .t-buzones .tools { grid-template-columns: 1fr; }
  .t-buzones .tool-row { flex-direction: column; }

  .t-buzones .row2 { grid-template-columns: 1fr; gap: 0; }
  .t-buzones dialog { padding: 20px 18px; }
  .t-buzones .doc-list li { grid-template-columns: auto minmax(0, 1fr); }
  .t-buzones .doc-list li .btn { grid-column: 1 / -1; }
  .t-buzones .dialog-actions .btn { flex: 1; }
}

/* The workspace bar (index.html #bar): the product name, one tab per tool (shell.js TOOLS; the current one underlined
   in the text colour, so each tool keeps its own accent), then the account's controls: email, admin gear (admins only),
   theme, password and Salir. It sits on the page's tokens and Geist, so it matches every tab in light and dark. */
.bar { display: flex; align-items: stretch; gap: 32px; height: 48px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); color: var(--text); font: 14px/1.5 "Geist", system-ui, -apple-system, "Segoe UI", sans-serif; }
.bar-name { align-self: center; font-size: 15px; font-weight: 650; letter-spacing: -.02em; white-space: nowrap; }
.bar-tabs { display: flex; gap: 24px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.bar-tabs a { display: flex; align-items: center; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; text-decoration: none; white-space: nowrap; transition: color .15s; }
.bar-tabs a:hover { color: var(--text); }
.bar-tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--text); }
.bar-right { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.bar-me { margin-right: 10px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.bar-icon { appearance: none; border: 0; background: transparent; color: var(--muted); width: 36px; height: 36px; border-radius: var(--r-control); cursor: pointer; display: inline-grid; place-items: center; text-decoration: none; transition: background-color .15s, color .15s; }
.bar-icon:hover { background: var(--surface-2); color: var(--text); }
.bar-icon:active { transform: scale(.96); }
.bar-icon .i { width: 18px; height: 18px; fill: currentColor; }
.bar :is(a, button):focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 4px; }
body:not(.is-admin) .bar .admin-only { display: none; }
@media (max-width: 767px) {
  .bar { gap: 12px; padding: 0 8px 0 16px; }
  .bar-tabs { gap: 12px; }
  .bar-icon { width: 32px; }
  .bar-me, .bar-name { display: none; }   /* both tabs whole and four controls from 360 px; the name stays in the title */
}

/* Switching tabs (shell.js) is a view transition: the bar keeps its place, the tab under it gives way in a short
   cross-fade with a 4 px rise. Off under reduced motion (shell.js skips it). */
.bar { view-transition-name: bar; }
::view-transition-group(bar), ::view-transition-old(bar), ::view-transition-new(bar) { animation: none; }
::view-transition-old(root) { animation: bar-out 90ms cubic-bezier(.23, 1, .32, 1) both; }
::view-transition-new(root) { animation: bar-in 200ms cubic-bezier(.23, 1, .32, 1) both; }
@keyframes bar-out { to { opacity: 0; } }
@keyframes bar-in { from { opacity: 0; transform: translateY(4px); } }
