/* Panel AnzenTec: sidebar azul marino, tarjetas blancas y acento azul de la marca */

/* ── Tokens ─────────────────────────────────────────── */
:root {
  --nav-bg: #0d1b2e;
  --nav-fg: #ffffff;
  --nav-muted: #a9b4c4;
  --nav-hover: rgba(255, 255, 255, .06);
  --bg: #ffffff;
  --bg-soft: #f4f6f9;
  --surface: #ffffff;
  --fg: #2b2f36;
  --muted: #5f6873;
  --line: #dfe3e8;
  --accent: #1f6fc0;
  --accent-strong: #185a9d;
  --nav-accent: #4d9bea;
  --accent-fg: #ffffff;
  --accent-soft: #e8f1fb;
  --ok: #4caf50;
  --ok-soft: #e7f5e8;
  --ok-fg: #2e7d32;
  --info: #1f6fc0;
  --danger: #e53935;
  --danger-soft: #fdecea;
  --danger-fg: #c62828;
  --warn: #ef8c00;
  --warn-fg: #a35a00;
  --neutral: #bdbdbd;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 2px 8px rgba(0, 0, 0, .06);
  --radius: 4px;
  --sidebar-w: 300px;
  --sidebar-w-collapsed: 76px;
  --font: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --nav-bg: #0a1422; --nav-hover: rgba(255, 255, 255, .07);
    --bg: #0f1621; --bg-soft: #141d2a; --surface: #182231;
    --fg: #e4e9f0; --muted: #98a4b5; --line: #2a3546;
    --accent: #6fb0ff; --accent-strong: #8cc0ff; --accent-fg: #0f1621; --accent-soft: #1b2b44;
    --ok: #66bb6a; --ok-soft: #15291a; --ok-fg: #81c784;
    --info: #6fb0ff; --danger: #ef5350; --danger-soft: #33191a; --danger-fg: #ff8a80;
    --warn: #ffa726; --warn-fg: #ffb74d; --neutral: #6b7480;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 2px 10px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --nav-bg: #0a1422; --nav-hover: rgba(255, 255, 255, .07);
  --bg: #0f1621; --bg-soft: #141d2a; --surface: #182231;
  --fg: #e4e9f0; --muted: #98a4b5; --line: #2a3546;
  --accent: #6fb0ff; --accent-strong: #8cc0ff; --accent-fg: #0f1621; --accent-soft: #1b2b44;
  --ok: #66bb6a; --ok-soft: #15291a; --ok-fg: #81c784;
  --info: #6fb0ff; --danger: #ef5350; --danger-soft: #33191a; --danger-fg: #ff8a80;
  --warn: #ffa726; --warn-fg: #ffb74d; --neutral: #6b7480;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 2px 10px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

/* ── Base ───────────────────────────────────────────── */
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 500; line-height: 1.2; margin: 0; }
code { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.empty { color: var(--muted); margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.icon { width: 22px; height: 22px; flex: none; }

/* ── Marca ──────────────────────────────────────────── */
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; }
.brand__mark { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #ffffff; color: var(--nav-bg); font-weight: 700; font-size: 1.15rem; flex: none; box-shadow: inset 0 0 0 3px var(--accent); }
.brand__text { display: grid; line-height: 1; }
.brand__name { font-size: 1.45rem; font-weight: 500; letter-spacing: -.01em; }
.brand__name strong { font-weight: 400; }
.brand__tagline { font-size: .68rem; font-style: italic; opacity: .8; margin-top: 3px; padding-left: 14px; white-space: nowrap; }

/* ── Estructura con menú lateral ────────────────────── */
.app { min-height: 100vh; padding-left: var(--sidebar-w); transition: padding-left .2s ease; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--nav-bg); color: var(--nav-fg); display: flex; flex-direction: column; padding: 20px 16px; gap: 20px; overflow-y: auto; z-index: 30; transition: width .2s ease, transform .2s ease; }
.sidebar__head { display: flex; align-items: center; gap: 14px; padding: 0 4px; }
.sidebar__brand { color: var(--nav-fg); }
.sidebar__brand:hover { text-decoration: none; }
.sidebar .sidebar__close { display: none; }

.icon-button { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; flex: none; }
.icon-button:hover { background: var(--nav-hover); }

.account { display: flex; align-items: center; gap: 14px; padding: 12px 8px; color: var(--nav-fg); border-radius: var(--radius); }
.account:hover { background: var(--nav-hover); text-decoration: none; }
.account__icon { width: 40px; height: 40px; stroke-width: 1.25; flex: none; }
.account__text { display: grid; min-width: 0; }
.account__name { font-size: 1.05rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account__meta { font-size: .88rem; color: var(--nav-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { display: grid; gap: 4px; }
.nav--footer { margin-top: auto; }
.nav__form { margin: 0; }
.nav__link { display: flex; align-items: center; gap: 22px; width: 100%; padding: 10px 18px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--nav-fg); font: inherit; font-weight: 500; text-align: left; cursor: pointer; }
.nav__link .icon { color: var(--nav-muted); }
.nav__link:hover { background: var(--nav-hover); text-decoration: none; }
.nav__link.is-active { border-color: var(--nav-accent); color: var(--nav-accent); background: rgba(77, 155, 234, .1); }
.nav__link.is-active .icon { color: var(--nav-accent); }
.nav__link--danger, .nav__link--danger .icon { color: #ff6b66; }
.nav__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Contraído (solo escritorio) */
@media (min-width: 901px) {
  .is-sidebar-collapsed { padding-left: var(--sidebar-w-collapsed); }
  .is-sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); padding-inline: 10px; }
  .is-sidebar-collapsed .sidebar { overflow: visible; }
  .is-sidebar-collapsed .sidebar__brand { display: none; }
  .is-sidebar-collapsed .account__text,
  .is-sidebar-collapsed .nav__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .is-sidebar-collapsed [data-tooltip] { position: relative; }
  .is-sidebar-collapsed [data-tooltip]:is(:hover, :focus-visible)::after {
    content: attr(data-tooltip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
    padding: 6px 10px; border-radius: var(--radius); background: #1e2b3d; color: #ffffff; font-size: .85rem; font-weight: 500;
    white-space: nowrap; box-shadow: var(--shadow); z-index: 40; pointer-events: none;
  }
  .is-sidebar-collapsed .sidebar__head { justify-content: center; padding: 0; }
  .is-sidebar-collapsed .sidebar__collapse .icon { transform: scaleX(-1); }
  .is-sidebar-collapsed .account,
  .is-sidebar-collapsed .nav__link { justify-content: center; padding-inline: 0; }
}

.mobilebar { display: none; }
.sidebar__backdrop { display: none; }

.content { max-width: 1240px; margin: 0 auto; padding: 32px max(16px, 3vw) 64px; display: grid; gap: 24px; align-content: start; }
.narrow { width: 100%; max-width: 880px; margin: 0 auto; display: grid; gap: 24px; }

/* ── Encabezados de página ──────────────────────────── */
.page-header { display: grid; gap: 6px; }
.page-header--center { text-align: center; justify-items: center; }
.page-header--row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: clamp(1.8rem, 3vw, 2.4rem); font-weight: 400; color: var(--fg); }
.page-title--accent { color: var(--accent); font-weight: 500; }

/* ── Tarjetas ───────────────────────────────────────── */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin: 0; }
.card__body { padding: 24px 28px 28px; display: grid; gap: 12px; align-content: start; }
.card__media { height: 150px; display: grid; place-items: center; background: var(--bg-soft); color: var(--accent); }
.card__media .icon { width: 72px; height: 72px; stroke-width: 1.1; opacity: .85; }
.card__title { font-size: 1.45rem; color: var(--accent); }
.card__text { margin: 0; font-size: .92rem; color: var(--fg); opacity: .85; }
.card__links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.card__subtitle { font-size: 1.1rem; margin-top: 10px; }
.card__heading { font-size: 1.35rem; margin-bottom: 8px; }
.card__heading--flush { margin: 0; }
.card__heading-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.card__email { margin: -6px 0 0; color: var(--accent); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 28px; }

/* Lista con puntos de estado */
.status-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.status-list li { display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--neutral); }
.status-dot--ok { background: var(--ok); }
.status-dot--info { background: var(--info); }
.status-dot--danger { background: var(--danger); }
.status-dot--warn { background: var(--warn); }
.status-dot--hollow { background: transparent; box-shadow: inset 0 0 0 2px var(--ok); }

