:root {
  color-scheme: light dark;

  --rail-w: 88px;

  --font-ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --bg: #f3f5f9;
  --panel: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;
  --line: #dfe5ee;
  --line-soft: #eef1f6;

  --text: #111726;
  --muted: #5c6779;

  --primary: #2351c6;
  --primary-dark: #1b3f9a;
  --primary-ink: #ffffff;
  --primary-soft: rgba(35, 81, 198, 0.12);

  --ok: #0b7a58;
  --ok-bg: #ddf4ea;
  --ok-dot: #0f9b70;
  --warn: #94500f;
  --warn-bg: #fbeed6;
  --warn-dot: #b4700f;
  --off: #5c6779;
  --off-bg: #ebeff5;
  --off-dot: #8a94a6;
  --danger: #cf3049;
  --danger-bg: rgba(207, 48, 73, 0.08);
  --danger-line: rgba(207, 48, 73, 0.3);

  --sidebar: #0b1020;
  --sidebar-line: #1b2238;
  --nav-fg: rgba(255, 255, 255, 0.62);
  --nav-active-bg: rgba(255, 255, 255, 0.1);
  --nav-active-fg: #ffffff;
  --brand-bg: #ffffff;
  --brand-fg: #0b1020;

  --scrim: rgba(10, 15, 28, 0.5);
  --focus: rgba(35, 81, 198, 0.3);
  --shadow: 0 1px 2px rgba(17, 23, 38, 0.05), 0 10px 28px rgba(17, 23, 38, 0.05);
  --shadow-lg: 0 24px 64px rgba(17, 23, 38, 0.22);
}

/* Tema oscuro. Los mismos tokens entran por dos vias:
   - preferencia del sistema, salvo que se haya elegido el claro a mano
   - eleccion manual, guardada en localStorage por theme.js (data-theme en <html>) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0e16;
    --panel: #111725;
    --surface-2: #161d2e;
    --surface-3: #1a2233;
    --line: #232c40;
    --line-soft: #1b2334;

    --text: #e6ebf4;
    --muted: #8a96ac;

    --primary: #5d8bff;
    --primary-dark: #7ba1ff;
    --primary-ink: #08101f;
    --primary-soft: rgba(93, 139, 255, 0.16);

    --ok: #56d9ab;
    --ok-bg: rgba(62, 207, 154, 0.14);
    --ok-dot: #3ecf9a;
    --warn: #e8a84e;
    --warn-bg: rgba(232, 168, 78, 0.14);
    --warn-dot: #e8a84e;
    --off: #8a96ac;
    --off-bg: rgba(138, 150, 172, 0.13);
    --off-dot: #6d7a90;
    --danger: #ff6b83;
    --danger-bg: rgba(255, 107, 131, 0.1);
    --danger-line: rgba(255, 107, 131, 0.32);

    --sidebar: #070b12;
    --sidebar-line: #1a2233;
    --nav-fg: #7d8899;
    --nav-active-bg: #171f30;
    --nav-active-fg: #e6ebf4;
    --brand-bg: #5d8bff;
    --brand-fg: #070b12;

    --scrim: rgba(2, 5, 12, 0.66);
    --focus: rgba(93, 139, 255, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px rgba(0, 0, 0, 0.26);
    --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0e16;
  --panel: #111725;
  --surface-2: #161d2e;
  --surface-3: #1a2233;
  --line: #232c40;
  --line-soft: #1b2334;

  --text: #e6ebf4;
  --muted: #8a96ac;

  --primary: #5d8bff;
  --primary-dark: #7ba1ff;
  --primary-ink: #08101f;
  --primary-soft: rgba(93, 139, 255, 0.16);

  --ok: #56d9ab;
  --ok-bg: rgba(62, 207, 154, 0.14);
  --ok-dot: #3ecf9a;
  --warn: #e8a84e;
  --warn-bg: rgba(232, 168, 78, 0.14);
  --warn-dot: #e8a84e;
  --off: #8a96ac;
  --off-bg: rgba(138, 150, 172, 0.13);
  --off-dot: #6d7a90;
  --danger: #ff6b83;
  --danger-bg: rgba(255, 107, 131, 0.1);
  --danger-line: rgba(255, 107, 131, 0.32);

  --sidebar: #070b12;
  --sidebar-line: #1a2233;
  --nav-fg: #7d8899;
  --nav-active-bg: #171f30;
  --nav-active-fg: #e6ebf4;
  --brand-bg: #5d8bff;
  --brand-fg: #070b12;

  --scrim: rgba(2, 5, 12, 0.66);
  --focus: rgba(93, 139, 255, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px rgba(0, 0, 0, 0.26);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.5);
}

:root[data-theme="light"] {
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.mono,
.monospace {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- sidebar */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  padding: 18px 12px;
  z-index: 3;
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-line);
  color: #ffffff;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--brand-bg);
  color: var(--brand-fg);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.nav {
  width: 100%;
  display: grid;
  gap: 4px;
}

