/* Wovelr SPA shell (post-redesign) — navigation rail, top bar, screen
   host, Hub layout, stub-screen scaffolding.

   Built on the Wovelr design tokens (brand/tokens/tokens.css). The
   existing per-screen styles live in app.css; this file owns the
   chrome that sits around them.
*/

/* ─── Layout ────────────────────────────────────────────────────────── */

body.has-shell {
  margin: 0;
  display: grid;
  grid-template-columns: 64px 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas:
    "rail topbar"
    "rail main";
  height: 100vh;
  overflow: hidden;
  background: var(--wv-bg-subtle);
}

body.has-shell.no-rail {
  grid-template-columns: 1fr;
  grid-template-areas:
    "topbar"
    "main";
}

/* The classic single-column layout used for login + public-style screens
   bypasses the shell. We toggle .show-shell on <body> after login. */
body:not(.has-shell) header { /* legacy header, kept for login */
  background: var(--wv-bg);
  border-bottom: 1px solid var(--wv-border);
}

/* ─── Navigation rail (left) ────────────────────────────────────────── */

.nav-rail {
  grid-area: rail;
  background: var(--wv-color-ink);
  color: var(--wv-color-paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--wv-space-3) 0;
  gap: var(--wv-space-1);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
}

.nav-rail .rail-brand {
  width: 40px;
  height: 40px;
  border-radius: var(--wv-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--wv-space-3);
}

.nav-rail .rail-brand img {
  width: 32px;
  height: 32px;
}

.nav-rail .rail-link {
  width: 48px;
  height: 48px;
  border-radius: var(--wv-radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: rgba(250, 250, 247, 0.65);
  cursor: pointer;
  position: relative;
  border: none;
  background: transparent;
  font-family: var(--wv-font-display);
  transition: background var(--wv-duration-fast) var(--wv-ease-out),
              color var(--wv-duration-fast) var(--wv-ease-out);
  text-decoration: none;
}

.nav-rail .rail-link:hover {
  color: var(--wv-color-paper);
  background: rgba(250, 250, 247, 0.08);
}

.nav-rail .rail-link.active {
  color: var(--wv-color-paper);
  background: rgba(200, 100, 60, 0.18);
}

.nav-rail .rail-link.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 26px;
  border-radius: 0 2px 2px 0;
  background: var(--wv-color-copper);
}

.nav-rail .rail-link .rail-icon {
  font-size: 18px;
  line-height: 1;
}

.nav-rail .rail-link .rail-label {
  font-size: 9px;
  font-weight: var(--wv-fw-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-rail .rail-spacer { flex: 1 1 auto; }

/* ─── Top bar ───────────────────────────────────────────────────────── */

.topbar {
  grid-area: topbar;
  background: var(--wv-bg);
  border-bottom: 1px solid var(--wv-border);
  display: flex;
  align-items: center;
  padding: 0 var(--wv-space-5);
  gap: var(--wv-space-4);
  z-index: 10;
}

.topbar .crumbs {
  display: flex;
  align-items: center;
  gap: var(--wv-space-2);
  font-family: var(--wv-font-display);
  font-weight: var(--wv-fw-bold);
  font-size: var(--wv-fs-base);
  color: var(--wv-fg);
}

.topbar .crumbs .crumb-mod {
  color: var(--wv-fg-muted);
  font-weight: var(--wv-fw-medium);
}

.topbar .crumbs .crumb-sep {
  color: var(--wv-fg-muted);
  font-weight: var(--wv-fw-medium);
}

.topbar .topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--wv-space-2);
}

.topbar .top-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--wv-radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--wv-fg-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-family: var(--wv-font-display);
  transition: background var(--wv-duration-fast) var(--wv-ease-out);
}

.topbar .top-icon-btn:hover {
  background: var(--wv-bg-subtle);
  color: var(--wv-fg);
}

.topbar .cmdk-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--wv-space-2);
  padding: 6px var(--wv-space-3);
  border-radius: var(--wv-radius-md);
  border: 1px solid var(--wv-border);
  background: var(--wv-bg);
  color: var(--wv-fg-muted);
  font-family: var(--wv-font-mono);
  font-size: var(--wv-fs-xs);
  cursor: pointer;
  min-width: 220px;
}

.topbar .cmdk-btn:hover { border-color: var(--wv-color-copper); color: var(--wv-fg); }

.topbar .cmdk-btn kbd {
  font-family: var(--wv-font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--wv-bg-subtle);
  border: 1px solid var(--wv-border);
  color: var(--wv-fg-muted);
}

.topbar .lang-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px var(--wv-space-2);
  border-radius: var(--wv-radius-full);
  border: 1px solid var(--wv-border);
  background: var(--wv-bg);
  cursor: pointer;
  font-family: var(--wv-font-mono);
  font-size: var(--wv-fs-xs);
  color: var(--wv-fg-muted);
}

.topbar .lang-pill .lang-active {
  font-weight: var(--wv-fw-bold);
  color: var(--wv-fg);
}

.topbar .user-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--wv-space-2);
  padding: 3px var(--wv-space-2) 3px 3px;
  border-radius: var(--wv-radius-full);
  border: 1px solid var(--wv-border);
  background: var(--wv-bg);
  cursor: pointer;
  position: relative;
  transition: border-color var(--wv-duration-fast);
}

.topbar .user-badge:hover { border-color: var(--wv-color-copper); }

.topbar .user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--wv-color-copper);
  color: var(--wv-color-paper);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--wv-font-mono);
  font-size: 11px;
  font-weight: var(--wv-fw-bold);
  position: relative;
}

.topbar .user-avatar .notif-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #C0392B;
  color: #fff;
  font-size: 10px;
  font-weight: var(--wv-fw-bold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--wv-bg);
  font-family: var(--wv-font-mono);
}

/* ─── Suite I — Bell button + popover ─────────────────────────── */
.topbar .bell-btn {
  position: relative;
  font-size: 16px;
  line-height: 1;
}
.topbar .bell-btn .bell-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--wv-color-copper);
  color: #fff;
  font-size: 9px;
  font-weight: var(--wv-fw-bold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--wv-bg);
  font-family: var(--wv-font-mono);
  pointer-events: none;
}
.bell-popover {
  position: fixed;
  display: none;
  width: 360px;
  max-height: 60vh;
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  border-radius: 10px;
  box-shadow: var(--wv-shadow-lg);
  z-index: 9000;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--wv-font-body);
}
.bell-popover.open { display: flex; }
.bell-popover-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--wv-border);
  background: var(--wv-bg-subtle);
}
.bell-popover-head strong {
  font-size: 14px;
  color: var(--wv-fg);
}
.bell-popover-count {
  font-size: 11px;
  color: var(--wv-fg-muted);
  font-family: var(--wv-font-mono);
}
.bell-popover-empty {
  padding: 20px;
  text-align: center;
  color: var(--wv-fg-muted);
  font-size: 13px;
}
.bell-popover-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  max-height: 380px;
}
.bell-popover-item {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--wv-border);
  cursor: pointer;
  transition: background 120ms;
}
.bell-popover-item:hover { background: var(--wv-bg-subtle); }
.bell-popover-item.unread {
  background: rgba(200, 100, 60, 0.06);
  border-left: 3px solid var(--wv-color-copper);
  padding-left: 11px;
}
.bell-popover-icon {
  font-size: 18px;
  line-height: 1.2;
  flex-shrink: 0;
}
.bell-popover-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.bell-popover-text {
  font-size: 13px;
  color: var(--wv-fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bell-popover-meta {
  font-size: 11px;
  color: var(--wv-fg-muted);
  font-family: var(--wv-font-mono);
}
.bell-popover-foot {
  display: flex;
  justify-content: space-between;
  padding: 8px 10px;
  border-top: 1px solid var(--wv-border);
  background: var(--wv-bg-subtle);
}
.bell-popover-link {
  background: transparent;
  border: 0;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--wv-fg-muted);
  cursor: pointer;
  border-radius: 6px;
}
.bell-popover-link:hover { background: rgba(0,0,0,0.06); color: var(--wv-fg); }
.bell-popover-link.primary { color: var(--wv-color-copper); font-weight: var(--wv-fw-medium); }

/* Workshop — BOM cell edit mode */
.workshop-row.editing { background: rgba(200,100,60,0.04); }
.workshop-cell-input {
  background: transparent;
  border: 1px solid var(--wv-color-copper);
  padding: 2px 4px;
  font-size: inherit;
  font-family: inherit;
  color: inherit;
  width: 100%;
  box-sizing: border-box;
}
.workshop-cell-input:focus { outline: none; border-color: var(--wv-fg); }

/* Print stylesheet — hide chrome (nav, top bar, palette, side
   panels) so window.print() yields a clean BOM / Sketch printout. */
/* Phase 14 — Matrice rôles × permissions */
.bo-roles-table {
  width: auto;
  min-width: 100%;
}
.bo-roles-table th, .bo-roles-table td {
  border: 1px solid var(--wv-border);
  padding: 6px 8px;
}
.bo-roles-role-col {
  width: 90px;
  min-width: 90px;
  vertical-align: bottom;
  padding: 4px !important;
}
.bo-roles-role-label {
  font-size: 11px;
  font-weight: var(--wv-fw-medium);
  text-align: center;
  white-space: normal;
  line-height: 1.1;
  min-height: 32px;
}
.bo-roles-row td:first-child {
  background: var(--wv-bg-subtle);
  font-family: var(--wv-font-mono);
}
.bo-roles-cell {
  text-align: center;
  padding: 4px 8px !important;
}
.bo-roles-checkbox {
  cursor: pointer;
  transform: scale(1.2);
  accent-color: var(--wv-color-copper);
}

@media print {
  .nav-rail, .topbar, .bell-popover, .user-dropdown, .cmdk-modal,
  .toasts, .sketch-page-bar, .sketch-page-tools, .workshop-action-wrap,
  .sketch-terminal, .bell-btn,
  /* hide the right-pane action buttons in Workshop */
  button.btn-primary, button.btn-secondary, button.btn-ghost {
    display: none !important;
  }
  body, .shell-main, .screen, .sketch-canvas-wrap {
    background: white !important;
    color: black !important;
  }
  .bo-body, .workshop-panel, .sketch-cartouche {
    box-shadow: none !important;
    border-color: black !important;
  }
  @page { size: A4 landscape; margin: 12mm; }
}

.topbar .user-name {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  font-family: var(--wv-font-display);
}

.topbar .user-name .name {
  font-size: var(--wv-fs-sm);
  font-weight: var(--wv-fw-bold);
  color: var(--wv-fg);
}

.topbar .user-name .role {
  font-size: 10px;
  color: var(--wv-color-copper);
  font-weight: var(--wv-fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.topbar .user-caret {
  font-family: var(--wv-font-mono);
  color: var(--wv-fg-muted);
  font-size: 10px;
  margin: 0 4px;
}

/* ─── User dropdown menu ────────────────────────────────────────────── */

.user-dropdown {
  position: absolute;
  right: var(--wv-space-5);
  top: 50px;
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-md);
  box-shadow: var(--wv-shadow-lg);
  padding: var(--wv-space-2);
  min-width: 240px;
  z-index: 50;
  display: none;
}

.user-dropdown.open { display: block; }

.user-dropdown .menu-header {
  padding: var(--wv-space-2);
  border-bottom: 1px solid var(--wv-border);
  margin-bottom: var(--wv-space-2);
}

.user-dropdown .menu-header .mh-name {
  font-family: var(--wv-font-display);
  font-weight: var(--wv-fw-bold);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg);
}

.user-dropdown .menu-header .mh-email {
  font-family: var(--wv-font-mono);
  font-size: 11px;
  color: var(--wv-fg-muted);
}

.user-dropdown .menu-item {
  display: flex;
  align-items: center;
  gap: var(--wv-space-2);
  padding: 8px var(--wv-space-2);
  border-radius: var(--wv-radius-base);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  position: relative;
}

.user-dropdown .menu-item:hover {
  background: var(--wv-bg-subtle);
}

.user-dropdown .menu-item.danger { color: #C0392B; }

.user-dropdown .menu-item .item-badge {
  margin-left: auto;
  background: #C0392B;
  color: #fff;
  font-family: var(--wv-font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 999px;
  font-weight: var(--wv-fw-bold);
}

.user-dropdown .menu-divider {
  height: 1px;
  background: var(--wv-border);
  margin: var(--wv-space-1) 0;
}

/* ─── Main host ─────────────────────────────────────────────────────── */

main.shell-main {
  grid-area: main;
  overflow: auto;
  background: var(--wv-bg-subtle);
  position: relative;
}

main.shell-main > section.screen {
  display: none;
  min-height: 100%;
}

main.shell-main > section.screen.active {
  display: block;
}

/* ─── Screen header (per-screen page title strip) ───────────────────── */

.screen-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: var(--wv-space-6) var(--wv-space-8) var(--wv-space-3);
  background: var(--wv-bg-subtle);
  gap: var(--wv-space-4);
  flex-wrap: wrap;
}

.screen-header h1 {
  margin: 0;
  font-family: var(--wv-font-display);
  font-weight: var(--wv-fw-extrabold);
  font-size: var(--wv-fs-3xl);
  color: var(--wv-fg);
  letter-spacing: var(--wv-tracking-tight);
}

.screen-header .screen-sub {
  color: var(--wv-fg-muted);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
}

.screen-header .screen-actions {
  display: flex;
  gap: var(--wv-space-2);
  align-items: center;
}

.screen-body {
  padding: 0 var(--wv-space-8) var(--wv-space-8);
}

/* ─── Hub — 3-column layout ─────────────────────────────────────────── */

.hub-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.2fr;
  gap: var(--wv-space-5);
  align-items: stretch;
  min-height: 0;
}

@media (max-width: 1100px) {
  .hub-grid { grid-template-columns: 1fr; }
}

.hub-col {
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-lg);
  display: flex;
  flex-direction: column;
  min-height: 480px;
  overflow: hidden;
}