/* Datos con icono (Rol, Empresa, Alta…) */
.info-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 32px; margin: 12px 0 0; }
.info-row { display: flex; align-items: center; gap: 14px; }
.info-row .icon { color: var(--muted); width: 26px; height: 26px; stroke-width: 1.4; }
.info-row dt { font-size: .8rem; color: var(--muted); }
.info-row dd { margin: 0; font-size: 1.05rem; }

/* ── Tablas ─────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 500; background: var(--bg-soft); }
.table tbody tr:hover { background: var(--bg-soft); }
.table tr:last-child td { border-bottom: 0; }
.table__actions { display: flex; gap: 16px; justify-content: flex-end; align-items: center; }
.table__actions form { margin: 0; }
.card > .table-wrap .table th:first-child, .card > .table-wrap .table td:first-child { padding-left: 28px; }

.pill, .role-chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 500; white-space: nowrap; }
.pill--ok { background: var(--ok-soft); color: var(--ok-fg); }
.pill--off { background: var(--bg-soft); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.role-chip { background: var(--accent-soft); color: var(--accent); }
.role-chip--superadmin { background: var(--danger-soft); color: var(--danger-fg); }
.role-chip--support { background: var(--bg-soft); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.role-chip--company_admin { background: var(--ok-soft); color: var(--ok-fg); }

/* ── Botones ────────────────────────────────────────── */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 500; font-size: .9rem; letter-spacing: .08em; text-transform: uppercase; padding: 10px 22px; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg); cursor: pointer; }
.button:hover { background: var(--accent-strong); border-color: var(--accent-strong); text-decoration: none; }
.button .icon { width: 18px; height: 18px; }
.button--outline { background: var(--surface); color: var(--accent); border-color: var(--line); }
.button--outline:hover { background: var(--accent-soft); border-color: var(--line); }
.button--text { background: none; border: 0; padding: 0; color: var(--accent); text-transform: none; letter-spacing: 0; font-size: inherit; }
.button--text:hover { background: none; text-decoration: underline; }
.button--danger { color: var(--danger-fg); }