.nav-item {
  width: 100%;
  min-height: 54px;
  padding: 8px 4px;
  display: grid;
  place-items: center;
  gap: 5px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--nav-fg);
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.nav-item svg {
  display: block;
}

.nav-item small {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.nav-item:hover {
  color: var(--nav-active-fg);
  background: var(--nav-active-bg);
}

.nav-item.active {
  color: var(--nav-active-fg);
  background: var(--nav-active-bg);
  box-shadow: inset 2px 0 0 var(--primary);
}

.nav-item[href*="panic"] {
  color: #ffc9d2;
}

.nav-item[href*="panic"]:hover {
  color: #ffffff;
  background: rgba(207, 48, 73, 0.26);
}

.nav-item.bottom {
  margin-top: auto;
}

/* ------------------------------------------------------------------ shell */

.shell {
  width: calc(100% - var(--rail-w));
  max-width: 1880px;
  margin-left: var(--rail-w);
  padding: 22px 26px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 14.5px;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -0.01em;
}

p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.eyebrow {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.status {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12.5px;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 999px;
  background: var(--off-dot);
}

body:has(#authenticatedContent:not([hidden])) .status-dot {
  background: var(--ok-dot);
}

/* --------------------------------------------------------------- controls */

button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

button svg {
  display: block;
  flex: none;
}

button.primary {
  color: var(--primary-ink);
  background: var(--primary);
}

button.primary:hover {
  background: var(--primary-dark);
}

button.secondary,
.icon-button {
  color: var(--text);
  border-color: var(--line);
  background: var(--surface-2);
}

button.secondary:hover,
.icon-button:hover {
  background: var(--surface-3);
}

button.warn {
  color: var(--warn);
  border-color: transparent;
  background: var(--warn-bg);
}

button.warn:hover {
  border-color: var(--warn);
}

button.danger {
  color: var(--danger);
  border-color: var(--line);
  background: transparent;
}

button.danger:hover {
  border-color: var(--danger-line);
  background: var(--danger-bg);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#themeBtn svg {
  display: none;
}

#themeBtn:not([data-theme]) [data-icon="system"],
#themeBtn[data-theme="system"] [data-icon="system"],
#themeBtn[data-theme="light"] [data-icon="light"],
#themeBtn[data-theme="dark"] [data-icon="dark"] {
  display: block;
}

.icon-button {
  width: 34px;
  padding: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
}

input {
  width: 100%;
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

input::placeholder {
  color: var(--muted);
}

input:focus,
input:focus-visible {
  outline: none;
  border-color: var(--primary);
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--focus);
}

input[type="password"],
input[type="datetime-local"],
input[type="number"],
#enrollmentCode,
#supabaseUrl {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

label input {
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

.input-action {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.filter-input {
  width: min(268px, 42vw);
}

/* ---------------------------------------------------------------- surfaces */

.login-empty,
.panel,
.metrics article {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-empty {
  width: min(640px, 100%);
  margin: 40px auto 0;
  padding: 44px 40px;
  display: grid;
  place-items: center;
  gap: 20px;
  border-radius: 16px;
  text-align: center;
}

.login-empty > div {
  max-width: 460px;
}

.login-empty h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-empty p {
  margin-top: 10px;
  font-size: 13.5px;
  line-height: 1.55;
}

.login-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--muted);
}

.login-empty button {
  min-height: 40px;
  padding: 0 18px;
}

/* ---------------------------------------------------------------- metrics */

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metrics article {
  position: relative;
  overflow: hidden;
  padding: 15px 16px 16px;
  border-radius: 11px;
  transition: border-color 150ms ease;
}

.metrics article::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--rail, var(--line));
}