.hub-col .col-head {
  padding: var(--wv-space-3) var(--wv-space-4);
  border-bottom: 1px solid var(--wv-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--wv-space-2);
  /* BUG-FIX dark mode — utilise le token semantique au lieu du
     hardcoded --wv-color-linen (qui restait beige en mode sombre
     et rendait le titre blanc invisible). */
  background: var(--wv-bg-subtle);
}

.hub-col .col-head .col-title {
  font-family: var(--wv-font-display);
  font-weight: var(--wv-fw-extrabold);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hub-col .col-head .col-action-btn {
  /* Bouton "+ Nouveau plan" / "+ Nouvelle base" en header de colonne */
  margin-left: auto;
  font-size: 12px;
  padding: 4px 10px;
  background: var(--wv-color-copper);
  color: white;
  border: 0;
  border-radius: var(--wv-radius-md);
  cursor: pointer;
  font-weight: var(--wv-fw-medium);
}
.hub-col .col-head .col-action-btn:hover { filter: brightness(1.1); }

.hub-col .col-head .col-count {
  font-family: var(--wv-font-mono);
  font-size: var(--wv-fs-xs);
  color: var(--wv-fg-muted);
  background: var(--wv-bg);
  padding: 2px 8px;
  border-radius: var(--wv-radius-full);
  border: 1px solid var(--wv-border);
}

.hub-col .col-controls {
  padding: var(--wv-space-3) var(--wv-space-4);
  border-bottom: 1px solid var(--wv-border);
  display: flex;
  gap: var(--wv-space-2);
  align-items: center;
  flex-wrap: wrap;
}

.hub-col .col-controls input.search {
  flex: 1 1 auto;
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-base);
  padding: 6px var(--wv-space-2);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  background: var(--wv-bg);
  color: var(--wv-fg);
  min-width: 0;
}

.hub-col .col-controls input.search:focus {
  outline: 2px solid var(--wv-color-copper);
  outline-offset: -1px;
  border-color: var(--wv-color-copper);
}

.hub-col .col-list {
  list-style: none;
  margin: 0;
  padding: var(--wv-space-3);
  display: flex;
  flex-direction: column;
  gap: var(--wv-space-2);
  overflow-y: auto;
  flex: 1 1 auto;
}

.hub-col .col-foot {
  border-top: 1px solid var(--wv-border);
  padding: var(--wv-space-2) var(--wv-space-4);
  font-family: var(--wv-font-mono);
  font-size: 11px;
  color: var(--wv-fg-muted);
  background: var(--wv-color-linen);
}

/* Plan / DB cards inside hub columns */
.hub-card {
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-md);
  padding: var(--wv-space-3);
  cursor: pointer;
  background: var(--wv-bg);
  transition: border-color var(--wv-duration-fast),
              transform var(--wv-duration-fast),
              box-shadow var(--wv-duration-fast);
  position: relative;
}

.hub-card:hover {
  border-color: var(--wv-color-copper);
  transform: translateY(-1px);
  box-shadow: var(--wv-shadow-sm);
}

.hub-card.selected {
  border-color: var(--wv-color-copper);
  background: linear-gradient(0deg, rgba(200, 100, 60, 0.05), rgba(200, 100, 60, 0.05)), var(--wv-bg);
  box-shadow: 0 0 0 1px var(--wv-color-copper);
}

.hub-card .card-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--wv-space-2);
  margin-bottom: 4px;
}

.hub-card .card-id {
  font-family: var(--wv-font-mono);
  font-size: 11px;
  color: var(--wv-fg-muted);
  font-weight: var(--wv-fw-medium);
}

.hub-card .card-name {
  font-family: var(--wv-font-display);
  font-weight: var(--wv-fw-bold);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg);
  font-weight: var(--wv-fw-bold);
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hub-card .card-meta {
  font-family: var(--wv-font-mono);
  font-size: 11px;
  color: var(--wv-fg-muted);
}

.hub-card .card-row3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--wv-space-2);
  margin-top: 6px;
}

.hub-card .card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.hub-card .tag {
  font-family: var(--wv-font-mono);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--wv-radius-full);
  background: var(--wv-bg-subtle);
  color: var(--wv-fg-muted);
  border: 1px solid var(--wv-border);
}

.hub-card .tag.type {
  background: var(--wv-color-ink);
  color: var(--wv-color-paper);
  border-color: var(--wv-color-ink);
}

.hub-card .rev-pill {
  display: inline-block;
  font-family: var(--wv-font-mono);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--wv-radius-full);
  background: var(--wv-color-copper);
  color: var(--wv-color-paper);
  font-weight: var(--wv-fw-bold);
}

.hub-card .mini-btn {
  font-family: var(--wv-font-display);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--wv-radius-base);
  border: 1px solid var(--wv-border);
  background: var(--wv-bg);
  color: var(--wv-fg);
  cursor: pointer;
}

.hub-card .mini-btn:hover {
  background: var(--wv-color-copper);
  color: var(--wv-color-paper);
  border-color: var(--wv-color-copper);
}

/* Sort chips in column 3 */
.hub-col .sort-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 0 var(--wv-space-4) var(--wv-space-2);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-xs);
  color: var(--wv-fg-muted);
}

.hub-col .sort-chips .sort-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  font-weight: var(--wv-fw-bold);
  margin-right: var(--wv-space-1);
}

.hub-col .sort-chips .sort-chip {
  padding: 2px 8px;
  border-radius: var(--wv-radius-full);
  border: 1px solid var(--wv-border);
  background: var(--wv-bg);
  color: var(--wv-fg-muted);
  cursor: pointer;
  font-family: var(--wv-font-mono);
  font-size: 11px;
}

.hub-col .sort-chips .sort-chip.on {
  background: var(--wv-color-ink);
  color: var(--wv-color-paper);
  border-color: var(--wv-color-ink);
}

/* Empty hub-col placeholder */
.hub-empty {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--wv-space-8);
  color: var(--wv-fg-muted);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  text-align: center;
}

/* ─── Stub-screen layout ────────────────────────────────────────────── */

.stub-card {
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-lg);
  padding: var(--wv-space-8);
  margin: 0 auto;
  max-width: 760px;
  text-align: center;
}

.stub-card h2 {
  font-family: var(--wv-font-display);
  font-weight: var(--wv-fw-extrabold);
  margin: 0 0 var(--wv-space-3);
  color: var(--wv-fg);
  font-size: var(--wv-fs-2xl);
}

.stub-card p {
  color: var(--wv-fg-muted);
  font-family: var(--wv-font-display);
  line-height: var(--wv-lh-relaxed);
}

.stub-card .stub-icon {
  font-size: 48px;
  margin-bottom: var(--wv-space-3);
  display: block;
}

.stub-card ul.stub-features {
  list-style: none;
  padding: 0;
  margin: var(--wv-space-5) 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--wv-space-3);
  text-align: left;
}

@media (max-width: 720px) {
  .stub-card ul.stub-features { grid-template-columns: 1fr; }
}

.stub-card ul.stub-features li {
  background: var(--wv-color-linen);
  padding: var(--wv-space-3);
  border-radius: var(--wv-radius-md);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg);
}

.stub-card ul.stub-features li strong {
  display: block;
  color: var(--wv-color-copper);
  margin-bottom: 2px;
  font-weight: var(--wv-fw-bold);
}

.stub-card .roadmap-tag {
  display: inline-block;
  font-family: var(--wv-font-mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--wv-radius-full);
  background: var(--wv-color-copper);
  color: var(--wv-color-paper);
  font-weight: var(--wv-fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--wv-space-3);
}

/* ─── Workshop / Dashboard / Polygon layout primitives ──────────────── */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--wv-space-3);
  margin-bottom: var(--wv-space-5);
}

.kpi-tile {
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-md);
  padding: var(--wv-space-4);
}

.kpi-tile .kpi-label {
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-xs);
  font-weight: var(--wv-fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wv-fg-muted);
}

.kpi-tile .kpi-value {
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-3xl);
  font-weight: var(--wv-fw-extrabold);
  color: var(--wv-fg);
  line-height: 1.1;
  margin-top: 4px;
}

