@import url('https://fonts.googleapis.com/css2?family=Play:wght@400;700&display=swap');

:root {
  /* Sfondi */
  --bg-primary:       #282a36;
  --bg-secondary:     #1d1b22;
  --bg-current-line:  #5a6891;

  /* Testo */
  --text-primary:  #f8f8f2;
  --text-comment:  #8ba3d4;

  /* Colori accento */
  --color-red:    #ff5555;
  --color-orange: #ffb86c;
  --color-yellow: #f1fa8c;
  --color-green:  #50fa7b;
  --color-cyan:   #8be9fd;
  --color-purple: #bd93f9;
  --color-pink:   #ff79c6;

  /* Alias */
  --accent-color: var(--color-purple);
  --accent-hover: #a569e1;

  /* Hover variants */
  --color-red-hover:   #cc3333;
  --color-green-hover: #3dcc60;
  --color-line-hover:  #6b7ba4;

  /* Spacing */
  --space-xs: 0.3rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

iconify-icon {
  display: inline-flex;
}

body {
  margin: 0;
  padding: 0 0 24px;
  font-family: 'Play', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

/* Layout full-viewport per pagine-tool: header/toolbar fissi, contenuto centrale che scorre.
   Le sezioni non scrollabili devono essere flex-shrink:0; quella centrale flex:1; min-height:0.
   I 24px di padding-bottom restano riservati alla status-bar fissa. */
body.page-fill {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Bottoni ─────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 0.8rem;
  font-family: 'Play', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  line-height: 1;
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-full { width: 100%; }

.btn-sm {
  font-size: 0.78rem;
  padding: 0.3rem 0.7rem;
  text-transform: uppercase;
}

.btn-xs {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  text-transform: uppercase;
}

.btn-primary {
  background: var(--accent-color);
  color: var(--bg-primary);
}
.btn-primary:not(:disabled):hover { background: var(--accent-hover); }
.btn-primary.cancel { background: var(--color-red); }
.btn-primary.cancel:not(:disabled):hover { background: var(--color-red-hover); }

.btn-secondary {
  background: var(--bg-current-line);
  color: var(--text-primary);
}
.btn-secondary:not(:disabled):hover { background: var(--color-line-hover); }

.btn-success {
  background: var(--color-green);
  color: var(--bg-primary);
}
.btn-success:not(:disabled):hover { background: var(--color-green-hover); }

.btn-danger {
  background: var(--color-red);
  color: var(--bg-primary);
}
.btn-danger:not(:disabled):hover { background: var(--color-red-hover); }

/* Bottone icona — quadrato, senza bordo, sfondo trasparente */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
  background: none;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  transition: background 0.12s, opacity 0.12s;
  line-height: 1;
}
.btn-icon:not(:disabled):hover { background: var(--bg-current-line); }
.btn-icon:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-icon.danger { color: var(--color-red); }
.btn-icon.danger:not(:disabled):hover { background: rgba(255, 85, 85, 0.12); }

/* ── Input / Textarea / Select ───────────────────────────────── */

.field-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field-wrap label {
  font-size: 0.75rem;
  color: var(--text-comment);
}

.field-wrap input,
.field-wrap textarea,
.field-wrap select {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--bg-current-line);
  border-radius: 2px;
  color: var(--text-primary);
  font-family: 'Play', sans-serif;
  font-size: 0.82rem;
  padding: 0.4rem 0.5rem;
}
.field-wrap input:focus,
.field-wrap textarea:focus,
.field-wrap select:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 1px;
}

.field-wrap textarea {
  resize: vertical;
  min-height: 5rem;
  line-height: 1.4;
}

.field-wrap select option {
  background: var(--bg-secondary);
}

/* ── Banner notifiche ────────────────────────────────────────── */

.banner {
  position: absolute;
  bottom: 1rem;
  left: 0.6rem;
  right: 0.6rem;
  padding: 0.6rem 0.8rem;
  border-radius: 2px;
  font-size: 0.82rem;
  font-weight: 700;
  display: none;
  z-index: 100;
  overflow-wrap: break-word;
}
.banner.success { background: var(--color-green); color: var(--bg-primary); }
.banner.error   { background: var(--color-red);   color: var(--bg-primary); }
.banner.visible { display: block; }

/* ── Dialog di conferma ──────────────────────────────────────── */

.confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.confirm-overlay.visible { display: flex; }

.confirm-dialog {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-current-line);
  border-radius: 2px;
  padding: 1.25rem 1.5rem;
  max-width: 340px;
  width: calc(100% - 2rem);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.confirm-dialog p {
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.5;
  margin: 0 0 1.1rem;
}

.confirm-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}


/* ── Nav dropdown ────────────────────────────────────────────── */

.nav-pages-dropdown {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-pages-dropdown .btn-icon {
  border: 1px solid var(--bg-current-line);
}

.nav-pages-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--bg-current-line);
  border-radius: 2px;
  min-width: 210px;
  max-height: 72vh;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  padding: 0.25rem 0;
}

.nav-pages-menu.open {
  display: flex;
}

/* ── Accordion group header ─────────────────────────────────── */

.nav-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.48rem 0.75rem;
  font-family: 'Play', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-comment);
  background: transparent;
  border: none;
  border-top: 1px solid var(--bg-current-line);
  cursor: pointer;
  text-align: left;
  user-select: none;
  transition: color 0.12s;
}

.nav-group-header.first { border-top: none; }

.nav-group-header:hover { color: var(--text-primary); }
.nav-group-header.open  { color: var(--accent-color); }

.nav-group-chevron {
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: transform 0.18s ease;
}

.nav-group-header.open .nav-group-chevron {
  transform: rotate(90deg);
}

/* ── Accordion pages list ─���─────────────────────────────────── */

.nav-group-pages {
  display: none;
  flex-direction: column;
}

.nav-group-pages.open {
  display: flex;
}

.nav-pages-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.75rem 0.42rem 1.3rem;
  font-family: 'Play', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s;
}

.nav-pages-item:hover {
  background: var(--bg-current-line);
}

.nav-pages-item[aria-current='page'] {
  color: var(--accent-color);
}

/* ── Page header ─────────────────────────────────────────────── */

.page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--bg-current-line);
  flex-shrink: 0;
  position: relative;
}

.page-header-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-color);
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin: 0;
  white-space: nowrap;
}

/* Gruppo azioni a destra nel page-header */
.page-header-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* ── Domain nav (sub-nav orizzontale nel page-header) ────────── */

.domain-nav {
  display: flex;
  gap: 0;
  align-items: center;
}

.domain-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  font-family: 'Play', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-comment);
  text-decoration: none;
  border-radius: 2px;
  transition: color 0.12s, background 0.12s;
  white-space: nowrap;
}

.domain-nav-item:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

.domain-nav-item[aria-current='page'] {
  color: var(--accent-color);
}

/* ── Tabs bar ────────────────────────────────────────────────── */

.tabs-bar {
  display: flex;
  gap: 0;
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--bg-current-line);
  flex-shrink: 0;
  padding: 0 1.5rem;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.1rem;
  font-family: 'Play', sans-serif;
  font-size: 0.84rem;
  font-weight: 700;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--text-comment);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
  text-decoration: none;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active,
.tab-btn[aria-current='page'] {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
}

.tabs-bar--inner {
  background: transparent;
  border-bottom-color: var(--bg-current-line);
  padding: 0 1rem;
}

.tab-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}
.tab-panel.active { display: flex; }

/* ── Sidebar ─────────────────────────────────────────────────── */

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-right: 1px solid var(--bg-current-line);
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-section {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--bg-current-line);
  flex-shrink: 0;
}

.sidebar-section--grow {
  flex: 1;
  overflow-y: auto;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}

.sidebar-section-header .sidebar-label { margin-bottom: 0; }

.sidebar-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-comment);
  margin-bottom: 0.45rem;
}

.sidebar-input {
  width: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--bg-current-line);
  border-radius: 2px;
  padding: 0.35rem 0.55rem;
  font-size: 0.82rem;
  font-family: inherit;
  box-sizing: border-box;
}
.sidebar-input:focus { outline: 2px solid var(--accent-color); outline-offset: 1px; }

.sidebar-select {
  width: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--bg-current-line);
  border-radius: 2px;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.sidebar-select:focus { outline: 2px solid var(--accent-color); outline-offset: 1px; }

/* Item list */
.sidebar-item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-item-list-empty {
  font-size: 0.78rem;
  color: var(--text-comment);
  padding: 0.25rem 0;
}

