/* ============================================================
   WorkerShield — styles.css (v4 · dark · dashboard layout)
   Paleta oscura worzero + estructura nueva (top nav + dashboard).
   ============================================================ */

:root {
  /* Marca verde */
  --brand:        #10B981;
  --brand-hover:  #00C764;
  --brand-deep:   #047857;
  --emerald:      #00E676;
  --emerald-soft: #B6FFCF;

  /* Tinta */
  --text:    #EAFBF1;
  --text-2:  #C6E4D0;
  --text-3:  #7A9489;
  --text-4:  #4D6358;

  /* Superficies */
  --bg:           #060B08;
  --surface:      #0E1714;
  --surface-2:    #0B1310;
  --surface-3:    #142019;
  --surface-tint: #0A1410;
  --hover:        #142019;

  /* Bordes */
  --border:        #142019;
  --border-strong: #1E2D24;
  --border-soft:   #0F1812;

  /* Acentos brand */
  --brand-bg:     rgba(0, 230, 118, 0.08);
  --brand-bg-2:   rgba(0, 230, 118, 0.14);
  --brand-border: rgba(0, 230, 118, 0.35);
  --brand-soft:   rgba(0, 230, 118, 0.18);

  /* Severidad (oscuro: bg rgba, color brillante) */
  --sev-low:      #34D399;  --sev-low-bg:  rgba(52, 211, 153, 0.12);  --sev-low-bd:  rgba(52, 211, 153, 0.30);
  --sev-mid:      #FACC15;  --sev-mid-bg:  rgba(250, 204, 21, 0.10);  --sev-mid-bd:  rgba(250, 204, 21, 0.30);
  --sev-high:     #FB923C;  --sev-high-bg: rgba(251, 146, 60, 0.10);  --sev-high-bd: rgba(251, 146, 60, 0.30);
  --sev-crit:     #EF4444;  --sev-crit-bg: rgba(239, 68, 68, 0.12);   --sev-crit-bd: rgba(239, 68, 68, 0.32);

  /* Radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;

  /* Shadows + glow */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 230, 118, 0.05);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.7);
  --glow-emerald: 0 0 24px rgba(0, 230, 118, 0.35);
  --ring-brand: 0 0 0 3px rgba(0, 230, 118, 0.18);

  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --topnav-h: 60px;
  --container-max: 1280px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background-color: var(--bg); }
body {
  font-family: var(--font-sans);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'cv02', 'cv03', 'cv11';
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 900px 600px at 15% -10%, rgba(0, 230, 118, 0.10), transparent 60%),
    radial-gradient(ellipse 1000px 700px at 105% 110%, rgba(16, 185, 129, 0.06), transparent 60%);
  background-attachment: fixed;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }

input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
  border-color: var(--emerald);
  box-shadow: var(--ring-brand);
}
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237A9489' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px;
  padding-right: 32px;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

h1, h2, h3, h4 { margin: 0; }
em, i { font-style: normal; font-family: inherit; font-weight: inherit; }

/* Editorial italic accent (worzero style) */
.italic-accent {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--emerald);
  letter-spacing: -0.01em;
}

/* ============ UTILS ============ */
.only-mobile { display: block; }
.only-desktop { display: none; }
@media (min-width: 1024px) {
  .only-mobile { display: none !important; }
  .only-desktop { display: block; }
  .only-desktop.flex { display: flex; }
}

/* ============ APP ============ */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: 80px;
  display: flex;
  flex-direction: column;
}

/* ============ TOP NAV ============ */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(6, 11, 8, 0.88);
  backdrop-filter: blur(18px) saturate(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
  display: flex;
  flex-direction: column;
}
.topnav-inner {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex; align-items: center;
  gap: 10px;
  height: var(--topnav-h);
  padding: 0 14px;
}
@media (min-width: 1024px) {
  .topnav-inner { padding: 0 18px; gap: 14px; }
}

/* Buscador desktop (en topnav, al lado de los links) */
.topnav-search {
  position: relative;
  flex: 1 1 auto;
  max-width: 360px;
  margin-left: auto;
  margin-right: 4px;
  display: flex; align-items: center;
}
.topnav-search input {
  width: 100%;
  height: 36px;
  padding: 7px 56px 7px 36px;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.topnav-search input::placeholder { color: var(--text-3); }
.topnav-search input:focus {
  border-color: var(--emerald);
  box-shadow: var(--ring-brand);
}
.topnav-search .icon-left {
  position: absolute;
  left: 11px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--text-3);
  pointer-events: none;
}
.topnav-search .kbd-hint {
  position: absolute;
  right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 1px 5px;
  pointer-events: none;
  user-select: none;
}

/* Buscador móvil (segunda fila del topnav, sticky con él) */
.topnav-search-mobile {
  position: relative;
  display: flex; align-items: center;
  padding: 8px 14px 10px;
  border-top: 1px solid rgba(0, 230, 118, 0.05);
}
.topnav-search-mobile input {
  width: 100%;
  height: 40px;
  padding: 9px 40px 9px 38px;
  font-size: 16px; /* evita zoom de iOS */
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.topnav-search-mobile input::placeholder { color: var(--text-3); font-size: 14px; }
.topnav-search-mobile input:focus {
  border-color: var(--emerald);
  box-shadow: var(--ring-brand);
}
.topnav-search-mobile .icon-left {
  position: absolute;
  left: 26px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-3);
  pointer-events: none;
}
.search-clear {
  position: absolute;
  right: 22px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.12s;
}
.search-clear:hover { background: var(--hover); color: var(--emerald); }
.search-clear svg { width: 12px; height: 12px; stroke-width: 2.5; }

.brand {
  display: flex; align-items: center; gap: 11px;
  text-decoration: none; color: inherit;
}
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--emerald) 0%, var(--brand-deep) 100%);
  display: grid; place-items: center;
  flex-shrink: 0;
  box-shadow:
    0 0 0 1px rgba(0, 230, 118, 0.35),
    0 12px 28px -10px rgba(0, 230, 118, 0.55);
}
.brand-mark svg { width: 16px; height: 16px; color: #04150c; stroke-width: 2.5; }
.brand-name {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text);
}
.brand-name .dot { color: var(--emerald); }