/* ── Formularios ────────────────────────────────────── */
.form { display: grid; gap: 20px; margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; align-items: start; }
fieldset.form-grid { border: 0; padding: 0; margin: 0; min-width: 0; }
.secret-card { box-shadow: var(--shadow), inset 0 3px 0 var(--warn); }
.secret-card__value { display: block; padding: 10px 14px; border-radius: var(--radius); background: var(--bg-soft); font-size: 1rem; overflow-wrap: anywhere; user-select: all; }
.form__actions { display: flex; gap: 16px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field__hint { color: var(--muted); font-size: .8rem; padding-left: 14px; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], select, textarea {
  font: inherit; font-size: 1rem; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; width: 100%;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: inset 0 0 0 1px var(--accent); }
select { appearance: none; padding-right: 44px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 17px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }

/* Etiqueta flotante sobre el borde (estilo outlined) */
.field--outlined { position: relative; }
.field--outlined > label { position: absolute; top: -8px; left: 12px; padding: 0 4px; background: var(--surface); color: var(--muted); font-size: .78rem; line-height: 16px; pointer-events: none; z-index: 1; }
.field--outlined:focus-within > label { color: var(--accent); }
.field--outlined.is-required > label::after { content: " *"; color: var(--danger-fg); }
.field__control { position: relative; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field.has-error input:focus, .field.has-error select:focus { box-shadow: inset 0 0 0 1px var(--danger); }
.field.has-error > label, .field.has-error:focus-within > label { color: var(--danger-fg); }
.field__error { display: flex; align-items: center; gap: 6px; color: var(--danger-fg); font-size: .82rem; padding-left: 14px; }
.field__error .icon { width: 16px; height: 16px; }
.field__caps { color: var(--warn); font-weight: 500; }
.field__toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.field__toggle:hover { background: var(--bg-soft); color: var(--fg); }
.field__toggle.is-on { color: var(--accent); }
.field__toggle .icon { width: 20px; height: 20px; }
.field__control:has(.field__toggle) input { padding-right: 48px; }
.field__icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.field__control:has(.field__icon) input { padding-left: 42px; }
.auth .is-required > label::after { content: none; }

/* Requisitos de contraseña */
.password-rules { list-style: none; margin: -6px 0 0; padding: 0 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: .85rem; color: var(--muted); }
.password-rules__item { display: flex; align-items: center; gap: 6px; }
.password-rules__item .icon { width: 16px; height: 16px; opacity: .35; }
.password-rules__item.is-met { color: var(--ok-fg); }
.password-rules__item.is-met .icon { opacity: 1; }

.choice-list { display: grid; gap: 4px; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.choice input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.choice small { display: block; }

/* ── Avisos ─────────────────────────────────────────── */
.flash { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); border-left: 4px solid; }
.flash .icon { width: 20px; height: 20px; margin-top: 1px; }
.flash p, .flash ul { margin: 0; }
.flash > p, .flash > div { flex: 1; }
.flash a { color: inherit; text-decoration: underline; }
.error-summary:focus { outline: 2px solid var(--danger); outline-offset: 2px; }
.flash__close { display: grid; place-items: center; width: 28px; height: 28px; margin: -4px -6px 0 0; border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; }
.flash__close:hover { background: rgba(0, 0, 0, .06); }
.flash__close .icon { width: 18px; height: 18px; margin: 0; }
.flash ul { padding-left: 1.2em; margin-top: 4px; }
.flash--notice { background: var(--ok-soft); border-color: var(--ok); color: var(--ok-fg); }
.flash--alert { background: var(--danger-soft); border-color: var(--danger); color: var(--danger-fg); }

/* ── Acceso (login y contraseñas) ───────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 2fr) 3fr; }
.auth__hero { background: var(--nav-bg); color: var(--nav-fg); padding: 48px; display: flex; flex-direction: column; justify-content: center; gap: 24px; }
.auth__hero .brand__mark { width: 52px; height: 52px; font-size: 1.6rem; }
.auth__hero .brand__name { font-size: 2.2rem; }
.auth__lead { margin: 0; max-width: 34ch; color: var(--nav-muted); font-size: 1.05rem; }
.auth__main { display: grid; place-items: center; padding: 32px 16px; background: var(--bg-soft); }
.auth__card { width: 100%; max-width: 420px; padding: 32px; display: grid; gap: 20px; }
.auth__card .button { width: 100%; }
.auth__card p { margin: 0; }
.auth__title { font-size: 1.8rem; font-weight: 400; }

/* ── Navegación auxiliar ────────────────────────────── */
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 50; padding: 10px 16px; border-radius: var(--radius); background: var(--accent); color: var(--accent-fg); font-weight: 500; }
.skip-link:focus { top: 12px; text-decoration: none; }
.content:focus { outline: none; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: .92rem; justify-self: start; }
.back-link .icon { width: 18px; height: 18px; }
.page-header__title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }

/* ── Filtros, resultados y paginación ───────────────── */
.filters { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(2, minmax(160px, 1fr)) auto; gap: 16px; align-items: start; margin: 0; }
.results-count { margin: 0 0 -12px; color: var(--muted); font-size: .9rem; }
turbo-frame { display: grid; gap: 24px; }
.pagy.series-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.pagy.series-nav a { min-width: 40px; height: 40px; padding: 0 12px; display: inline-grid; place-items: center; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--accent); font-weight: 500; }
.pagy.series-nav a:hover { background: var(--accent-soft); text-decoration: none; }
.pagy.series-nav a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.pagy.series-nav a[aria-disabled="true"]:not([aria-current]) { color: var(--muted); background: transparent; border-color: transparent; }

/* ── Estados vacíos y avisos en tarjetas ────────────── */
.empty-state { display: grid; justify-items: center; gap: 12px; padding: 40px 24px; text-align: center; }
.empty-state__icon { width: 40px; height: 40px; color: var(--muted); stroke-width: 1.4; }
.empty-state .card__text { max-width: 46ch; }
.pill--info { background: var(--accent-soft); color: var(--accent); }
.pill--danger { background: var(--danger-soft); color: var(--danger-fg); }
.pill--warn { background: var(--bg-soft); color: var(--warn-fg); box-shadow: inset 0 0 0 1px var(--warn); }