.sidebar-group-header {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-comment);
  padding: 0.45rem 0 0.1rem;
  pointer-events: none;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.55rem;
  cursor: pointer;
  border-radius: 2px;
  background: var(--bg-primary);
  border-left: 2px solid transparent;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, color 0.12s;
}
.sidebar-item:hover { color: var(--color-cyan); border-left-color: var(--color-cyan); }
.sidebar-item.active { border-left-color: var(--color-green); }

.sidebar-item .sidebar-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-item .sidebar-item-name {
  font-size: 0.78rem;
  font-family: 'Cascadia Code', Consolas, monospace;
  overflow-wrap: break-word;
}

.sidebar-item .sidebar-item-sub {
  font-size: 0.68rem;
  color: var(--text-comment);
  font-family: 'Cascadia Code', Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-item .sidebar-item-action { color: var(--text-comment); }
.sidebar-item .sidebar-item-action:hover { color: var(--color-green); }
.sidebar-item.active .sidebar-item-action { color: var(--color-red); }
.sidebar-item.active .sidebar-item-action:hover {
  background: rgba(255, 85, 85, 0.12);
  color: var(--color-red);
}

/* Tree nesting — sidebar-item-group wraps row + children */
.sidebar-item-group {
  display: block;
}

.sidebar-item--parent {
  cursor: pointer;
  user-select: none;
}

.sidebar-item-chevron {
  color: var(--text-comment);
  font-size: 0.72em;
  flex-shrink: 0;
  transition: transform 0.15s;
}

.sidebar-item-group:not(.sidebar-item--open) .sidebar-item-chevron {
  transform: rotate(-90deg);
}

.sidebar-children {
  display: none;
  padding-left: 0.85rem;
  padding-top: 0.1rem;
}

.sidebar-item-group.sidebar-item--open > .sidebar-children {
  display: flex;
}

/* ── Sidebar layout — sidebar fissa + main flex:1 ────────────── */
/*    Worked example: lab/templates/sidebar/                       */

.sidebar-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sidebar-layout > .sidebar {
  width: 250px;
}

.sidebar-layout .content-wrap {
  flex: 1;
  overflow-y: auto;
  max-width: none;
}

/* ── Map layout — sidebar fissa + mappa flex:1 ───────────────── */
/*    Worked example: lab/templates/map/                           */

.map-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.map-layout > .sidebar {
  width: 250px;
}

.map-area {
  flex: 1;
  min-width: 0;
  position: relative;
}

/* ── Inspector layout — sidebar + main + panel destro ─────────── */
/*    Worked example: lab/templates/inspector/                     */
/*    Usato per pagine viewer/editor con history a sinistra,       */
/*    canvas/contenuto principale al centro, pannello dettagli     */
/*    con tab a destra. Ogni colonna è flex column indipendente.   */

.inspector-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.inspector-layout > .sidebar {
  width: 280px;
}

.inspector-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.inspector-panel {
  width: 320px;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-left: 1px solid var(--bg-current-line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Icona dentro .sidebar-item — dimensione e shrink canonici */
.sidebar-icon {
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* ── Content wrap (form/detail pages) ───────────────────────── */

.content-wrap {
  max-width: 740px;
  margin: 0 auto;
  padding: var(--space-lg);
  flex: 1;
  overflow-y: auto;
}

/* ── Form section ────────────────────────────────────────────── */

.form-section {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--bg-current-line);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-section:last-child {
  border-bottom: none;
}

.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-comment);
  margin: 0;
}

.section-hint {
  font-size: 0.78rem;
  color: var(--text-comment);
  line-height: 1.5;
  margin: 0;
}

/* Lista di regole/note inside .form-section o .field-wrap.
   Worked example: lab/templates/standard/ */
.hint-list {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.content-wrap a,
.section-hint a,
.info-list a {
  color: var(--accent-color);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent-color);
  transition: color 120ms ease, border-color 120ms ease;
}
.content-wrap a:hover,
.section-hint a:hover,
.info-list a:hover {
  color: var(--accent-hover);
  border-bottom-color: var(--accent-hover);
}

/* ── Table utilities ─────────────────────────────────────────── */

.table-toolbar {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--bg-current-line);
  flex-shrink: 0;
}

.table-toolbar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  flex-wrap: wrap;
}

.table-toolbar-row + .table-toolbar-row {
  border-top: 1px solid var(--bg-current-line);
}