.topnav-links {
  display: flex; align-items: center; gap: 2px;
  margin-left: 14px;
}
.topnav-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.12s;
}
.topnav-link:hover { background: var(--hover); color: var(--text); }
.topnav-link.active {
  background: var(--brand-bg);
  color: var(--emerald);
  font-weight: 600;
}
.topnav-link .badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  background: var(--sev-crit); color: #fff;
  font-size: 10px; font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1;
}

.topnav-end {
  display: flex; align-items: center; gap: 8px;
}
@media (max-width: 1023px) {
  /* En móvil no hay search desktop, así que end empuja desde la derecha */
  .topnav-end { margin-left: auto; }
}

/* User pill */
.user-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 4px 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.12s;
  position: relative;
}
.user-pill:hover { border-color: var(--brand-border); background: var(--surface-3); }
.user-pill .av {
  width: 26px; height: 26px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--emerald) 0%, var(--brand-deep) 100%);
  color: #04150c;
  display: grid; place-items: center;
  font-weight: 700; font-size: 11px;
  flex-shrink: 0;
}
.user-pill .info { display: flex; flex-direction: column; align-items: flex-start; gap: 0; }
.user-pill .info .n {
  font-size: 12.5px; font-weight: 600;
  color: var(--text);
  line-height: 1.1;
  max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-pill .info .e {
  font-size: 10.5px; color: var(--text-3);
  line-height: 1.1;
  max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--font-mono);
}

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: all 0.15s;
  position: relative;
}
.icon-btn:hover { border-color: var(--brand-border); color: var(--emerald); background: var(--hover); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 17px; height: 17px; stroke-width: 1.8; }
.icon-btn .badge-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 999px;
  background: var(--sev-crit);
  border: 2px solid var(--bg);
  box-shadow: 0 0 8px rgba(239,68,68,0.6);
}
.icon-btn .badge-num {
  position: absolute; top: 2px; right: 2px;
  background: var(--sev-crit); color: #fff;
  font-size: 9px; font-weight: 700;
  font-family: var(--font-mono);
  border-radius: 999px;
  padding: 1px 5px;
  border: 2px solid var(--bg);
  line-height: 1;
}

/* User dropdown */
.user-menu {
  position: absolute;
  top: calc(100% + 6px); right: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  padding: 5px;
  display: none;
  z-index: 60;
}
.user-pill.open .user-menu { display: block; }
.user-menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-weight: 500;
}
.user-menu-item:hover { background: var(--hover); color: var(--emerald); }
.user-menu-item svg { width: 14px; height: 14px; stroke-width: 1.8; }
.user-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }
.user-menu-head {
  padding: 11px 12px 9px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.user-menu-head .n { font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.user-menu-head .e {
  font-size: 11px; color: var(--text-3); margin-top: 3px;
  font-family: var(--font-mono); letter-spacing: 0.04em;
}

/* ============ MAIN ============ */
.main { flex: 1; }
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 16px;
}
.view {
  animation: fadeIn 0.2s ease backwards;
  padding: 24px 0 32px;
}

/* ============ PAGE HEAD ============ */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head h1 {
  font-size: clamp(1.6rem, 3.2vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
  color: var(--text);
}
.page-head h1 em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--emerald);
  letter-spacing: -0.02em;
}
.page-head .desc {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.55;
  max-width: 60ch;
}
.page-head .actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }

/* ============ STATS BAR ============ */
.stats-bar {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 10px 18px;
  padding: 12px 16px;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 14px;
}
.stats-bar .stat {
  display: inline-flex; align-items: baseline; gap: 6px;
  font-size: 12.5px;
  color: var(--text-3);
}
.stats-bar .stat .n {
  font-size: 15px; font-weight: 700;
  color: var(--text);
  letter-spacing: -0.015em;
}
.stats-bar .stat .n.brand { color: var(--emerald); }
.stats-bar .sep {
  width: 1px; height: 16px;
  background: var(--border-strong);
}

/* ============ TOOLBAR ============ */
.toolbar {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 14px;
  align-items: center;
}
.toolbar .search {
  flex: 1; min-width: 220px;
  position: relative;
}
.toolbar .search input {
  padding: 9px 12px 9px 36px;
  height: 38px;
}
.toolbar .search svg.icon-left {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--text-3);
  pointer-events: none;
}
.toolbar select {
  width: auto; min-width: 150px;
  height: 38px;
  padding: 8px 32px 8px 12px;
  background-color: var(--surface);
  font-size: 13px;
}

/* ============ SEVERITY TOGGLE ============ */
.sev-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 14px;
  max-width: 100%;
}
.sev-toggle::-webkit-scrollbar { display: none; }
.sev-toggle button {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  transition: all 0.12s;
}
.sev-toggle button:hover:not(.active) { color: var(--text); background: var(--hover); }
.sev-toggle button .dot-sm { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.sev-toggle button[data-sev="low"]   .dot-sm { background: var(--sev-low);  box-shadow: 0 0 6px var(--sev-low); }
.sev-toggle button[data-sev="mid"]   .dot-sm { background: var(--sev-mid);  box-shadow: 0 0 6px var(--sev-mid); }
.sev-toggle button[data-sev="high"]  .dot-sm { background: var(--sev-high); box-shadow: 0 0 6px var(--sev-high); }
.sev-toggle button[data-sev="crit"]  .dot-sm { background: var(--sev-crit); box-shadow: 0 0 6px var(--sev-crit); }
.sev-toggle button.active {
  background: var(--brand-bg);
  color: var(--emerald);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--brand-border) inset;
}
.sev-toggle button .count {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.75;
}