.kpi-tile .kpi-delta {
  font-family: var(--wv-font-mono);
  font-size: 11px;
  margin-top: 2px;
}

.kpi-tile .kpi-delta.up { color: #2A7D4F; }
.kpi-tile .kpi-delta.down { color: #C0392B; }

/* ─── Notifications ─────────────────────────────────────────────────── */

.notif-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--wv-space-2);
  max-width: 880px;
}

.notif-item {
  display: flex;
  gap: var(--wv-space-3);
  padding: var(--wv-space-3);
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-md);
  cursor: pointer;
}

.notif-item.unread { border-left: 3px solid var(--wv-color-copper); }

.notif-item .notif-icon {
  font-size: 20px;
  width: 32px;
  text-align: center;
}

.notif-item .notif-body {
  flex: 1;
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg);
}

.notif-item .notif-meta {
  font-family: var(--wv-font-mono);
  font-size: 11px;
  color: var(--wv-fg-muted);
  margin-top: 2px;
}

/* ─── Ctrl+K palette ────────────────────────────────────────────────── */

.cmdk-modal {
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 32, 0.55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 200;
  padding-top: 12vh;
}

.cmdk-modal.open { display: flex; }

.cmdk-card {
  background: var(--wv-bg);
  border-radius: var(--wv-radius-lg);
  width: min(620px, 90vw);
  box-shadow: var(--wv-shadow-lg);
  overflow: hidden;
  border: 1px solid var(--wv-border);
}

.cmdk-input {
  width: 100%;
  border: none;
  padding: var(--wv-space-4) var(--wv-space-5);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-lg);
  background: var(--wv-bg);
  color: var(--wv-fg);
  border-bottom: 1px solid var(--wv-border);
  outline: none;
}

.cmdk-results {
  list-style: none;
  margin: 0;
  padding: var(--wv-space-2);
  max-height: 50vh;
  overflow-y: auto;
}

.cmdk-results li {
  padding: var(--wv-space-2) var(--wv-space-3);
  border-radius: var(--wv-radius-base);
  cursor: pointer;
  display: flex;
  gap: var(--wv-space-3);
  align-items: center;
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg);
}

.cmdk-results li:hover, .cmdk-results li.active {
  background: var(--wv-color-linen);
}

.cmdk-results li .cmdk-icon { font-size: 16px; }

.cmdk-results li .cmdk-kbd {
  margin-left: auto;
  font-family: var(--wv-font-mono);
  font-size: 10px;
  color: var(--wv-fg-muted);
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--wv-bg-subtle);
  border: 1px solid var(--wv-border);
}

.cmdk-section-label {
  padding: var(--wv-space-2) var(--wv-space-3) 4px;
  font-family: var(--wv-font-display);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--wv-fg-muted);
  font-weight: var(--wv-fw-bold);
}

/* ─── Buttons used across stub screens ──────────────────────────────── */

.btn-primary, .btn-secondary, .btn-ghost {
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  font-weight: var(--wv-fw-bold);
  padding: 8px var(--wv-space-3);
  border-radius: var(--wv-radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform var(--wv-duration-fast), background var(--wv-duration-fast);
}

.btn-primary {
  background: var(--wv-color-copper);
  color: var(--wv-color-paper);
}
.btn-primary:hover { background: var(--wv-color-copper-soft); color: var(--wv-color-ink); transform: translateY(-1px); }

.btn-secondary {
  background: var(--wv-bg);
  color: var(--wv-fg);
  border-color: var(--wv-border);
}
.btn-secondary:hover { border-color: var(--wv-color-copper); color: var(--wv-color-copper); }

.btn-ghost {
  background: transparent;
  color: var(--wv-fg);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--wv-bg-subtle); }

/* ─── Toast surface promotion (existing toasts) ─────────────────────── */

body.has-shell .toasts {
  position: fixed;
  top: 70px;
  right: var(--wv-space-5);
  z-index: 100;
}

/* ─── Login screen overrides when shell is hidden ───────────────────── */

body:not(.has-shell) main.login {
  min-height: calc(100vh - 80px);
}

/* ─── Studio — components & equipments library ──────────────────────── */

.screen-header .studio-count {
  font-family: var(--wv-font-mono);
  font-size: var(--wv-fs-xs);
  color: var(--wv-fg-muted);
  background: var(--wv-bg);
  padding: 4px var(--wv-space-3);
  border-radius: var(--wv-radius-full);
  border: 1px solid var(--wv-border);
}

.studio-body {
  display: grid;
  grid-template-columns: 220px 1fr 1.2fr;
  gap: var(--wv-space-4);
  padding: 0 var(--wv-space-8) var(--wv-space-8);
  min-height: 70vh;
}

@media (max-width: 1100px) {
  .studio-body { grid-template-columns: 200px 1fr; }
  .studio-detail-pane { grid-column: 1 / -1; }
}

/* Left rail — categories */
.studio-categories {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-md);
  padding: var(--wv-space-2);
  align-self: start;
  position: sticky;
  top: var(--wv-space-3);
}

.studio-cat-btn {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: var(--wv-space-2);
  align-items: center;
  padding: 8px var(--wv-space-2);
  background: transparent;
  border: none;
  border-radius: var(--wv-radius-base);
  cursor: pointer;
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg);
  text-align: left;
}

.studio-cat-btn:hover { background: var(--wv-bg-subtle); }

.studio-cat-btn.active {
  background: var(--wv-color-ink);
  color: var(--wv-color-paper);
}

.studio-cat-btn.active .studio-cat-count {
  background: var(--wv-color-copper);
  color: var(--wv-color-paper);
}

.studio-cat-icon { text-align: center; font-size: 14px; }

.studio-cat-count {
  font-family: var(--wv-font-mono);
  font-size: 10px;
  background: var(--wv-bg-subtle);
  color: var(--wv-fg-muted);
  padding: 1px 6px;
  border-radius: var(--wv-radius-full);
  font-weight: var(--wv-fw-bold);
  min-width: 24px;
  text-align: center;
}

/* Middle pane — list of components */
.studio-list-pane {
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-md);
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100vh - 180px);
}

.studio-list-controls {
  display: flex;
  align-items: center;
  gap: var(--wv-space-2);
  padding: var(--wv-space-3);
  border-bottom: 1px solid var(--wv-border);
  background: var(--wv-color-linen);
}

.studio-search {
  flex: 1 1 auto;
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-base);
  padding: 6px var(--wv-space-2);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  background: var(--wv-bg);
  color: var(--wv-fg);
}

.studio-search:focus {
  outline: 2px solid var(--wv-color-copper);
  outline-offset: -1px;
  border-color: var(--wv-color-copper);
}

.studio-list-count {
  font-family: var(--wv-font-mono);
  font-size: var(--wv-fs-xs);
  color: var(--wv-fg-muted);
  white-space: nowrap;
}

.studio-list {
  list-style: none;
  margin: 0;
  padding: var(--wv-space-2);
  overflow-y: auto;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.studio-list-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px var(--wv-space-2);
  border-radius: var(--wv-radius-base);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: var(--wv-font-display);
}

.studio-list-item:hover {
  background: var(--wv-bg-subtle);
  border-color: var(--wv-border);
}

.studio-list-item.selected {
  background: var(--wv-color-linen);
  border-color: var(--wv-color-copper);
}

.studio-li-pn {
  font-family: var(--wv-font-mono);
  font-size: var(--wv-fs-sm);
  font-weight: var(--wv-fw-bold);
  color: var(--wv-fg);
}

.studio-li-desc {
  font-size: var(--wv-fs-xs);
  color: var(--wv-fg);
  line-height: 1.3;
}

.studio-li-meta {
  font-family: var(--wv-font-mono);
  font-size: 11px;
  color: var(--wv-fg-muted);
}

.studio-empty {
  padding: var(--wv-space-5);
  text-align: center;
  color: var(--wv-fg-muted);
  font-family: var(--wv-font-display);
}

/* Right pane — detail */
.studio-detail-pane {
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-md);
  padding: var(--wv-space-5);
  align-self: start;
  position: sticky;
  top: var(--wv-space-3);
  max-height: calc(100vh - 180px);
  overflow-y: auto;
}

.studio-detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 240px;
  color: var(--wv-fg-muted);
  font-family: var(--wv-font-display);
  text-align: center;
  font-size: var(--wv-fs-2xl);
}

.studio-detail-empty p {
  font-size: var(--wv-fs-sm);
  margin-top: var(--wv-space-2);
}

.studio-detail-title {
  font-family: var(--wv-font-mono);
  font-size: var(--wv-fs-lg);
  font-weight: var(--wv-fw-bold);
  color: var(--wv-fg);
  margin: 0;
  word-break: break-all;
}

.studio-detail-sub {
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg-muted);
  margin: 4px 0 var(--wv-space-4);
}

.studio-detail-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px var(--wv-space-4);
  margin: 0;
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
}

.studio-detail-grid dt {
  font-weight: var(--wv-fw-bold);
  color: var(--wv-fg-muted);
  font-size: var(--wv-fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  align-self: start;
  padding-top: 2px;
}

.studio-detail-grid dd {
  margin: 0;
  color: var(--wv-fg);
  font-family: var(--wv-font-mono);
}

.studio-detail-grid dd pre {
  font-family: var(--wv-font-mono);
  font-size: var(--wv-fs-xs);
}

/* ─── Sketch — full plan editor (post-redesign) ─────────────────────── */
/* Layout : top-bar + 3-column grid (130px / 1fr / 460px) ─────────────── */

#screen-sketch.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--wv-space-3) var(--wv-space-3) 0;
}

.sketch-topbar {
  display: flex;
  align-items: center;
  gap: var(--wv-space-3);
  padding: 6px var(--wv-space-3);
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-md);
  margin-bottom: var(--wv-space-2);
}

.sketch-topbar-left {
  display: flex;
  align-items: center;
  gap: var(--wv-space-2);
  flex: 1 1 auto;
  min-width: 0;
}
.sketch-topbar-right {
  display: flex;
  align-items: center;
  gap: var(--wv-space-2);
}
.sketch-back {
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  font-weight: var(--wv-fw-bold);
}
.sketch-title {
  font-family: var(--wv-font-display);
  font-weight: var(--wv-fw-extrabold);
  font-size: var(--wv-fs-xl);
  color: var(--wv-fg);
  margin: 0;
}
.sketch-chip {
  font-family: var(--wv-font-mono);
  font-size: var(--wv-fs-xs);
  padding: 2px var(--wv-space-2);
  border-radius: var(--wv-radius-full);
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  color: var(--wv-fg);
}
.sketch-chip.accent {
  background: var(--wv-color-copper);
  border-color: var(--wv-color-copper);
  color: var(--wv-color-paper);
  font-weight: var(--wv-fw-bold);
}