/* Input/select compatti dentro la toolbar — usati per filtri */
.table-toolbar select,
.table-toolbar input[type='date'],
.table-toolbar input[type='number'],
.table-toolbar input[type='search'],
.table-toolbar input[type='text'] {
  font-family: 'Play', sans-serif;
  font-size: 0.8rem;
  padding: 0.2rem 0.45rem;
  background: var(--bg-primary);
  border: 1px solid var(--bg-current-line);
  color: var(--text-primary);
  border-radius: 2px;
  height: 28px;
  outline: none;
}
.table-toolbar select:focus,
.table-toolbar input:focus {
  border-color: var(--accent-color);
}

.toolbar-count {
  font-size: 0.78rem;
  color: var(--text-comment);
  font-family: monospace;
}

.table-wrap {
  flex: 1;
  min-height: 0;
}

/* ── Tabulator overrides — tema Dracula ──────────────────────── */

.tabulator {
  background: var(--bg-primary) !important;
  border: none !important;
  font-family: 'Play', sans-serif !important;
  font-size: 0.8rem !important;
  height: 100% !important;
}

.tabulator .tabulator-header {
  background: var(--bg-secondary) !important;
  border-bottom: 2px solid var(--bg-current-line) !important;
}

.tabulator .tabulator-header .tabulator-col {
  background: var(--bg-secondary) !important;
  border-right: 1px solid var(--bg-current-line) !important;
  color: var(--text-comment) !important;
  font-size: 0.75rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
}

.tabulator .tabulator-header .tabulator-col.tabulator-sortable:hover {
  background: var(--bg-current-line) !important;
  color: var(--text-primary) !important;
}

.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input {
  background: var(--bg-primary) !important;
  border: 1px solid var(--bg-current-line) !important;
  color: var(--text-primary) !important;
  font-family: 'Play', sans-serif !important;
  font-size: 0.75rem !important;
  padding: 0.2rem 0.4rem !important;
  border-radius: 2px !important;
  outline: none !important;
}
.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input:focus {
  border-color: var(--accent-color) !important;
}

.tabulator .tabulator-tableHolder {
  background: var(--bg-primary) !important;
}

.tabulator .tabulator-row {
  background: var(--bg-primary) !important;
  border-bottom: 1px solid var(--bg-current-line) !important;
  color: var(--text-primary) !important;
  cursor: pointer;
}

.tabulator .tabulator-row:hover,
.tabulator .tabulator-row.tabulator-row-even:hover {
  background: var(--bg-secondary) !important;
}

.tabulator .tabulator-row.tabulator-row-even {
  background: color-mix(in srgb, var(--bg-primary) 80%, var(--bg-secondary) 20%) !important;
}

.tabulator .tabulator-row .tabulator-cell {
  border-right: 1px solid var(--bg-current-line) !important;
  padding: 0.35rem 0.6rem !important;
}

/* Wrapper standard per il contenuto di ogni cella Tabulator.
   Regola: ogni formatter CUSTOM deve restituire <div class="cell-wrap">...</div> come radice.
   Per le colonne plain-text usare columnDefaults:
     columnDefaults: { formatter: cell => `<div class="cell-wrap">${cell.getValue()??''}</div>` }
   I formatter built-in di Tabulator (progress, star, rownum) gestiscono internamente
   l'altezza — NON richiedono cell-wrap e bypassano columnDefaults.
   NON modificare display su .tabulator-cell — rompe il flusso inline-block del row.
*/
.tabulator .tabulator-row .tabulator-cell > .cell-wrap {
  display: flex;
  align-items: center;
  height: 100%;
  width: 100%;
}

.tabulator .tabulator-row .tabulator-cell.cell-image {
  padding: 0 !important;
}

/* progress formatter — centra verticalmente la legenda e garantisce leggibilità su qualsiasi sfondo */
.tabulator .tabulator-row .tabulator-cell [data-min] ~ div {
  top: 50% !important;
  transform: translateY(-50%);
  color: var(--text-primary) !important;
  line-height: 1;
  text-shadow:
    -1px -1px 0 rgba(0, 0, 0, 0.7),
     1px -1px 0 rgba(0, 0, 0, 0.7),
    -1px  1px 0 rgba(0, 0, 0, 0.7),
     1px  1px 0 rgba(0, 0, 0, 0.7);
}