/* ============ ROWS (lista compacta) ============ */
.rows {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.rows-head {
  display: none;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background 0.12s;
  text-decoration: none;
  color: inherit;
}
.row:last-child { border-bottom: none; }
.row:hover { background: var(--hover); }
.row[data-sev] { --sev-c: var(--text-3); }
.row[data-sev="low"]  { --sev-c: var(--sev-low); }
.row[data-sev="mid"]  { --sev-c: var(--sev-mid); }
.row[data-sev="high"] { --sev-c: var(--sev-high); }
.row[data-sev="crit"] { --sev-c: var(--sev-crit); }

.row-bar {
  width: 3px; align-self: stretch;
  border-radius: 2px;
  background: var(--sev-c);
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--sev-c);
}
.row-avatar {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-weight: 700; font-size: 11.5px;
  color: var(--emerald);
}
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-line-1 {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.row-name {
  font-weight: 700; font-size: 14px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.row-doc {
  font-family: var(--font-mono);
  font-size: 11.5px; color: var(--text-3);
}
.row-meta {
  font-size: 12px; color: var(--text-3);
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.row-meta .sep { width: 2px; height: 2px; border-radius: 50%; background: currentColor; opacity: 0.5; }

.row-sev {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px 3px 8px;
  border-radius: 999px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.row[data-sev="low"]  .row-sev { background: var(--sev-low-bg);  border: 1px solid var(--sev-low-bd);  color: var(--sev-low); }
.row[data-sev="mid"]  .row-sev { background: var(--sev-mid-bg);  border: 1px solid var(--sev-mid-bd);  color: var(--sev-mid); }
.row[data-sev="high"] .row-sev { background: var(--sev-high-bg); border: 1px solid var(--sev-high-bd); color: var(--sev-high); }
.row[data-sev="crit"] .row-sev { background: var(--sev-crit-bg); border: 1px solid var(--sev-crit-bd); color: var(--sev-crit); }
.row-sev .dot-sm {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--sev-c);
  box-shadow: 0 0 6px var(--sev-c);
}

.row-stat {
  font-size: 11.5px; color: var(--text-3);
  flex-shrink: 0;
  font-family: var(--font-mono);
}
.row-stat strong { color: var(--text); font-weight: 700; }
.row-arrow {
  flex-shrink: 0;
  color: var(--text-4);
  transition: color 0.12s, transform 0.12s;
}
.row-arrow svg { width: 16px; height: 16px; stroke-width: 1.8; }
.row:hover .row-arrow { color: var(--emerald); transform: translateX(2px); }

@media (max-width: 1023px) {
  .row { padding: 10px 12px; gap: 10px; }
  .row-line-1 { gap: 6px; }
  .row-name { font-size: 13.5px; }
  .row-meta { font-size: 11.5px; }
  .row-stat { display: none; }
  .row-bar { width: 2px; }
  .row-avatar { width: 34px; height: 34px; font-size: 11px; }
}

@media (min-width: 1024px) {
  .rows-head {
    display: grid;
    grid-template-columns: 4px 36px 1fr 220px 130px 120px 24px;
    gap: 12px;
    align-items: center;
  }
  .rows-head > div:nth-child(1) { display: none; }
  .row {
    display: grid;
    grid-template-columns: 4px 36px 1fr 220px 130px 120px 24px;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
  }
  .row-line-1 { flex-direction: column; align-items: flex-start; gap: 1px; }
  .row-line-1 .row-doc { font-size: 11px; }
  .row-meta { font-size: 12.5px; }
}

/* ============ EMPTY ============ */
.empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.empty svg { width: 36px; height: 36px; opacity: 0.5; margin-bottom: 12px; color: var(--text-4); }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 14px; font-weight: 700; }
.empty p { font-size: 13px; margin: 0 auto; max-width: 38ch; line-height: 1.5; }
.empty .btn { margin-top: 18px; }

/* ============ MOBILE BOTTOM NAV ============ */
.mobile-bottomnav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(6, 11, 8, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  z-index: 100;
  display: flex; align-items: stretch; justify-content: space-around;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  gap: 4px;
}
.nav-tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  flex: 1; max-width: 76px;
  padding: 6px 0 4px;
  border-radius: 8px;
  color: var(--text-3);
  transition: color 0.12s;
  cursor: pointer;
  position: relative;
}
.nav-tab svg { width: 20px; height: 20px; stroke-width: 1.8; }
.nav-tab .label { font-size: 10.5px; font-weight: 500; }
.nav-tab.active { color: var(--emerald); }
.nav-tab.active svg { filter: drop-shadow(0 0 6px rgba(0, 230, 118, 0.55)); }
.nav-tab .badge-num {
  position: absolute; top: 2px; right: 6px;
  background: var(--sev-crit); color: #fff;
  font-size: 9px; font-weight: 700;
  font-family: var(--font-mono);
  border-radius: 999px;
  padding: 1px 5px;
  border: 1.5px solid var(--bg);
  line-height: 1;
}

.nav-cta {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  flex: 1; max-width: 76px;
  cursor: pointer;
  color: var(--text-3);
}
.nav-cta-bubble {
  width: 46px; height: 46px;
  border-radius: 999px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--emerald) 0%, var(--brand-deep) 100%);
  color: #04150c;
  margin-top: -10px;
  box-shadow:
    0 0 0 1px rgba(0, 230, 118, 0.4),
    0 8px 22px -6px rgba(0, 230, 118, 0.65);
  transition: all 0.15s;
}
.nav-cta:active .nav-cta-bubble { transform: scale(0.94); filter: brightness(1.1); }
.nav-cta-bubble svg { width: 22px; height: 22px; stroke-width: 2.4; }
.nav-cta .label { font-size: 10.5px; font-weight: 500; }

@media (min-width: 1024px) {
  .mobile-bottomnav { display: none; }
  .app { padding-bottom: 0; }
}

/* ============ DETAIL: SHEET / RIGHT PANEL ============ */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%; max-width: 480px;
  background: var(--surface);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  border: 1px solid var(--border-strong);
  border-bottom: none;
  z-index: 201;
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 88vh;
  overflow-y: auto;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
}
.sheet.open { transform: translateX(-50%) translateY(0); }
.sheet-handle {
  width: 36px; height: 4px;
  background: var(--text-4);
  border-radius: 2px;
  margin: 10px auto 4px;
}
.sheet-content { padding: 8px 22px 20px; }