.metrics article:nth-child(1) {
  --rail: var(--primary);
}

.metrics article:nth-child(2) {
  --rail: var(--ok-dot);
}

.metrics article:nth-child(3) {
  --rail: var(--off-dot);
}

.metrics article:nth-child(4) {
  --rail: var(--warn-dot);
}

.metrics article:hover,
.panel:hover {
  border-color: var(--muted);
}

.metrics span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.metrics span::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 999px;
  background: var(--rail);
}

.metrics strong {
  display: block;
  margin-top: 11px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 31px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}

.metrics article:nth-child(4) strong {
  color: var(--warn-dot);
}

/* ----------------------------------------------------------------- panels */

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(320px, 0.85fr);
  gap: 12px;
  align-items: stretch;
}

/* las dos columnas del overview comparten altura: la lista scrollea dentro */
.dashboard-grid > .panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel {
  padding: 0;
  overflow: hidden;
  border-radius: 11px;
  transition: border-color 150ms ease;
}

.panel.wide {
  min-width: 0;
}

.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-title h2 + p,
.panel-title p {
  font-size: 12px;
}

.panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

/* ----------------------------------------------------------------- tables */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.compact {
  max-height: 260px;
  overflow: auto;
}

.compact-events {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 520px;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  white-space: nowrap;
}

th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

td {
  font-size: 13px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr {
  transition: background 150ms ease;
}

tbody tr:hover {
  background: var(--surface-2);
}

td[data-label="Endpoint"],
td[data-label="Versión"],
td[data-label="IP"],
td[data-label="Último contacto"],
td[data-label="Usos"],
td[data-label="Expira"] {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  letter-spacing: -0.01em;
}

td[data-label="Endpoint"] {
  font-weight: 650;
}

td[data-label="Versión"],
td[data-label="IP"],
td[data-label="Último contacto"],
td[data-label="Usos"],
td[data-label="Expira"] {
  color: var(--muted);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.row-actions button {
  min-height: 28px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 12px;
}

/* ----------------------------------------------------------- pills/estado */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 22px;
  padding: 2px 9px 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 999px;
  background: currentColor;
}

.pill.ok {
  color: var(--ok);
  background: var(--ok-bg);
}

.pill.warn {
  color: var(--warn);
  background: var(--warn-bg);
}

.pill.off {
  color: var(--off);
  background: var(--off-bg);
}

/* ----------------------------------------------------------------- eventos */

.events {
  display: grid;
}

.event {
  position: relative;
  padding: 12px 16px 12px 32px;
  border-bottom: 1px solid var(--line-soft);
}

.event::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 17px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--primary);
}

.event::after {
  content: "";
  position: absolute;
  left: 18.5px;
  top: 27px;
  bottom: -1px;
  width: 1px;
  background: var(--line);
}

.event:last-child {
  border-bottom: 0;
}

.event:last-child::after {
  display: none;
}

.event strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.event span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
}

.empty-state {
  padding: 26px 14px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

/* ---------------------------------------------------------------- modales */

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--scrim);
  animation: scrim-in 150ms ease;
}

.modal[hidden],
[hidden] {
  display: none !important;
}

