/* Multiusuario: login, usuario en cabecera y panel Compartir (SPEC B3, B6, B21) */

.login-card form,
.members-form { display:grid; gap:6px var(--ctl-gap); }
/* Grid forms space label and field with the row gap: 6px, as in every other form. */

.login-card h1 { margin:0 0 16px; }
.login-error {
  margin:0 0 12px;
  padding:10px 12px;
  border:1px solid var(--danger);
  border-radius:var(--radius);
  color:var(--color-red-350);
  background:var(--color-red-50);
}

.members-main { display:grid; gap:16px; }

/* ===== UI audit 2026-11-12 (docs/AUDITORIA_UI.md): spacing scale 4/8/12/16/24, controls 28-32px ===== */

/* IDE header: one compact row; the title keeps one line (full name in its title attribute). */

/* Back to the project list: icon beside the title (replaces the «← Proyectos» header button). */

.project-back {
  flex:0 0 auto; display:inline-flex; align-items:center; justify-content:center;
  width:var(--ctl-h-sm); height:var(--ctl-h-sm); border:1px solid var(--line); border-radius:var(--radius-sm);
  color:var(--muted); background:var(--surface); transition:color .15s, background .15s, border-color .15s;
}
.project-back:hover { color:var(--primary-dark); background:var(--ctl-hover-bg); border-color:var(--primary); }
.project-back:focus-visible { outline:none; box-shadow:var(--focus-ring); }
/* The project's place in the home tree, one quiet line above its name; long node names shorten first. */
.project-heading { display:grid; min-width:0; }
.project-route { min-width:0; font-size:var(--text-13); line-height:18px; color:var(--muted); }
 /* line up with the rename button's text */
.project-route ol { display:flex; align-items:center; min-width:0; margin:0; padding:0; list-style:none; }
.project-route li { display:flex; align-items:center; flex:0 1 auto; min-width:0; white-space:nowrap; }
.project-route li:first-child { flex-shrink:0; }
.project-route li > * { min-width:0; overflow:hidden; text-overflow:ellipsis; }
.project-route li:last-child { color:var(--ink); }
.project-route li + li::before {
  content:""; flex:0 0 auto; width:12px; height:12px; margin:0 4px; background:var(--muted); opacity:.7;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6 3.5 10.5 8 6 12.5' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.project-route a { color:inherit; text-decoration:none; border-radius:var(--radius-sm); }
.project-route a:hover { color:var(--primary-dark); text-decoration:underline; text-underline-offset:3px; }
.project-route a:focus-visible { outline:none; box-shadow:var(--focus-ring); }

/* Owners click the project title to rename it; it keeps the h1's look and ellipsis. */

 /* inset: the h1 clips overflow */

/* Signed-in user: its own group, separated from the page actions. */

/* File tree: 28px rows whose whole height is clickable. */

.tree-list--dark { gap:2px; }
.tree-menu-trigger { width:24px; height:24px; }

/* Explorer view tabs: wrap in rows instead of a 2-column grid with an orphan. */

/* Editor toolbar: selects lose the form-field bottom margin that lifted them 6px above the buttons. */

/* PDF viewer toolbar: 28px controls, one shared height, a little more air. */

.pdf-viewer__toolbar input:not([type="checkbox"]) {
  min-height:28px; min-width:28px; display:inline-flex; align-items:center; justify-content:center; margin:0;
}

/* Index: AA contrast for the destructive action and the counters. */

/* Compile panel: the compile action leads; engine, mode and flags live in "Opciones avanzadas". */
.compile-advanced { margin:4px 0 12px; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); }
.compile-advanced > summary { padding:8px 12px; color:var(--muted); font-size:var(--text-12); font-weight:600; cursor:pointer; }
.compile-advanced > summary:hover { color:var(--ink); }
.compile-advanced[open] { padding:0 12px 12px; }
.compile-advanced[open] > summary { margin:0 -12px 8px; border-bottom:1px solid var(--line); }

/* Explorer footer: "Crear archivo" / "Subir recurso" as compact rows so the tree keeps the height. */

.mini-section--dark[open] { padding-bottom:10px; }
.mini-section--dark form { margin:4px 12px 0; }

/* ===== Home (2026-11-13): projects reach the first screen, counters share one right edge, search ===== */