.sketch-icon-btn {
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-xs);
  padding: 6px var(--wv-space-2);
  border-radius: var(--wv-radius-md);
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  color: var(--wv-fg-muted);
  cursor: pointer;
  font-weight: var(--wv-fw-bold);
}
.sketch-icon-btn.on {
  background: var(--wv-color-ink);
  color: var(--wv-color-paper);
  border-color: var(--wv-color-ink);
}
.sketch-icon-btn:hover { border-color: var(--wv-color-copper); color: var(--wv-fg); }

.sketch-grid {
  display: grid;
  grid-template-columns: 200px 1fr 460px;
  gap: var(--wv-space-3);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.sketch-col-left,
.sketch-col-center,
.sketch-col-right {
  display: flex;
  flex-direction: column;
  gap: var(--wv-space-2);
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 1280px) {
  .sketch-grid { grid-template-columns: 180px 1fr 400px; }
}
@media (max-width: 1100px) {
  .sketch-grid { grid-template-columns: 160px 1fr; }
  .sketch-col-right { grid-column: 1 / -1; max-height: 40vh; }
}

/* Generic Sketch panel */
.sketch-panel {
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.sketch-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px var(--wv-space-2);
  border-bottom: 1px solid var(--wv-border);
  background: var(--wv-color-linen);
  font-family: var(--wv-font-display);
  font-weight: var(--wv-fw-bold);
  font-size: var(--wv-fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--wv-fg);
}
.sketch-panel-title { color: var(--wv-fg); }
.sketch-panel-count {
  font-family: var(--wv-font-mono);
  font-size: 10px;
  color: var(--wv-fg-muted);
  background: var(--wv-bg);
  padding: 1px 6px;
  border-radius: var(--wv-radius-full);
  border: 1px solid var(--wv-border);
}
.sketch-panel-count.ok { color: #1F8A5B; border-color: #1F8A5B; }
.sketch-panel-count.err { color: #C0392B; border-color: #C0392B; }

/* Equipments list (left col) */
.sketch-eq-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  max-height: 200px;
  overflow-y: auto;
}
.sketch-eq-item {
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-base);
  padding: 4px 6px;
  cursor: grab;
  background: var(--wv-bg);
}
.sketch-eq-item:hover { border-color: var(--wv-color-copper); }
.sketch-eq-name {
  font-family: var(--wv-font-display);
  font-size: 11px;
  color: var(--wv-fg);
  font-weight: var(--wv-fw-bold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sketch-eq-marker {
  font-family: var(--wv-font-mono);
  font-size: 10px;
  color: var(--wv-fg-muted);
}
.sketch-anno {
  font-family: var(--wv-font-display);
  font-size: 10px;
  color: var(--wv-color-copper);
  padding: 4px 6px;
  font-style: italic;
}
.sketch-anno.err { color: #C0392B; }

/* Palette */
.sketch-palette { flex: 1 1 auto; }
.sketch-palette-section-label {
  font-family: var(--wv-font-display);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wv-fg-muted);
  font-weight: var(--wv-fw-bold);
  padding: 6px 6px 2px;
}
.sketch-palette-tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 0 6px;
}
.sketch-tool-btn {
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-base);
  padding: 6px 0;
  font-family: var(--wv-font-display);
  font-size: 14px;
  color: var(--wv-fg);
  cursor: pointer;
}
.sketch-tool-btn.small { padding: 4px 6px; font-size: 11px; }
.sketch-tool-btn.danger { color: #C0392B; }
.sketch-tool-btn:hover { border-color: var(--wv-color-copper); background: var(--wv-color-linen); }
.sketch-palette-row {
  display: flex;
  gap: 4px;
  padding: 0 6px 4px;
  align-items: center;
}
.sketch-palette-row > * { flex: 1; }
.sketch-color {
  width: 30px !important;
  height: 24px;
  border: 1px solid var(--wv-border);
  padding: 0;
  cursor: pointer;
  flex: 0 0 auto;
}
.sketch-select {
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-base);
  padding: 3px 6px;
  font-family: var(--wv-font-mono);
  font-size: 11px;
  background: var(--wv-bg);
  color: var(--wv-fg);
}
.sketch-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--wv-font-display);
  font-size: 11px;
  color: var(--wv-fg);
}
.sketch-swatches {
  display: flex;
  gap: 4px;
  padding: 0 6px 6px;
  flex-wrap: wrap;
}
.sketch-swatch {
  width: 18px;
  height: 18px;
  border: 1px solid var(--wv-border);
  cursor: pointer;
  padding: 0;
}

/* Page tabs + zoom (center column) */
.sketch-page-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--wv-space-2);
  flex-wrap: wrap;
}
.sketch-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--wv-border);
}
.sketch-tab {
  padding: 5px var(--wv-space-3);
  background: var(--wv-color-linen);
  border: 1px solid var(--wv-border);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-xs);
  color: var(--wv-fg-muted);
  cursor: pointer;
  position: relative;
  top: 1px;
  font-weight: var(--wv-fw-medium);
}
.sketch-tab.active {
  background: var(--wv-bg);
  color: var(--wv-fg);
  font-weight: var(--wv-fw-bold);
  border-bottom: 1px solid var(--wv-bg);
}
.sketch-tab.dashed { border-style: dashed; opacity: 0.7; }
.sketch-tab:hover { color: var(--wv-fg); }

.sketch-page-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}
.sketch-mini-chip {
  font-family: var(--wv-font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--wv-radius-full);
  background: var(--wv-bg-subtle);
  border: 1px solid var(--wv-border);
  color: var(--wv-fg-muted);
}

/* Plan canvas */
.sketch-canvas-wrap {
  flex: 1 1 auto;
  position: relative;
  border: 2px solid var(--wv-fg);
  border-radius: var(--wv-radius-md);
  background: var(--wv-bg);
  overflow: hidden;
  min-height: 360px;
}
.sketch-canvas {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(11, 18, 32, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(11, 18, 32, 0.06) 1px, transparent 1px);
  background-size: 24px 24px;
  background-color: var(--wv-bg);
  display: block;
}
.sketch-plan-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.sketch-cartouche-host {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 5;
}
.sketch-page-indicator {
  position: absolute;
  left: 8px;
  top: 8px;
  font-family: var(--wv-font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--wv-radius-full);
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  color: var(--wv-fg);
  z-index: 5;
}

/* Cartouche */
.sketch-cartouche {
  background: var(--wv-bg);
  border: 1.5px solid var(--wv-fg);
  border-radius: var(--wv-radius-md);
  font-size: 11px;
  box-shadow: 0 -2px 6px rgba(11, 18, 32, 0.05);
  overflow: hidden;
}
.cart-row1 {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.6fr 70px;
  border-bottom: 1px solid var(--wv-fg);
}
.cart-cell {
  padding: 4px 8px;
  border-right: 1px solid var(--wv-fg);
}
.cart-cell:last-child { border-right: none; }
.cart-cell.flex { min-width: 0; }
.cart-label {
  font-family: var(--wv-font-display);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wv-fg-muted);
  font-weight: var(--wv-fw-bold);
}
.cart-val { font-family: var(--wv-font-display); color: var(--wv-fg); font-weight: var(--wv-fw-medium); }
.cart-val.mono { font-family: var(--wv-font-mono); }
.cart-val.big { font-size: 13px; }
.cart-edit {
  background: transparent;
  border: 1px solid transparent;
  padding: 1px 4px;
  font-size: inherit;
  color: inherit;
  width: 100%;
  box-sizing: border-box;
}
.cart-edit:hover, .cart-edit:focus {
  border-color: var(--wv-color-copper);
  background: var(--wv-bg);
  outline: none;
}
.cart-cell.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--wv-font-display);
  font-size: 10px;
  color: var(--wv-fg-muted);
  cursor: pointer;
  border-right: none;
  border-style: dashed;
  text-align: center;
  line-height: 1.1;
}
.cart-cell.logo:hover { color: var(--wv-color-copper); }
.cart-row2 { padding: 4px 8px; }
.cart-rev-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--wv-font-display);
  font-size: 10px;
  margin-top: 2px;
}
.cart-rev-table th, .cart-rev-table td {
  text-align: left;
  padding: 2px 4px;
  border-bottom: 1px dashed var(--wv-border);
}
.cart-rev-table th {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: var(--wv-fw-bold);
  color: var(--wv-fg-muted);
}
.cart-rev-table td.mono { font-family: var(--wv-font-mono); }

/* Comment pins overlay */
.sketch-pins-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.sketch-pin-wrap {
  position: absolute;
  pointer-events: auto;
}
.sketch-pin {
  width: 24px;
  height: 30px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sketch-pin::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #C8643C;
  clip-path: polygon(50% 100%, 16% 50%, 50% 0%, 84% 50%);
  border-radius: 12px 12px 12px 0;
}
.sketch-pin-num {
  position: relative;
  font-family: var(--wv-font-mono);
  font-size: 11px;
  color: white;
  font-weight: var(--wv-fw-bold);
  padding-bottom: 6px;
}
.sketch-thread {
  position: absolute;
  left: 28px;
  top: 0;
  width: 280px;
  background: var(--wv-bg);
  border: 1px solid var(--wv-fg);
  border-radius: var(--wv-radius-md);
  padding: var(--wv-space-2);
  font-family: var(--wv-font-display);
  font-size: 11px;
  color: var(--wv-fg);
  z-index: 10;
  box-shadow: var(--wv-shadow-md);
}
.sketch-thread-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: var(--wv-fw-bold);
  border-bottom: 1px solid var(--wv-border);
  padding-bottom: 4px;
  margin-bottom: 4px;
}
.sketch-thread-close {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--wv-fg-muted);
}
.sketch-thread-msg, .sketch-thread-reply {
  margin-bottom: 6px;
}
.sketch-thread-reply {
  border-left: 2px solid var(--wv-color-copper);
  padding-left: 6px;
  margin-left: 4px;
}
.sketch-thread-author {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  margin-bottom: 2px;
}
.sketch-avatar-mini {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--wv-color-linen);
  border: 1px solid var(--wv-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--wv-font-mono);
  font-size: 8px;
  color: var(--wv-fg);
}
.sketch-thread-ts {
  margin-left: auto;
  color: var(--wv-fg-muted);
  font-style: italic;
  font-size: 10px;
}
.sketch-thread-body {
  font-size: 11px;
  line-height: 1.4;
  color: var(--wv-fg);
}
.sketch-thread-input {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.sketch-thread-input input {
  flex: 1;
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-base);
  padding: 3px 6px;
  font-size: 11px;
  font-family: var(--wv-font-display);
}
.sketch-thread-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.sketch-thread-actions button { flex: 1; }
.sketch-pin-anno {
  position: absolute;
  left: 14px;
  bottom: 90px;
  font-family: var(--wv-font-display);
  font-size: 10px;
  color: var(--wv-color-copper);
  font-style: italic;
}