@media (min-width: 1024px) {
  .sheet {
    bottom: 0; right: 0; left: auto;
    top: 0;
    transform: translateX(100%);
    height: 100vh;
    max-height: none;
    width: 480px;
    max-width: 480px;
    border-radius: 0;
    border-left: 1px solid var(--border-strong);
    border-right: none;
    border-top: none;
    padding-bottom: 0;
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.65);
  }
  .sheet.open { transform: translateX(0); }
  .sheet-handle { display: none; }
  .sheet-content { padding: 28px 28px 28px; }
}

.sheet-close {
  position: absolute;
  top: 14px; right: 16px;
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid; place-items: center;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all 0.12s;
}
.sheet-close:hover { background: var(--hover); color: var(--emerald); border-color: var(--brand-border); }
.sheet-close svg { width: 16px; height: 16px; stroke-width: 2; }
@media (max-width: 1023px) { .sheet-close { display: none; } }

.sheet-hero {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 0 16px;
  border-bottom: 1px solid var(--border);
}
.sheet-avatar {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-weight: 700; font-size: 17px;
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--border-strong);
  color: var(--emerald);
}
.sheet-name {
  font-size: 18px; font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: var(--text);
}
.sheet-meta {
  margin-top: 4px;
  font-size: 12px; color: var(--text-3);
}
.sheet-meta .doc { color: var(--text-2); font-family: var(--font-mono); }
.sheet-id {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.sheet-id strong { color: var(--emerald); font-weight: 600; }

.sheet-section { margin-top: 22px; }
.sheet-section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.sheet-section h4 {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.sec-num {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  color: var(--text-3);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.sev-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  border-radius: var(--r-md);
}
.sev-card .sev-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  font-family: var(--font-mono);
}
.sev-card .sev-name {
  font-size: 22px; font-weight: 800;
  letter-spacing: -0.025em;
  margin-top: 2px;
}
.sev-card .sev-score { text-align: right; }
.sev-card .sev-score .num {
  font-size: 32px; font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}
.sev-card .sev-score .div {
  font-family: var(--font-mono);
  font-size: 11px;
  opacity: 0.75;
  margin-top: 2px;
}
.sev-bar {
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  margin-top: 12px;
  overflow: hidden;
}
.sev-bar > span { display: block; height: 100%; border-radius: inherit; }

.reasons-list { display: flex; flex-direction: column; gap: 8px; }
.reason-item {
  display: flex; gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.reason-icon {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--brand-bg);
  color: var(--emerald);
  display: grid; place-items: center;
  border: 1px solid var(--brand-border);
}
.reason-icon svg { width: 15px; height: 15px; stroke-width: 2; }
.reason-text strong {
  display: block;
  font-size: 13px; font-weight: 700;
  margin-bottom: 3px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.reason-text p { margin: 0; font-size: 12.5px; color: var(--text-2); line-height: 1.55; }
.reason-text .by {
  display: block; margin-top: 6px;
  font-size: 10.5px; color: var(--text-3);
  font-family: var(--font-mono); letter-spacing: 0.04em;
}
.reason-text .by strong { display: inline; color: var(--emerald); font-size: 10.5px; }

.timeline { display: flex; flex-direction: column; gap: 0; position: relative; padding-left: 4px; }
.timeline::before {
  content: ''; position: absolute; left: 7px; top: 14px; bottom: 14px;
  width: 1px;
  background: linear-gradient(180deg, var(--emerald) 0%, var(--border) 100%);
  opacity: 0.5;
}
.timeline-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 8px 0;
  position: relative;
}
.timeline-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--emerald);
  flex-shrink: 0;
  margin-top: 4px;
  z-index: 1;
  box-shadow: 0 0 0 3px var(--surface);
}
.timeline-content { font-size: 12.5px; color: var(--text); flex: 1; }
.timeline-content strong { color: var(--emerald); font-weight: 600; }
.timeline-content .date {
  color: var(--text-3); font-size: 10.5px;
  font-family: var(--font-mono);
  margin-top: 2px; display: block;
  letter-spacing: 0.04em;
}

/* Contact list (sheet) */
.contact-list { display: flex; flex-direction: column; gap: 6px; }
.contact-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-decoration: none;
  color: inherit;
  transition: all 0.12s;
}
.contact-row:hover, .contact-row:active {
  border-color: var(--brand-border);
  background: var(--hover);
}
.contact-icon {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--brand-bg);
  color: var(--emerald);
  display: grid; place-items: center;
  border: 1px solid var(--brand-border);
}
.contact-icon svg { width: 14px; height: 14px; stroke-width: 2; }
.contact-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.contact-label {
  font-size: 10.5px; font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.06em;
  font-family: var(--font-mono);
}
.contact-value {
  font-size: 13px; font-weight: 500;
  color: var(--text);
  letter-spacing: -0.005em;
  word-break: break-all;
}

.rgpd-card {
  margin-top: 18px;
  padding: 13px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: flex; gap: 10px; align-items: flex-start;
}
.rgpd-card svg { width: 16px; height: 16px; color: var(--emerald); flex-shrink: 0; margin-top: 1px; }
.rgpd-card p { margin: 0; font-size: 11.5px; color: var(--text-2); line-height: 1.55; }
.rgpd-card p strong { color: var(--emerald); font-weight: 600; }

/* ============ BOTONES ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500;
  transition: all 0.15s;
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  letter-spacing: -0.005em;
  height: 38px;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btn svg { width: 14px; height: 14px; stroke-width: 2; }
.btn-outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--brand-border); color: var(--emerald); background: var(--hover); }
.btn-accent {
  background: linear-gradient(135deg, var(--emerald) 0%, var(--brand-deep) 100%);
  color: #04150c;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 8px 24px -10px rgba(0, 230, 118, 0.55);
}
.btn-accent:hover { filter: brightness(1.06) saturate(1.1); }
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
.btn-ghost:hover { color: var(--emerald); background: var(--hover); }
.btn-danger {
  background: var(--surface);
  color: var(--sev-crit);
  border-color: var(--sev-crit-bd);
}
.btn-danger:hover { background: var(--sev-crit-bg); border-color: var(--sev-crit); }
.btn-lg { height: 42px; padding: 11px 18px; font-size: 14px; }
.btn-sm { height: 32px; padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }

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

/* ============ TOAST ============ */
.toast {
  position: fixed;
  top: 18px; left: 50%;
  transform: translateX(-50%) translateY(-130%);
  background: var(--surface);
  border: 1px solid var(--emerald);
  border-radius: 999px;
  padding: 9px 16px 9px 12px;
  font-size: 13px; font-weight: 500;
  color: var(--text);
  z-index: 300;
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 12px 28px -10px rgba(0, 230, 118, 0.4);
  display: flex; align-items: center; gap: 8px;
  max-width: 92vw;
}
.toast svg { width: 15px; height: 15px; color: var(--emerald); flex-shrink: 0; }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--sev-crit); }
.toast.error svg { color: var(--sev-crit); }

