  :root {
    --bg: #0e1315;
    --surface: #161d20;
    --surface-raised: #1c2427;
    --border: #29343a;
    --border-soft: #202a2f;
    --text: #e7edee;
    --text-dim: #8fa1a3;
    --text-faint: #5c6d6f;
    --accent: #57c2b7;
    --accent-strong: #7fd8cd;
    --accent-soft: rgba(87, 194, 183, 0.13);
    --accent-border: rgba(87, 194, 183, 0.35);
    --ok: #6bc084;
    --ok-soft: rgba(107, 192, 132, 0.13);
    --warn: #dba94a;
    --warn-soft: rgba(219, 169, 74, 0.13);
    --danger: #dd6f6a;
    --danger-soft: rgba(221, 111, 106, 0.13);
    --shadow: 0 20px 44px -20px rgba(0, 0, 0, 0.55);
  }

  :root[data-theme="light"] {
    --bg: #f2f5f4;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --border: #d7e0de;
    --border-soft: #e4ecea;
    --text: #16201f;
    --text-dim: #55696a;
    --text-faint: #8b9c9c;
    --accent: #17847a;
    --accent-strong: #106861;
    --accent-soft: rgba(23, 132, 122, 0.09);
    --accent-border: rgba(23, 132, 122, 0.3);
    --ok: #2f8f52;
    --ok-soft: rgba(47, 143, 82, 0.1);
    --warn: #a5730e;
    --warn-soft: rgba(165, 115, 14, 0.1);
    --danger: #b7443f;
    --danger-soft: rgba(183, 68, 63, 0.09);
    --shadow: 0 20px 44px -24px rgba(20, 40, 38, 0.25);
  }

  @media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
      --bg: #f2f5f4;
      --surface: #ffffff;
      --surface-raised: #ffffff;
      --border: #d7e0de;
      --border-soft: #e4ecea;
      --text: #16201f;
      --text-dim: #55696a;
      --text-faint: #8b9c9c;
      --accent: #17847a;
      --accent-strong: #106861;
      --accent-soft: rgba(23, 132, 122, 0.09);
      --accent-border: rgba(23, 132, 122, 0.3);
      --ok: #2f8f52;
      --ok-soft: rgba(47, 143, 82, 0.1);
      --warn: #a5730e;
      --warn-soft: rgba(165, 115, 14, 0.1);
      --danger: #b7443f;
      --danger-soft: rgba(183, 68, 63, 0.09);
      --shadow: 0 20px 44px -24px rgba(20, 40, 38, 0.25);
    }
  }

  * { box-sizing: border-box; }

  /* Scrollbar delgado y de la paleta del tema — el default del navegador
     desentona con un panel oscuro (Firefox: scrollbar-width/color; Chrome/
     Safari/Edge: pseudo-elementos ::-webkit-scrollbar). Aplicado a cualquier
     contenedor con scroll propio (.main-area, .sidebar, listas internas). */
  .main-area, .sidebar, #actividad-lista, #reportes-individuo {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }

  .main-area::-webkit-scrollbar,
  .sidebar::-webkit-scrollbar,
  #actividad-lista::-webkit-scrollbar,
  #reportes-individuo::-webkit-scrollbar {
    width: 8px;
  }

  .main-area::-webkit-scrollbar-track,
  .sidebar::-webkit-scrollbar-track,
  #actividad-lista::-webkit-scrollbar-track,
  #reportes-individuo::-webkit-scrollbar-track {
    background: transparent;
  }

  .main-area::-webkit-scrollbar-thumb,
  .sidebar::-webkit-scrollbar-thumb,
  #actividad-lista::-webkit-scrollbar-thumb,
  #reportes-individuo::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 8px;
  }

  .main-area::-webkit-scrollbar-thumb:hover,
  .sidebar::-webkit-scrollbar-thumb:hover,
  #actividad-lista::-webkit-scrollbar-thumb:hover,
  #reportes-individuo::-webkit-scrollbar-thumb:hover {
    background: var(--text-faint);
  }

  html, body {
    height: 100%;
  }

  body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, "Segoe UI", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }

  .mono {
    font-family: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
    font-variant-numeric: tabular-nums;
  }

  a { color: inherit; }

  /* Shell fijo (P204/Fase4, pedido del Operador): antes .app-shell usaba
     min-height y toda la página scrolleaba junta — la sidebar terminaba más
     alta que la pantalla y se perdía contenido abajo sin forma clara de
     saberlo. Ahora la sidebar queda pinneada a 100vh y solo .main-area
     scrollea — patrón estándar de "shell fijo + contenido scrolleable".
     Sidebar y contenido son paneles FLOTANTES separados del fondo (.app-shell
     hace de "fondo", con su propio padding/gap) — no franjas pegadas borde a
     borde, patrón de dashboards reales investigado (bento/floating panels). */
  .app-shell {
    display: flex;
    height: 100vh;
    align-items: stretch;
    overflow: hidden;
    background: var(--bg);
    padding: 16px;
    gap: 16px;
  }

  .sidebar {
    width: 208px;
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    padding: 20px 12px;
    overflow-y: auto;
    transition: width 0.16s ease;
  }

  .sidebar.collapsed { width: 60px; }

  .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 26px;
    padding: 0 6px;
    min-height: 24px;
  }

  .sidebar.collapsed .sidebar-header { justify-content: center; }
  .sidebar.collapsed .sidebar-header .brand-block { display: none; }

  .sidebar-toggle-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 15px;
    padding: 5px 7px;
    border-radius: 7px;
    line-height: 1;
  }

  .sidebar-toggle-btn:hover { background: var(--bg); color: var(--text); }

  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }

  /* Versión visible bajo el brand mark, no al pie (P204/Fase4) — este layout no
     tiene sidebar fijo (la página entera scrollea junta, .app-shell usa
     min-height, no height), así que "pegado al fondo" vía margin-top:auto
     terminaba en el fondo del CONTENIDO total, invisible sin scrollear todo. */
  .version-tag {
    font-size: 10.5px;
    color: var(--text-faint);
  }

  .nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 11px;
    border-radius: 9px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    white-space: nowrap;
    overflow: hidden;
  }

  .nav-item .nav-icon { font-size: 16px; flex-shrink: 0; }
  .sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }
  .sidebar.collapsed .nav-label { display: none; }

  .nav-item[aria-current="page"] {
    background: var(--accent-soft);
    color: var(--accent-strong);
  }

  .nav-item:not([aria-current="page"]):hover {
    background: var(--bg);
    color: var(--text);
  }

  /* padding-bottom era 80px — sobraba de cuando la página scrolleaba completa
     (daba aire al final); con shell fijo eso solo resta espacio real y
     provoca overflow innecesario. Sin max-width — el ancho fijo (980px) no
     tenía motivo real más que "se veía prolijo" (corregido, Operador): con
     más pantalla disponible hay lugar para más paneles por fila sin
     scrollear (ver .dash-panels, auto-fit). Sin height explícito — el
     align-items:stretch de .app-shell (default de flex) ya le da la altura
     correcta, no hace falta duplicarla. */
  .main-area {
    flex: 1;
    min-width: 0;
    padding: 28px 24px;
    overflow-y: auto;
  }

  .section { display: none; }
  .section.active { display: block; }

  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 26px;
  }

  .page-title {
    font-size: 19px;
    font-weight: 700;
    margin: 0;
  }

  .brand {
    display: flex;
    align-items: baseline;
    gap: 10px;
  }

  .brand-mark {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 0.01em;
  }

  .brand-sub {
    font-size: 12.5px;
    color: var(--text-faint);
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
  }

  .node-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12.5px;
    color: var(--text-dim);
    background: var(--surface);
  }

  .node-pill .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 0 3px var(--ok-soft);
  }

  .node-pill.error .dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

  .tabs {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    margin-bottom: 22px;
  }

  .tab {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-size: 13.5px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, color 0.15s ease;
  }

  .tab[aria-selected="true"] {
    background: var(--accent-soft);
    color: var(--accent-strong);
  }

  .tab:not([aria-selected="true"]):hover {
    color: var(--text);
  }

  /* Dashboard (P204/Fase4, rediseñado 2 veces con referencia a patrones
     reales de dashboards — barra de métricas full-width primero, después
     una grilla de tarjetas PAREJAS). auto-fit + minmax en vez de un número
     fijo de columnas (corregido, Operador: "no me gusta lo fijo/rígido") —
     el navegador acomoda tantas tarjetas por fila como el ancho disponible
     permita, sin depender de breakpoints a mano ni de un max-width fijo en
     .main-area. Con las 4 tarjetas actuales, en una pantalla de escritorio
     normal entran las 4 en una sola fila; en una más angosta, el mismo grid
     las acomoda en 2 filas de 2, sin JS ni media query dedicada. */
  .dash-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
  }

  .panel-tall {
    max-height: 360px;
    display: flex;
    flex-direction: column;
  }

  .panel-tall #actividad-lista,
  .panel-tall #reportes-individuo {
    overflow-y: auto;
    flex: 1;
  }

  .stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
  }

  .stat {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 12px;
    padding: 14px 16px;
  }

  .stat-label {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    margin-bottom: 6px;
  }

  .stat-value {
    font-size: 22px;
    font-weight: 700;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
  }

  .stat-value.warn { color: var(--warn); }
  .stat-value.info { color: var(--accent); }

  /* P204/Fase4 — gauges, gráfico de barras y actividad reciente del Dashboard */
  .panel {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 12px;
    padding: 14px 16px;
  }

  .panel-title {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    margin-bottom: 14px;
  }

  .gauge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
  }

  .gauge {
    width: 120px;
    text-align: center;
  }

  .gauge svg { width: 100%; height: auto; }

  .gauge-bg {
    fill: none;
    stroke: var(--border-soft);
    stroke-width: 10;
  }

  .gauge-fg {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.4s ease;
  }

  .gauge-pct {
    font-size: 20px;
    font-weight: 700;
    text-anchor: middle;
    fill: var(--text);
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
  }

  .gauge-sub {
    font-size: 10px;
    text-anchor: middle;
    fill: var(--text-dim);
  }

  .gauge-label {
    margin-top: 2px;
    font-size: 13px;
    color: var(--text-dim);
  }

  .bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 76px;
  }

  .bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
  }

  .bar {
    width: 100%;
    max-width: 28px;
    background: var(--accent);
    border-radius: 3px 3px 0 0;
  }

  .bar-label {
    font-size: 10px;
    color: var(--text-faint);
    margin-top: 6px;
  }

  .activity-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 8px 0;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13px;
  }

  .activity-row:last-child { border-bottom: none; }

  .activity-text {
    flex: 1;
    color: var(--text-dim);
  }

  .activity-text b { color: var(--text); font-weight: 600; }

  .report-row {
    display: grid;
    grid-template-columns: 100px 1fr 32px;
    align-items: center;
    gap: 12px;
    padding: 7px 0;
  }

  .report-label {
    font-size: 12.5px;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .report-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--border-soft);
  }

  .report-seg.ok { background: var(--ok); }
  .report-seg.warn { background: var(--warn); }

  .report-count {
    font-size: 12.5px;
    color: var(--text-faint);
    text-align: right;
  }

  .notice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border: 1px solid var(--accent-border);
    background: var(--accent-soft);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 22px;
  }

  .notice.error {
    display: none;
    border-color: var(--danger);
    background: var(--danger-soft);
  }

  .notice.error.visible {
    display: flex;
  }

  .notice strong { color: var(--text); }

  .group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    margin: 22px 0 10px;
  }

  .group-title .line {
    flex: 1;
    height: 1px;
    background: var(--border-soft);
  }

  .card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .key-card {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 12px;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 1.2fr 1fr 0.9fr 1.2fr auto;
    gap: 14px;
    align-items: center;
  }

  .card-icon-actions {
    display: flex;
    gap: 6px;
    justify-self: end;
  }

  .icon-btn {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
  }

  .icon-btn:hover { color: var(--text); border-color: var(--text-faint); }
  .icon-btn.danger { color: var(--danger); }
  .icon-btn.danger:hover { border-color: var(--danger); background: var(--danger-soft); }
  .icon-btn.primary { color: var(--accent-strong); border-color: var(--accent-border); }
  .icon-btn.primary:hover { background: var(--accent-soft); }

  /* Ficha inline de alta genérica — reusada por APIs (keys) y Nodos
     (consumidores, P201/Fase3): un "+" arriba de la lista despliega un
     formulario con el mismo estilo visual que las fichas ya cargadas. */
  .add-trigger {
    appearance: none;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px dashed var(--border);
    background: transparent;
    color: var(--text-dim);
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 14px;
  }

  .add-trigger:hover {
    border-color: var(--accent-border);
    color: var(--accent-strong);
    background: var(--accent-soft);
  }

  .add-plus {
    font-size: 16px;
    line-height: 1;
  }

  /* Especificidad "div.inline-add-form" a propósito: gana el empate con
     .key-card/.consumidor-card (misma especificidad de clase única) sin
     depender del orden de aparición en la hoja de estilos. */
  div.inline-add-form {
    display: none;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
    border-color: var(--accent-border);
  }

  div.inline-add-form.visible { display: flex; }

  .inline-add-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
  }

  .inline-add-field label {
    display: block;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    margin-bottom: 5px;
  }

  .inline-add-field input, .inline-add-field select {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 13.5px;
    font-family: inherit;
  }

  .inline-add-field.secret-field { position: relative; }
  .inline-add-field.secret-field input { padding-right: 62px; }

  .inline-add-field .secret-toggle {
    position: absolute;
    right: 6px;
    top: 28px;
    background: none;
    border: none;
    color: var(--text-faint);
    font-size: 11.5px;
    cursor: pointer;
    padding: 4px 6px;
  }

  .inline-add-field.has-error input { border-color: var(--danger); }

  .inline-add-hint {
    font-size: 11.5px;
    color: var(--text-faint);
    margin: 0;
  }

  @media (max-width: 640px) {
    .inline-add-row { grid-template-columns: 1fr 1fr; }
  }

  .key-card.is-new {
    animation: pop 1.2s ease;
    border-color: var(--accent-border);
  }

  @keyframes pop {
    0% { background: var(--accent-soft); }
    100% { background: var(--surface); }
  }

  .field-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    margin-bottom: 3px;
  }

  .id-block .id {
    font-weight: 600;
    font-size: 14.5px;
  }

  .id-block .provider {
    color: var(--text-dim);
    font-size: 12.5px;
  }

  .owner {
    font-size: 13.5px;
    color: var(--text);
    font-weight: 600;
  }

  .owner.unassigned {
    color: var(--text-faint);
    font-weight: 400;
    font-style: italic;
  }

  .pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    width: fit-content;
  }

  .pill .dot { width: 6px; height: 6px; border-radius: 50%; }

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

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

  .pill.info { background: var(--accent-soft); color: var(--accent); }
  .pill.info .dot { background: var(--accent); }

  .timing {
    font-size: 12.5px;
    color: var(--text-dim);
  }

  .timing .value { color: var(--text); }

  .timing-sub {
    font-size: 11.5px;
    color: var(--text-faint);
    margin-top: 3px;
  }

  .key-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    padding-top: 12px;
    margin-top: 2px;
    border-top: 1px solid var(--border-soft);
  }

  .action-btn {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: 7px;
    cursor: pointer;
    font-family: inherit;
  }

  .action-btn:hover { color: var(--text); border-color: var(--text-faint); }
  .action-btn.danger { color: var(--danger); }
  .action-btn.danger:hover { border-color: var(--danger); background: var(--danger-soft); }
  .action-btn.confirm { color: #08211e; background: var(--danger); border-color: var(--danger); }
  .action-btn.primary { color: var(--accent-strong); border-color: var(--accent-border); }

  .edit-panel {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    padding-top: 12px;
    margin-top: 2px;
    border-top: 1px solid var(--border-soft);
    flex-wrap: wrap;
  }

  .edit-panel .ep-field { display: flex; flex-direction: column; gap: 4px; }
  .edit-panel label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
  .edit-panel input, .edit-panel select {
    padding: 6px 9px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
  }

  .pill.inactive { background: var(--border-soft); color: var(--text-faint); }
  .pill.inactive .dot { background: var(--text-faint); }

  .empty-state {
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 34px 18px;
    text-align: center;
    color: var(--text-faint);
    font-size: 13.5px;
  }

  .token-banner .token-value {
    display: inline-block;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 6px 10px;
    margin: 6px 8px 6px 0;
    font-size: 13px;
    word-break: break-all;
  }

  .consumidor-card {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
    flex-wrap: wrap;
  }

  .consumidor-info .id { font-weight: 600; font-size: 14.5px; }
  .consumidor-info .meta { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }

  /* Check-in proactivo (P216/Fase4) — badge de estado real, segunda línea de la card */
  .badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--border-soft);
    color: var(--text-faint);
  }
  .badge.success { background: var(--ok-soft); color: var(--ok); }
  .badge.warning { background: var(--warn-soft); color: var(--warn); }
  .badge.stale { background: var(--danger-soft); color: var(--danger); }

  .secret-toggle {
    position: absolute;
    right: 8px;
    top: 32px;
    background: none;
    border: none;
    color: var(--text-faint);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 6px;
  }

  .secret-toggle:hover { color: var(--text-dim); }

  .hint-conditional {
    display: none;
    color: var(--danger);
  }

  .hint-conditional.visible {
    display: block;
  }

  .confirm-banner, .error-banner {
    display: none;
    align-items: flex-start;
    gap: 10px;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 18px;
    font-size: 13.5px;
  }

  .confirm-banner {
    border: 1px solid var(--ok);
    background: var(--ok-soft);
  }

  .error-banner {
    border: 1px solid var(--danger);
    background: var(--danger-soft);
  }

  .confirm-banner.visible, .error-banner.visible { display: flex; }

  .confirm-banner .title { font-weight: 700; color: var(--ok); display: block; margin-bottom: 3px; }
  .error-banner .title { font-weight: 700; color: var(--danger); display: block; margin-bottom: 3px; }
  .confirm-banner .body, .error-banner .body { color: var(--text-dim); }

  .view { display: none; }
  .view.active { display: block; }

  @media (max-width: 640px) {
    .key-card { grid-template-columns: 1fr 1fr; row-gap: 10px; }
    .panel-tall { max-height: none; }
  }

  @media (prefers-reduced-motion: reduce) {
    .key-card.is-new { animation: none; }
  }

  .modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 9, 0.6);
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
  }

  .modal-backdrop.visible { display: flex; }

  .modal {
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 26px;
    max-width: 360px;
    width: 100%;
    box-shadow: var(--shadow);
    text-align: center;
  }

  .modal-icon { font-size: 30px; margin-bottom: 10px; }
  .modal h3 { margin: 0 0 8px; font-size: 16px; }
  .modal-body { color: var(--text-dim); font-size: 13.5px; margin: 0 0 18px; line-height: 1.5; }
  .modal-body b { color: var(--text); }

  .modal-field { text-align: left; margin-bottom: 18px; }
  .modal-field label {
    display: block;
    font-size: 11.5px;
    color: var(--text-faint);
    margin-bottom: 6px;
  }
  .modal-field input {
    width: 100%;
    padding: 9px 11px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
  }
  .modal-field input:focus {
    outline: none;
    border-color: var(--danger);
    box-shadow: 0 0 0 3px var(--danger-soft);
  }

  .modal-actions { display: flex; gap: 10px; justify-content: center; }
  .modal-actions .action-btn { padding: 8px 16px; font-size: 13px; }
  .modal-actions .action-btn.confirm:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--border);
    border-color: var(--border);
    color: var(--text-faint);
  }
