:root {
  /* Active tokens default to the light palette. */
  --nexo-primary: #1D3341;
  --nexo-primary-hover: #2B84A2;
  --nexo-fg: #1a1a1a;
  --nexo-bg: #ffffff;
  --nexo-surface: #f5f5f5;
  --nexo-muted: #5a5a5a;
  --nexo-border: #e0e0e0;
  --nexo-error: #b00020;
  --nexo-warn: #9c5d0a;
  --nexo-link: #2B84A2;
  --nexo-success: #1b8a3d;
  --nexo-accent: #2B84A2;

  /* Dark palette values — single source of truth (aligned to the eppsc dark theme: soft,
     slightly blue-tinted, comfortable contrast), referenced by the dark selectors below. */
  --nexo-dark-primary: #4a7a9a;
  --nexo-dark-primary-hover: #5b9bb8;
  --nexo-dark-fg: #e6edf3;
  --nexo-dark-bg: #0f1419;
  --nexo-dark-surface: #1a2129;
  --nexo-dark-muted: #8b949e;
  --nexo-dark-border: #30363d;
  --nexo-dark-error: #ef5350;
  --nexo-dark-warn: #f0a64d;
  --nexo-dark-link: #5b9bb8;
  --nexo-dark-success: #4caf50;
  --nexo-dark-accent: #5b9bb8;
}

/* Dark theme token mapping. app.js resolves the light/dark/system preference and writes the
   effective value to data-theme, so this drives explicit dark *and* system→dark. The @media
   block only takes effect before app.js runs (or with JS disabled), giving the right palette
   from the OS preference with no flash. Only the mapping is restated; values live once above. */
:root[data-theme="dark"] {
  --nexo-primary: var(--nexo-dark-primary);
  --nexo-primary-hover: var(--nexo-dark-primary-hover);
  --nexo-fg: var(--nexo-dark-fg);
  --nexo-bg: var(--nexo-dark-bg);
  --nexo-surface: var(--nexo-dark-surface);
  --nexo-muted: var(--nexo-dark-muted);
  --nexo-border: var(--nexo-dark-border);
  --nexo-error: var(--nexo-dark-error);
  --nexo-warn: var(--nexo-dark-warn);
  --nexo-link: var(--nexo-dark-link);
  --nexo-success: var(--nexo-dark-success);
  --nexo-accent: var(--nexo-dark-accent);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --nexo-primary: var(--nexo-dark-primary);
    --nexo-primary-hover: var(--nexo-dark-primary-hover);
    --nexo-fg: var(--nexo-dark-fg);
    --nexo-bg: var(--nexo-dark-bg);
    --nexo-surface: var(--nexo-dark-surface);
    --nexo-muted: var(--nexo-dark-muted);
    --nexo-border: var(--nexo-dark-border);
    --nexo-error: var(--nexo-dark-error);
    --nexo-warn: var(--nexo-dark-warn);
    --nexo-link: var(--nexo-dark-link);
    --nexo-success: var(--nexo-dark-success);
    --nexo-accent: var(--nexo-dark-accent);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--nexo-fg);
  background: var(--nexo-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.container {
  max-width: 64rem;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

/* Consistent headings so content never reads as loose text floating on the page. */
h1 { font-size: 1.5rem; font-weight: 700; color: var(--nexo-fg); margin: 0 0 1.25rem; line-height: 1.2; }
h2 { font-size: 1.15rem; font-weight: 600; color: var(--nexo-fg); margin: 1.75rem 0 .75rem; line-height: 1.25; }
h3 { font-size: 1rem; font-weight: 600; color: var(--nexo-fg); margin: 1.25rem 0 .5rem; }
/* Standalone explanatory paragraphs read as muted intro text under the heading, not body noise. */
.page-content > p, .page-content > .home + p { color: var(--nexo-muted); max-width: 70ch; }

a { color: var(--nexo-link); }

/* Adjacent buttons never touch. Containers that already use flex gap opt out. */
.btn + .btn { margin-left: .5rem; }
:where(.row-actions, .page-header__actions, .pager__nav, .bulk-bar, .export-menu, .filters, .toolbar, .topbar-actions) .btn + .btn { margin-left: 0; }
td form + form, td form + .btn, td .btn + form, td a.btn + form, td form + a.btn { margin-left: .35rem; }
.inline-form { display: inline-flex; margin: 0; }

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

/* ──────────── Layout: Sidebar + Topbar ──────────── */
.layout-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar — fixed 250px */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 250px;
  height: 100vh;
  background: #1D3341;
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 500;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 1rem 1.25rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-brand:hover { color: #fff; }
.sidebar-brand-logo { height: 52px; width: auto; max-width: 100%; display: block; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: .5rem 0;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 2px; }

.sidebar-section {
  padding: .75rem 1.25rem .25rem;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.4);
  font-weight: 600;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem 1.25rem;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: .875rem;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}
.sidebar-nav-link:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}
.sidebar-nav-link--active {
  background: rgba(43,132,162,.2);
  border-left-color: #2B84A2;
  color: #fff;
}
.sidebar-nav-link i { font-size: 1.1rem; width: 1.25rem; text-align: center; }

.sidebar-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .8rem;
  flex-shrink: 0;
}
.sidebar-user { display: flex; align-items: center; gap: .6rem; }
.sidebar-user-avatar { font-size: 1.6rem; color: rgba(255,255,255,.6); line-height: 1; flex-shrink: 0; }
.sidebar-user-id { min-width: 0; }
.sidebar-user-name { font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { color: rgba(255,255,255,.45); font-size: .72rem; text-transform: capitalize; }
.sidebar-user-meta { color: rgba(255,255,255,.5); font-size: .75rem; }
.sidebar-footer-meta { color: rgba(255,255,255,.3); font-size: .7rem; margin-top: .5rem; font-variant-numeric: tabular-nums; }
.footer-version { font-variant-numeric: tabular-nums; opacity: .7; }

/* Main content area — offset by sidebar */
.main-wrapper {
  margin-left: 250px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar — sticky white bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1.5rem;
  background: var(--nexo-bg);
  border-bottom: 1px solid var(--nexo-border);
  min-height: 52px;
}
[data-theme="dark"] .topbar { background: var(--nexo-surface); }

/* On desktop the body already carries the eyebrow + <h1> and the sidebar highlights the active
   item, so the topbar title is pure duplication — hide it. It returns on mobile (≤768px), where
   the sidebar is collapsed behind the hamburger and the title is the only on-screen context. */
.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--nexo-fg);
  display: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
  margin-left: auto;
}

.topbar-actions .theme-toggle {
  margin-left: 0;
  color: var(--nexo-fg);
  border: 1px solid var(--nexo-border);
}
.topbar-actions .btn--ghost { color: var(--nexo-fg); }
.topbar-cross { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
@media (max-width: 640px) { .topbar-cross__label { display: none; } }
/* Topbar search: the shared cross-surface search control. Collapses to the icon button alone on
   narrow screens, where the topbar has no room for the field. */
.topbar-search { display: flex; align-items: center; gap: .25rem; }
.topbar-search__input { width: 190px; height: 34px; padding: 0 .6rem; border: 1px solid var(--nexo-border); border-radius: 8px; background: var(--nexo-surface); color: var(--nexo-fg); font-size: .85rem; }
.topbar-search__input:focus { outline: 2px solid var(--nexo-primary); outline-offset: 1px; }
.topbar-search__btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--nexo-border); border-radius: 8px; background: transparent; color: var(--nexo-fg); cursor: pointer; }
.topbar-search__btn:hover { background: var(--nexo-bg); }
@media (max-width: 900px) { .topbar-search__input { display: none; } }
.topbar-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 8px; color: var(--nexo-fg); text-decoration: none; font-size: 1.1rem; }
.topbar-bell:hover { background: var(--nexo-bg); }
.topbar-bell__badge { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--nexo-error); color: #fff; font-size: .66rem; font-weight: 700; line-height: 16px; text-align: center; box-sizing: border-box; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: center; }
.admin-actions__group { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.admin-actions__group + .admin-actions__group { padding-left: 1.5rem; border-left: 1px solid var(--nexo-border); }

/* User menu dropdown (no-JS <details>; app.js closes it on outside click). */
.user-menu { position: relative; }
.user-menu__btn { list-style: none; display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; padding: .25rem .5rem; border-radius: 8px; color: var(--nexo-fg); }
.user-menu__btn::-webkit-details-marker { display: none; }
.user-menu__btn:hover { background: var(--nexo-surface); }
.user-menu__avatar { font-size: 1.4rem; line-height: 1; color: var(--nexo-muted); display: flex; }
.user-menu__id { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.user-menu__name { font-size: .88rem; font-weight: 600; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu__role { font-size: .72rem; color: var(--nexo-muted); }
.user-menu__caret { font-size: .7rem; color: var(--nexo-muted); transition: transform .15s; }
.user-menu[open] .user-menu__caret { transform: rotate(180deg); }
.user-menu__pop { position: absolute; right: 0; top: calc(100% + .4rem); min-width: 14rem; display: flex; flex-direction: column; background: var(--nexo-bg); border: 1px solid var(--nexo-border); border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: .35rem; z-index: 600; }
.user-menu__pop a, .user-menu__pop button { display: flex; align-items: center; gap: .6rem; padding: .55rem .65rem; border-radius: 6px; background: none; border: none; color: var(--nexo-fg); text-decoration: none; font: inherit; width: 100%; text-align: left; cursor: pointer; }
.user-menu__pop a:hover, .user-menu__pop button:hover { background: var(--nexo-surface); }
.user-menu__pop form { margin: 0; }
.user-menu__pop hr { border: none; border-top: 1px solid var(--nexo-border); margin: .3rem .2rem; }
.user-menu__section { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--nexo-muted); padding: .35rem .65rem .15rem; }
/* Account rows mirror the menu-item layout; a <span> for the current account doesn't match the
   a/button rule above, so cover it explicitly. */
.user-menu__pop .user-menu__acc { display: flex; align-items: center; gap: .6rem; padding: .55rem .65rem; border-radius: 6px; color: var(--nexo-fg); text-decoration: none; }
.user-menu__pop a.user-menu__acc:hover { background: var(--nexo-surface); }
.user-menu__acc--current { color: var(--nexo-muted); cursor: default; }
.user-menu__acc--add { color: var(--nexo-link); }
/* A switchable account row: the switch form (a full-width submit button) flexes to fill, and the ×
   forget-button sits at the end, showing its surface only on hover/focus so the menu stays clean. */
.user-menu__acc-row { display: flex; align-items: center; }
.user-menu__acc-row form { flex: 1 1 auto; min-width: 0; }
.user-menu__acc-row .user-menu__acc { min-width: 0; }
.user-menu__pop .user-menu__acc-remove { flex: 0 0 auto; width: 1.7rem; height: 1.7rem; margin-right: .3rem; padding: 0; justify-content: center; gap: 0; border: 0; border-radius: 6px; background: transparent; color: var(--nexo-muted); cursor: pointer; }
.user-menu__pop .user-menu__acc-remove:hover, .user-menu__pop .user-menu__acc-remove:focus-visible { background: var(--nexo-surface); color: var(--nexo-fg); }
@media (max-width: 640px) { .user-menu__id { display: none; } }

/* Hamburger — hidden on desktop */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--nexo-fg);
  font-size: 1.3rem;
  padding: .25rem;
  cursor: pointer;
}