/* Muestra del color de una flotilla (grupo en Navixy) */
.color-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; margin-right: 8px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .15); }
.field__control input[type="color"] { width: 100%; height: 54px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.field__control input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.field__control input[type="color"]::-webkit-color-swatch { border: none; border-radius: 4px; }
.field__control input[type="color"]::-moz-color-swatch { border: none; border-radius: 4px; }
.card--warn { box-shadow: var(--shadow), inset 0 3px 0 var(--warn); }
.card__alert { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; color: var(--warn-fg); font-size: .9rem; font-weight: 500; }
.card__alert .icon { width: 18px; height: 18px; }
.card__hint { margin: 0; color: var(--muted); font-size: .9rem; }

/* ── Telemetría ─────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs__link { padding: 10px 16px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 500; }
.tabs__link:hover { color: var(--fg); text-decoration: none; }
.tabs__link.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.filters--telemetry { grid-template-columns: minmax(220px, 2fr) repeat(auto-fit, minmax(160px, 1fr)); }
.filters--vehicle-telemetry { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 16px; }
.table--compact th, .table--compact td { padding: 10px 12px; font-size: .92rem; font-variant-numeric: tabular-nums; }
.table--compact td:first-child { white-space: nowrap; }
.truncate { max-width: 32ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-chip { display: flex; align-items: center; gap: 12px; margin: 0; }
.narrow--wide { max-width: 1120px; }
.disclosure > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before { content: "▸"; color: var(--muted); font-size: .9em; transition: transform .15s; }
.disclosure[open] > summary::before { transform: rotate(90deg); }
.code-block { margin: 12px 0 0; padding: 16px; max-height: 480px; overflow: auto; border-radius: var(--radius); background: var(--bg-soft); font-size: .85rem; line-height: 1.5; }

/* ── Actividad reciente ─────────────────────────────── */
.activity { list-style: none; margin: 0; padding: 0; display: grid; }
.activity__item { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.activity__item:last-child { border-bottom: 0; }
.activity__icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.activity__icon .icon { width: 18px; height: 18px; }
.activity__text { margin: 0; }
.activity__time { color: var(--muted); font-size: .85rem; white-space: nowrap; }

/* ── Diálogo de confirmación ────────────────────────── */
.dialog { width: min(440px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 8px; background: var(--surface); color: var(--fg); box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
.dialog::backdrop { background: rgba(13, 27, 46, .55); }
.dialog__body { display: grid; gap: 12px; padding: 24px; margin: 0; }
.dialog__title { font-size: 1.25rem; }
.dialog__message { margin: 0; color: var(--muted); }
.dialog__actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.button--destructive { background: var(--danger-fg); border-color: var(--danger-fg); color: #ffffff; }
.button--destructive:hover { background: #a61d1d; border-color: #a61d1d; }

/* ── Móvil y tableta ────────────────────────────────── */
@media (max-width: 900px) {
  .app { padding-left: 0; }
  .mobilebar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 20; padding: 8px 12px; background: var(--nav-bg); color: var(--nav-fg); }
  .mobilebar__brand { color: var(--nav-fg); }
  .mobilebar__brand:hover { text-decoration: none; }
  .mobilebar .brand__tagline { display: none; }
  .sidebar { width: min(var(--sidebar-w), 86vw); transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s .2s; }
  .is-sidebar-open .sidebar { transform: none; visibility: visible; transition: transform .2s ease; box-shadow: 0 0 24px rgba(0, 0, 0, .35); }
  .is-sidebar-open .sidebar__backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .4); }
  .sidebar__collapse { display: none; }
  .sidebar .sidebar__close { display: inline-grid; }
  .content { padding-top: 24px; }

  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth__hero { padding: 28px 16px; gap: 12px; }
  .auth__hero .brand__name { font-size: 1.7rem; }
}

@media (max-width: 640px) {
  .card__body { padding: 20px 16px 24px; }
  .card-grid { gap: 20px; }
  .table thead { display: none; }
  .table tr { display: grid; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .table td, .card > .table-wrap .table td:first-child { border: 0; padding: 2px 16px; }
  .table__actions { justify-content: flex-start; }
  /* Cada fila es su propia tarjeta */
  .card--table { background: none; box-shadow: none; overflow: visible; }
  .card--table .table tbody { display: grid; gap: 14px; }
  .card--table .table tr { gap: 6px; padding: 16px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
  .card--table .table tbody tr:hover { background: var(--surface); }
  .card--table .table td:first-child { font-weight: 500; font-size: 1.05rem; }
  .card--table .table__actions { padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--line); }
  .card--table .table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85rem; margin-right: 4px; }
  .filters, .filters--telemetry { grid-template-columns: 1fr 1fr; }
  .truncate { max-width: none; white-space: normal; }
  .filters__search { grid-column: 1 / -1; }
  .activity__item { grid-template-columns: auto 1fr; }
  .activity__time { grid-column: 2; }
  .form__actions { justify-content: stretch; }
  .form__actions .button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .app, .sidebar { transition: none; }
}