/* cell-wrap modifier classes — usare invece di inline style nei formatter */
.cell-wrap.cell-wrap-icon  { gap: 0.35rem }
.cell-wrap.cell-wrap-stats { gap: 0.4rem }
.cell-wrap.cell-wrap-chips { gap: 4px; flex-wrap: wrap }
.cell-wrap.cell-centered   { justify-content: center }

/* Mini-stat verticale — pattern per colonne STR/INT/DEX e simili */
.inline-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 28px;
}
.inline-stat-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-comment);
  line-height: 1;
}
.inline-stat-val {
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.2;
}

.tabulator .tabulator-footer {
  background: var(--bg-secondary) !important;
  border-top: 1px solid var(--bg-current-line) !important;
  color: var(--text-comment) !important;
  font-size: 0.75rem !important;
  padding: 0.35rem 0.75rem !important;
}

/* Pagination — bottoni e selettore size */
.tabulator .tabulator-footer .tabulator-paginator label {
  color: var(--text-comment) !important;
  font-size: 0.75rem !important;
}
.tabulator .tabulator-footer .tabulator-page-size {
  background: var(--bg-primary) !important;
  border: 1px solid var(--bg-current-line) !important;
  color: var(--text-primary) !important;
  border-radius: 2px !important;
  padding: 0.15rem 0.35rem !important;
  margin: 0 0.4rem !important;
}
.tabulator .tabulator-footer .tabulator-page {
  background: var(--bg-primary) !important;
  border: 1px solid var(--bg-current-line) !important;
  color: var(--text-primary) !important;
  border-radius: 2px !important;
  margin: 0 1px !important;
  padding: 0.15rem 0.5rem !important;
}
.tabulator .tabulator-footer .tabulator-page:not(.disabled):hover {
  background: var(--bg-current-line) !important;
}
.tabulator .tabulator-footer .tabulator-page.active {
  background: var(--accent-color) !important;
  color: var(--bg-primary) !important;
  border-color: var(--accent-color) !important;
}
.tabulator .tabulator-footer .tabulator-page.disabled {
  opacity: 0.35 !important;
  cursor: not-allowed !important;
}

/* ── Log panel ───────────────────────────────────────────────── */

.log-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-current-line);
  border-radius: 2px;
  padding: 0.6rem 0.8rem;
  font-family: monospace;
  font-size: 0.78rem;
  color: var(--text-comment);
  min-height: 6rem;
  max-height: 14rem;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}

/* Full-height log panel — rimuove max-height per blocchi codice statici */
.log-panel--full { max-height: none; }

/* ── Status badge ────────────────────────────────────────────── */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  border-radius: 2px;
  font-size: 0.78rem;
  font-weight: 700;
}

.status-badge.running  { background: rgba(80, 250, 123, 0.15); color: var(--color-green); }
.status-badge.stopped  { background: rgba(255, 85, 85, 0.12);  color: var(--color-red); }
.status-badge.unknown  { background: rgba(139, 163, 212, 0.1); color: var(--text-comment); }

/* ── Stat cards row ──────────────────────────────────────────── */

.stat-cards {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-current-line);
  border-radius: 2px;
  padding: 0.8rem 1.2rem;
  flex: 1;
  min-width: 100px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-color);
  line-height: 1;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-comment);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Tag chips ───────────────────────────────────────────────── */

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(189, 147, 249, 0.12);
  color: var(--accent-color);
  border: 1px solid rgba(189, 147, 249, 0.3);
  border-radius: 2px;
  padding: 0.15rem 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.tag-chip button {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  padding: 0;
  display: inline-flex;
  font-size: 12px;
  line-height: 1;
}

.tag-chip button:hover { opacity: 1; }

/* ── Landing — domain groups ─────────────────────────────────── */

.domain-group {
  margin-bottom: var(--space-xl);
}

.domain-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-comment);
  margin: 0 0 0.7rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--bg-current-line);
}

.domain-group-cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* ── Page cards (da reference, esteso) ───────────────────────── */