/* Page content */
.page-content {
  flex: 1;
  padding: 1.75rem 2rem;
}

/* Frontend variant (agent-facing, pladecof feel): readable max width. Both surfaces share the
   base page background; cards/panels use the elevated --nexo-surface so they always stand out. */
.layout-wrapper--front .page-content > .container,
.layout-wrapper--front .home { max-width: 1100px; margin-inline: auto; }

/* ──────────── Home dashboard (after-login) ──────────── */
.home-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.home-header h1 { margin: 0; font-size: 1.5rem; }
.home-header .notif-badge { margin-left: auto; }
.notif-badge { display: inline-flex; align-items: center; gap: .35rem; background: var(--nexo-accent); color: #fff; font-size: .8rem; font-weight: 600; padding: .25rem .6rem; border-radius: 999px; text-decoration: none; }
.home-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; align-items: start; }
.home-panel { background: var(--nexo-surface); border: 1px solid var(--nexo-border); border-radius: 10px; padding: 1.1rem 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.home-panel h2 { margin: 0 0 .85rem; font-size: 1rem; display: flex; align-items: center; gap: .5rem; }
.home-panel h2 a { color: var(--nexo-fg); text-decoration: none; }
.home-panel h2 a:hover { color: var(--nexo-link); }
.home-panel .empty { color: var(--nexo-muted); font-size: .9rem; margin: .25rem 0; }
.home-panel--pending { grid-column: span 2; }

.pending-list, .novedad-feed, .favorito-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pending-item { display: flex; align-items: center; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--nexo-border); }
.pending-item:last-child { border-bottom: none; }
.pending-item a { flex: 1; color: var(--nexo-fg); text-decoration: none; font-weight: 500; }
.pending-item a:hover { color: var(--nexo-link); }
.pending-item__type { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: var(--nexo-muted); background: var(--nexo-surface); padding: .1rem .45rem; border-radius: 4px; }
.pending-item__deadline { font-size: .8rem; color: var(--nexo-muted); }
.pending-item--overdue a { color: var(--nexo-error); }
.pending-item--overdue .pending-item__deadline { color: var(--nexo-error); font-weight: 600; }

.novedad-feed li { padding: .5rem 0; border-bottom: 1px solid var(--nexo-border); display: flex; flex-direction: column; gap: .15rem; }
.novedad-feed li:last-child { border-bottom: none; }
.novedad-feed__titulo { color: var(--nexo-fg); text-decoration: none; font-weight: 500; }
.novedad-feed__titulo:hover { color: var(--nexo-link); }
.novedad-feed__time { font-size: .78rem; color: var(--nexo-muted); }
.panel-more { display: inline-block; margin-top: .6rem; font-size: .85rem; color: var(--nexo-link); text-decoration: none; }
.panel-more:hover { text-decoration: underline; }

.favorito-list li { padding: .4rem 0; }
.favorito-list a { display: flex; align-items: center; gap: .5rem; color: var(--nexo-fg); text-decoration: none; }
.favorito-list a:hover { color: var(--nexo-link); }
.favorito-icon { font-size: 1.1rem; }
.favorito-icon img { width: 1.2em; height: 1.2em; object-fit: contain; vertical-align: middle; }

@media (max-width: 860px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-panel--pending { grid-column: auto; }
}

/* Backoffice footer */
.backoffice-footer {
  padding: .75rem 1.5rem;
  font-size: .8rem;
  color: var(--nexo-muted);
  border-top: 1px solid var(--nexo-border);
  text-align: center;
}

/* Sidebar overlay on mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 499;
}

/* Responsive */
@media (max-width: 768px) {
  .topbar-title { display: block; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar--open {
    transform: translateX(0);
  }
  .sidebar-overlay--visible {
    display: block;
  }
  .main-wrapper {
    margin-left: 0;
  }
  .hamburger {
    display: inline-flex;
  }
}

/* Flat data tables: clean rows, uppercase header, subtle row hover. Not a card. */
table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: .9rem; }
th, td { text-align: left; padding: 0.55rem 0.8rem; border-bottom: 1px solid var(--nexo-border); vertical-align: middle; }
th { color: var(--nexo-muted); font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 2px solid var(--nexo-border); }
tbody tr:hover { background: var(--nexo-surface); }
/* Action column: a tight, right-aligned cell of icon buttons (the .row-actions wrapper). */
td:has(.row-actions), td.col-actions, th.col-actions { width: 1%; white-space: nowrap; text-align: right; }