/* Right column — tabs + content + terminal */
.sketch-right-tabs { flex: 0 0 auto; }
.sketch-right-pane {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.sketch-right-pane > .sketch-panel { height: 100%; }

/* Wires table */
.sketch-wires-panel { height: 100%; display: flex; flex-direction: column; }
.sketch-wires-scroll {
  flex: 1 1 auto;
  overflow: auto;
}
.sketch-wires-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--wv-font-display);
  font-size: 11px;
}
.sketch-wires-table th {
  font-family: var(--wv-font-display);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--wv-fg-muted);
  padding: 4px 6px;
  text-align: left;
  border-bottom: 1px solid var(--wv-border);
  background: var(--wv-color-linen);
  position: sticky;
  top: 0;
  z-index: 1;
}
.sketch-wires-table th.sub {
  border-top: 1px dashed var(--wv-border);
  font-size: 9px;
  font-weight: var(--wv-fw-medium);
}
.sketch-wires-table th.borderright,
.sketch-wires-table td.borderright { border-right: 1px solid var(--wv-border); }
.sketch-wires-table th.group-head { text-align: center; border-right: 1px solid var(--wv-border); }
.sketch-wires-table th.module-col { text-align: center; border-right: 1px solid var(--wv-border); }
.sketch-wires-table th.add-col-th { text-align: center; cursor: pointer; color: var(--wv-color-copper); }
.sketch-wires-table td {
  padding: 3px 6px;
  border-bottom: 1px dashed var(--wv-border);
  font-family: var(--wv-font-display);
  font-size: 11px;
  color: var(--wv-fg);
}
.sketch-wires-table td.mono { font-family: var(--wv-font-mono); }
.sketch-wires-table td.center { text-align: center; }
.sketch-wires-table td.muted { color: var(--wv-fg-muted); }
.sketch-wires-table tr.unconnected td { background: rgba(192, 57, 43, 0.08); color: #C0392B; }
.sketch-wires-table .wires-add td { padding: 6px; background: var(--wv-color-linen); }
.wire-crosspage {
  background: var(--wv-color-copper);
  color: var(--wv-color-paper);
  font-family: var(--wv-font-mono);
  font-size: 9px;
  padding: 1px 5px;
  border-radius: var(--wv-radius-full);
  margin-left: 4px;
}
.err-hint { color: #C0392B; font-weight: var(--wv-fw-bold); }

/* Sketch-X — interactive wire table pickers */
.sketch-wires-table .wire-picker {
  background: transparent;
  border: 1px solid transparent;
  font-family: var(--wv-font-mono);
  font-size: 12px;
  padding: 2px 4px;
  color: inherit;
  max-width: 70px;
}
.sketch-wires-table .wire-picker:hover,
.sketch-wires-table .wire-picker:focus {
  border-color: var(--wv-color-copper);
  background: var(--wv-bg);
  outline: none;
}
.sketch-wires-table .wire-no-input,
.sketch-wires-table .wire-mod-input,
.sketch-wires-table input.mono {
  background: transparent;
  border: 1px solid transparent;
  font-family: var(--wv-font-mono);
  font-size: 12px;
  padding: 2px 4px;
  color: inherit;
}
.sketch-wires-table .wire-no-input:focus,
.sketch-wires-table .wire-mod-input:focus,
.sketch-wires-table input.mono:focus {
  border-color: var(--wv-color-copper);
  background: var(--wv-bg);
  outline: none;
}
.sketch-wires-table tr.selected { background: rgba(200, 100, 60, 0.10) !important; }
.sketch-wires-table tr.unconnected td { color: #C0392B; }
.sketch-wires-table tr.unconnected .wire-picker,
.sketch-wires-table tr.unconnected input.mono { color: #C0392B; }

/* Canvas — selection ring on equipment + clickable wires */
.sketch-eq-glyph.selected rect:first-child {
  stroke: var(--wv-color-copper);
  stroke-width: 2.5;
}
path.sketch-wire { cursor: pointer; }
path.sketch-wire:hover { stroke-width: 2.5; }
path.sketch-wire.selected { stroke-width: 2.5; filter: drop-shadow(0 0 4px rgba(200,100,60,0.6)); }

/* Library equipment items being dragged */
.sketch-eq-item.dragging { opacity: 0.4; }

/* Palette active tool */
.sketch-tool-btn.active {
  background: var(--wv-color-copper);
  color: var(--wv-color-paper);
}

/* Bundle panel */
.sketch-bundles-panel { padding: 0; }
.sketch-bundle-list {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sketch-bundle-card {
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-base);
  padding: 6px 8px;
  background: var(--wv-bg);
}
.sketch-bundle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sketch-bundle-meta {
  font-family: var(--wv-font-mono);
  font-size: 10px;
  color: var(--wv-fg-muted);
  margin-top: 2px;
}
.sketch-bundle-drop {
  border: 1px dashed var(--wv-border);
  padding: 4px 6px;
  margin-top: 4px;
  font-family: var(--wv-font-mono);
  font-size: 10px;
  color: var(--wv-fg-muted);
  border-radius: var(--wv-radius-base);
}
.sketch-add-bundle {
  width: 100%;
  margin-top: 4px;
}

/* Mini schema */
.sketch-mini-schema {
  padding: var(--wv-space-3);
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sketch-mini-schema-svg {
  width: 100%;
  max-width: 360px;
  height: auto;
}

/* Terminal */
.sketch-terminal {
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-md);
  background: var(--wv-bg);
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  max-height: 220px;
  overflow: hidden;
}
.sketch-terminal-output {
  margin: 0;
  padding: 8px 12px;
  background: var(--wv-color-ink);
  color: var(--wv-color-paper);
  font-family: var(--wv-font-mono);
  font-size: 11px;
  line-height: 1.5;
  flex: 1 1 auto;
  overflow: auto;
  white-space: pre-wrap;
  border-radius: 0;
}
.sketch-to-workshop {
  border-radius: 0;
  border-top: 1px solid var(--wv-border);
  padding: 8px;
  font-family: var(--wv-font-display);
  font-weight: var(--wv-fw-bold);
}

/* ─── Workshop — BOM editor ─────────────────────────────────────────── */

#screen-workshop.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--wv-space-3);
}

.workshop-topbar { margin-bottom: var(--wv-space-3); }

.workshop-dirty-chip {
  background: #FCEFD0 !important;
  border-color: var(--wv-color-copper) !important;
  color: var(--wv-color-ink) !important;
  font-weight: var(--wv-fw-bold);
}

.workshop-action-wrap { position: relative; }
.workshop-action-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  background: var(--wv-bg);
  border: 2px solid var(--wv-fg);
  border-radius: var(--wv-radius-md);
  box-shadow: var(--wv-shadow-md);
  padding: 4px;
  min-width: 260px;
  z-index: 30;
}
.workshop-action-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px var(--wv-space-2);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  cursor: pointer;
  border-radius: var(--wv-radius-base);
  color: var(--wv-fg);
}
.workshop-action-item:hover { background: var(--wv-color-linen); }
.workshop-action-item.disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.workshop-action-item.disabled:hover { background: transparent; }
.workshop-action-item.has-sub { border-bottom: 1px dashed var(--wv-border); }
.workshop-action-item.sub { padding-left: var(--wv-space-4); font-size: var(--wv-fs-xs); }
.workshop-action-arrow { color: var(--wv-fg-muted); font-family: var(--wv-font-mono); }
.workshop-action-meta {
  font-family: var(--wv-font-mono);
  font-size: 10px;
  color: var(--wv-fg-muted);
  font-style: italic;
}
.workshop-action-sub {
  border-bottom: 1px dashed var(--wv-border);
  background: var(--wv-bg-subtle);
}

.workshop-body {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--wv-space-3);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
@media (max-width: 1100px) {
  .workshop-body { grid-template-columns: 1fr; }
}
.workshop-bom-pane,
.workshop-side-pane {
  display: flex;
  flex-direction: column;
  gap: var(--wv-space-2);
  min-height: 0;
  overflow: hidden;
}

.workshop-panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}
.workshop-bom-scroll {
  flex: 1 1 auto;
  overflow: auto;
}
.workshop-bom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--wv-fs-sm);
}
.workshop-bom-table th {
  background: var(--wv-color-linen);
  position: sticky;
  top: 0;
  z-index: 1;
  font-family: var(--wv-font-display);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: var(--wv-fw-bold);
  color: var(--wv-fg-muted);
  padding: 6px;
  text-align: left;
  border-bottom: 1px solid var(--wv-border);
}
.workshop-bom-table td {
  padding: 4px 6px;
  border-bottom: 1px dashed var(--wv-border);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg);
}
.workshop-bom-table td.mono { font-family: var(--wv-font-mono); font-size: var(--wv-fs-xs); }
.workshop-bom-table td.muted { color: var(--wv-fg-muted); }
.workshop-bom-grouphdr td {
  padding: 8px 6px 2px !important;
  background: var(--wv-bg-subtle);
  font-weight: var(--wv-fw-bold);
  font-size: var(--wv-fs-sm);
}
.workshop-bom-grouphdr .mono {
  font-family: var(--wv-font-mono);
  font-size: var(--wv-fs-sm);
  color: var(--wv-color-copper);
}
.workshop-row.manual td {
  color: #1F5FB0;
}
.workshop-row.manual td.mono { color: #1F5FB0; }
.workshop-row-actions {
  text-align: right;
  white-space: nowrap;
}
.workshop-row-actions span {
  cursor: pointer;
  margin-left: var(--wv-space-2);
  color: var(--wv-fg-muted);
  font-size: 14px;
}
.workshop-row-actions span:hover { color: var(--wv-color-copper); }
.workshop-row-actions span.danger { color: #C0392B; }
.workshop-row-actions span.danger:hover { color: #911e1e; }

.workshop-bom-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--wv-space-2) var(--wv-space-3);
  border-top: 1px dashed var(--wv-border);
  background: var(--wv-color-linen);
}
.workshop-bom-foot-actions { display: flex; gap: var(--wv-space-2); }
.workshop-manual-count { color: #1F5FB0; font-family: var(--wv-font-mono); font-size: var(--wv-fs-xs); }

.workshop-recap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--wv-space-2);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
}
.workshop-recap-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
}
.workshop-recap-row .mono { font-family: var(--wv-font-mono); font-size: var(--wv-fs-xs); color: var(--wv-fg); }
.workshop-recap-divider {
  border-top: 1px dashed var(--wv-border);
  margin: 4px 0;
}

.workshop-manual-panel { flex: 1 1 auto; }
.workshop-manual-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--wv-space-2);
}
.workshop-manual-body .sketch-anno {
  padding: 0 0 4px;
  line-height: 1.4;
}
.workshop-input {
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-base);
  padding: 4px 6px;
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  background: var(--wv-bg);
  color: var(--wv-fg);
  width: 100%;
}
.workshop-input:focus {
  outline: 2px solid var(--wv-color-copper);
  outline-offset: -1px;
  border-color: var(--wv-color-copper);
}
.workshop-form-row { display: flex; gap: 6px; }
.workshop-form-row > * { flex: 1; }