/* ============ LOGIN ============ */
.login-shell {
  min-height: 100vh; min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--bg);
}
.login-aside { display: none; }
.login-main {
  display: flex; align-items: center; justify-content: center;
  padding: 24px 20px;
  min-height: 100dvh;
}
.login-card {
  width: 100%; max-width: 420px;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  padding: 32px 28px 26px;
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.6);
}
.login-card .brand { margin-bottom: 22px; }
.login-card h1 {
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  margin: 0 0 4px;
  line-height: 1.1;
  color: var(--text);
}
.login-card h1 em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--emerald);
}
.login-card .sub {
  margin: 0 0 22px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
}
.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 11px; font-weight: 600;
  color: var(--text-3);
  margin-bottom: 5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.field-help { font-size: 11.5px; color: var(--text-3); margin-top: 5px; line-height: 1.4; }
.divider {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-3);
  font-size: 11px; font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.16em; text-transform: uppercase;
  margin: 18px 0;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.login-card .demo-hint {
  margin-top: 18px; padding: 12px 14px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  font-size: 12px; color: var(--text-2);
  line-height: 1.55;
}
.login-card .demo-hint strong { color: var(--emerald); font-weight: 600; }
.login-card .demo-hint code {
  font-family: var(--font-mono);
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--emerald);
}

@media (min-width: 1024px) {
  .login-shell { grid-template-columns: 1fr 460px; }
  .login-aside {
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 56px 56px 44px;
    background:
      radial-gradient(ellipse 700px 500px at 20% 0%, rgba(0, 230, 118, 0.16), transparent 60%),
      linear-gradient(180deg, #04100A, var(--bg));
    border-right: 1px solid var(--border);
    position: relative;
  }
  .login-aside h2 {
    font-size: clamp(2.2rem, 4vw, 3.4rem);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 1;
    color: var(--text);
    margin: 32px 0 0;
    max-width: 16ch;
  }
  .login-aside h2 em {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    color: var(--emerald);
  }
  .login-aside .lead { color: var(--text-2); font-size: 14.5px; max-width: 38ch; line-height: 1.55; margin-top: 18px; }
  .login-aside .footer { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); letter-spacing: 0.1em; }
  .login-aside .features {
    margin-top: 32px;
    display: flex; flex-direction: column; gap: 14px;
    padding: 0; list-style: none;
  }
  .login-aside .features li {
    display: flex; align-items: flex-start; gap: 10px;
    font-size: 13px; color: var(--text-2); line-height: 1.4;
  }
  .login-aside .features li svg { width: 16px; height: 16px; color: var(--emerald); flex-shrink: 0; margin-top: 2px; }
  .login-aside .features li strong { color: var(--text); font-weight: 600; display: block; margin-bottom: 1px; }
}

/* ============ FORMULARIO REPORTAR ============ */
.form-card {
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 22px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 640px) {
  .form-grid.two { grid-template-columns: 1fr 1fr; }
}

.severity-picker {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 4px;
}
.sev-opt {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 12px; font-weight: 600;
  color: var(--text-2);
}
.sev-opt:hover { background: var(--hover); border-color: var(--border-strong); }
.sev-opt[data-sev="low"]  { --c: var(--sev-low); }
.sev-opt[data-sev="mid"]  { --c: var(--sev-mid); }
.sev-opt[data-sev="high"] { --c: var(--sev-high); }
.sev-opt[data-sev="crit"] { --c: var(--sev-crit); }
.sev-opt .pill {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; background: var(--c);
  box-shadow: 0 0 8px var(--c);
  margin-bottom: 6px;
}
.sev-opt.selected {
  background: rgba(255,255,255,0.02);
  border-color: var(--c);
  color: var(--c);
  box-shadow: 0 0 0 1px var(--c) inset, 0 0 18px -4px var(--c);
}

.reasons-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 4px;
}
@media (min-width: 480px) { .reasons-grid { grid-template-columns: repeat(3, 1fr); } }
.reason-check {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 10px 12px;
  cursor: pointer;
  font-size: 11.5px; font-weight: 500;
  color: var(--text-2);
  transition: all 0.12s;
}
.reason-check:hover { border-color: var(--border-strong); background: var(--hover); }
.reason-check input { display: none; }
.reason-check .check-box {
  width: 14px; height: 14px;
  border-radius: 4px;
  border: 1.5px solid var(--text-3);
  display: grid; place-items: center;
  flex-shrink: 0; background: transparent;
  transition: all 0.12s;
}
.reason-check .check-box svg { width: 9px; height: 9px; opacity: 0; color: #04150c; stroke-width: 3; }
.reason-check.checked {
  border-color: var(--emerald);
  background: var(--brand-bg);
  color: var(--emerald);
  font-weight: 600;
}
.reason-check.checked .check-box {
  background: var(--emerald);
  border-color: var(--emerald);
}
.reason-check.checked .check-box svg { opacity: 1; }

/* ============ ALERTAS ============ */
.notif {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}
.notif:last-child { border-bottom: none; }
.notif:hover { background: var(--hover); }
.notif.unread::before {
  content: ''; position: absolute;
  left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%;
  border-radius: 0 3px 3px 0;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}
.notif-icon {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: var(--brand-bg);
  color: var(--emerald);
  border: 1px solid var(--brand-border);
}
.notif-icon svg { width: 15px; height: 15px; stroke-width: 1.8; }
.notif[data-type="newReport"] .notif-icon { background: var(--sev-crit-bg); border-color: var(--sev-crit-bd); color: var(--sev-crit); }
.notif[data-type="crossMatch"] .notif-icon { background: var(--sev-high-bg); border-color: var(--sev-high-bd); color: var(--sev-high); }
.notif-body { flex: 1; min-width: 0; }
.notif-msg { font-size: 13px; line-height: 1.45; color: var(--text); }
.notif-msg strong { color: var(--emerald); font-weight: 700; }
.notif-date {
  margin-top: 4px; font-size: 10.5px; color: var(--text-3);
  font-family: var(--font-mono); letter-spacing: 0.04em;
}

.notif-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}