/* "Nuevo proyecto": compact cards; the create form is one row (name + button). */

/* Field row (opt-in): label on top, then the field and its action on one line. */

.home-section { margin-bottom:32px; }

/* Toolbar: the search leads; "Nuevo nodo" stays on the right. */
 /* search, view switch, «Paneles» and actions wrap before overflowing */
.project-tree-toolbar__search { flex:1 1 280px; min-width:0; display:grid; gap:6px; }
.project-filter { width:100%; max-width:420px; margin:0; padding:8px 12px; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); color:var(--ink); font-size:var(--text-14); }
.project-filter:focus-visible { outline:2px solid var(--primary); outline-offset:1px; border-color:var(--primary); }

.project-tree [hidden] { display:none!important; }

/* One counter column: the badge is always the last item, so every count ends on the same edge. */
.project-tree__summary > .project-table__badge,
.project-tree__project > .project-table__badge { order:10; min-width:92px; text-align:center; }

/* Denser project rows. */
.project-tree__project.project-table__row { padding-block:10px; gap:12px; }

/* Create, import and (admin) new node: the tree is where projects start. */
.project-tree-toolbar__actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:var(--ctl-gap); flex-shrink:0; }

@media (max-width: 640px) {


  .project-tree-toolbar__actions > * { flex:1 1 auto; justify-content:center; }
}

/* ===== Unificación de controles 2026-11-13 (docs/AUDITORIA_UI.md): páginas claras, cabeceras y diálogos ===== */
/* Area A: light pages (index, login, 404, Compartir, Dependencias), headers, user nav and dialogs.
   Spec: docs/AUDITORIA_UI.md, "Unificación de controles". Variants: secondary (default), primary, danger. */

/* ── Buttons: one shape. Secondary is the default; heights 34 (normal), 40 (form action), 28 (dense rows). ── */
.nav-action {
  box-sizing:border-box;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  width:auto;
  height:var(--ctl-h);
  min-height:var(--ctl-h);
  margin:0;

  white-space:nowrap;

  transform:none;

}

.nav-action:hover {

  transform:none;
}

/* Primary: the one main action of a header, form or dialog. */

/* Danger: outlined red; a filled red only on the button that confirms a deletion. */

/* Sizes */
.nav-action--lg { height:var(--ctl-h-lg); min-height:var(--ctl-h-lg);  } /* secondary action of a form */

/* Header nav: the layout <select> keeps its native arrow but takes the button box. */
select.nav-action {
  width:auto;

}

/* IDE header: same buttons, a little tighter so long project names keep their room. */

/* Chips (installable package shortcuts) are the only pill-shaped controls. */

/* Icon-only delete in a project row: ghost, 28px, red only on hover. */

/* Rename sits beside delete with the same ghost look; hover is neutral, not red. */

/* Home tree of any depth: each level indents 22px; a node's projects line up under its label. */

.project-tree__node > .project-tree__projects { margin-left:calc(34px + (var(--depth, 1) - 1) * 22px); }
.project-tree__node > .project-tree__empty-branch { padding-left:calc(42px + var(--depth, 0) * 22px); }

