/* Warehouse Hub — hoja de estilos única (la CSP no permite estilos inline) */
:root {
  --bg: #f3f5f9; --surface: #fff; --surface-2: #f7f8fb; --hover: #f2f5fc;
  --text: #121a2b; --muted: #5a6577; --faint: #8791a3;
  --border: #e2e6ee; --border-strong: #c9d0dc;
  --primary: #2b59e3; --primary-hover: #1f47c4; --primary-soft: #e9efff; --on-primary: #fff;
  --ok: #17794a; --ok-soft: #e4f6ec; --bad: #c0302c; --bad-soft: #fdecea; --warn: #8f5200; --warn-soft: #fff2d6; --warn-border: #f1d391;
  --nav: #0f1729; --nav-2: #1b2640; --nav-text: #eef1f7; --nav-muted: #a3adc0;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 41, .05), 0 2px 6px rgba(15, 23, 41, .04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 41, .12);
  --ring: 0 0 0 3px rgba(43, 89, 227, .28);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  /* etapas: texto / fondo */
  --st-prealertas: #475467; --st-prealertas-bg: #eef0f4;
  --st-retained: #6a3fc7; --st-retained-bg: #f0eafd;
  --st-nodoc: #b3411b; --st-nodoc-bg: #fdebe3;
  --st-wrs: #1d55c7; --st-wrs-bg: #e6eeff;
  --st-shs: #17794a; --st-shs-bg: #e4f6ec;
  --st-serv: #0c7483; --st-serv-bg: #e1f5f7;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c111b; --surface: #151c2a; --surface-2: #1a2232; --hover: #1c2639;
    --text: #e8ecf4; --muted: #9ba6b9; --faint: #74809a;
    --border: #263044; --border-strong: #37435b;
    --primary: #7ea2ff; --primary-hover: #9bb7ff; --primary-soft: #1c2a4d; --on-primary: #0b1430;
    --ok: #5fd39a; --ok-soft: #143326; --bad: #ff8f86; --bad-soft: #3a1b1a; --warn: #f3c267; --warn-soft: #36290f; --warn-border: #5c4718;
    --nav: #0a0f18; --nav-2: #18213a; --nav-text: #eef1f7; --nav-muted: #9aa5ba;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
    --ring: 0 0 0 3px rgba(126, 162, 255, .35);
    --st-prealertas: #b4bdcc; --st-prealertas-bg: #232c3d;
    --st-retained: #c3a8ff; --st-retained-bg: #2a2147;
    --st-nodoc: #ffa583; --st-nodoc-bg: #3d2218;
    --st-wrs: #94b4ff; --st-wrs-bg: #1b2a4f;
    --st-shs: #6fdba4; --st-shs-bg: #143326;
    --st-serv: #6fd3df; --st-serv-bg: #11313a;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 15px; font-weight: 650; letter-spacing: -.005em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
.mono { font-family: var(--mono); font-size: .94em; letter-spacing: -.01em; }
.sub { color: var(--muted); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.icon { width: 16px; height: 16px; flex: none; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- barra superior ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--nav); color: var(--nav-text); border-bottom: 1px solid rgba(255, 255, 255, .06); }
.topbar-in { max-width: 1280px; margin: 0 auto; padding: 0 20px; height: 56px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; letter-spacing: -.01em; font-size: 15px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .icon { width: 28px; height: 28px; padding: 5px; border-radius: 8px; background: #2b59e3; color: #fff; }
.nav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav a { color: var(--nav-muted); padding: 7px 12px; border-radius: 8px; font-weight: 550; white-space: nowrap; }
.nav a:hover { color: #fff; background: var(--nav-2); text-decoration: none; }
.nav a[aria-current] { color: #fff; background: var(--nav-2); }
.topbar-end { display: flex; align-items: center; gap: 8px; }
.sync { display: flex; align-items: center; gap: 10px; }
.sync-state { display: flex; align-items: center; gap: 7px; color: var(--nav-muted); font-size: 12.5px; white-space: nowrap; }
.sync-state i { width: 8px; height: 8px; border-radius: 50%; background: #3ecf8e; box-shadow: 0 0 0 3px rgba(62, 207, 142, .18); }
.sync-state.is-bad i { background: #ff6b63; box-shadow: 0 0 0 3px rgba(255, 107, 99, .2); }
.sync-state.is-busy i { background: #f5b942; box-shadow: 0 0 0 3px rgba(245, 185, 66, .2); animation: pulse 1.2s ease-in-out infinite; }
.me { display: flex; align-items: center; gap: 8px; color: var(--nav-text); padding: 4px 10px 4px 4px; border-radius: 999px; font-weight: 550; }
.me:hover, .me[aria-current] { background: var(--nav-2); text-decoration: none; }
.me-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- botones y formularios ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .05s; }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--bad); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; height: 42px; font-size: 15px; }
.btn-nav { background: transparent; border-color: rgba(255, 255, 255, .16); color: var(--nav-text); height: 34px; }
.btn-nav:hover { background: var(--nav-2); }
.btn-icon { width: 34px; padding: 0; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.link-btn:hover { color: var(--bad); text-decoration: underline; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

input[type=text], input[type=password], input[type=search], input:not([type]), select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  height: 36px; padding: 0 11px; min-width: 0; transition: border-color .12s, box-shadow .12s; }
textarea { height: auto; padding: 10px 12px; width: 100%; resize: vertical; min-height: 84px; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--primary); box-shadow: var(--ring); border-radius: var(--radius-sm); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: 13px; }
.field input, .field select { width: 100%; height: 40px; }
.field small { color: var(--muted); }
.form { display: grid; gap: 16px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; }
.switch input { appearance: none; -webkit-appearance: none; width: 34px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; margin: 0; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s; }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(14px); }

/* ---------- estructura de página ---------- */
.page { max-width: 1280px; margin: 0 auto; padding: 24px 20px 56px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { font-size: 14px; margin-top: 4px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head .icon { color: var(--faint); }
.count { background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: 12px; font-weight: 600; border-radius: 999px; padding: 0 8px; }
.section { margin-top: 20px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 10px; }
.crumbs { margin-bottom: 14px; }
.crumbs a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 550; }
.crumbs a:hover { color: var(--text); text-decoration: none; }

/* ---------- avisos ---------- */
.flashes { display: grid; gap: 8px; margin-bottom: 16px; }
.flash { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); font-weight: 550; }
.flash span { flex: 1; }
.flash-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.flash-bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.flash-info { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.flash-x { border: 0; background: none; color: inherit; cursor: pointer; padding: 4px; display: flex; border-radius: 6px; opacity: .7; }
.flash-x:hover { opacity: 1; }
.alert { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius); background: var(--warn-soft); border: 1px solid var(--warn-border); color: var(--warn); margin-bottom: 18px; }
.alert:hover { text-decoration: none; }
.alert .icon { width: 20px; height: 20px; }
.alert-body { flex: 1; display: grid; }
.alert-body span { color: var(--text); opacity: .8; font-size: 13px; }
.alert-cta { font-weight: 650; white-space: nowrap; }
.empty { display: grid; justify-items: center; gap: 4px; padding: 40px 20px; color: var(--muted); text-align: center; }
.empty .icon { width: 32px; height: 32px; color: var(--faint); margin-bottom: 6px; stroke-width: 1.5; }
.empty strong { color: var(--text); font-size: 15px; }

/* ---------- etiquetas ---------- */
.stage { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  color: var(--c, var(--st-prealertas)); background: var(--b, var(--st-prealertas-bg)); }
.stage::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.stage b { font-weight: 700; }
[data-stage=prealertas] { --c: var(--st-prealertas); --b: var(--st-prealertas-bg); }
[data-stage=retained] { --c: var(--st-retained); --b: var(--st-retained-bg); }
[data-stage=withoutDocumentation] { --c: var(--st-nodoc); --b: var(--st-nodoc-bg); }
[data-stage=wrs] { --c: var(--st-wrs); --b: var(--st-wrs-bg); }
[data-stage=shs] { --c: var(--st-shs); --b: var(--st-shs-bg); }
[data-stage=listServices] { --c: var(--st-serv); --b: var(--st-serv-bg); }
.badge { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.co { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; white-space: nowrap; color: var(--text); }
.co i { width: 9px; height: 9px; border-radius: 3px; background: var(--h); }
[data-h="0"] { --h: #2b59e3; } [data-h="1"] { --h: #0e9384; } [data-h="2"] { --h: #c2410c; }
[data-h="3"] { --h: #7c3aed; } [data-h="4"] { --h: #be185d; } [data-h="5"] { --h: #4d7c0f; }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--h, var(--primary)); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .02em; flex: none; }

/* ---------- inicio: empresas ---------- */
.companies { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 22px; }
.company { padding: 16px 18px; display: grid; gap: 12px; position: relative; overflow: hidden; }
.company::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--h); }
.company.is-active { border-color: var(--primary); box-shadow: var(--ring); }
.company-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.company-name { font-size: 15px; font-weight: 700; color: var(--text); }
.company-name::after { content: ""; position: absolute; inset: 0; }
.company-total { font-size: 30px; line-height: 1; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.company-total small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.company-stages { display: flex; flex-wrap: wrap; gap: 6px; min-height: 24px; position: relative; }
.company-stages a:hover { text-decoration: none; filter: brightness(.96); }
.company-foot { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; padding-top: 10px; border-top: 1px solid var(--border); }
.company-foot.is-bad { color: var(--bad); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.is-bad .dot { background: var(--bad); }
.is-idle .dot { background: var(--faint); }

/* ---------- inicio: filtros y tabla ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; color: var(--muted); font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.tab:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.tab[aria-current] { background: var(--primary-soft); color: var(--primary); }
.tab b { font-size: 12px; font-weight: 650; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.tab[aria-current] b { background: transparent; border-color: transparent; color: inherit; padding: 0; }
.filters { display: flex; gap: 8px; flex: 1; justify-content: flex-end; min-width: 260px; }
.search { position: relative; flex: 1; max-width: 340px; display: flex; }
.search .icon { position: absolute; left: 11px; top: 10px; color: var(--faint); pointer-events: none; }
.search input { width: 100%; padding-left: 34px; }
.result-bar { display: flex; align-items: center; gap: 10px; padding: 9px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.result-bar .chip { display: inline-flex; align-items: center; gap: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 1px 4px 1px 10px; color: var(--text); font-weight: 550; }
.result-bar .chip a { display: flex; color: var(--muted); padding: 3px; border-radius: 50%; }
.result-bar .chip a:hover { background: var(--hover); color: var(--text); }
.result-bar .chip .icon { width: 13px; height: 13px; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
.data th { text-align: left; font-size: 11.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); }
.data td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data tbody tr:last-child td { border-bottom: 0; }
.data tr[data-href] { cursor: pointer; transition: background .1s; }
.data tr[data-href]:hover { background: var(--hover); }
.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data th.num { text-align: right; }
.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--st-nodoc); }
.wr { font-family: var(--mono); font-weight: 700; font-size: 13.5px; color: var(--text); }
.wr:hover { color: var(--primary); }
.state-note { color: var(--st-nodoc); font-size: 12.5px; font-weight: 550; margin-top: 4px; }
.track { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 13px; }
.track .icon { width: 12px; height: 12px; opacity: .6; }
.clip { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-sm { max-width: 170px; }
.cm-link { display: inline-flex; align-items: center; gap: 5px; font-weight: 650; color: var(--text); }
.cm-link .icon { color: var(--primary); }
.cm-add { color: var(--faint); font-weight: 500; opacity: 0; transition: opacity .1s; }
tr:hover .cm-add, .cm-add:focus-visible { opacity: 1; }

/* ---------- movimientos ---------- */
.feed { list-style: none; margin: 0; padding: 6px 18px 10px; columns: 2 320px; column-gap: 32px; }
.feed li { display: flex; gap: 12px; padding: 9px 0; break-inside: avoid; border-bottom: 1px dashed var(--border); }
.feed-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: var(--faint); flex: none; }
.feed-dot[data-kind=nuevo], .feed-dot[data-kind=reaparece] { background: var(--ok); }
.feed-dot[data-kind=sale] { background: var(--faint); }
.feed-dot[data-kind=cambio] { background: var(--primary); }

/* ---------- ficha del paquete ---------- */
.head-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.head-title h1 { font-family: var(--mono); font-size: 26px; }
.head-meta { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; color: var(--muted); margin-top: 8px; }
.head-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.detail-main, .detail-side { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; }
.comments { list-style: none; margin: 0; padding: 4px 18px; }
.comment { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.comment-head time { color: var(--muted); font-size: 12.5px; }
.comment-head form { margin-left: auto; }
.comment-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.composer { padding: 16px 18px 18px; display: grid; gap: 10px; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.composer-foot .sub { display: inline-flex; align-items: center; gap: 6px; }
.composer-foot .icon { width: 13px; height: 13px; }
.counter { font-variant-numeric: tabular-nums; white-space: nowrap; margin-left: 4px; }
.track-box { display: grid; gap: 4px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 12px; }
.track-box .carrier { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.track-num { font-family: var(--mono); font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 16px; margin: 0; }
.dl dt { color: var(--muted); white-space: nowrap; }
.dl dd { margin: 0; text-align: right; font-weight: 550; overflow-wrap: anywhere; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.files { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.files a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-weight: 550; }
.files a:hover { background: var(--hover); border-color: var(--border-strong); text-decoration: none; }
.files a span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files .icon { color: var(--primary); }
.files .icon:last-child { color: var(--faint); width: 13px; height: 13px; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.thumbs a { display: block; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.timeline { list-style: none; margin: 0; padding: 16px 18px; display: grid; }
.timeline li { position: relative; padding: 0 0 16px 22px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
.timeline li::after { content: ""; position: absolute; left: 4px; top: 18px; bottom: 0; width: 1px; background: var(--border-strong); }
.timeline li:last-child::after { display: none; }
.timeline strong { font-weight: 600; }
.foot-note { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

/* ---------- acceso y cuenta ---------- */
body.auth { min-height: 100vh; display: grid; background: radial-gradient(1100px 520px at 50% -10%, rgba(43, 89, 227, .16), transparent 70%), var(--bg); }
body.auth .page { width: 100%; max-width: 420px; padding: 24px 20px; align-self: center; }
.auth-card { padding: 32px 28px 28px; box-shadow: var(--shadow-lg); }
.auth-brand { display: grid; justify-items: center; gap: 6px; text-align: center; margin-bottom: 24px; }
.auth-brand .icon { width: 48px; height: 48px; padding: 10px; border-radius: 14px; background: var(--primary); color: var(--on-primary); margin-bottom: 8px; }
.auth-card .flash { margin-bottom: 18px; font-weight: 500; align-items: flex-start; }
.error-cta { margin-top: 16px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 18px; }
.narrow { max-width: 480px; }
.error-page { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 12vh 20px; }
.error-code { font-size: 64px; line-height: 1; font-weight: 800; letter-spacing: -.04em; color: var(--border-strong); }

/* ---------- usuarios ---------- */
.user-cell { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.users td { vertical-align: middle; }
.users input[type=password] { width: 170px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; }
.new-user { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 14px; align-items: end; }
.kv { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.kv span { color: var(--muted); }
.kv b { font-weight: 550; color: var(--text); }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- pantallas chicas ---------- */
@media (max-width: 980px) {
  .detail { grid-template-columns: minmax(0, 1fr); }
  .sync-state, .me-name, .btn-nav span { display: none; }
  .btn-nav { width: 34px; padding: 0; }
  .me { padding: 4px; }
  .new-user { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .topbar-in { gap: 10px; padding: 0 12px; }
  .brand span { display: none; }
  .page { padding: 16px 12px 40px; }
  h1 { font-size: 21px; }
  .filters { min-width: 100%; }
  .search { max-width: none; }
  .new-user { grid-template-columns: 1fr; }
  /* la tabla pasa a tarjetas */
  .stack thead { display: none; }
  .stack, .stack tbody, .stack tr, .stack td { display: block; }
  .stack tr { padding: 12px 14px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
  .stack td { padding: 0; border: 0; min-width: 0; }
  .stack td::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); margin-bottom: 1px; }
  .stack td.wide { grid-column: 1 / -1; }
  .stack td.bare::before { display: none; }
  .stack .num { text-align: left; }
  .stack .clip { max-width: none; white-space: normal; }
  .stack .row-warn { box-shadow: inset 3px 0 0 var(--st-nodoc); }
  .row-warn td:first-child { box-shadow: none; }
  .cm-add { opacity: 1; }
  .actions { justify-content: flex-start; }
  .users input[type=password] { width: 100%; }
}