.modal-card {
  width: min(660px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  animation: card-in 180ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

.modal-card.small {
  width: min(520px, 100%);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px 15px;
}

.modal-header h2 {
  font-size: 16px;
}

.modal-header p {
  font-size: 12.5px;
}

.modal-card .grid {
  display: grid;
  gap: 13px;
  padding: 4px 20px 18px;
}

.modal-card .grid .grid {
  padding: 0;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
}

#logoutBtn {
  margin-right: auto;
}

@keyframes scrim-in {
  from {
    opacity: 0;
  }
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
}

/* ------------------------------------------------------------------ toast */

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 44px));
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  animation: card-in 180ms cubic-bezier(0.2, 0.8, 0.3, 1);
}

.toast[data-type="error"] {
  border-left-color: var(--danger);
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .dashboard-grid,
  .metrics,
  .grid.two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .sidebar {
    inset: auto 0 0 0;
    width: 100%;
    height: calc(72px + env(safe-area-inset-bottom));
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--sidebar-line);
  }

  .brand-mark {
    display: none;
  }

  .nav {
    width: auto;
    flex: 1;
    grid-template-columns: repeat(5, minmax(48px, 1fr));
    gap: 4px;
  }

  .nav-item,
  .nav-item.bottom {
    min-height: 54px;
    margin-top: 0;
    border-radius: 9px;
  }

  .nav-item.active {
    box-shadow: inset 0 2px 0 var(--primary);
  }

  .sidebar > .nav-item.bottom {
    width: 54px;
    flex: 0 0 54px;
    margin-left: 4px;
  }

  .shell {
    width: 100%;
    margin-left: 0;
    padding: 18px 14px 22px;
  }

  h1 {
    font-size: 22px;
  }

  .topbar,
  .panel-title,
  .panel-actions,
  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar {
    gap: 14px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
  }

  .top-actions .status {
    grid-column: 1 / -1;
    justify-content: center;
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: center;
  }

  button,
  input,
  .status,
  .link-button {
    min-height: 44px;
  }

  .icon-button {
    width: 44px;
  }

  .login-empty {
    width: 100%;
    margin-top: 18px;
    padding: 32px 22px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .metrics article {
    padding: 13px 14px 14px;
  }

  .metrics strong {
    font-size: 25px;
  }

  .panel-title {
    padding: 14px;
  }

  .filter-input {
    width: 100%;
  }

  #logoutBtn {
    margin-right: 0;
  }

  .table-wrap {
    overflow: visible;
    padding: 12px 12px 14px;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  table {
    border-collapse: separate;
    border-spacing: 0;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
  }

  tbody tr:hover {
    background: var(--panel);
  }

  td,
  tbody tr:last-child td {
    display: grid;
    grid-template-columns: minmax(104px, 36%) minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line-soft);
    white-space: normal;
    overflow-wrap: anywhere;
  }

  td:last-child {
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-family: var(--font-ui);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  td.empty-state {
    display: block;
    border: 0;
    text-align: center;
  }

  td.empty-state::before {
    content: none;
  }

  .row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .modal {
    align-items: end;
    padding: 12px;
  }

  .modal-card {
    max-height: calc(100vh - 24px);
    overflow: auto;
  }

  .modal-card .grid {
    padding: 4px 16px 16px;
  }

  .modal-header,
  .modal-actions {
    padding-inline: 16px;
  }

  .input-action {
    grid-template-columns: 1fr;
  }

  .toast {
    right: 12px;
    bottom: calc(88px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 24px);
  }
}

@media (max-width: 420px) {
  .shell {
    padding-inline: 10px;
  }
}

@media (max-width: 360px) {
  /* etiqueta encima del valor: las fechas largas ya no se parten */
  td {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .top-actions,
  .metrics {
    grid-template-columns: 1fr;
  }

  .top-actions .icon-button {
    width: 100%;
  }

  .nav-item small {
    display: none;
  }

  .nav-item,
  .nav-item.bottom {
    min-height: 48px;
  }

  .row-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