/* Workshop modals */
.workshop-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 32, 0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.workshop-modal {
  background: var(--wv-bg);
  border: 2px solid var(--wv-fg);
  border-radius: var(--wv-radius-md);
  padding: var(--wv-space-5);
  width: 420px;
  max-width: 90vw;
  font-family: var(--wv-font-display);
}
.workshop-modal h3 {
  margin: 0 0 var(--wv-space-2);
  font-size: var(--wv-fs-lg);
  font-weight: var(--wv-fw-extrabold);
  color: var(--wv-fg);
}
.workshop-modal p {
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg-muted);
  line-height: 1.5;
  margin: 0 0 var(--wv-space-4);
}
.workshop-modal-actions {
  display: flex;
  gap: var(--wv-space-2);
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ─── Dashboard ─────────────────────────────────────────────────────── */

#screen-dashboard.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--wv-space-3);
  gap: var(--wv-space-3);
}

.dash-subtitle {
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg-muted);
  font-style: italic;
}

.dash-kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--wv-space-2);
}
@media (max-width: 1100px) { .dash-kpi-strip { grid-template-columns: repeat(2, 1fr); } }

.dash-kpi-tile {
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-md);
  padding: 8px 12px;
}
.dash-kpi-label {
  font-family: var(--wv-font-display);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wv-fg-muted);
  font-weight: var(--wv-fw-bold);
}
.dash-kpi-value {
  font-family: var(--wv-font-mono);
  font-size: 22px;
  color: var(--wv-fg);
  font-weight: var(--wv-fw-bold);
  margin: 2px 0;
}
.dash-kpi-sub {
  font-family: var(--wv-font-display);
  font-size: 10px;
  color: var(--wv-color-copper);
  font-style: italic;
}

.dash-body {
  display: grid;
  grid-template-columns: 320px 1fr 320px;
  gap: var(--wv-space-3);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
@media (max-width: 1280px) { .dash-body { grid-template-columns: 280px 1fr 280px; } }
@media (max-width: 1100px) { .dash-body { grid-template-columns: 1fr; } }

.dash-filter-form {
  padding: var(--wv-space-2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dash-form-label {
  font-family: var(--wv-font-display);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wv-fg-muted);
  font-weight: var(--wv-fw-bold);
  margin-top: 4px;
}
.dash-divider { border-top: 1px dashed var(--wv-border); margin: 6px 0; }

.dash-reports {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.dash-reports-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: var(--wv-space-2);
  overflow-y: auto;
}
@media (max-width: 1280px) { .dash-reports-grid { grid-template-columns: 1fr; } }
.dash-report-card {
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-base);
  padding: 8px;
  background: var(--wv-bg);
  cursor: pointer;
}
.dash-report-card:hover { border-color: var(--wv-color-copper); }
.dash-report-card.selected {
  border-color: var(--wv-color-copper);
  background: linear-gradient(0deg, rgba(200, 100, 60, 0.05), rgba(200, 100, 60, 0.05)), var(--wv-bg);
  box-shadow: 0 0 0 1px var(--wv-color-copper);
}
.dash-report-row1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dash-report-title {
  font-family: var(--wv-font-display);
  font-weight: var(--wv-fw-bold);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg);
}
.dash-report-desc {
  font-family: var(--wv-font-display);
  font-size: 10px;
  color: var(--wv-fg-muted);
  font-style: italic;
  margin-top: 2px;
}
.dash-report-formats {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.dash-format-pill {
  font-family: var(--wv-font-mono);
  font-size: 9px;
  background: var(--wv-color-ink);
  color: var(--wv-color-paper);
  padding: 1px 6px;
  border-radius: var(--wv-radius-full);
  font-weight: var(--wv-fw-bold);
}

.dash-side-pane {
  display: flex;
  flex-direction: column;
  gap: var(--wv-space-2);
  min-height: 0;
  overflow: hidden;
}
.dash-preview {
  padding: var(--wv-space-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.dash-preview-svg { width: 100%; height: auto; }

.dash-recents { flex: 1 1 auto; }
.dash-recent-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--wv-space-2);
  overflow-y: auto;
}
.dash-recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-base);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-xs);
}
.dash-recent-item .mono { font-family: var(--wv-font-mono); font-size: 11px; }
.dash-recent-meta {
  font-family: var(--wv-font-display);
  font-size: 10px;
  color: var(--wv-color-copper);
  font-style: italic;
}

/* ─── Polygon ───────────────────────────────────────────────────────── */

#screen-polygon.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--wv-space-3);
  gap: var(--wv-space-3);
}

.polygon-body {
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  gap: var(--wv-space-3);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
@media (max-width: 1280px) { .polygon-body { grid-template-columns: 220px 1fr 280px; } }
@media (max-width: 1100px) { .polygon-body { grid-template-columns: 1fr; } }

.polygon-tree { min-height: 0; }
.polygon-tree-body {
  padding: var(--wv-space-2);
  overflow-y: auto;
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg);
}
.tree-node { padding: 3px 0; font-weight: var(--wv-fw-bold); cursor: pointer; }
.tree-node.collapsed { color: var(--wv-fg-muted); }
.tree-node:hover { color: var(--wv-color-copper); }
.tree-children { padding-left: var(--wv-space-3); display: flex; flex-direction: column; gap: 2px; }
.tree-leaf {
  font-family: var(--wv-font-mono);
  font-size: var(--wv-fs-xs);
  color: var(--wv-fg-muted);
  padding: 2px 0;
  cursor: pointer;
}
.tree-leaf:hover { color: var(--wv-fg); }

.polygon-viewport-wrap {
  position: relative;
  background: var(--wv-bg);
  border: 2px solid var(--wv-fg);
  border-radius: var(--wv-radius-md);
  overflow: hidden;
  background-image:
    linear-gradient(to right, rgba(11, 18, 32, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(11, 18, 32, 0.06) 1px, transparent 1px);
  background-size: 24px 24px;
  background-color: var(--wv-bg);
}
.polygon-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.polygon-tool-palette {
  position: absolute;
  left: 10px;
  top: 10px;
  display: flex;
  gap: 4px;
  z-index: 5;
}
.polygon-tool-btn {
  background: var(--wv-bg);
  border: 1px solid var(--wv-fg);
  border-radius: var(--wv-radius-base);
  padding: 4px 10px;
  font-size: 14px;
  cursor: pointer;
  color: var(--wv-fg);
  font-family: var(--wv-font-display);
}
.polygon-tool-btn:hover { background: var(--wv-color-linen); }
.polygon-tool-btn.active {
  background: var(--wv-color-copper);
  color: var(--wv-color-paper);
  border-color: var(--wv-color-copper);
}
.polygon-view-info {
  position: absolute;
  right: 10px;
  top: 10px;
  display: flex;
  gap: 4px;
  z-index: 5;
}
.polygon-view-buttons {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: flex;
  gap: 2px;
  z-index: 5;
}
.polygon-pin-anno {
  position: absolute;
  right: 10px;
  bottom: 10px;
  font-family: var(--wv-font-display);
  font-size: 10px;
  color: var(--wv-color-copper);
  font-style: italic;
  z-index: 5;
}

.polygon-inspector {
  display: flex;
  flex-direction: column;
  gap: var(--wv-space-2);
  min-height: 0;
  overflow-y: auto;
}
.polygon-selection,
.polygon-layers,
.polygon-coh-body {
  padding: var(--wv-space-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg);
}
.polygon-coh-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
}
.polygon-coh-row .mono {
  font-family: var(--wv-font-mono);
  font-size: var(--wv-fs-xs);
  color: var(--wv-fg);
}
.polygon-coh-row.warn { color: #C0392B; }
.polygon-coherence { flex: 1 1 auto; }

/* ─── Hub admin context menu + Instancier popover ───────────────────── */

.hub-ctx-menu {
  background: var(--wv-bg);
  border: 2px solid var(--wv-fg);
  border-radius: var(--wv-radius-md);
  box-shadow: var(--wv-shadow-md);
  padding: 4px;
  min-width: 220px;
  z-index: 250;
}
.hub-ctx-head {
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hub-ctx-kind {
  font-family: var(--wv-font-display);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wv-fg-muted);
  font-weight: var(--wv-fw-bold);
}
.hub-ctx-id {
  font-family: var(--wv-font-mono);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg);
}
.hub-ctx-divider {
  height: 1px;
  background: var(--wv-border);
  margin: 4px 0;
}
.hub-ctx-item {
  display: flex;
  align-items: center;
  gap: var(--wv-space-2);
  padding: 6px 8px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg);
  cursor: pointer;
  border-radius: var(--wv-radius-base);
}
.hub-ctx-item:hover { background: var(--wv-color-linen); }
.hub-ctx-item.danger { color: #C0392B; }
.hub-ctx-foot {
  padding: 4px 8px;
  font-family: var(--wv-font-display);
  font-size: 10px;
  color: var(--wv-color-copper);
  font-style: italic;
}

.hub-instance-popover { min-width: 300px; }
.hub-instance-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 8px;
  max-height: 200px;
  overflow-y: auto;
}
.hub-instance-row {
  display: flex;
  align-items: center;
  gap: var(--wv-space-2);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg);
  cursor: pointer;
}
.hub-instance-row .muted { color: var(--wv-fg-muted); }
.hub-instance-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--wv-space-2);
  padding: 4px 8px;
}

/* ─── Account ───────────────────────────────────────────────────────── */

#screen-account.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--wv-space-3);
  gap: var(--wv-space-3);
}
.account-body {
  display: grid;
  grid-template-columns: 260px 1fr 1fr;
  gap: var(--wv-space-3);
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
@media (max-width: 1100px) { .account-body { grid-template-columns: 1fr; } }

.account-avatar-pane { background: var(--wv-color-linen); }
.account-avatar-body {
  padding: var(--wv-space-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--wv-space-2);
}
.account-avatar-big {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: var(--wv-color-copper);
  color: var(--wv-color-paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--wv-font-display);
  font-size: 56px;
  font-weight: var(--wv-fw-extrabold);
}
.account-divider {
  border-top: 1px dashed var(--wv-border);
  width: 100%;
  margin: var(--wv-space-2) 0;
}
.account-label {
  font-family: var(--wv-font-display);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wv-fg-muted);
  font-weight: var(--wv-fw-bold);
  margin-top: var(--wv-space-2);
}
.account-value {
  font-family: var(--wv-font-mono);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg);
}

.account-pers-body {
  padding: var(--wv-space-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px dashed var(--wv-border);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg);
}
.account-rowkey {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wv-fg-muted);
  font-weight: var(--wv-fw-bold);
}
.account-rowval { font-family: var(--wv-font-mono); font-size: var(--wv-fs-sm); color: var(--wv-fg); }