form { margin: 1rem 0; }
label { display: block; margin: 0.85rem 0 0.3rem; font-size: .9rem; font-weight: 500; }
input, select, textarea { padding: 0.5rem 0.65rem; font: inherit; color: var(--nexo-fg); background: var(--nexo-bg); border: 1px solid var(--nexo-border); border-radius: 6px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--nexo-accent); box-shadow: 0 0 0 3px rgba(43,132,162,.15); }
button {
  padding: 0.5rem 0.9rem;
  font: inherit;
  font-weight: 500;
  color: #fff;
  background: var(--nexo-primary);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
button:hover { background: var(--nexo-primary-hover); }
button + button { margin-left: .5rem; }

.error { color: var(--nexo-error); font-weight: 600; }
.perm-list { list-style: none; padding: 0; }
.perm-list li { margin: 0.25rem 0; }
.perm-list label { display: flex; align-items: baseline; gap: 0.5rem; margin: 0; }
/* List controls: search filters, bulk-action bar, export bar, pager — all consistent toolbars. */
.filters { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.bulk-bar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: 1rem 0; }
.bulk-bar__label { color: var(--nexo-muted); font-size: .9rem; }
.export-menu { display: flex; align-items: center; gap: .5rem; margin: 1rem 0; }
.export-menu__label { color: var(--nexo-muted); font-size: .9rem; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: 1rem 0; flex-wrap: wrap; }
.pager__range { color: var(--nexo-muted); font-size: .85rem; }
.pager__nav { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.pager__btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2rem; height: 2rem; padding: 0 .5rem;
  border: 1px solid var(--nexo-border); border-radius: 6px;
  background: var(--nexo-surface); color: var(--nexo-fg);
  font-size: .85rem; text-decoration: none; line-height: 1;
  font-variant-numeric: tabular-nums; transition: background .12s, border-color .12s, color .12s;
}
.pager__btn:hover { border-color: var(--nexo-primary); color: var(--nexo-primary); }
.pager__btn--current { background: var(--nexo-primary); border-color: var(--nexo-primary); color: #fff; font-weight: 600; }
.pager__btn--current:hover { color: #fff; }
.pager__btn.is-disabled { opacity: .4; pointer-events: none; }
.pager__gap { color: var(--nexo-muted); padding: 0 .15rem; }
.empty { color: var(--nexo-muted); }
.btn.is-disabled, .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; cursor: default; }

/* Theme toggle button */
.theme-toggle {
  background: none;
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
  border-radius: 4px;
  cursor: pointer;
  margin-left: auto;
}
.theme-toggle:hover { background: rgba(255,255,255,0.15); }

/* Idle-timeout warning modal */
.idle-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.idle-modal__box {
  background: var(--nexo-surface); padding: 2rem; border-radius: .5rem;
  max-width: 24rem; width: 90%; text-align: center;
}
.idle-modal__box h2 { margin: 0 0 .75rem; }
.idle-modal__box p { margin: 0 0 1.5rem; }

/* ──────────── Components ──────────── */

/* Buttons — a complete style so anchors and <button>s look identical (an .btn anchor must
   read as a button, never a bare link). Variants override colour. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem .9rem; font: inherit; font-size: .9rem; font-weight: 500; line-height: 1.2;
  color: #fff; background: var(--nexo-primary); border: 1px solid transparent; border-radius: 6px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--nexo-primary-hover); color: #fff; }
.btn--primary { background: var(--nexo-accent); border-color: var(--nexo-accent); color: #fff; }
.btn--primary:hover { background: var(--nexo-primary-hover); }
.btn--ghost { background: none; color: var(--nexo-fg); border: 1px solid var(--nexo-border); }
.btn--ghost:hover { background: var(--nexo-surface); color: var(--nexo-fg); }
.btn--sm { padding: .3rem .6rem; font-size: .82rem; }
.back-link { display: inline-flex; align-items: center; gap: .35rem; margin-bottom: 1rem; }
.back-link i { font-size: .9em; }
.push-optin { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin: 1rem 0 1.5rem; padding: .9rem 1rem; background: var(--nexo-surface); border: 1px solid var(--nexo-border); border-radius: 8px; }
.push-optin__status { margin: 0; flex: 1 1 16rem; color: var(--nexo-muted); }
.btn--secondary { background: #2B84A2; border-color: #2B84A2; color: #fff; }
.btn--secondary:hover { background: #236f89; color: #fff; }
.btn--danger { background: var(--nexo-error); border-color: var(--nexo-error); color: #fff; }
.btn--danger:hover { opacity: .9; }
.btn--outline { background: none; color: var(--nexo-link); border-color: var(--nexo-border); }
.btn--outline:hover { background: var(--nexo-surface); }
.btn--success { background: var(--nexo-success); border-color: var(--nexo-success); color: #fff; }
.btn--success:hover { opacity: .9; }
.btn--warning { background: var(--nexo-warn); border-color: var(--nexo-warn); color: #fff; }
.btn--warning:hover { opacity: .9; }
.btn--xs { padding: .15rem .4rem; font-size: .75rem; }

/* Card */
.card {
  background: var(--nexo-surface);
  border: 1px solid var(--nexo-border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.card--help { border-left: 3px solid var(--nexo-accent); }
.card--danger { border-left: 3px solid var(--nexo-error); }
/* Read-only detail card: a key/value definition list rendered as an aligned two-column grid. */
.detail-card { background: var(--nexo-surface); border: 1px solid var(--nexo-border); border-radius: 10px; padding: 1.25rem 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.code-block { background: var(--nexo-bg); border: 1px solid var(--nexo-border); border-radius: 8px; padding: .75rem 1rem; margin: .5rem 0 0; overflow-x: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; line-height: 1.5; }
/* Integration cards */
.integration-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); gap: 1rem; margin-top: 1rem; }
.integration-card { display: flex; flex-direction: column; gap: .6rem; }
.integration-card__head { display: flex; align-items: flex-start; gap: .75rem; }
.integration-card__icon { font-size: 1.6rem; line-height: 1; color: var(--nexo-accent, var(--nexo-link)); display: flex; }
.integration-card__title { flex: 1; min-width: 0; }
.integration-card__title h3 { margin: 0; font-size: 1.02rem; }
.integration-card__title .text-muted { font-size: .82rem; }
.integration-card__summary { margin: 0; }
.integration-card__summary dt { font-size: .72rem; }
.integration-card__health { font-size: .85rem; margin: 0; }
.integration-card__empty { margin: 0; }
.integration-card__actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: auto; padding-top: .4rem; }
.status-ok { color: var(--nexo-ok, #16794a); font-weight: 600; }
.status-error { color: var(--nexo-danger, #b42318); font-weight: 600; }
/* Sistema icon field + bootstrap-icon picker */
.launch-card__img { width: 1.6em; height: 1.6em; object-fit: contain; vertical-align: middle; }
.icon-field__row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.icon-field__preview { width: 2.2rem; height: 2.2rem; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--nexo-border); border-radius: 8px; background: var(--nexo-bg); font-size: 1.2rem; flex: none; overflow: hidden; }
.icon-field__preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.icon-field__row [data-icon-input] { flex: 1; min-width: 12rem; }
.icon-picker-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem; }
.icon-picker-backdrop[hidden] { display: none; }
.icon-picker { background: var(--nexo-surface); border: 1px solid var(--nexo-border); border-radius: 12px; width: min(40rem, 100%); max-height: min(34rem, 90vh); display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.icon-picker__head { display: flex; gap: .5rem; padding: .75rem; border-bottom: 1px solid var(--nexo-border); }
.icon-picker__search { flex: 1; }
.icon-picker__close { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--nexo-muted); padding: 0 .4rem; }
.icon-picker__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(3rem, 1fr)); gap: .3rem; padding: .75rem; overflow-y: auto; }
.icon-picker__item { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; background: var(--nexo-bg); border: 1px solid var(--nexo-border); border-radius: 8px; cursor: pointer; color: var(--nexo-fg); }
.icon-picker__item:hover { background: var(--nexo-accent, var(--nexo-link)); color: #fff; }
/* Formulario response summary (per-question aggregates) */
.summary-field__head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.summary-field__head h3 { margin: 0; font-size: 1rem; }
.summary-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.summary-bar__label { display: flex; justify-content: space-between; gap: .75rem; font-size: .88rem; margin-bottom: .2rem; }
.summary-bar__track { background: var(--nexo-bg); border: 1px solid var(--nexo-border); border-radius: 4px; height: .65rem; overflow: hidden; }
.summary-bar__fill { background: var(--nexo-link); height: 100%; width: var(--bar-pct, 0%); min-width: 2px; }
.summary-samples { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: .25rem; }
.summary-samples li { font-size: .9rem; }
.detail-list { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.25rem; margin: 0; }
.detail-list dt { font-weight: 600; color: var(--nexo-muted); font-size: .85rem; }
.detail-list dd { margin: 0; }
/* Sanitized rich HTML body (campaign/comunicación/normativa previews). */
.rich-content { line-height: 1.6; overflow-wrap: anywhere; }
.rich-content img { max-width: 100%; height: auto; }
.rich-content :first-child { margin-top: 0; }
.rich-content :last-child { margin-bottom: 0; }
/* In-page section header: a heading with an optional right-aligned action (e.g. "Agregar …"). */
.section-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.section-header > h2 { margin: 0; font-size: 1.05rem; }
/* The [hidden] attribute must win over component display rules (e.g. .form-field{display:flex}). */
[hidden] { display: none !important; }
/* Key/value detail table inside a card reads as a clean definition list. */
.card > .table-detail { margin: 0; }
.card > .table-detail td { padding: .4rem .25rem; }

/* Tablero list card — color accent from CSS variable set via style attr */
.card-grid .card { border-top: 4px solid var(--card-color, var(--nexo-accent)); }

/* A short muted lead paragraph under a page <h1> (front/agent pages). */
.page-lead { color: var(--nexo-muted); margin: -.25rem 0 1.25rem; max-width: 60ch; }

/* App-launcher grid (front Sistemas/Recursos): compact, fully clickable cards in a responsive grid. */
.launch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.launch-card {
  display: flex; align-items: center; gap: .85rem;
  background: var(--nexo-surface); border: 1px solid var(--nexo-border); border-radius: 10px;
  padding: 1rem 1.1rem; text-decoration: none; color: inherit;
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.launch-card:hover { border-color: var(--nexo-primary); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.launch-card__icon {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; background: rgba(43,132,162,.12); color: var(--nexo-primary);
}
.launch-card__body { min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.launch-card__title { font-weight: 600; color: var(--nexo-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.launch-card__desc { font-size: .82rem; color: var(--nexo-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.launch-card__go { margin-left: auto; color: var(--nexo-muted); font-size: .9rem; flex-shrink: 0; }
.launch-card:hover .launch-card__go { color: var(--nexo-primary); }

/* Toolbar: page title on the left, primary action (e.g. "Nuevo X") pushed to the right
   (eppsc parity). Filter forms reuse .toolbar but keep their controls grouped left. */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1rem;
}
.toolbar h1 { margin: 0; font-size: 1.3rem; }
.toolbar .muted { color: var(--nexo-muted); font-size: .9rem; }
form.toolbar { justify-content: flex-start; flex-wrap: wrap; }
/* List/detail page header: title on the left, primary action(s) pushed right (eppsc parity). */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-header h1 { margin: 0; font-size: 1.3rem; }
.page-header__actions { display: flex; align-items: center; gap: .5rem; }
.page-header__titles { display: flex; flex-direction: column; gap: .15rem; }
.page-header__eyebrow { font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--nexo-muted); }

/* Breadcrumb trail (detail/form pages reached from a list). Clickable text + chevron separators. */
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; margin-bottom: .85rem; font-size: .85rem; }
.breadcrumb__item { color: var(--nexo-link); text-decoration: none; }
.breadcrumb__item:hover { text-decoration: underline; }
.breadcrumb__item--current { color: var(--nexo-muted); font-weight: 500; }
.breadcrumb__sep { font-size: .7rem; color: var(--nexo-muted); }

/* Segmented control (active/historical toggles, netspo "sesiones relay" style). */
.segmented { display: inline-flex; border: 1px solid var(--nexo-border); border-radius: 8px; overflow: hidden; background: var(--nexo-surface); }
.segmented__item { padding: .4rem .9rem; font-size: .85rem; color: var(--nexo-muted); text-decoration: none; border-right: 1px solid var(--nexo-border); transition: background .12s, color .12s; }
.segmented__item:last-child { border-right: 0; }
.segmented__item:hover { color: var(--nexo-fg); background: var(--nexo-bg); }
.segmented__item--active { background: var(--nexo-primary); color: #fff; }
.segmented__item--active:hover { background: var(--nexo-primary); color: #fff; }
/* Radio-based segmented control (form choice): the visible radio conveys the selected state. */
.segmented__opt { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .9rem; font-size: .85rem; color: var(--nexo-fg); border-right: 1px solid var(--nexo-border); cursor: pointer; }
.segmented__opt:last-child { border-right: 0; }
.segmented__opt:has(input:checked) { background: var(--nexo-primary); color: #fff; }

/* Underline tabs (Configuración and other multi-panel sections). Server renders the active panel
   via ?tab=; JS (data-tabs) switches panels instantly as progressive enhancement. */
.tabs__bar { display: flex; gap: .25rem; border-bottom: 1px solid var(--nexo-border); margin-bottom: 1.5rem; flex-wrap: wrap; }
.tabs__tab { padding: .6rem .9rem; color: var(--nexo-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; font-size: .9rem; white-space: nowrap; }
.tabs__tab:hover { color: var(--nexo-fg); }
.tabs__tab--active { color: var(--nexo-primary); border-bottom-color: var(--nexo-primary); }
.tabs__panel { display: none; }
.tabs__panel--active { display: block; }
.settings-card { max-width: 720px; }
/* Settings provenance tag + restore-to-default control on each setting label. */
.setting-tag { display: inline-block; margin-left: .4rem; padding: .05rem .4rem; border-radius: 4px; font-size: .7rem; font-weight: 600; vertical-align: middle; }
.setting-tag--env { background: rgba(43,132,162,.16); color: var(--nexo-primary); }
.setting-restore { margin-left: .5rem; padding: 0; border: none; background: none; color: var(--nexo-link); font-size: .75rem; cursor: pointer; vertical-align: middle; }
.setting-restore:hover { text-decoration: underline; background: none; }
.branding-upload { max-width: 720px; }

/* Formulario field builder */
.form-builder__list { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1rem; }
.fb-row { border: 1px solid var(--nexo-border); border-radius: 8px; background: var(--nexo-surface); padding: .75rem; }
.fb-row__head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.fb-row__handle { color: var(--nexo-muted); cursor: default; }
.fb-row__type { max-width: 220px; }
.fb-row__label { flex: 1 1 200px; min-width: 160px; }
.fb-row__req { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; white-space: nowrap; }
.fb-row__body { display: flex; flex-direction: column; gap: .5rem; margin-top: .6rem; }
.fb-options { display: flex; flex-direction: column; gap: .35rem; }
.form-builder__raw summary { cursor: pointer; color: var(--nexo-muted); font-size: .88rem; }

/* Badges and tags */
.badge {
  display: inline-block;
  padding: .15em .55em;
  font-size: .8rem;
  font-weight: 600;
  border-radius: 10px;
  white-space: nowrap;
}
/* Tone backgrounds are translucent so the same rule reads on both light and dark themes;
   the text uses the theme-aware semantic token. */
.badge--ok { background: rgba(27,138,61,.16); color: var(--nexo-success); }
.badge--warn { background: rgba(184,115,10,.16); color: var(--nexo-warn); }
.badge--bad { background: rgba(176,0,32,.16); color: var(--nexo-error); }
.badge--alert { background: var(--nexo-error); color: #fff; }
.badge--muted { background: var(--nexo-border); color: var(--nexo-muted); }
/* Inline remove control inside a badge (e.g. an Área chip on the user detail page). */
.badge .inline-form { display: inline; }
.badge-x { background: none; border: 0; padding: 0 0 0 .25em; margin: 0; color: inherit; cursor: pointer; font-size: .9em; line-height: 1; vertical-align: middle; }
.badge-x:hover { color: var(--nexo-error); }
/* Checkbox set (e.g. a Unidad's Áreas). */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .4rem .9rem; margin: .5rem 0; }
.check-item { display: flex; align-items: center; gap: .45rem; font-size: .9rem; }

/* Alerts: a bordered, tinted message block (success / error / warning / info). Used for flash
   messages and inline banners. The left accent + soft tint read on both light and dark themes. */
.alert {
  display: flex; align-items: flex-start; gap: .55rem;
  border: 1px solid var(--nexo-border); border-left: 3px solid var(--nexo-muted);
  border-radius: 8px; padding: .75rem 1rem; margin-bottom: 1.25rem;
  font-size: .9rem; line-height: 1.45; background: var(--nexo-surface);
}
.alert i { margin-top: .1rem; flex-shrink: 0; }
.alert--success { border-left-color: var(--nexo-success); background: rgba(27,138,61,.08); }
.alert--success i { color: var(--nexo-success); }
.alert--error, .alert--danger { border-left-color: var(--nexo-error); background: rgba(176,0,32,.08); }
.alert--error i, .alert--danger i { color: var(--nexo-error); }
.alert--warning, .alert--warn { border-left-color: var(--nexo-warn); background: rgba(184,115,10,.08); }
.alert--warning i, .alert--warn i { color: var(--nexo-warn); }
.alert--info { border-left-color: var(--nexo-primary); background: rgba(43,132,162,.08); }
.alert--info i { color: var(--nexo-primary); }
/* System banner: a site-wide notice set from the backoffice, rendered full-width above the topbar.
   Severity drives the accent (info/warn/critical), mirroring the .alert tones. */
.system-banner {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem 1.5rem; font-size: .9rem; line-height: 1.4; font-weight: 500;
  color: var(--nexo-fg); background: var(--nexo-surface);
  border-bottom: 1px solid var(--nexo-border); border-left: 4px solid var(--nexo-muted);
}
.system-banner i { flex-shrink: 0; font-size: 1.05rem; line-height: 1; }
.system-banner__msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.system-banner__dismiss {
  flex-shrink: 0; border: 0; background: transparent; cursor: pointer; color: inherit;
  opacity: .6; font-size: .95rem; line-height: 1; padding: .2rem .45rem; border-radius: 6px;
  transition: opacity .15s ease, background .15s ease;
}
.system-banner__dismiss:hover { opacity: 1; background: rgba(0,0,0,.08); }
[data-theme="dark"] .system-banner__dismiss:hover { background: rgba(255,255,255,.12); }
.system-banner--info { border-left-color: var(--nexo-primary); background: rgba(43,132,162,.10); }
.system-banner--info i { color: var(--nexo-primary); }
.system-banner--warn { border-left-color: var(--nexo-warn); background: rgba(184,115,10,.12); }
.system-banner--warn i { color: var(--nexo-warn); }
.system-banner--critical { border-left-color: var(--nexo-error); background: rgba(176,0,32,.12); color: var(--nexo-error); font-weight: 600; }
.system-banner--critical i { color: var(--nexo-error); }
@media (max-width: 640px) { .system-banner { padding: .55rem 1rem; font-size: .85rem; } }

/* Impersonation bar: a persistent strip shown while an admin views the app as another user. */
.impersonation-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: .5rem;
  padding: .55rem 1.5rem; font-size: .88rem; line-height: 1.4;
  color: #fff; background: var(--nexo-primary);
}
.impersonation-bar form { margin-left: auto; }
.impersonation-bar__stop {
  border: 1px solid rgba(255,255,255,.5); background: transparent; color: #fff; cursor: pointer;
  font-size: .82rem; font-weight: 600; padding: .25rem .7rem; border-radius: 6px;
  transition: background .15s ease;
}
.impersonation-bar__stop:hover { background: rgba(255,255,255,.18); }
@media (max-width: 640px) { .impersonation-bar { padding: .5rem 1rem; font-size: .82rem; } }

/* Semantic aliases so legacy class names still get a colour (map to the canonical tones). */
.badge--success { background: rgba(27,138,61,.16); color: var(--nexo-success); }
.badge--danger, .badge--error { background: rgba(176,0,32,.16); color: var(--nexo-error); }
.badge--info { background: rgba(43,132,162,.16); color: var(--nexo-primary); }

.tag {
  display: inline-block;
  padding: .1em .45em;
  font-size: .75rem;
  font-weight: 500;
  border-radius: 4px;
  background: var(--nexo-surface);
  border: 1px solid var(--nexo-border);
  color: var(--nexo-muted);
}
.tag-critical { background: rgba(176,0,32,.16); color: var(--nexo-error); border-color: transparent; }
.tag-high { background: rgba(184,115,10,.16); color: var(--nexo-warn); border-color: transparent; }
.tag-medium { background: rgba(43,132,162,.16); color: var(--nexo-link); border-color: transparent; }
.tag-low { background: var(--nexo-surface); color: var(--nexo-muted); }
.tag-info { background: rgba(27,138,61,.16); color: var(--nexo-success); border-color: transparent; }
.tag-resolved { background: rgba(27,138,61,.16); color: var(--nexo-success); border-color: transparent; }
.tag-open { background: rgba(176,0,32,.16); color: var(--nexo-error); border-color: transparent; }

/* State badges */
.state-online { color: var(--nexo-success); }
.state-offline { color: var(--nexo-muted); }
.state-disabled { color: var(--nexo-warn); }
.state-decommissioned { color: var(--nexo-error); }

/* Detail table */
.table-detail { width: auto; background: none; border: none; border-radius: 0; }
.table-detail td { padding: .4rem .75rem; border: none; }
.table-detail tbody tr:hover { background: none; }
.detail-label {
  width: 140px;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--nexo-muted);
  font-weight: 600;
  vertical-align: top;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 1rem 0;
  font-size: .9rem;
  color: var(--nexo-muted);
}
.pagination a { text-decoration: none; }

/* Tablero board — main area with tinted background from CSS variable */
.tablero-board {
  background: color-mix(in srgb, var(--board-color, #4B7BE5) 13%, transparent);
}
.tablero-board .tablero-header h1 { color: var(--board-color, var(--nexo-primary)); }

/* Calendar month grid */
.calendar-grid { border: 1px solid var(--nexo-border); border-radius: 8px; overflow: hidden; background: var(--nexo-surface); margin-top: 1rem; }
.calendar-grid__header { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--nexo-bg); border-bottom: 1px solid var(--nexo-border); }
.calendar-grid__header span { padding: .5rem; text-align: center; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--nexo-muted); }
.calendar-grid__body { display: flex; flex-direction: column; }
/* A week row: day cells are the backdrop (borders, number, today), entries sit over them and are
   placed across the columns they cover, so a multi-day entry is one bar and not one pill per day.
   The backdrop is the absolute layer so the entries decide the row's height. */
.calendar-week { position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: min-content; align-content: start; row-gap: .15rem; min-height: 96px; padding: 1.55rem 0 .35rem; }
.calendar-week__days { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-day { border-right: 1px solid var(--nexo-border); border-bottom: 1px solid var(--nexo-border); padding: .35rem; min-width: 0; }
.calendar-day:nth-child(7) { border-right: 0; }
.calendar-span { position: relative; min-width: 0; padding: 0 .2rem; }
/* Placement of a week-row entry: the column it starts in and the number of columns it covers.
   Static rules, not a scripted custom property, so the month grid lays out with JavaScript
   disabled; the value space is closed (seven columns, no span past the end of the week), so it
   is enumerated here in full. The pill colour stays scripted - that one comes from the database. */
.calendar-span--c1-s1 { grid-column: 1 / span 1; } .calendar-span--c1-s2 { grid-column: 1 / span 2; } .calendar-span--c1-s3 { grid-column: 1 / span 3; } .calendar-span--c1-s4 { grid-column: 1 / span 4; } .calendar-span--c1-s5 { grid-column: 1 / span 5; } .calendar-span--c1-s6 { grid-column: 1 / span 6; } .calendar-span--c1-s7 { grid-column: 1 / span 7; }
.calendar-span--c2-s1 { grid-column: 2 / span 1; } .calendar-span--c2-s2 { grid-column: 2 / span 2; } .calendar-span--c2-s3 { grid-column: 2 / span 3; } .calendar-span--c2-s4 { grid-column: 2 / span 4; } .calendar-span--c2-s5 { grid-column: 2 / span 5; } .calendar-span--c2-s6 { grid-column: 2 / span 6; }
.calendar-span--c3-s1 { grid-column: 3 / span 1; } .calendar-span--c3-s2 { grid-column: 3 / span 2; } .calendar-span--c3-s3 { grid-column: 3 / span 3; } .calendar-span--c3-s4 { grid-column: 3 / span 4; } .calendar-span--c3-s5 { grid-column: 3 / span 5; }
.calendar-span--c4-s1 { grid-column: 4 / span 1; } .calendar-span--c4-s2 { grid-column: 4 / span 2; } .calendar-span--c4-s3 { grid-column: 4 / span 3; } .calendar-span--c4-s4 { grid-column: 4 / span 4; }
.calendar-span--c5-s1 { grid-column: 5 / span 1; } .calendar-span--c5-s2 { grid-column: 5 / span 2; } .calendar-span--c5-s3 { grid-column: 5 / span 3; }
.calendar-span--c6-s1 { grid-column: 6 / span 1; } .calendar-span--c6-s2 { grid-column: 6 / span 2; }
.calendar-span--c7-s1 { grid-column: 7 / span 1; }
.calendar-day--pad { background: var(--nexo-bg); }
.calendar-day--today { background: color-mix(in srgb, var(--nexo-primary) 10%, transparent); }
.calendar-day__num { font-size: .8rem; font-weight: 600; color: var(--nexo-muted); }
.calendar-day--today .calendar-day__num { color: var(--nexo-primary); font-weight: 800; }
.calendar-dot { background: var(--dot-color, #4B7BE5); }
.calendar-event-pill { display: block; background: var(--pill-color, #4B7BE5); color: #fff; border-radius: 4px; padding: .1rem .35rem; font-size: .72rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.calendar-event-pill:hover { opacity: .9; }
/* Calendar page layout: sidebar (calendars + actions) beside the month grid. */
.calendar-layout { display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .calendar-layout { grid-template-columns: 1fr; } }
.calendar-sidebar > h2 { font-size: 1rem; margin: 0 0 .75rem; }
.calendar-list { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: .25rem; }
.calendar-list li { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.calendar-list li .inline-form { margin-left: auto; }
.calendar-dot { width: .7rem; height: .7rem; border-radius: 50%; flex-shrink: 0; }
.calendar-sidebar__actions { display: flex; flex-direction: column; gap: .5rem; padding-top: .75rem; border-top: 1px solid var(--nexo-border); }
.calendar-sidebar__actions .btn { width: 100%; justify-content: center; }
.calendar-nav { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.calendar-nav h2 { margin: 0; font-size: 1.1rem; flex: 1; text-align: center; }

/* Toast notifications */
#toasts {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-width: 380px;
}
.toast {
  background: var(--nexo-surface);
  border: 1px solid var(--nexo-border);
  border-radius: 8px;
  padding: .85rem 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  font-size: .9rem;
  border-left: 4px solid var(--nexo-muted);
  animation: toast-in .3s ease;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.toast-success { border-left-color: var(--nexo-success); }
.toast-info { border-left-color: var(--nexo-accent); }
.toast-error { border-left-color: var(--nexo-error); }
.toast-hide { animation: toast-out .3s ease forwards; }
@keyframes toast-in { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toast-out { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* Help card */
.help-card {
  background: var(--nexo-surface);
  border: 1px solid var(--nexo-border);
  border-left: 3px solid var(--nexo-accent);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  font-size: .9rem;
}
.help-card .help-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 600;
  margin-bottom: .25rem;
}

/* Password field */
.password-field { position: relative; }
.password-field input { padding-right: 2.5rem; }
.password-toggle {
  position: absolute;
  right: .4rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--nexo-muted);
  cursor: pointer;
  padding: .25rem;
  font-size: 1rem;
}
.password-actions {
  display: flex;
  gap: .5rem;
  margin-top: .35rem;
  font-size: .8rem;
}

/* Busy state */
.is-busy { position: relative; pointer-events: none; }
.is-busy::after {
  content: "";
  display: inline-block;
  width: .85rem;
  height: .85rem;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-left: .4rem;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1D3341;
  padding: 1rem;
}
.login-card {
  /* The login card is always a light surface on the navy page, in any theme. Re-mapping the
     semantic tokens here keeps every inner rule (labels, inputs, icon prefixes) correct
     light-on-white without per-element overrides, and fixes the dark-box / faint-label
     artifacts that appeared when the page theme was dark. */
  --nexo-fg: #1a2535;
  --nexo-bg: #ffffff;
  --nexo-surface: #f1f3f5;
  --nexo-border: #d8dde3;
  --nexo-muted: #6b7280;
  background: #fff;
  color: var(--nexo-fg);
  border-radius: 12px;
  padding: 2rem 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
/* Neutralise the browser's yellow autofill so it doesn't clash with the white card. */
.login-card input:-webkit-autofill,
.login-card input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 30px #fff inset;
  -webkit-text-fill-color: #1a2535;
  caret-color: #1a2535;
}
.login-brand-logo { display: block; height: 56px; width: auto; margin: 0 auto 1rem; }
.login-card h1 {
  color: #1D3341;
  font-size: 1.3rem;
  text-align: center;
  margin: 0 0 .25rem;
}
.login-card .login-subtitle {
  text-align: center;
  color: var(--nexo-muted);
  font-size: .85rem;
  margin-bottom: 1.5rem;
}
.login-card label { margin: .75rem 0 .25rem; font-size: .85rem; font-weight: 500; color: var(--nexo-fg); }
.login-card .input-group {
  display: flex;
  align-items: center;
  border: 1px solid var(--nexo-border);
  border-radius: 6px;
  overflow: hidden;
}
.login-card .input-group i {
  padding: .5rem .65rem;
  color: var(--nexo-muted);
  background: var(--nexo-surface);
  font-size: 1rem;
}
.login-card .input-group input {
  flex: 1;
  border: none;
  border-radius: 0;
  padding: .55rem .65rem;
  background: transparent;
}
.login-card .input-group:focus-within { border-color: #2B84A2; }
.login-card button[type="submit"] {
  width: 100%;
  padding: .65rem;
  font-size: 1rem;
  background: #2B84A2;
  border-radius: 6px;
  margin-top: 1.25rem;
}
.login-card button[type="submit"]:hover { background: #236f89; }
.login-card .login-footer { text-align: center; margin-top: 1rem; font-size: .85rem; }
.login-card .login-inline-error { margin: .25rem 0 0; font-size: .85rem; text-align: left; }
.login-remember-wrapper { margin-top: .75rem; }
.checkbox-label { display: flex; align-items: center; gap: .4rem; font-size: .85rem; font-weight: 400; margin: 0; }
.checkbox-label input[type="checkbox"] { width: auto; }
.login-passkey-wrapper { text-align: center; margin-top: .75rem; }
.inline-form { margin: 0; display: inline; }

/* Iconized row actions (view / edit / delete) — uniform across every list */
.row-actions { display: inline-flex; align-items: center; gap: .25rem; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; padding: 0;
  border: 1px solid var(--nexo-border); border-radius: 6px;
  background: var(--nexo-bg); color: var(--nexo-fg);
  cursor: pointer; text-decoration: none; font-size: 1rem; line-height: 1;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--nexo-surface); border-color: var(--nexo-primary); color: var(--nexo-primary); }
.icon-btn--primary { border-color: var(--nexo-primary); color: var(--nexo-primary); }
.icon-btn--primary:hover { background: var(--nexo-primary); border-color: var(--nexo-primary); color: #fff; }
.icon-btn--danger:hover { background: var(--nexo-error); border-color: var(--nexo-error); color: #fff; }
.login-version {
  position: fixed;
  bottom: .5rem;
  right: 1rem;
  font-size: .75rem;
  color: rgba(255,255,255,.4);
}

/* Profile grid */
.profile-grid { display: grid; grid-template-columns: 140px 1fr; gap: .35rem .75rem; font-size: .9rem; }
.profile-grid dt { color: var(--nexo-muted); font-weight: 600; font-size: .8rem; }

/* Glossary */
.glossary { max-width: 600px; }
.glossary dt { font-weight: 600; margin-top: 1rem; color: var(--nexo-primary); }
.glossary dd { margin: .25rem 0 0 1rem; color: var(--nexo-fg); font-size: .9rem; }

/* Help page */
.help-toc { display: flex; gap: .5rem 1rem; flex-wrap: wrap; margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--nexo-border); }
.help-toc a { font-size: .9rem; text-decoration: none; }
.help-toc a:hover { text-decoration: underline; }
.help-page section { margin-bottom: 1.5rem; }
.help-page section h2 { font-size: 1.1rem; margin-bottom: .5rem; }
.help-page section p { color: var(--nexo-fg); line-height: 1.6; }

/* Dashboard stats */
.dashboard-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.dashboard-stat { background: var(--nexo-surface); border: 1px solid var(--nexo-border); border-radius: 8px; padding: 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.dashboard-stat--alert { border-left: 3px solid var(--nexo-error); }
.dashboard-stat__label { font-size: .8rem; color: var(--nexo-muted); text-transform: uppercase; letter-spacing: .04em; }
.dashboard-stat__value { font-size: 1.8rem; font-weight: 700; color: var(--nexo-primary); margin: .25rem 0; }
.dashboard-stat__trend { font-size: .85rem; color: var(--nexo-muted); }
.dashboard-stat--link { display: block; text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
.dashboard-stat--link:hover { border-color: var(--nexo-accent); box-shadow: 0 4px 14px rgba(0,0,0,.12); transform: translateY(-1px); }
.dashboard-stat__more { display: inline-flex; align-items: center; gap: .3rem; margin-top: .6rem; font-size: .82rem; font-weight: 500; color: var(--nexo-link); }

/* KPI / stat cards (netspo style) — used by the dashboard and the Seguridad overview. Left accent
   border, big tabular value, uppercase eyebrow label. */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin: 1.25rem 0 1.5rem; }
.stat-card {
  background: var(--nexo-surface); border: 1px solid var(--nexo-border);
  border-left: 4px solid var(--nexo-primary); border-radius: 8px;
  padding: 1.1rem 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,.08);
  display: flex; flex-direction: column; gap: .35rem;
}
.stat-card__value { font-size: 2rem; font-weight: 800; line-height: 1; color: var(--nexo-fg); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-card__label { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--nexo-muted); }

/* Analítica */
.analytics-since { color: var(--nexo-muted); font-size: .85rem; margin: .6rem 0 0; }
.analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; margin-top: 1.5rem; }
.analytics-grid > section { background: var(--nexo-surface); border: 1px solid var(--nexo-border); border-radius: 8px; padding: 1rem 1.25rem; }
.analytics-grid > section > h2 { margin-top: 0; font-size: 1rem; }

/* Create/edit form cards: a boxed, intentional form (replaces raw fields at page bottom). */
.form-card { max-width: 680px; }
.form-card > h2:first-child { margin-top: 0; }

/* Explicit form fields: label above its control, comfortable vertical rhythm (netspo style). */
.form-field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.form-field > label { font-weight: 600; font-size: .85rem; color: var(--nexo-fg); }
.form-field > input:not([type=checkbox]):not([type=radio]):not([type=color]),
.form-field > select, .form-field > textarea { width: 100%; }
.form-field__hint { font-size: .8rem; color: var(--nexo-muted); }
.form-field__hint--accent { color: var(--nexo-primary); }
.form-field__error { font-size: .8rem; color: var(--nexo-error); }
.form-field > input.is-invalid { border-color: var(--nexo-error); }
.required-star { color: var(--nexo-error); margin-left: .15rem; font-weight: 700; }
/* Rendered (user-built) form fields: help text, choice groups and decorative blocks. */
.form-help { margin: 0; font-size: .8rem; color: var(--nexo-muted); }
.form-help-block { font-size: .9rem; color: var(--nexo-fg); background: var(--nexo-surface); border-left: 3px solid var(--nexo-border); padding: .5rem .75rem; border-radius: 4px; }
.form-section-heading { margin: .5rem 0 .25rem; font-size: 1rem; border-bottom: 1px solid var(--nexo-border); padding-bottom: .3rem; }
.form-divider { border: 0; border-top: 1px solid var(--nexo-border); margin: .5rem 0; }
.form-radio-group, .form-checkbox-group { display: flex; flex-direction: column; gap: .35rem; }
.form-radio { display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; margin: 0; cursor: pointer; }
.form-radio input { width: auto; margin: 0; }
/* Action row at the bottom of a form: primary action first, then secondary. Buttons never touch. */
.form-actions { display: flex; align-items: center; gap: .6rem; margin-top: 1.25rem; flex-wrap: wrap; }
/* Inline checkbox + label row inside a form field (the checkbox sits beside its label). */
.check-row { display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; }
.check-row input[type="checkbox"] { width: auto; margin: 0; }

/* Help / guidance affordances (eppsc style): a short explanatory banner at the top of a page, and
   a side panel next to forms documenting what each field means — so every page is self-explanatory. */
.help-card {
  display: flex; align-items: flex-start; gap: .6rem;
  background: rgba(43,132,162,.08); border: 1px solid var(--nexo-border);
  border-left: 3px solid var(--nexo-primary); border-radius: 8px;
  padding: .8rem 1rem; margin-bottom: 1.25rem; font-size: .9rem; line-height: 1.45;
}
.help-card__icon { color: var(--nexo-primary); font-size: 1.05rem; flex-shrink: 0; margin-top: .1rem; }
.help-card p { margin: 0; }
.help-card strong { font-weight: 600; }

/* Form + side-help two-column layout; collapses under the help panel on narrow screens. */
.with-help { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.25rem; align-items: start; }
.with-help > .form-card { max-width: none; margin-bottom: 0; }
@media (max-width: 880px) { .with-help { grid-template-columns: 1fr; } }
.help-aside {
  background: var(--nexo-surface); border: 1px solid var(--nexo-border);
  border-radius: 8px; padding: 1rem 1.1rem; font-size: .85rem; line-height: 1.5;
}
.help-aside__title { display: flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .9rem; margin: 0 0 .6rem; }
.help-aside__title i { color: var(--nexo-primary); }
.help-aside dl { margin: 0; }
.help-aside dt { font-weight: 600; margin-top: .7rem; }
.help-aside dt:first-of-type { margin-top: 0; }
.help-aside dd { margin: .1rem 0 0; color: var(--nexo-muted); }

/* Section cards (profile, detail pages): each logical section is a boxed panel, not loose text. */
.profile-section { margin-bottom: 1.25rem; }
.profile-section > h2:first-child, .profile-section > h2:nth-child(2) { margin-top: 0; }
.profile-section > table:last-child, .profile-section > form:last-child { margin-bottom: 0; }

/* In real (non-inline) forms, fields stack under their label — cleaner than label-beside-field,
   and fixes textareas that rendered next to their label. Inline filter/search forms keep rows. */
.form-card label, .form-grid label { display: block; }
.form-card label > input:not([type=checkbox]):not([type=radio]):not([type=color]),
.form-card label > select, .form-card label > textarea,
.form-grid label > input:not([type=checkbox]):not([type=radio]):not([type=color]),
.form-grid label > select, .form-grid label > textarea { display: block; margin-top: .3rem; width: 100%; max-width: 460px; }
textarea { min-height: 7rem; resize: vertical; width: 100%; max-width: 460px; }

/* Checkbox rows. Declared after `.form-card label { display: block }` so the box keeps sitting beside
   its own label instead of being stretched to its own line by the block rule above. */
label.form-checkbox { display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; margin: 0; cursor: pointer; }
label.form-checkbox > input[type="checkbox"] { width: auto; margin: 0; flex-shrink: 0; }
/* A stack of related checkboxes; a hint belongs to the checkbox above it, so it is indented under it. */
.form-checkboxes { display: flex; flex-direction: column; gap: .4rem; }
.form-checkboxes > .form-field__hint { margin: -.1rem 0 .4rem 1.6rem; }
/* A field whose label wraps its own checkbox: label and box share one line. */
.form-field--inline > label { display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; }
.form-field--inline > label > input[type="checkbox"] { width: auto; margin: 0; }

/* A field that lays its sub-blocks side by side. Each column keeps the label-above-control rhythm of a
   plain .form-field — without this the nested controls fall back to inline flow and misalign. */
.form-field--row { flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 1rem 1.25rem; }
.form-field--row > div { display: flex; flex-direction: column; gap: .35rem; flex: 1 1 180px; min-width: 0; }
/* A bare checkbox sitting among labelled columns lines up with the controls, not with their labels. */
.form-field--row > .form-checkbox { flex: 0 1 auto; align-self: center; }
.form-field--row > div > label { font-weight: 600; font-size: .85rem; color: var(--nexo-fg); }
.form-field--row > div > input:not([type=checkbox]):not([type=radio]):not([type=color]),
.form-field--row > div > select, .form-field--row > div > textarea { width: 100%; max-width: none; margin-top: 0; }

/* Explanatory paragraph inside a field (advanced/JSON editors), and the status line above a form. */
.form-help-inline { margin: .1rem 0 .4rem; font-size: .8rem; color: var(--nexo-muted); }
.form-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; font-size: .88rem; }
.form-card__help { margin: 0 0 1rem; font-size: .9rem; color: var(--nexo-muted); }

/* Public form-fill page: title block above the form, and the server-rendered field preview. */
.form-header { margin-bottom: 1rem; }
.form-header > h1 { margin-bottom: .35rem; }
.form-header__desc { margin: 0; color: var(--nexo-muted); }
.form-pager { margin: .4rem 0 0; font-size: .85rem; color: var(--nexo-muted); }
.form-preview { background: var(--nexo-surface); border: 1px solid var(--nexo-border); border-radius: 10px; padding: 1.25rem 1.5rem; max-width: 680px; }
.form-preview > h3:first-child { margin-top: 0; }

/* Branded error / not-found page: centered card with the status code. */
.error-page { min-height: 70vh; display: flex; align-items: center; justify-content: center; padding: 2rem; text-align: center; }
.error-card { max-width: 460px; }
.error-card__code { font-size: 4rem; font-weight: 800; color: var(--nexo-accent); line-height: 1; margin-bottom: .25rem; }
.error-card h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
.error-card p { color: var(--nexo-muted); margin: .35rem 0; }
.error-card .btn { margin-top: 1.25rem; }

/* System health / diagnostics */
.health-header { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.health-timestamp { color: var(--nexo-muted); font-size: .85rem; }
.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-top: 1rem; }
.health-card { background: var(--nexo-surface); border: 1px solid var(--nexo-border); border-radius: 8px; padding: 1.1rem 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); display: flex; flex-direction: column; min-width: 0; }
.health-card--wide { grid-column: 1 / -1; }
.health-card h2 { font-size: .9rem; text-transform: uppercase; letter-spacing: .04em; color: var(--nexo-muted); margin: 0 0 .75rem; }
.health-card dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem .75rem; margin: 0; }
.health-card dt { color: var(--nexo-muted); font-size: .85rem; }
.health-card dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
/* Per-core CPU bars + generic progress bar */
.cpu-cores { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .35rem .9rem; margin-top: .75rem; }
.cpu-core { display: flex; align-items: center; gap: .5rem; font-size: .8rem; font-variant-numeric: tabular-nums; }
.cpu-core__label { color: var(--nexo-muted); min-width: 3.2em; }
.cpu-core__track, .health-bar { flex: 1; height: 6px; background: var(--nexo-border); border-radius: 3px; overflow: hidden; }
.cpu-core__fill, .health-bar__fill { display: block; height: 100%; background: var(--nexo-primary); transition: width .4s ease; }
.cpu-core__val { min-width: 3em; text-align: right; color: var(--nexo-muted); }
.health-bar { display: block; margin-top: .6rem; }
.health-deps { margin-top: .75rem; }
.health-deps__title { display: inline; }

/* Multi-field filter bars (Auditoría, Depuración) */
.filters--grid { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem 1rem; margin-bottom: 1rem; }
.filters--grid label { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; color: var(--nexo-muted); }
.filters--grid input, .filters--grid select { min-width: 140px; }
.filters__actions { display: flex; gap: .5rem; align-items: flex-end; }

/* Calendar colour dot in the calendars list / header */
.cal-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .4rem; vertical-align: middle; }

/* Card action row (footer of a card-grid card) */
.card__actions { display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }

/* Inline input + adjacent action buttons (e.g. password field with show/generate) */
.input-group { display: flex; align-items: stretch; gap: .4rem; }
.input-group > input { flex: 1 1 auto; min-width: 0; }

/* User management (list count badge + detail/edit two-column layout + card head/foot) */
.count-badge { display: inline-block; background: var(--nexo-border); color: var(--nexo-muted); font-size: .7em; font-weight: 700; padding: .1em .55em; border-radius: 999px; vertical-align: middle; }
.cell-strong { font-weight: 600; }
.ms-1 { margin-left: .35rem; }
.user-detail-grid { display: grid; grid-template-columns: minmax(280px, 1fr) 2fr; gap: 1.5rem; align-items: start; }
.user-detail-grid__side { display: flex; flex-direction: column; }
.user-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 1.5rem; align-items: start; }
.user-grid__main { display: flex; flex-direction: column; gap: 1.25rem; }
.user-grid__main .form-card { max-width: none; margin: 0; }
@media (max-width: 900px) { .user-detail-grid, .user-grid { grid-template-columns: 1fr; } }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: .6rem; margin-bottom: .9rem; border-bottom: 1px solid var(--nexo-border); }
.card__head h2 { margin: 0; font-size: .95rem; }
.card__foot { display: flex; gap: .5rem; flex-wrap: wrap; padding-top: .9rem; margin-top: .9rem; border-top: 1px solid var(--nexo-border); }
/* Compact stacked action in a sidebar card (password reset, 2FA, delete) */
.side-action { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
.side-action + .side-action { margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--nexo-border); }
.form-label-sm { font-size: .8rem; font-weight: 600; color: var(--nexo-muted); }
/* Sidebar action stack (tertulia-style): full-width buttons, one per row. */
.user-grid__side { display: flex; flex-direction: column; gap: 1rem; }
.side-actions { display: flex; flex-direction: column; gap: .5rem; }
.side-actions > form { margin: 0; }
.side-actions .btn { width: 100%; justify-content: center; margin-left: 0; }

/* Help center topic cards (Ayuda) */
.doc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.doc-card { display: flex; gap: .9rem; background: var(--nexo-surface); border: 1px solid var(--nexo-border); border-radius: 10px; padding: 1.1rem 1.25rem; }
.doc-card__icon { flex: 0 0 auto; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--nexo-bg); color: var(--nexo-primary); font-size: 1.25rem; }
.doc-card__body h3 { margin: 0 0 .3rem; font-size: 1rem; }
.doc-card__body p { margin: 0; color: var(--nexo-muted); font-size: .9rem; line-height: 1.5; }
.health-dead { margin-top: 1rem; min-height: 0; }
.health-dead h3 { font-size: .8rem; color: var(--nexo-muted); margin: 0 0 .35rem; }
/* Bound the failures list inside the card so a long run of dead jobs scrolls instead of pushing the
   card past its grid row (and into the next section). */
.health-dead__scroll { max-height: 11rem; overflow-y: auto; border: 1px solid var(--nexo-border); border-radius: 6px; }
.health-dead-err { color: var(--nexo-error); font-size: .8rem; }
.table--compact th, .table--compact td { padding: .3rem .5rem; font-size: .82rem; }
.health-services { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .5rem .75rem; }
.health-services--compact { margin-top: 1rem; }
/* Dashboard section heading row: title left, action (e.g. "Ver salud en vivo") right. */
.dashboard-section__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; flex-wrap: wrap; }
.dashboard-section__head h2 { margin: 0; }
.dashboard-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 1.5rem; }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; }
.quick-action { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; padding: 1.1rem .75rem; text-align: center; background: var(--nexo-surface); border: 1px solid var(--nexo-border); border-radius: 10px; color: var(--nexo-fg); text-decoration: none; transition: border-color .12s, box-shadow .12s, transform .12s; }
.quick-action:hover { border-color: var(--nexo-primary); box-shadow: 0 2px 8px rgba(0,0,0,.1); transform: translateY(-1px); }
.quick-action__icon { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; border-radius: 50%; background: var(--nexo-bg); color: var(--nexo-primary); font-size: 1.25rem; }
.quick-action__label { font-size: .85rem; font-weight: 600; }
.stat-card__value--sm { font-size: 1.4rem; }
.health-service { display: flex; align-items: center; gap: .5rem; }
.health-service-name { flex: 1; }
.health-service-state { font-weight: 600; font-size: .85rem; }
.health-service-detail { color: var(--nexo-muted); font-size: .8rem; }
.status-dot { width: .65rem; height: .65rem; border-radius: 50%; flex-shrink: 0; display: inline-block; background: var(--nexo-muted); }
.status-dot--ok { background: var(--nexo-success); }
.status-dot--bad { background: var(--nexo-error); }

/* System tasks / job queue */
.tasks-section { margin: 1.5rem 0; }
.tasks-section > .muted { color: var(--nexo-muted); font-size: .85rem; margin: .25rem 0 .75rem; }
.status-badge { display: inline-block; padding: .1em .5em; border-radius: 4px; font-size: .78rem; font-weight: 600; background: var(--nexo-surface); border: 1px solid var(--nexo-border); }
.status-badge--ready { color: var(--nexo-link); }
.status-badge--active { color: var(--nexo-warn); }
.status-badge--retry { color: var(--nexo-warn); }
.status-badge--done { color: var(--nexo-success); }
.status-badge--dead { color: var(--nexo-error); border-color: var(--nexo-error); }
.status-badge--draft { color: var(--nexo-muted); }
.status-badge--published { color: var(--nexo-success); }
.status-badge--archived { color: var(--nexo-muted); }

/* Utilities — no inline styles */
.wysiwyg-source { display: none; }
.hidden-form { display: none; }
.form-row { display: flex; gap: 1rem; }
.text-muted { color: var(--nexo-muted); }
.text-sm { font-size: .85rem; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.ml-2 { margin-left: .5rem; }
.is-hidden { display: none; }
.user-search-input { width: 100%; }
.user-search-clear { margin-top: .35rem; padding: .15rem .5rem; font-size: .8rem; background: none; border: 1px solid var(--border, #ccc); border-radius: 4px; color: var(--muted, #555); cursor: pointer; }
.user-search-clear:hover { background: var(--surface-2, #f2f2f2); }
.chart-box { position: relative; height: 220px; margin-bottom: 1rem; }
.kanban { display: flex; gap: 1rem; align-items: flex-start; overflow-x: auto; }
.kanban-col { flex: 1 1 0; min-width: 220px; background: var(--nexo-surface); border-radius: 6px; padding: 0.5rem; }
.kanban-col__title { font-size: 0.9rem; margin: 0 0 0.5rem; display: flex; justify-content: space-between; align-items: center; }
.kanban-col__count { background: var(--nexo-border); border-radius: 999px; padding: 0 0.5rem; font-size: 0.75rem; }
.kanban-card { display: block; background: var(--nexo-bg); border: 1px solid var(--nexo-border); border-radius: 4px; padding: 0.5rem; margin-bottom: 0.5rem; box-shadow: 0 1px 2px rgba(0,0,0,.08); text-decoration: none; color: inherit; }
.kanban-card__folio { font-weight: 600; font-size: 0.85rem; }
.kanban-card__tipo { font-size: 0.8rem; color: var(--nexo-muted); }
.kanban-card__assignee { font-size: 0.75rem; color: var(--nexo-muted); margin-top: 0.25rem; }
.kanban-card__escalation { display: inline-block; margin-top: 0.25rem; font-size: 0.7rem; color: var(--nexo-error); font-weight: 600; }
.wip-input { width: 3.5rem; }
.kanban-wip { font-size: 0.75rem; color: var(--nexo-muted); background: var(--nexo-surface); border-radius: 999px; padding: 0 0.4rem; }
.kanban-wip--full { background: rgba(176,0,32,.16); color: var(--nexo-error); font-weight: 600; }
.kanban-col-wip summary { cursor: pointer; list-style: none; }

/* ──────────── Public landing (anonymous home) ──────────── */
.landing-nav { background: var(--nexo-sidebar, #1D3341); color: #fff; }
.landing-nav__inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 1.5rem; padding: .5rem 1.5rem; }
.landing-nav__brand { display: flex; align-items: center; text-decoration: none; }
.landing-nav__logo { height: 34px; width: auto; display: block; }
.landing-nav__actions { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.landing-nav .theme-toggle { background: transparent; color: rgba(255,255,255,.85); border: 1px solid rgba(255,255,255,.25); border-radius: 6px; padding: .35rem .5rem; line-height: 1; }
.landing-nav .theme-toggle:hover { color: #fff; background: rgba(255,255,255,.12); }
/* The login control is a compact real button on the dark nav: light fill = primary action. */
.landing-nav__login { background: #fff; color: var(--nexo-primary); border-color: #fff; }
.landing-nav__login:hover { background: rgba(255,255,255,.88); color: var(--nexo-primary); }

.landing { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.landing-hero { text-align: center; padding: 4rem 1rem 3rem; border-bottom: 1px solid var(--nexo-border); }
.landing-hero h1 { font-size: clamp(1.9rem, 4vw, 3rem); font-weight: 800; line-height: 1.1; margin: 0 0 1rem; color: var(--nexo-fg); }
.landing-hero__lead { max-width: 680px; margin: 0 auto 2rem; color: var(--nexo-muted); font-size: 1.1rem; line-height: 1.5; }
.btn-cta { display: inline-flex; align-items: center; gap: .5rem; background: var(--nexo-primary); color: #fff; text-decoration: none; padding: .8rem 1.6rem; border-radius: 6px; font-weight: 600; font-size: 1.05rem; }
.btn-cta:hover { background: var(--nexo-primary-hover); }

.landing-features { padding: 3rem 0 4rem; }
.landing-features h2 { text-align: center; font-size: 1.5rem; font-weight: 700; margin: 0 0 .35rem; color: var(--nexo-fg); }
.landing-features__sub { text-align: center; color: var(--nexo-muted); margin: 0 0 2.5rem; }
.landing-features__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem 2rem; }
.landing-feature { display: flex; gap: .75rem; align-items: flex-start; }
.landing-feature i { color: var(--nexo-accent); font-size: 1.35rem; line-height: 1.3; flex-shrink: 0; }
.landing-feature strong { display: block; font-size: .95rem; color: var(--nexo-fg); margin-bottom: .15rem; }
.landing-feature span { display: block; font-size: .85rem; color: var(--nexo-muted); line-height: 1.4; }

.landing-footer { text-align: center; color: var(--nexo-muted); font-size: .85rem; padding: 1.75rem 1rem; border-top: 1px solid var(--nexo-border); }

@media (max-width: 900px) { .landing-features__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .landing-features__grid { grid-template-columns: 1fr; } .landing-nav__links { display: none; } }

/* @-mention chips in rendered comment bodies, and the mention/help typeahead UI. */
.mention { color: var(--nexo-link); background: rgba(37, 99, 235, 0.10); padding: 0 3px; border-radius: 3px; font-weight: 600; }
.mention-dropdown { z-index: 1000; background: var(--nexo-surface); border: 1px solid var(--nexo-border); border-radius: 6px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14); max-height: 240px; overflow-y: auto; }
.mention-dropdown__item { padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.mention-dropdown__item.is-active, .mention-dropdown__item:hover { background: rgba(37, 99, 235, 0.12); }
.help-search { max-width: 480px; margin-bottom: 1rem; }
.help-searching .tabs__panel { display: block; }

/* Comment / message thread (host detail pages). The markup is an <ol> for semantics, but it renders
   as stacked cards — no list numbering — with a meta header, body, and a spaced action row. */
.comment-thread { margin-top: 1.5rem; }
.comment-thread__header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.comment-thread__header h3 { margin: 0; }
.comment-list { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.comment-list__empty { list-style: none; color: var(--nexo-muted); font-style: italic; padding: .5rem 0; }
.comment-item { background: var(--nexo-surface); border: 1px solid var(--nexo-border); border-radius: 8px; padding: .7rem .85rem; }
.comment-item__meta { display: flex; align-items: baseline; flex-wrap: wrap; gap: .5rem; margin-bottom: .35rem; }
.comment-item__meta strong { font-size: .92rem; }
.comment-item__meta time { color: var(--nexo-muted); font-size: .8rem; }
.comment-item__edited { color: var(--nexo-muted); font-size: .78rem; font-style: italic; }
.comment-item__body { margin: 0; line-height: 1.5; overflow-wrap: anywhere; }
.comment-item__body--deleted { color: var(--nexo-muted); font-style: italic; }
.comment-item__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .6rem; }
.comment-item__reported { color: var(--nexo-muted); font-size: .8rem; display: inline-flex; align-items: center; gap: .3rem; }
/* Internal (staff-only) comments get a left accent + tinted surface so they read as set apart. */
.comment-item--internal { border-left: 3px solid var(--nexo-primary); }
.comment-item--editing { border-color: var(--nexo-primary); }
.badge--internal { background: var(--nexo-primary); color: #fff; }

/* Custom reports: interactive charts + builder island */
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; margin-top: 1rem; }
.chart-card__canvas { position: relative; height: 300px; }
.table-scroll { overflow-x: auto; }
.report-builder__section { border: 1px solid var(--border); border-radius: 8px; padding: 1rem; margin: 1rem 0; }
.report-builder__section legend { font-weight: 600; padding: 0 0.5rem; }
.report-builder__cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.25rem 0.75rem; }
.report-builder__row { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; flex-wrap: wrap; }
.report-builder__chart { border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem; margin-bottom: 0.75rem; }
.report-builder__chart-head { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.report-builder__chart-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.5rem; }
.report-builder__field label { display: block; font-size: 0.8rem; color: var(--muted); }