.page-card {
  background: var(--bg-secondary);
  border-radius: 2px;
  padding: 1rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.page-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.page-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.page-desc {
  font-size: 0.78rem;
  color: var(--text-comment);
  line-height: 1.35;
}

a.page-link {
  text-decoration: none;
  background: var(--accent-color);
  color: var(--bg-primary);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.4rem 0.9rem;
  border-radius: 2px;
  white-space: nowrap;
  transition: background 0.15s;
  flex-shrink: 0;
}
a.page-link:hover { background: var(--accent-hover); }

/* ── Utilities ───────────────────────────────────────────────── */

.hidden { display: none !important; }

.mt-action { margin-top: 0.8rem; }

/* Riga di bottoni azione in fondo a un .form-section.
   Worked example: lab/templates/standard/ */
.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.back-link {
  color: var(--text-comment);
  font-size: 0.82rem;
  text-decoration: none;
}
.back-link:hover { color: var(--text-primary); }

/* Spacer flex — occupa lo spazio rimanente in una riga flex */
.spacer { flex: 1 }

/* page-card senza sfondo/bordo/padding — per toolbar e layout flat */
.page-card.page-card--flat {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0;
}

/* field-wrap orizzontale — label + input su una riga */
.field-wrap--row {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
}
.field-wrap--row label {
  white-space: nowrap;
  font-size: 0.8rem;
  margin: 0;
}
.field-wrap--row input,
.field-wrap--row select {
  width: auto;
}

/* Colori semantici — testo */
.text-danger  { color: var(--color-red) }
.text-warning { color: var(--color-orange) }
.text-success { color: var(--color-green) }
.text-muted   { color: var(--text-comment) }
.text-accent  { color: var(--accent-color) }

/* Icone genere */
.icon-female { color: var(--color-pink) }
.icon-male   { color: var(--color-cyan) }

/* Stella vuota (rating) */
.star-empty { color: var(--bg-current-line) }

/* Chip neutro — sfondo muted, testo primario */
.chip {
  display: inline-block;
  background: var(--bg-current-line);
  border-radius: 2px;
  padding: 1px 5px;
  font-size: 0.7rem;
  white-space: nowrap;
}

/* Badge monospace — valori codificati, dadi, bonus */
.mono-badge {
  font-family: monospace;
  font-weight: 700;
  font-size: 0.82rem;
}

/* ── Status bar — iniettata da nav-dropdown.js ──────────────── */
/*    .status-bar  — componente standard (una per pagina)         */
/*    #global-status-bar — fallback per pagine senza #status-bar  */

.status-bar,
#global-status-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0 0.6rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--bg-current-line);
  font-size: 0.7rem;
  font-family: 'Play', sans-serif;
  color: var(--text-comment);
  z-index: 500;
  user-select: none;
  overflow: hidden;
}

/* Dot di stato — primo item flat della bar */
.gsb-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-green);
  flex-shrink: 0;
  margin: 0 0.3rem 0 0.1rem;
}
.gsb-dot.restarting {
  background: var(--color-yellow);
  animation: gsb-blink 0.6s step-start infinite;
}
@keyframes gsb-blink { 50% { opacity: 0; } }

/* Label "geoDesktop" */
#gsb-label {
  white-space: nowrap;
  flex-shrink: 0;
  padding-right: 0.15rem;
}

/* Separatore · tra sezioni */
.gsb-sep-after {
  flex-shrink: 0;
  padding: 0 0.2rem;
  opacity: 0.35;
  user-select: none;
}

/* Bottoni stop / restart — usano btn btn-secondary btn-sm, solo color hover custom */
.gsb-stop-btn:hover:not(:disabled)    { color: var(--color-red); }
.gsb-restart-btn:hover:not(:disabled) { color: var(--color-yellow); }


/* Messaggio temporaneo — spinto a destra */
.gsb-msg {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 0.4rem;
  font-style: italic;
  color: var(--color-yellow);
  white-space: nowrap;
  margin-left: auto;
}

/* ── Modal overlay — sistema condiviso ──────────────────────── */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.visible {
  display: flex;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-current-line);
  border-radius: 2px;
  padding: 1.5rem;
  width: 420px;
  max-width: 95vw;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--bg-current-line);
  flex-shrink: 0;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--bg-current-line);
  flex-shrink: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

/* ── In-sviluppo banner (growth-crm placeholders) ───────────── */

.dev-banner {
  background: rgba(255, 184, 108, 0.1);
  border: 1px solid rgba(255, 184, 108, 0.3);
  color: var(--color-orange);
  border-radius: 2px;
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
}