.account-side-stack {
  display: flex;
  flex-direction: column;
  gap: var(--wv-space-2);
  min-height: 0;
}
.account-billing {
  padding: var(--wv-space-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg);
}
.account-billing-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.account-billing-meta { font-family: var(--wv-font-mono); font-size: 10px; color: var(--wv-fg-muted); }
.account-invoice-row {
  display: grid;
  grid-template-columns: 1fr 1fr 60px;
  gap: var(--wv-space-2);
  padding: 2px 0;
  border-bottom: 1px dashed var(--wv-border);
  font-family: var(--wv-font-mono);
  font-size: var(--wv-fs-xs);
}
.account-pdf-link {
  color: var(--wv-color-copper);
  cursor: pointer;
  font-style: italic;
  text-align: right;
}
.account-perms { flex: 1 1 auto; }
.account-perms-body {
  padding: var(--wv-space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.account-perm-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px dashed var(--wv-border);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
}

/* ─── Integrations ──────────────────────────────────────────────────── */

#screen-integrations.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--wv-space-3);
  gap: var(--wv-space-3);
}
.integrations-body {
  display: flex;
  flex-direction: column;
  gap: var(--wv-space-5);
  overflow: auto;
  padding-bottom: var(--wv-space-5);
}
.integrations-cat-title {
  font-family: var(--wv-font-display);
  font-weight: var(--wv-fw-extrabold);
  font-size: var(--wv-fs-lg);
  color: var(--wv-fg);
  margin: 0 0 var(--wv-space-2);
}
.integrations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--wv-space-3);
}
.integration-card {
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-rows: auto auto auto;
  grid-template-areas:
    "icon meta"
    "icon meta"
    "status btn";
  gap: var(--wv-space-2);
  padding: var(--wv-space-3);
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-md);
  align-items: start;
}
.integration-card.status-soon { opacity: 0.65; }
.integration-icon { grid-area: icon; font-size: 28px; }
.integration-meta { grid-area: meta; }
.integration-name {
  font-family: var(--wv-font-display);
  font-weight: var(--wv-fw-bold);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg);
}
.integration-desc {
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-xs);
  color: var(--wv-fg-muted);
  margin-top: 2px;
}
.integration-status {
  grid-area: status;
  font-family: var(--wv-font-mono);
  font-size: 9px;
  padding: 2px 8px;
  border-radius: var(--wv-radius-full);
  font-weight: var(--wv-fw-bold);
  align-self: center;
  justify-self: start;
}
.integration-status.status-available { background: #1F8A5B; color: #fff; }
.integration-status.status-beta { background: var(--wv-color-copper); color: var(--wv-color-paper); }
.integration-status.status-soon { background: var(--wv-bg-subtle); color: var(--wv-fg-muted); }
.integration-card .btn-primary,
.integration-card .btn-secondary { grid-area: btn; justify-self: end; padding: 4px 10px; font-size: var(--wv-fs-xs); }

/* ─── Users ─────────────────────────────────────────────────────────── */

#screen-users.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--wv-space-3);
  gap: var(--wv-space-3);
}
.users-body {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: var(--wv-space-3);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
@media (max-width: 1100px) { .users-body { grid-template-columns: 1fr; } }

.users-list-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.users-list-controls {
  padding: var(--wv-space-2);
  border-bottom: 1px solid var(--wv-border);
  background: var(--wv-color-linen);
}
.users-list {
  list-style: none;
  margin: 0;
  padding: var(--wv-space-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.users-list-btn {
  display: flex;
  align-items: center;
  gap: var(--wv-space-2);
  padding: 6px 8px;
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-base);
  background: var(--wv-bg);
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: var(--wv-font-display);
}
.users-list-btn:hover { border-color: var(--wv-color-copper); }
.users-list-btn.selected {
  background: var(--wv-color-linen);
  border-color: var(--wv-color-copper);
  box-shadow: 0 0 0 1px var(--wv-color-copper);
}
.users-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--wv-color-linen);
  border: 1.5px solid var(--wv-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--wv-font-mono);
  font-size: 12px;
  color: var(--wv-fg);
  flex-shrink: 0;
}
.users-meta { flex: 1; min-width: 0; }
.users-row1 { display: flex; justify-content: space-between; align-items: center; }
.users-name {
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  font-weight: var(--wv-fw-bold);
  color: var(--wv-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.users-email, .users-last {
  font-family: var(--wv-font-mono);
  font-size: 10px;
  color: var(--wv-fg-muted);
}

.users-detail-pane {
  display: flex;
  flex-direction: column;
  gap: var(--wv-space-2);
  min-height: 0;
  overflow: auto;
}
.users-profile {
  padding: var(--wv-space-3);
  display: grid;
  grid-template-columns: 64px 1fr 1fr;
  gap: var(--wv-space-3);
  align-items: center;
}
.users-profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--wv-color-copper);
  color: var(--wv-color-paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--wv-font-display);
  font-size: 22px;
  font-weight: var(--wv-fw-extrabold);
}
.users-profile-name {
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-lg);
  font-weight: var(--wv-fw-bold);
  color: var(--wv-fg);
}
.users-profile-email {
  font-family: var(--wv-font-mono);
  font-size: var(--wv-fs-xs);
  color: var(--wv-fg-muted);
}
.users-role-picker { display: flex; flex-direction: column; gap: 4px; }
.users-role-desc {
  font-family: var(--wv-font-display);
  font-size: 10px;
  color: var(--wv-color-copper);
  font-style: italic;
  text-align: right;
}

.users-perms-panel { flex: 1 1 auto; display: flex; flex-direction: column; }
.users-perms-anno {
  padding: 4px 8px;
  font-family: var(--wv-font-display);
  font-size: 10px;
  color: var(--wv-color-copper);
  font-style: italic;
}
.users-perms-scroll {
  overflow: auto;
  padding: 0 var(--wv-space-2);
}
.users-perms-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-xs);
}
.users-perms-table th {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--wv-border);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wv-fg-muted);
  font-weight: var(--wv-fw-bold);
  background: var(--wv-color-linen);
}
.users-perms-table th.role-col {
  text-align: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  vertical-align: bottom;
  height: 90px;
}
.users-perms-table td {
  padding: 4px 6px;
  border-bottom: 1px dashed var(--wv-border);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-xs);
  color: var(--wv-fg);
}
.users-perms-table td.role-cell {
  text-align: center;
  font-family: var(--wv-font-mono);
}
.users-perms-table td.role-cell.yes { color: var(--wv-color-copper); font-weight: var(--wv-fw-bold); }
.users-perms-table td.role-cell.no { color: var(--wv-fg-muted); }
.users-divider { border-top: 1px dashed var(--wv-border); margin: var(--wv-space-2) 0; }
.users-db-access {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wv-space-2);
  padding: 4px var(--wv-space-2);
}
.users-db-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px var(--wv-space-2);
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-full);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-xs);
  cursor: pointer;
  background: var(--wv-bg);
}
.users-actions {
  display: flex;
  gap: var(--wv-space-2);
  justify-content: flex-end;
  padding: var(--wv-space-2);
  flex-wrap: wrap;
}

/* ─── Workflow modals (CreatePlan, NewBase, RunCheckDetail) ─────────── */
.wv-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 32, 0.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--wv-space-3);
}
.wv-modal {
  background: var(--wv-bg);
  border: 2px solid var(--wv-fg);
  border-radius: var(--wv-radius-lg);
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--wv-shadow-lg);
}
.wv-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--wv-space-3) var(--wv-space-5);
  border-bottom: 1px solid var(--wv-border);
}
.wv-modal-head h3 {
  margin: 0;
  font-family: var(--wv-font-display);
  font-weight: var(--wv-fw-extrabold);
  font-size: var(--wv-fs-lg);
  color: var(--wv-fg);
}
.wv-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--wv-fg-muted);
}
.wv-modal-close:hover { color: var(--wv-fg); }
.wv-modal-body {
  padding: var(--wv-space-3) var(--wv-space-5);
  overflow-y: auto;
}
.wv-modal-foot {
  display: flex;
  gap: var(--wv-space-2);
  justify-content: flex-end;
  padding: var(--wv-space-3) var(--wv-space-5);
  border-top: 1px solid var(--wv-border);
  background: var(--wv-color-linen);
}

.wv-field { margin-bottom: var(--wv-space-3); }
.wv-field-label {
  display: block;
  font-family: var(--wv-font-display);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wv-fg-muted);
  font-weight: var(--wv-fw-bold);
  margin-bottom: 4px;
}
.wv-radio-row {
  display: flex;
  gap: var(--wv-space-2);
}
.wv-radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px var(--wv-space-2);
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-full);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  cursor: pointer;
  background: var(--wv-bg);
}
.wv-radio-pill input { margin-right: 2px; }
.wv-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-base);
  padding: 6px;
  background: var(--wv-bg);
}
.wv-chip-removable {
  display: inline-flex;
  align-items: center;
  cursor: default;
}
.wv-chip-x {
  cursor: pointer;
  margin-left: 4px;
  color: var(--wv-fg-muted);
  font-weight: var(--wv-fw-bold);
}
.wv-chip-x:hover { color: #C0392B; }
.wv-tag-input {
  border: none;
  outline: none;
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  padding: 4px 6px;
  min-width: 80px;
  flex: 1;
  background: transparent;
}

.wv-rcheck-summary {
  display: flex;
  gap: var(--wv-space-3);
  margin-bottom: var(--wv-space-3);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  font-weight: var(--wv-fw-bold);
}
.wv-rcheck-sum.err { color: #C0392B; }
.wv-rcheck-sum.warn { color: var(--wv-color-copper); }
.wv-rcheck-sum.info { color: var(--wv-fg-muted); }

.wv-rcheck-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
}
.wv-rcheck-table th {
  background: var(--wv-color-linen);
  padding: 6px 8px;
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wv-fg-muted);
  font-weight: var(--wv-fw-bold);
  border-bottom: 1px solid var(--wv-border);
}
.wv-rcheck-table td {
  padding: 6px 8px;
  border-bottom: 1px dashed var(--wv-border);
}
.wv-rcheck-table td.mono { font-family: var(--wv-font-mono); font-size: var(--wv-fs-xs); }
.wv-rcheck-error td:first-child { color: #C0392B; font-weight: var(--wv-fw-bold); }
.wv-rcheck-warning td:first-child { color: var(--wv-color-copper); font-weight: var(--wv-fw-bold); }
.wv-rcheck-info td:first-child { color: var(--wv-fg-muted); }
.wv-rcheck-jump { padding: 2px 8px; font-size: var(--wv-fs-xs); }

/* ─── Trash ─────────────────────────────────────────────────────────── */

#screen-trash.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--wv-space-3);
  gap: var(--wv-space-3);
}
.trash-body {
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-md);
  padding: var(--wv-space-3);
  overflow: auto;
  flex: 1 1 auto;
}
.trash-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
}
.trash-table th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--wv-border);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wv-fg-muted);
  font-weight: var(--wv-fw-bold);
  background: var(--wv-color-linen);
}
.trash-table td {
  padding: 6px 8px;
  border-bottom: 1px dashed var(--wv-border);
}
.trash-table td.mono { font-family: var(--wv-font-mono); font-size: var(--wv-fs-xs); }
.trash-table td.trash-warn { color: #C0392B; font-weight: var(--wv-fw-bold); }
.trash-table button { margin-left: 4px; padding: 2px 8px; font-size: 11px; }

/* ─── Back-office STAFF ─────────────────────────────────────────────── */

#screen-staff.active {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--wv-space-3);
  gap: var(--wv-space-3);
  overflow: auto;
}
.staff-body {
  display: flex;
  flex-direction: column;
  gap: var(--wv-space-5);
  padding-bottom: var(--wv-space-5);
}
.staff-section-title {
  font-family: var(--wv-font-display);
  font-weight: var(--wv-fw-extrabold);
  font-size: var(--wv-fs-lg);
  color: var(--wv-fg);
  margin: 0 0 var(--wv-space-3);
}
.staff-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--wv-space-2);
}
@media (max-width: 1280px) { .staff-kpi-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px)  { .staff-kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.staff-tenants {
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-md);
  padding: var(--wv-space-3);
  overflow: auto;
}
.staff-modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--wv-space-3);
}
.staff-module-card {
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-md);
  padding: var(--wv-space-3);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.staff-module-title {
  font-family: var(--wv-font-display);
  font-weight: var(--wv-fw-bold);
  font-size: var(--wv-fs-sm);
  color: var(--wv-fg);
}
.staff-module-desc {
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-xs);
  color: var(--wv-fg-muted);
  line-height: 1.4;
  flex: 1;
}
.staff-module-card .sketch-chip {
  align-self: flex-start;
  background: var(--wv-bg-subtle);
  color: var(--wv-fg-muted);
}