/* Right-click menu of the home tree (light; the IDE's dark menus are .tree-menu-*). */
.context-menu {
  position:fixed;
  z-index:var(--z-dropdown);
  min-width:200px;
  max-width:min(280px, calc(100vw - 16px));
  padding:4px;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:0 12px 32px var(--alpha-shadow-16), 0 2px 6px var(--alpha-shadow-8);
  animation:context-menu-in .12s ease-out;
}
@keyframes context-menu-in { from { opacity: 0; transform: translateY(-2px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .context-menu { animation:none; } }

.context-menu__hint { font-size:var(--ctl-fs-sm); color:var(--muted); font-weight:400; }
.context-menu__separator { height:1px; margin:4px 6px; background:var(--line); }

/* Home: Árbol / Columnas switch (project-tree.js); the chosen view renders in .tree-view-host. */
.tree-view-switch {
  display:inline-flex;
  flex-shrink:0;
  gap:2px;
  padding:2px;
  border:1px solid var(--ctl-border);
  border-radius:var(--radius);
  background:var(--surface-soft);
}
.tree-view-switch[hidden] { display:none; }

/* «Paneles»: Detalles / PDF toggles and the «Distribución» select, same segmented look as the switch. */

.tree-view-host[hidden] { display:none; }

/* Drag a project onto a node (admin). */
.project-tree__project[draggable="true"] { cursor:grab; }
.project-tree__project.is-dragging { opacity:.45; }
.project-tree__summary.is-drop-target {
  background:var(--ctl-hover-bg);
  box-shadow:inset 0 0 0 2px var(--primary);
}

/* ── Focus: one ring for every control. ── */

.project-tree__summary:focus-visible {
  outline:2px solid var(--primary);
  outline-offset:-2px;
}

/* ── Fields: same border, radius and height as the button in their row. ── */
.node-picker select,
.node-picker input[name="new_node"] {
  box-sizing:border-box;
  width:100%;

  margin:0;
  padding:0 12px;
  border:1px solid var(--ctl-border);
  border-radius:var(--radius);
  background:var(--surface);
  color:var(--ink);
  font-size:var(--text-14);
  text-transform:none;
  letter-spacing:0;
}

.page-home .project-filter:focus,
.node-picker select:focus,
.node-picker input[name="new_node"]:focus {
  outline:none;
  border-color:var(--primary);
  box-shadow:var(--focus-ring);
}

/* Dense rows: the index search (beside "Nuevo nodo"), member role selects, dialog fields. */
.node-picker select,
.node-picker input[name="new_node"] { height:var(--ctl-h); }

/* Login: one column, full-width action. */
.login-card label[for="login-password"] { margin-top:10px; }

.login-card .hint { margin:16px 0 0; }

/* Compartir: username, role and action on one row. */
@media (min-width: 641px) {
  .members-form { grid-template-columns:minmax(0, 1fr) minmax(140px, 200px) auto; gap:6px var(--ctl-gap); align-items:end; }

  .members-form #member-username { grid-area:2 / 1; }
  .members-form #member-role { grid-area:2 / 2; }

}

/* Dependencias */
.deps-installed-item form { margin:0; }
 /* the card field rule stretched the checkboxes to 100% */

.project-tree-toolbar .project-tree-action--primary { flex-shrink:0; }

/* ── Dialogs: radius 12, one backdrop, footer right-aligned (Cancelar, then the action). ── */

/* ===== Usuarios (admin): create form in a grid of fields, accounts as member rows ===== */
.users-form { display:grid; gap:12px var(--ctl-gap); grid-template-columns:repeat(auto-fit, minmax(min(100%, 220px), 1fr)); align-items:start; }
.users-form__field { display:grid; gap:4px; min-width:0; }

.users-form__hint,
.users-list__meta { color:var(--muted); font-size:var(--text-13); margin:0; }
.users-form__check { grid-column:1 / -1; display:flex; gap:8px; align-items:center; }
/* The global input rule (full width, border, bottom margin) must not reach the checkbox; same fix as .deps-check. */
.page-home .users-form__check input { width:auto; min-height:0; margin:0; border:0; accent-color:var(--primary); }
.page-home .users-form__check input:focus-visible { outline:2px solid var(--primary); outline-offset:2px; }

.users-form--inline { display:flex; flex-wrap:wrap; gap:var(--ctl-gap); margin-top:8px; }
.users-form--inline input { width:auto; min-width:0; flex:1 1 160px; }
.users-list__item { align-items:flex-start; padding:10px 0; border-top:1px solid var(--line); }
.users-list__item:first-child { border-top:0; }
.users-list__who { flex:1 1 260px; min-width:0; overflow-wrap:anywhere; }
.users-list__password summary { list-style:none; cursor:pointer; }
.users-list__password summary::-webkit-details-marker { display:none; }
/* Open, the password form takes its own line under the row instead of pushing the other buttons around. */
.users-list__password[open] { flex-basis:100%; }  /* no reorder: visual order stays the focus order */
.users-list__password[open] > summary { border-color:var(--primary); color:var(--primary); }

/* «Consola (CLI)» in the home header: a green dot while a console session is in use. */
.nav-dot { display:inline-block; width:8px; height:8px; margin-right:6px; border-radius:var(--radius-round); background:var(--color-green-150); vertical-align:1px; }