/* ============ EMPRESA ============ */
.company-card {
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px;
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 14px;
}
.company-avatar {
  width: 54px; height: 54px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--emerald) 0%, var(--brand-deep) 100%);
  color: #04150c;
  font-weight: 800; font-size: 17px;
  flex-shrink: 0;
  box-shadow:
    0 0 0 1px rgba(0, 230, 118, 0.4),
    0 12px 28px -10px rgba(0, 230, 118, 0.55);
}
.company-info { flex: 1; min-width: 0; }
.company-name { font-size: 16px; font-weight: 800; letter-spacing: -0.025em; color: var(--text); }
.company-meta {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px; color: var(--text-3);
}
.company-meta .verified {
  color: var(--emerald);
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: 6px;
  font-weight: 500;
}
.company-meta .verified svg { width: 11px; height: 11px; }
.company-plan {
  display: inline-flex; margin-top: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--brand-bg); color: var(--emerald);
  font-family: var(--font-mono);
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  border: 1px solid var(--brand-border);
}

/* ============ DASHBOARD ============ */
.dash-kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
@media (min-width: 720px) {
  .dash-kpis { grid-template-columns: repeat(4, 1fr); }
}

.kpi-card {
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.kpi-card::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 100% 0%, rgba(0, 230, 118, 0.06), transparent 60%);
  pointer-events: none;
}
.kpi-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
  position: relative; z-index: 1;
}
.kpi-label {
  font-size: 11px; color: var(--text-3); font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  font-family: var(--font-mono);
}
.kpi-head svg { width: 16px; height: 16px; color: var(--text-3); stroke-width: 1.8; }
.kpi-value {
  font-size: 1.875rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
  position: relative; z-index: 1;
}
.kpi-value small { font-size: 1.125rem; opacity: 0.7; font-weight: 600; margin-left: 1px; }
.kpi-value.crit { color: var(--sev-crit); }
.kpi-value.brand { color: var(--emerald); }
.kpi-trend {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-3);
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono);
  position: relative; z-index: 1;
}
.kpi-trend.up { color: var(--emerald); }
.kpi-trend.muted { color: var(--text-3); }
.kpi-trend svg { width: 11px; height: 11px; stroke-width: 2.5; }

.dash-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 720px) {
  .dash-grid { grid-template-columns: 1fr 1fr; }
}

.dash-card {
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 20px 16px;
  display: flex; flex-direction: column;
}
.dash-card.full { grid-column: 1 / -1; }
.dash-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
  gap: 8px;
}
.dash-card h3 {
  font-size: 14px; font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.dash-card h3 .badge-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--sev-crit); color: #fff;
  font-size: 10px; font-weight: 700;
  font-family: var(--font-mono);
  vertical-align: 1px;
}
.dash-card-meta {
  font-size: 11px; color: var(--text-3);
  font-family: var(--font-mono); letter-spacing: 0.04em;
}
.dash-link {
  font-size: 12px; font-weight: 600;
  color: var(--emerald);
  cursor: pointer;
}
.dash-link:hover { text-decoration: underline; }

/* Bar chart */
.bar-chart {
  display: flex; flex-direction: column;
  gap: 11px;
}
.bar-row {
  display: grid;
  grid-template-columns: 95px 1fr 75px;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
}
.bar-row[data-sev="low"]   .bar-fill { background: var(--sev-low);  box-shadow: 0 0 8px var(--sev-low); }
.bar-row[data-sev="mid"]   .bar-fill { background: var(--sev-mid);  box-shadow: 0 0 8px var(--sev-mid); }
.bar-row[data-sev="high"]  .bar-fill { background: var(--sev-high); box-shadow: 0 0 8px var(--sev-high); }
.bar-row[data-sev="crit"]  .bar-fill { background: var(--sev-crit); box-shadow: 0 0 8px var(--sev-crit); }
.bar-row[data-sev="low"]   .bar-label .dot-sm { background: var(--sev-low); }
.bar-row[data-sev="mid"]   .bar-label .dot-sm { background: var(--sev-mid); }
.bar-row[data-sev="high"]  .bar-label .dot-sm { background: var(--sev-high); }
.bar-row[data-sev="crit"]  .bar-label .dot-sm { background: var(--sev-crit); }
.bar-label {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--text-2); font-weight: 500;
}
.bar-label .dot-sm { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.bar-track {
  height: 6px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--emerald);
  border-radius: inherit;
  min-width: 4px;
  transition: width 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}
.bar-count {
  text-align: right;
  font-size: 12px;
  color: var(--text); font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}
.bar-pct { color: var(--text-3); font-weight: 500; margin-left: 4px; font-size: 10.5px; }