/* ─── Back-office STAFF — phase 2 sidebar + modules ─────────────────── */

.staff-shell {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: var(--wv-space-2);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
@media (max-width: 900px) { .staff-shell { grid-template-columns: 1fr; } }

.staff-sidebar {
  background: var(--wv-color-ink);
  border-radius: var(--wv-radius-md);
  padding: var(--wv-space-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}
.staff-sb-btn {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: var(--wv-space-2);
  align-items: center;
  padding: 8px var(--wv-space-2);
  background: transparent;
  border: none;
  border-radius: var(--wv-radius-base);
  cursor: pointer;
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
  color: rgba(250, 250, 247, 0.7);
  text-align: left;
}
.staff-sb-btn:hover { background: rgba(250, 250, 247, 0.08); color: var(--wv-color-paper); }
.staff-sb-btn.active {
  background: rgba(200, 100, 60, 0.18);
  color: var(--wv-color-paper);
  font-weight: var(--wv-fw-bold);
}
.staff-sb-btn.active::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
}
.staff-sb-icon { font-size: 14px; text-align: center; }
.staff-sb-label { font-size: var(--wv-fs-xs); }

.staff-content {
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-md);
  padding: var(--wv-space-4);
  overflow-y: auto;
}

.bo-body { display: flex; flex-direction: column; gap: var(--wv-space-4); }
.bo-h {
  font-family: var(--wv-font-display);
  font-weight: var(--wv-fw-extrabold);
  font-size: var(--wv-fs-2xl);
  color: var(--wv-fg);
  margin: 0;
}
.bo-header-row {
  display: flex;
  align-items: center;
  gap: var(--wv-space-3);
  flex-wrap: wrap;
  justify-content: space-between;
}
.bo-toolbar {
  display: flex;
  gap: var(--wv-space-2);
  align-items: center;
  flex-wrap: wrap;
}
.bo-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--wv-space-3);
}
.bo-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--wv-space-3);
}
@media (max-width: 1100px) { .bo-grid-2, .bo-grid-3 { grid-template-columns: 1fr; } }

.bo-box {
  background: var(--wv-bg);
  border: 1px solid var(--wv-border);
  border-radius: var(--wv-radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.bo-box-head {
  padding: 6px var(--wv-space-3);
  background: var(--wv-color-linen);
  border-bottom: 1px solid var(--wv-border);
  font-family: var(--wv-font-display);
  font-weight: var(--wv-fw-bold);
  font-size: var(--wv-fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--wv-fg);
}
.bo-box-body { padding: var(--wv-space-3); }

.bo-list { display: flex; flex-direction: column; gap: 4px; }
.bo-row {
  display: flex;
  align-items: center;
  gap: var(--wv-space-2);
  padding: 6px 0;
  border-bottom: 1px dashed var(--wv-border);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
}
.bo-row:last-child { border-bottom: none; }
.bo-row .flex1 { flex: 1; }
.bo-row .mono { font-family: var(--wv-font-mono); font-size: var(--wv-fs-xs); }
.bo-row-line {
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-xs);
  color: var(--wv-fg-muted);
  padding: 2px 0;
}
.bo-stack-row {
  padding: 6px 0;
  border-bottom: 1px dashed var(--wv-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bo-stack-row:last-child { border-bottom: none; }
.bo-ts {
  font-family: var(--wv-font-display);
  font-size: 10px;
  color: var(--wv-color-copper);
  font-style: italic;
  white-space: nowrap;
}
.bo-trend.up { color: #1F8A5B; font-family: var(--wv-font-mono); font-size: 11px; }
.bo-trend.down { color: #C0392B; font-family: var(--wv-font-mono); font-size: 11px; }

.bo-funnel { display: flex; flex-direction: column; gap: 6px; }
.bo-funnel-row {
  display: flex;
  align-items: center;
  gap: var(--wv-space-2);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
}
.bo-funnel-row > span:first-child { width: 200px; }
.bo-funnel-bar {
  flex: 1;
  height: 14px;
  background: var(--wv-bg-subtle);
  border-radius: var(--wv-radius-base);
  overflow: hidden;
}
.bo-funnel-bar > div { height: 100%; opacity: 0.7; }
.bo-funnel-row .mono {
  font-family: var(--wv-font-mono);
  font-size: 11px;
  min-width: 60px;
  text-align: right;
}

.bo-load { display: flex; flex-direction: column; gap: 6px; }
.bo-load-row { display: flex; flex-direction: column; gap: 2px; }
.bo-load-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-xs);
}
.bo-load-meta .mono { font-family: var(--wv-font-mono); font-size: 11px; }
.bo-load-bar {
  height: 10px;
  background: var(--wv-bg-subtle);
  border-radius: var(--wv-radius-base);
  overflow: hidden;
}
.bo-load-bar > div { height: 100%; opacity: 0.6; transition: width 250ms; }

.bo-alert-row {
  display: flex;
  align-items: center;
  gap: var(--wv-space-2);
  padding: 4px 0;
  border-bottom: 1px dashed var(--wv-border);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
}
.bo-alert-row .flex1 { flex: 1; }

.bo-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
}
.bo-table th {
  background: var(--wv-color-linen);
  font-family: var(--wv-font-display);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: var(--wv-fw-bold);
  color: var(--wv-fg-muted);
  padding: 6px;
  text-align: left;
  border-bottom: 1px solid var(--wv-border);
  position: sticky;
  top: 0;
  z-index: 1;
}
.bo-table td {
  padding: 4px 6px;
  border-bottom: 1px dashed var(--wv-border);
  font-size: var(--wv-fs-xs);
}
.bo-table td.mono { font-family: var(--wv-font-mono); font-size: 11px; }
.bo-table-wrap { overflow: auto; max-height: 540px; }

.bo-logs {
  margin: 0;
  padding: 12px;
  background: var(--wv-color-ink);
  color: var(--wv-color-paper);
  font-family: var(--wv-font-mono);
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  border-radius: var(--wv-radius-md);
  max-height: 360px;
  overflow: auto;
}

.bo-form { display: flex; flex-direction: column; gap: 4px; }
.bo-form-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed var(--wv-border);
  font-family: var(--wv-font-display);
  font-size: var(--wv-fs-sm);
}
.bo-form-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--wv-fg-muted);
  font-weight: var(--wv-fw-bold);
}
.bo-form-value { color: var(--wv-fg); }

.bo-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--wv-border);
  margin-bottom: var(--wv-space-2);
}
.bo-actions-row {
  display: flex;
  gap: var(--wv-space-2);
  flex-wrap: wrap;
  padding-top: var(--wv-space-2);
  border-top: 1px dashed var(--wv-border);
}

/* ─── Phase 47 — RTL support (Arabic, Hebrew) ──────────────────────────
 * Override directional properties when the document root carries
 * `dir="rtl"`. Most modern selectors below would benefit from a
 * full rewrite using logical properties (padding-inline-start etc.)
 * but this layer is a safe, additive overlay : it mirrors the layout
 * without touching the existing LTR rules.
 */
html[dir="rtl"] body { direction: rtl; }
html[dir="rtl"] .sketch-topbar-left,
html[dir="rtl"] .sketch-topbar-right { flex-direction: row-reverse; }
html[dir="rtl"] .menu-item { text-align: right; }
html[dir="rtl"] .sketch-grid { direction: rtl; }
html[dir="rtl"] .sketch-col-left  { order: 3; }
html[dir="rtl"] .sketch-col-right { order: 1; }
html[dir="rtl"] .sketch-col-center { order: 2; }
html[dir="rtl"] .hub-col-head { flex-direction: row-reverse; }
html[dir="rtl"] .workshop-input,
html[dir="rtl"] .workshop-label { text-align: right; }
html[dir="rtl"] .mono { unicode-bidi: isolate; }    /* preserve LTR for codes */
html[dir="rtl"] .sketch-wire-label { text-anchor: end; }
html[dir="rtl"] .account-row { flex-direction: row-reverse; }
html[dir="rtl"] .sketch-back::before { content: " →"; }
html[dir="rtl"] .sketch-back { transform: scaleX(-1); }

/* Use logical properties for newly-added Phase 47+ rules so they
 * work in both LTR and RTL with no overrides. */
.wv-pad-start { padding-inline-start: var(--wv-space-3); }
.wv-pad-end   { padding-inline-end:   var(--wv-space-3); }
.wv-margin-start { margin-inline-start: var(--wv-space-3); }
.wv-margin-end   { margin-inline-end:   var(--wv-space-3); }

/* ─── Phase 60 — Collapsible Sketch side columns ─────────────────────── */
.sketch-grid.left-collapsed {
  grid-template-columns: 32px 1fr 320px !important;
}
.sketch-grid.right-collapsed {
  grid-template-columns: 280px 1fr 32px !important;
}
.sketch-grid.left-collapsed.right-collapsed {
  grid-template-columns: 32px 1fr 32px !important;
}
.sketch-col-left.collapsed, .sketch-col-right.collapsed {
  width: 32px;
  background: var(--wv-bg-soft);
  border: 1px solid var(--wv-border);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: background 0.15s;
}
.sketch-col-left.collapsed:hover, .sketch-col-right.collapsed:hover {
  background: var(--wv-color-linen);
}
.sketch-col-toggle {
  font-size: 18px;
  color: var(--wv-color-copper);
  font-weight: 600;
}
.sketch-col-toggle-btn {
  position: absolute;
  top: 8px;
  right: -2px;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--wv-bg-soft);
  border: 1px solid var(--wv-border);
  cursor: pointer;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--wv-color-copper);
}
.sketch-col-toggle-btn.right {
  right: auto;
  left: -2px;
}
.sketch-col-left, .sketch-col-right { position: relative; }