/* Dash list */
.dash-list { display: flex; flex-direction: column; flex: 1; }
.dash-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border-soft);
  cursor: pointer;
  transition: opacity 0.12s;
}
.dash-row:first-child { border-top: none; padding-top: 0; }
.dash-row:last-child { padding-bottom: 0; }
.dash-row:hover { opacity: 0.85; }
.dash-row-icon {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  flex-shrink: 0;
  background: var(--surface-3);
  color: var(--text-3);
  border: 1px solid var(--border);
}
.dash-row[data-type="newReport"] .dash-row-icon { background: var(--sev-crit-bg); color: var(--sev-crit); border-color: var(--sev-crit-bd); }
.dash-row[data-type="crossMatch"] .dash-row-icon { background: var(--sev-high-bg); color: var(--sev-high); border-color: var(--sev-high-bd); }
.dash-row[data-type="systemTip"] .dash-row-icon,
.dash-row[data-type="confirm"]   .dash-row-icon { background: var(--brand-bg); color: var(--emerald); border-color: var(--brand-border); }
.dash-row-icon svg { width: 14px; height: 14px; stroke-width: 2; }
.dash-row-avatar {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-weight: 700; font-size: 10.5px;
  color: var(--emerald);
  flex-shrink: 0;
  position: relative;
}
.dash-row-avatar[data-sev]::before {
  content: '';
  position: absolute;
  bottom: -2px; right: -2px;
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 2px solid var(--surface);
}
.dash-row-avatar[data-sev="low"]::before  { background: var(--sev-low);  box-shadow: 0 0 5px var(--sev-low); }
.dash-row-avatar[data-sev="mid"]::before  { background: var(--sev-mid);  box-shadow: 0 0 5px var(--sev-mid); }
.dash-row-avatar[data-sev="high"]::before { background: var(--sev-high); box-shadow: 0 0 5px var(--sev-high); }
.dash-row-avatar[data-sev="crit"]::before { background: var(--sev-crit); box-shadow: 0 0 5px var(--sev-crit); }
.dash-row-body { flex: 1; min-width: 0; }
.dash-row-msg {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-row-msg strong { font-weight: 700; }
.dash-row-date {
  font-size: 10.5px;
  color: var(--text-3);
  margin-top: 2px;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.row-sev.mini {
  font-size: 9.5px;
  padding: 1px 7px 1px 5px;
  flex-shrink: 0;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.row-sev.mini .dot-sm { width: 5px; height: 5px; }

.dash-empty {
  display: flex; flex-direction: column; align-items: center;
  padding: 22px 16px 8px;
  text-align: center;
  color: var(--text-3);
  flex: 1;
  justify-content: center;
}
.dash-empty svg { width: 28px; height: 28px; opacity: 0.4; color: var(--text-4); margin-bottom: 8px; }
.dash-empty p { font-size: 12px; margin: 0; line-height: 1.5; max-width: 32ch; }
.dash-empty p strong { color: var(--emerald); }

.section-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 22px 0 10px;
}

/* Animaciones */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%   { transform: scale(0.9); opacity: 0.7; }
  70%  { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ============================================================
   MOBILE APP POLISH (≤ 1023px)
   Refuerza la sensación de app: safe areas, touch targets ≥44px,
   tipografías ajustadas, navs y sheets nativas.
   ============================================================ */
@media (max-width: 1023px) {

  /* Container con padding lateral cómodo */
  .container { padding: 0 14px; }
  .view { padding: 16px 0 24px; }

  /* Topnav: solo logo + acciones, sin links centrales */
  .topnav-links { display: none !important; }
  .brand-name { font-size: 14.5px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 8px; }
  .brand-mark svg { width: 15px; height: 15px; }

  /* User pill: solo avatar (info y dropdown info se ven al abrir) */
  .user-pill { padding: 4px; gap: 0; border-radius: 999px; }
  .user-pill .info { display: none; }
  .user-pill .av { width: 30px; height: 30px; font-size: 11.5px; }
  .icon-btn { width: 36px; height: 36px; }
  .topnav-end { gap: 6px; }

  /* User menu posición desde la derecha */
  .user-menu {
    right: 0;
    min-width: min(280px, calc(100vw - 28px));
  }

  /* Page head: stack y h1 más compacto. Esconde botón "+ Reportar" del page-head
     porque ya hay CTA en el bottom nav */
  .page-head {
    margin-bottom: 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .page-head h1 {
    font-size: 1.45rem;
    letter-spacing: -0.03em;
  }
  .page-head .desc { margin-top: 4px; font-size: 13px; line-height: 1.5; }
  .page-head .actions { display: none; }
  /* Excepción: en alertas dejamos el botón "marcar todo leído" porque es útil */
  .page-head .actions:has(#markAll) { display: flex; }

  /* Stats bar: scroll horizontal cómodo */
  .stats-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 11px 14px;
    gap: 14px;
    -webkit-overflow-scrolling: touch;
    margin-left: -14px;
    margin-right: -14px;
    border-radius: 0;
    border-left: none; border-right: none;
  }
  .stats-bar::-webkit-scrollbar { display: none; }
  .stats-bar .stat { flex-shrink: 0; }
  .stats-bar .sep { flex-shrink: 0; }

  /* KPIs: 2x2 con respiración */
  .dash-kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-card { padding: 14px 14px; }
  .kpi-value { font-size: 1.6rem; }
  .kpi-label { font-size: 10px; letter-spacing: 0.05em; }

  /* Dash grid: 1 col, full width edge-to-edge feeling */
  .dash-grid { gap: 8px; }
  .dash-card { padding: 14px 14px 12px; border-radius: var(--r-md); }
  .dash-card h3 { font-size: 13px; }

  /* Toolbar móvil: search en línea propia, selects abajo */
  .toolbar { gap: 8px; }
  .toolbar .search { flex: 1 1 100%; min-width: 0; }
  .toolbar .search input { height: 42px; font-size: 15px; padding-left: 38px; }
  .toolbar .search svg.icon-left { width: 16px; height: 16px; }
  .toolbar select { flex: 1 1 calc(50% - 4px); min-width: 0; height: 42px; font-size: 14px; }

  /* Sev toggle: scroll horizontal sin distinción */
  .sev-toggle {
    border-radius: 999px;
    padding: 3px;
  }
  .sev-toggle button {
    min-height: 30px;
    padding: 6px 11px;
    font-size: 12.5px;
  }

  /* Filas con touch target generoso */
  .row { padding: 13px 12px; gap: 11px; min-height: 60px; }
  .row-avatar { width: 38px; height: 38px; }
  .row-name { font-size: 14.5px; }

  /* Bottom nav: safe area + más cómodo */
  .mobile-bottomnav {
    padding-top: 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .nav-tab { min-height: 48px; }
  .nav-cta-bubble {
    width: 48px; height: 48px;
    margin-top: -12px;
  }
  .nav-cta-bubble svg { width: 24px; height: 24px; }
  .app { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }

  /* Sheet: drag handle más prominente, max 92dvh */
  .sheet {
    max-height: 92vh;
    max-height: 92dvh;
    border-top-left-radius: 22px;
    border-top-right-radius: 22px;
  }
  .sheet-handle {
    width: 44px; height: 5px;
    margin: 8px auto 6px;
    background: var(--border-strong);
  }
  .sheet-content { padding: 4px 18px 18px; }
  .sheet-hero { padding: 6px 0 14px; gap: 12px; }
  .sheet-avatar { width: 50px; height: 50px; font-size: 16px; }
  .sheet-name { font-size: 16.5px; }
  .sheet-actions { gap: 8px; margin-top: 18px; }

  /* Toast respeta safe area */
  .toast {
    top: calc(12px + env(safe-area-inset-top, 0px));
    font-size: 12.5px;
  }

  /* Forms: touch targets cómodos */
  input, select, textarea { font-size: 16px; padding: 11px 13px; }
  /* iOS no hace zoom si el input tiene >= 16px */
  .field label { font-size: 11.5px; }
  .form-card { padding: 16px 14px; border-radius: var(--r-md); }

  .severity-picker { gap: 6px; }
  .sev-opt { padding: 12px 6px; font-size: 11.5px; min-height: 56px; }
  .sev-opt .pill { width: 9px; height: 9px; margin-bottom: 5px; }

  .reasons-grid { gap: 6px; }
  .reason-check {
    padding: 11px 12px;
    font-size: 12px;
    min-height: 42px;
  }

  /* Botones más altos para tocar bien */
  .btn { height: 42px; padding: 10px 16px; font-size: 13.5px; }
  .btn-sm { height: 36px; }
  .btn-lg { height: 46px; font-size: 14px; }

  /* Login en móvil */
  .login-shell { grid-template-columns: 1fr; }
  .login-main { padding: max(20px, env(safe-area-inset-top, 20px)) 16px max(20px, env(safe-area-inset-bottom, 20px)); align-items: flex-start; padding-top: 32px; }
  .login-card { padding: 26px 22px 22px; max-width: 100%; }
  .login-card h1 { font-size: 1.4rem; }

  /* Cuando no hay sesión, no hay bottom nav, usa altura completa */
  .login-shell + .toast { top: 12px; }

  /* Notif: full width */
  .notif { padding: 12px 14px; }
  .notif-msg { font-size: 13px; }

  /* Empresa */
  .company-card { padding: 16px; gap: 12px; }
  .company-avatar { width: 48px; height: 48px; font-size: 15px; }
  .company-name { font-size: 15px; }

  /* Dashboard: reducir saludo cuando es muy largo */
  .page-head h1 { line-height: 1.15; }
}

/* Pantallas muy pequeñas (≤ 380px) */
@media (max-width: 380px) {
  .severity-picker { grid-template-columns: 1fr 1fr; }
  .reasons-grid { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 1.4rem; }
  .dash-kpis { gap: 6px; }
  .kpi-card { padding: 12px 12px; }
  .row-avatar { width: 36px; height: 36px; font-size: 11px; }
  .nav-tab .label { font-size: 9.5px; }
  .stats-bar .stat .n { font-size: 14px; }
  .nav-cta-bubble { width: 44px; height: 44px; }
  .nav-cta-bubble svg { width: 22px; height: 22px; }
}

/* iOS PWA standalone: más respiración bajo el notch */
@media all and (display-mode: standalone) {
  .topnav { background: rgba(6, 11, 8, 0.95); }
}

/* ============================================================
   MOBILE OVERFLOW FIX (≤ 720px)
   Garantiza que los widgets del dashboard no se salgan.
   Aplica min-width:0 a los grid/flex children y compacta el
   bar-chart y las dash-rows en pantallas estrechas.
   ============================================================ */
@media (max-width: 720px) {

  /* min-width:0 imprescindible para que ellipsis funcione dentro de flex/grid */
  .dash-grid > * { min-width: 0; }
  .dash-card    { min-width: 0; overflow: hidden; }
  .dash-list    { min-width: 0; }
  .bar-chart    { min-width: 0; }
  .dash-row     { min-width: 0; }
  .dash-row-body{ min-width: 0; flex: 1 1 0%; }

  /* Bar chart en móvil: columnas adaptativas, labels más pequeños */
  .bar-row {
    grid-template-columns: minmax(0, 32%) minmax(0, 1fr) minmax(0, max-content);
    gap: 8px;
    font-size: 12px;
  }
  .bar-label {
    font-size: 12px;
    gap: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }
  .bar-label .dot-sm { width: 6px; height: 6px; flex-shrink: 0; }
  .bar-count { font-size: 11.5px; white-space: nowrap; }
  .bar-pct { font-size: 10px; margin-left: 3px; }

  /* Dash rows: ellipsis en mensaje y fecha, badge severidad pequeño */
  .dash-row { gap: 8px; align-items: center; }
  .dash-row-msg {
    font-size: 12.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .dash-row-date {
    font-size: 10.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .row-sev.mini {
    font-size: 9px;
    padding: 2px 6px 2px 5px;
    letter-spacing: 0.04em;
    flex-shrink: 0;
  }
  .row-sev.mini .dot-sm { width: 4px; height: 4px; }
  .dash-row-icon { width: 28px; height: 28px; flex-shrink: 0; }
  .dash-row-icon svg { width: 13px; height: 13px; }
  .dash-row-avatar { width: 28px; height: 28px; font-size: 10px; flex-shrink: 0; }

  /* Card head: el título trunca y el link "Ver todas →" se mantiene */
  .dash-card-head { gap: 8px; flex-wrap: nowrap; }
  .dash-card h3 {
    font-size: 13px;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .dash-card h3 .badge-num { flex-shrink: 0; }
  .dash-card-head .dash-link,
  .dash-card-head .dash-card-meta {
    flex-shrink: 0;
    font-size: 11px;
  }

  /* Padding interno reducido en móvil para más respiración */
  .dash-card { padding: 14px 14px 12px; }

  /* Empty state dentro de dash-card */
  .dash-empty p { font-size: 11.5px; }
}
