/* ============================================================
   SolarDesigner Pro — Stylesheet
   ============================================================ */

:root {
  /* ── Sunject design (2026-11-24): neutral warm greys, 1 px borders, almost no shadow;
        ink (near-black) = primary action / selection, orange = brand & state accent ── */
  --brand: #d97706;           /* orange: dots, progress, active markers */
  --brand-ink: #9a4a05;       /* orange text on light backgrounds (≥ 4.5:1) */
  --brand-soft: #fdf3e7;
  --evm-blue: #1b4a8a;        /* technical drawings only */
  --evm-blue-dark: #143a6b;
  --gold: #d97706;            /* legacy name → brand orange */
  --gold-dark: #9a4a05;
  --gold-dim: rgba(217,119,6,0.12);

  --bg-primary: #f8f8f7;      /* app canvas */
  --bg-side: #fbfbfa;         /* sidebars, table heads */
  --bg-secondary: #ffffff;    /* header, bars, floating panels */
  --bg-card: #ffffff;
  --bg-card-hover: #f6f6f5;
  --bg-input: #ffffff;        /* outlined inputs */
  --bg-soft: #f3f3f2;         /* kanban columns, neutral tiles */
  --bg-hover: #f3f3f2;
  --bg-active: #ececea;       /* selected pill in segmented controls */
  --glass: rgba(255,255,255,0.97);
  --border: #e7e6e4;
  --border-light: #d4d2cf;
  --text-primary: #1c1b19;
  --text-secondary: #57534e;
  --text-muted: #76716b;      /* ≥ 4.5:1 on white and on --bg-primary */
  --ink: #1c1b19;             /* primary buttons, selected states */
  --ink-hover: #3a3835;

  --accent: #1c1b19;          /* links, focus: ink (no blue in the chrome) */
  --accent-hover: #000000;
  --accent-dim: rgba(28,27,25,0.08);
  --cta-grad: #1c1b19;        /* primary CTA = ink */
  --cta-ink: #ffffff;
  --success: #15803d;
  --success-bg: rgba(21,128,61,0.09);
  --warning: #9a4a05;
  --warning-bg: rgba(217,119,6,0.10);
  --error: #c62828;
  --error-bg: rgba(198,40,40,0.07);
  --info: #2563eb;
  --info-bg: rgba(37,99,235,0.07);
  --header-h: 64px;
  --sidebar-w: 280px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: none;
  --shadow-float: 0 8px 28px rgba(28,27,25,0.10), 0 1px 2px rgba(28,27,25,0.05);
  --transition: 0.15s ease;

  /* String colors for layout (functional — kept vivid on white) */
  --s1: #f59e0b; --s2: #10b981; --s3: #3b82f6; --s4: #a855f7;
  --s5: #ef4444; --s6: #ec4899; --s7: #14b8a6; --s8: #f97316;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================================
   HEADER — project bar with the 7-step stepper (redesign 2026-11)
   ============================================================ */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  z-index: 100;
}
.hdr-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 0 1 auto; }
.brand-icon { width: 36px; height: 36px; object-fit: contain; }
.hdr-project { min-width: 0; }
.hdr-crumb { font-size: 0.74rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-crumb a { color: inherit; text-decoration: none; }
.hdr-crumb a:hover { color: var(--accent); text-decoration: underline; }
.hdr-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }

.header-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; margin-left: auto; }
.hdr-icon { width: 36px; height: 36px; border-radius: 9px; }
.hdr-icon svg { width: 17px; height: 17px; }

.validation-badge {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 12px; font-size: 0.75rem; color: var(--text-secondary); white-space: nowrap;
}
.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); flex: none; }
.badge-dot.ok { background: var(--success); }
.badge-dot.warn { background: var(--gold); }
.badge-dot.error { background: var(--error); }

/* ============================================================
   LAYOUT
   ============================================================ */
.app-layout {
  margin-top: var(--header-h);   /* clear the fixed header */
  min-height: calc(100vh - var(--header-h));
}

/* ============================================================
   STEPPER (was the phase tab bar) — lives in the header
   ============================================================ */
.phase-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
  flex: 0 1 auto;
}
.phase-nav::-webkit-scrollbar { display: none; }
.phase-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 11px 5px 6px;
  cursor: pointer;
  border-radius: 7px;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
.phase-item:hover { background: var(--bg-hover); }
.step-num {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 600;
  background: var(--bg-soft); color: var(--text-muted); box-shadow: inset 0 0 0 1px var(--border);
}
.phase-title { font-size: 0.93rem; font-weight: 400; color: var(--text-secondary); }
.phase-item.active { background: var(--bg-active); }
.phase-item.active .phase-title { color: var(--ink); font-weight: 500; }
.phase-item.active .step-num { background: var(--brand); color: #fff; box-shadow: none; }
.phase-item.done:not(.active) .step-num { background: var(--success-bg); color: transparent; position: relative; }
.phase-item.done:not(.active) .step-num::after { content: '✓'; color: var(--success); position: absolute; font-size: 0.8rem; }
.phase-item.done:not(.active) .phase-title { color: var(--text-primary); }
.phase-status { display: none; }      /* state is shown by the step number (✓); kept for setPhaseStatus */
.phase-nav .phase-icon { display: none; }

@media (max-width: 1360px) {
  .phase-item:not(.active) .phase-title { display: none; }   /* compact stepper: numbers only, active step keeps its label */
  .validation-badge #validationStatus { display: none; }
}
@media (max-width: 900px) {
  .hdr-crumb, .save-status { display: none; }
  .app-header { gap: 8px; padding: 0 10px; }
}

/* full-bleed design phases: title already shown in the top tab bar */
#phase-3 .phase-header { display: none; }
#phase-3 { padding: 0; }
body[data-phase="3"] .main-content { padding: 0; }
/* page steps: centred content column as in the design */
body:not([data-phase="3"]) .main-content { padding: 28px 32px 48px; max-width: 1520px; margin: 0 auto; }

.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.summary-item { display: flex; flex-direction: column; gap: 2px; }
.summary-label { font-size: 0.7rem; color: var(--text-muted); }
.summary-value { font-size: 0.85rem; font-weight: 600; color: var(--accent); }

/* Validation panel */
.validation-panel {
  margin: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  flex: 1;
  overflow-y: auto;
}

.validation-panel h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 10px;
}

.val-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
}

.val-item:last-child { border-bottom: none; }
.val-icon { font-size: 0.9rem; flex-shrink: 0; margin-top: 1px; }
.val-text { color: var(--text-secondary); line-height: 1.4; }
.val-item.ok .val-text { color: var(--success); }
.val-item.warn .val-text { color: var(--warning); }
.val-item.error .val-text { color: var(--error); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  min-width: 0;
}

.phase-content { display: none; animation: fadeIn 0.3s ease; }
.phase-content.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.phase-header {
  margin-bottom: 24px;
}
.phase-eyebrow {
  display: block; margin-bottom: 6px;
  font-size: 0.93rem; font-weight: 400; color: var(--text-muted);
}

.phase-header h2 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.phase-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ============================================================
   FORM CARDS
   ============================================================ */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.form-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.form-card h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.subsection-title {
  font-size: 0.8rem !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted) !important;
  margin-top: 16px !important;
  margin-bottom: 10px !important;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 1100px) { .form-grid-2 { grid-template-columns: 1fr; } }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input, .form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  padding: 9px 12px;
  font-size: 0.88rem;
  transition: border-color var(--transition);
  outline: none;
  -webkit-appearance: none;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 32px;
  cursor: pointer;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-input::placeholder { color: var(--text-muted); }
.form-hint { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }

.form-input-sm {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 6px 10px;
  font-size: 0.82rem;
  width: 70px;
  outline: none;
}

.form-input-sm:focus { border-color: var(--accent); }

.input-with-btn {
  display: flex;
  gap: 8px;
}

.input-with-btn .form-input { flex: 1; }

.input-with-check {
  display: flex;
  gap: 10px;
  align-items: center;
}

.input-with-check .form-input { flex: 1; }

.input-with-calc {
  display: flex;
  gap: 8px;
}

.input-with-calc .form-input { flex: 1; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--ink);
  color: #fff;
  font-weight: 500;
  border: 1px solid var(--ink);
}
.btn-primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.btn-dark { background: var(--ink); color: #fff; font-weight: 500; }
.btn-dark:hover { background: var(--ink-hover); }

.btn-secondary {
  background: #fff;
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-card-hover); border-color: var(--border-light); }

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg-card); color: var(--text-primary); border-color: var(--border-light); }
.btn-outline.active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 0.95rem;
}

.btn-full { width: 100%; justify-content: center; }

.btn-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.btn-toggle {
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--bg-primary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.btn-toggle:hover { border-color: var(--border-light); color: var(--text-primary); }
.btn-toggle.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
}

.tab {
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.tab:hover { color: var(--text-primary); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--gold);   /* E-VM gold finish */
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================================
   INFO BOX / CALC RESULT
   ============================================================ */
.info-box {
  background: var(--info-bg);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}

.info-box svg { flex-shrink: 0; margin-top: 2px; color: var(--info); }

.info-box h4 {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--info);
  margin-bottom: 6px;
}

.info-box p { margin-bottom: 4px; }
.info-box p:last-child { margin-bottom: 0; }

.calc-result {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  line-height: 1.6;
}

.calc-result .calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
}

.calc-result .calc-label { color: var(--text-muted); }
.calc-result .calc-value { font-weight: 600; color: var(--text-primary); }
.calc-result .calc-value.ok { color: var(--success); }
.calc-result .calc-value.warn { color: var(--warning); }
.calc-result .calc-value.error { color: var(--error); }

.calc-panel {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 0.83rem;
  line-height: 1.7;
}

/* ============================================================
   CHECKBOX & TOGGLE
   ============================================================ */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-secondary);
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.toggle-section {
  padding: 4px 0;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.toggle-label input[type="checkbox"] { display: none; }

.toggle-slider {
  width: 44px; height: 24px;
  background: var(--border);
  border-radius: 12px;
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider {
  background: var(--accent);
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider::after {
  transform: translateX(20px);
}

/* ============================================================
   KPI GRID
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.kpi-unit {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.kpi-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.3;
}

/* ============================================================
   DATA TABLES
   ============================================================ */
.table-container { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.data-table th {
  background: var(--bg-primary);
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 7px 12px;
  border-bottom: 1px solid rgba(51,65,85,0.5);
  color: var(--text-secondary);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-card-hover); }
.data-table td.highlight { color: var(--accent); font-weight: 600; }
.data-table tfoot td { background: var(--bg-primary); color: var(--text-primary); font-weight: 600; border-top: 1px solid var(--border); }

/* ============================================================
   CHART
   ============================================================ */
.chart-container {
  margin: 16px 0;
}

.chart-container h4 {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-group label {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.roof-stats-bar {
  padding: 8px 14px;
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  margin: 4px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ── 2D layout workspace: full-bleed map with floating overlay panels ── */
.layout2d-workspace { position: relative; }
.layout2d-main { position: relative; min-width: 0; }
.layout2d-main #layout2dMap {
  height: calc(100vh - var(--header-h)) !important;
  min-height: 560px;
  width: 100%;
  background: #cfd8e3;
}

/* controls float top-left over the map */
.layout2d-sidebar {
  position: absolute;
  top: 16px; left: 16px;
  width: 340px;
  max-height: calc(100% - 32px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  overflow-y: auto;
  overflow-x: hidden;   /* safety net: never spill content past the right edge */
  z-index: 6;
  box-shadow: var(--shadow-float);
}

/* legend + panel-info float over the map; wrapper must not create a box */
.layout2d-below { display: contents; }
.layout2d-below .layout-legend {
  position: absolute;
  top: 12px; right: 12px;
  width: 230px;
  max-height: 42%;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  z-index: 6;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.layout2d-below .panel-info-card {
  position: absolute;
  bottom: 12px; left: 50%;
  transform: translateX(-50%);
  width: min(680px, calc(100% - 340px));
  margin: 0;
  z-index: 7;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}
/* roof stats float top-centre */
.layout2d-main .roof-stats-bar {
  position: absolute;
  top: 12px; left: 50%;
  transform: translateX(-50%);
  margin: 0;
  z-index: 6;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.l2d-section { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.l2d-section:last-child { border-bottom: none; padding-bottom: 0; }
.l2d-section > h4 {
  margin: 0 0 8px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
}
.l2d-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.l2d-field label { font-size: 0.8rem; color: var(--text-secondary, #cbd5e1); flex: 1; }
.l2d-field .form-input-sm, .l2d-field .form-select { width: 108px; flex: none; }
.l2d-btn-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.l2d-btn-grid .btn { flex: 1 1 auto; white-space: nowrap; }
.l2d-full { width: 100%; margin-bottom: 8px; }
.l2d-count { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.l2d-check { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; margin: 8px 0; }
.l2d-hint { font-size: 0.72rem; color: var(--text-muted); margin: 4px 0 0; line-height: 1.35; }

/* Merged design panel: fit the relocated site/component forms inside the floating panel */
.layout2d-sidebar .tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.layout2d-sidebar .tab { padding: 5px 9px; font-size: 0.75rem; }
.layout2d-sidebar .tab-content { padding: 2px 0; }
.layout2d-sidebar .form-card { background: transparent; border: none; padding: 0; margin: 0; box-shadow: none; }
.layout2d-sidebar .form-card h3 { font-size: 0.82rem; margin: 4px 0 8px; }
/* Narrow floating panel: stack 2-column rows so nothing overflows the right edge */
.layout2d-sidebar .form-row { display: grid; grid-template-columns: 1fr; gap: 0; }
.layout2d-sidebar .form-row .form-group { min-width: 0; }
.layout2d-sidebar .form-group { margin-bottom: 8px; }
.layout2d-sidebar .form-group > label { font-size: 0.75rem; }

/* Technical output boxes (Voc min, efficiency, array, inverter check, cable drops…)
   sit at the bottom of their tab — render them as readable, clearly-separated,
   scroll-if-long info panels so no technical data is lost. */
.layout2d-sidebar .calc-result,
.layout2d-sidebar .calc-panel,
.layout2d-sidebar .check-panel {
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--accent-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius, 8px);
  font-size: 0.74rem;
  line-height: 1.45;
  max-height: 190px;
  overflow-y: auto;
}
.layout2d-sidebar .calc-result:first-child,
.layout2d-sidebar .calc-panel:first-child,
.layout2d-sidebar .check-panel:first-child { margin-top: 0; }

/* Keep every tab's content inside the narrow floating panel (no horizontal overflow) */
.layout2d-sidebar .form-grid-2 { grid-template-columns: 1fr; gap: 0; }
/* Grid/flex items default to min-width:auto, which lets wide content (tables, long
   unbreakable strings) force the item — and everything after it — wider than the
   360px panel. Without this, overflow-x:hidden on the panel just clips the excess
   silently, truncating text ("Imax tot." → "Imax to") and pushing inputs flush to
   the edge instead of stopping the content from growing in the first place. */
.layout2d-sidebar .form-card,
.layout2d-sidebar .form-group { min-width: 0; }
.layout2d-sidebar .form-input,
.layout2d-sidebar .form-select { max-width: 100%; min-width: 0; }
/* Multi-unit inverter/battery tables are wide by nature (6 nowrap columns) — let
   them scroll horizontally inside their own box instead of stretching the card. */
.layout2d-sidebar #inverterUnitsList,
.layout2d-sidebar #batteryUnitsList { overflow-x: auto; max-width: 100%; }
.layout2d-sidebar .data-table { min-width: 420px; }
.layout2d-sidebar .info-box { flex-direction: column; align-items: stretch; }
.layout2d-sidebar .info-box p,
.layout2d-sidebar .calc-result,
.layout2d-sidebar .calc-panel,
.layout2d-sidebar .check-panel { overflow-wrap: anywhere; word-break: break-word; overflow-x: hidden; }
/* small "technical" heading before the first output box in a tab */
.layout2d-sidebar .calc-result + .calc-result,
.layout2d-sidebar .calc-panel + .calc-result { margin-top: 8px; }
.layout2d-sidebar .calc-result .calc-row { padding: 2px 0; }

@media (max-width: 900px) {
  .layout2d-sidebar,
  .layout2d-below .layout-legend { position: static; width: auto; max-height: none; }
  .layout2d-below { display: block; }
  .layout2d-below .panel-info-card { position: static; transform: none; width: auto; margin-top: 12px; }
  .layout2d-main .roof-stats-bar { position: static; transform: none; margin-bottom: 8px; }
  .layout2d-main #layout2dMap { height: 60vh !important; }
}

.canvas-placeholder {
  fill: var(--text-muted);
  font-size: 14px;
  font-family: inherit;
}

.layout-legend {
  width: 200px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.layout-legend h4 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.legend-color {
  width: 16px; height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-stats {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.legend-outside-badge {
  margin-top: 8px;
  padding: 5px 8px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 4px;
  color: #ef4444;
  font-size: 0.75rem;
  font-weight: 600;
}

.panel-info-card {
  margin-top: 16px;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

/* ============================================================
   ELECTRICAL DIAGRAM
   ============================================================ */
.electrical-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}

.ml-3 { margin-left: 12px; }

.electrical-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: auto;
  min-height: 600px;
  position: relative;
}

.electrical-svg {
  display: block;
  min-width: 100%;
  min-height: 600px;
}

/* SVG Electrical symbols */
.elec-wire { stroke: #94a3b8; stroke-width: 1.5; fill: none; }
.elec-wire-dc-pos { stroke: #ef4444; stroke-width: 2; fill: none; }
.elec-wire-dc-neg { stroke: #1e293b; stroke-width: 2; fill: none; stroke: #64748b; }
.elec-wire-ac-l1 { stroke: #f97316; stroke-width: 2; fill: none; }
.elec-wire-ac-n { stroke: #60a5fa; stroke-width: 2; fill: none; }
.elec-wire-pe { stroke: #22c55e; stroke-dasharray: 5,3; stroke-width: 2; fill: none; }
.elec-label { fill: #94a3b8; font-size: 11px; font-family: 'JetBrains Mono', monospace; }
.elec-label-bold { fill: #f1f5f9; font-size: 12px; font-weight: 600; font-family: inherit; }
.elec-comp-box { fill: #1e293b; stroke: #475569; stroke-width: 1.5; }
.elec-comp-text { fill: #e2e8f0; font-size: 10px; text-anchor: middle; font-family: inherit; }
.elec-section-label { fill: #f59e0b; font-size: 11px; font-weight: 600; font-family: inherit; }

/* Print/light theme for the single-line diagram (white page, darker labels) */
.electrical-svg.print-mode .elec-label { fill: #334155; }
.electrical-svg.print-mode .elec-label-bold { fill: #0f172a; }
.elec-zoom-group { display: inline-flex; gap: 2px; margin-left: 6px; }
.elec-zoom-group .btn { min-width: 30px; padding: 4px 6px; }

/* ============================================================
   REPORT / ECONOMICS
   ============================================================ */
.report-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.economics-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.economics-kpi {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.econ-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}

.econ-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
}

.econ-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.normative-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
}

.norm-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 0.82rem;
}

.norm-icon { font-size: 1rem; flex-shrink: 0; }
.norm-label { color: var(--text-secondary); }
.norm-value { color: var(--text-primary); font-weight: 600; margin-top: 2px; font-size: 0.78rem; }
.norm-item.ok { border-color: rgba(16,185,129,0.3); }
.norm-item.warn { border-color: rgba(245,158,11,0.3); }
.norm-item.error { border-color: rgba(239,68,68,0.3); }

.notes-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.note-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  border-left: 3px solid var(--info);
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.note-item.warn { border-left-color: var(--warning); }
.note-item.error { border-left-color: var(--error); }

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.85rem;
  box-shadow: var(--shadow);
  min-width: 280px;
  max-width: 380px;
  animation: slideIn 0.3s ease;
  pointer-events: all;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--info); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; pointer-events: none; } }

/* ============================================================
   LOADING OVERLAY
   ============================================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(234,240,247,0.82);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-spinner p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ============================================================
   CHECK PANEL (Inverter verify)
   ============================================================ */
.check-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  border: 1px solid transparent;
}

.check-item.ok { background: var(--success-bg); border-color: rgba(16,185,129,0.2); color: var(--success); }
.check-item.warn { background: var(--warning-bg); border-color: rgba(245,158,11,0.2); color: var(--warning); }
.check-item.error { background: var(--error-bg); border-color: rgba(239,68,68,0.2); color: var(--error); }
.check-item.info { background: var(--info-bg); border-color: rgba(59,130,246,0.2); color: var(--info); }

.check-icon { font-size: 1rem; flex-shrink: 0; }
.check-text { line-height: 1.5; }
.check-text strong { display: block; font-weight: 600; margin-bottom: 2px; }

/* ============================================================
   UTILITIES
   ============================================================ */
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-3 { margin-bottom: 12px; }
.text-muted { color: var(--text-muted); font-size: 0.82rem; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* Input range */
input[type="range"] {
  -webkit-appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  width: 120px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

/* ============================================================
   LAYOUT 2D — PANEL COUNT TOOLBAR
   ============================================================ */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: var(--radius);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-icon:hover { background: var(--bg-hover); border-color: var(--border-light); }

/* ============================================================
   ELECTRICAL DIAGRAM — EDIT MODE
   ============================================================ */
/* Hover highlight for editable SVG groups */
.elec-editable:hover rect:first-of-type,
.elec-editable:hover > rect {
  filter: brightness(1.3);
  outline: 1px solid var(--accent);
}

/* Manual cables: highlight the line on hover, endpoint handles are grab targets */
.elec-cable:hover line,
.elec-cable:hover polyline { filter: brightness(1.4); stroke-width: 3; }
.elec-cable-handle {
  cursor: grab;
  transition: r 0.1s ease;
}
.elec-cable-handle:hover { r: 7; }

/* Edit panel overlay */
.electrical-edit-panel {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.elec-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.9rem;
}

.elec-edit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.elec-edit-field label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.elec-edit-field .form-input {
  max-width: 200px;
}

.elec-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   AUTH — LOGIN MODAL
   ============================================================ */
.login-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 15, 30, 0.92);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s;
}
.login-modal.visible { opacity: 1; }

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.login-logo h2 { margin: 0; font-size: 1.3rem; }
.login-logo img { width: 44px; height: 44px; object-fit: contain; flex-shrink: 0; }
.login-logo .login-by { display: block; font-size: .78rem; color: var(--text-muted, #6b6a67); margin-top: 2px; }

.login-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

.login-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.login-tab:hover { color: var(--text-primary); }
.login-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.login-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}
.login-field label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

.login-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 0.82rem;
  margin-bottom: 10px;
}

/* User management (Auth.openUserManager) */
.um-table { width: 100%; font-size: 0.84rem; border-collapse: collapse; }
.um-table th { text-align: left; color: var(--text-muted); font-weight: 500; padding: 6px 8px; }
.um-table td { border-top: 1px solid var(--border); padding: 6px 8px; vertical-align: middle; }
.um-table .um-role { padding: 4px 6px; font-size: 0.82rem; width: auto; }
.um-actions { white-space: nowrap; text-align: right; }
.um-new { display: grid; grid-template-columns: 1fr 1fr 1.3fr auto; gap: 8px; }
@media (max-width: 640px) { .um-new { grid-template-columns: 1fr; } .um-table { font-size: 0.78rem; } }
.login-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.5;
}

.btn-full { width: 100%; justify-content: center; }
.mt-2 { margin-top: 8px; }

/* User badge in header */
.user-badge {
  position: relative;
  display: flex;
  align-items: center;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg-primary);
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.user-avatar:hover { opacity: 0.85; }

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-width: 180px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 1000;
  overflow: hidden;
}

.user-dropdown-header {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-dropdown-header strong { font-size: 0.88rem; }
.user-role {
  background: var(--bg-secondary);
  color: var(--accent);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 0.72rem;
  width: fit-content;
}

.user-dropdown-divider { height: 1px; background: var(--border); }

.user-dropdown-item {
  display: block;
  padding: 9px 14px;
  color: var(--text-secondary);
  font-size: 0.84rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.1s;
}
.user-dropdown-item:hover { background: var(--bg-secondary); color: var(--text-primary); }
.user-dropdown-item.text-error { color: var(--error); }

/* ============================================================
   PROJECTS MODAL
   ============================================================ */
.project-name-badge {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  cursor: pointer;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}
.project-name-badge:hover { color: var(--accent); }
/* variant switcher rendered as a small grey badge ("Variante A · Bozza") */
.variant-bar #variantSelect {
  width: auto; max-width: 180px; padding: 3px 26px 3px 8px; font-size: 0.72rem; font-weight: 600;
  background-color: var(--bg-soft); border: 1px solid var(--border); border-radius: 6px; color: var(--text-secondary);
  background-position: right 6px center; background-size: 12px;
}
.variant-bar .btn { padding: 2px 6px; }

/* Modal overlay */
.projects-modal,
.integrations-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10,15,30,0.8);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.25s;
}
.projects-modal.visible,
.integrations-modal.visible { opacity: 1; }

.projects-modal-card,
.integrations-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: min(90vw, 820px);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  overflow: hidden;
}

.proj-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.proj-modal-header h3 { margin: 0; font-size: 1rem; }

.proj-modal-tabs {
  display: flex;
  padding: 0 20px;
  border-bottom: 2px solid var(--border);
  flex-shrink: 0;
}

.proj-modal-tab,
.integ-modal-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 10px 16px;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  transition: color 0.15s, border-color 0.15s;
}
.proj-modal-tab:hover,
.integ-modal-tab:hover { color: var(--text-primary); }
.proj-modal-tab.active,
.integ-modal-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.proj-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.proj-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* Project cards grid */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.project-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.15s;
}
.project-card:hover { border-color: var(--border-light); }
.project-card.active { border-color: var(--accent); background: rgba(245,158,11,0.05); }

.project-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}
.project-card-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  word-break: break-word;
}
.project-active-badge {
  background: var(--accent);
  color: var(--bg-primary);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.project-card-meta {
  display: flex;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.project-card-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.project-card-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   INTEGRATIONS MODAL
   ============================================================ */
.integration-action-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.integration-action-card p { margin: 4px 0 0; }

.connector-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.connector-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.connector-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.connector-item-info strong { font-size: 0.88rem; }
.connector-item-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* Integration history log */
.integration-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.integration-log-item {
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.log-ok   { background: var(--success-bg); border-color: rgba(16,185,129,0.2); }
.log-error{ background: var(--error-bg);   border-color: rgba(239,68,68,0.2); }

.log-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.log-action { font-weight: 600; font-size: 0.84rem; }
.log-time   { font-size: 0.75rem; color: var(--text-muted); flex-shrink: 0; }
.log-detail { font-size: 0.78rem; color: var(--text-muted); }
.log-link   { font-size: 0.78rem; color: var(--accent); text-decoration: none; }
.log-link:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* Google Places Autocomplete dropdown — ensure above all overlays */
.pac-container { z-index: 99999 !important; border-radius: 8px; border: 1px solid var(--border); background: #ffffff; box-shadow: 0 8px 24px rgba(19,41,74,0.18); }
.pac-item { background: #ffffff; color: #46586f; cursor: pointer; padding: 6px 12px; border-top: 1px solid var(--border); font-family: inherit; font-size: 0.84rem; }
.pac-item:hover, .pac-item-selected { background: rgba(27,74,138,0.10) !important; }
.pac-item-query { color: var(--ink); font-weight: 500; }
.pac-matched { color: #f59e0b; font-weight: 600; }
.pac-icon { display: none; }


/* Collapsible advanced-input blocks (design temperatures, datasheet extras, cable/protection params) */
.adv-details { margin: 12px 0; border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; background: var(--bg-card, #fff); }
.adv-details > summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: 0.85rem; color: var(--accent); }
.adv-details[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.adv-details > .form-row, .adv-details > .form-group { margin-bottom: 10px; }

/* Strutture phase */
#phase-8 .struct-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 16px; }
#phase-8 .form-card { margin-bottom: 16px; }
#phase-8 .kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
#phase-8 .kpi-card.error .kpi-value { color: var(--error); }
#phase-8 .kpi-card.ok .kpi-value { color: #0b7a53; }

/* Strutture, redesign 2026-11-24: steps on the left, the answer (verdict cards + map) on the right */
.stx { display: grid; grid-template-columns: minmax(360px, 460px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .stx { grid-template-columns: 1fr; } }
.stx-steps { display: flex; flex-direction: column; gap: 16px; }
.stx-out { position: sticky; top: calc(var(--header-h, 64px) + 16px); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 1100px) { .stx-out { position: static; } }
#stResults { display: flex; flex-direction: column; gap: 14px; }
.stx-card { background: var(--bg-card, #fff); border: 1px solid var(--border); border-radius: 14px; padding: 18px; box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,.06)); }
.stx-card > header { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.stx-card > header h3 { margin: 0; font-size: 1.05rem; }
.stx-card > header p { margin: 2px 0 0; font-size: 0.82rem; color: var(--text-muted); }
.stx-card h3 { font-size: 1rem; margin: 0 0 10px; }
.stx-n { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.stx-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.stx-badges > span { background: var(--bg-soft, #f3f5f9); border-radius: 999px; padding: 4px 10px; font-size: 0.78rem; color: var(--text-secondary); }
.stx-badges b { color: var(--text-primary); }
.stx-tag { margin-left: 6px; font-size: 0.68rem; color: var(--brand-ink); background: var(--brand-soft); border-radius: 6px; padding: 0 5px; }
.stx-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stx-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: var(--text-secondary); }
.stx-field small { font-size: 0.72rem; color: var(--text-muted); }
.stx-input { position: relative; display: block; }
.stx-input input { width: 100%; padding: 8px 10px; padding-right: 46px; border: 1px solid var(--border); border-radius: 10px; font-size: 0.95rem; font-weight: 600; background: #fff; }
.stx-addr { margin-bottom: 10px; }
.stx-addr .stx-input { display: flex; gap: 6px; }
.stx-addr .stx-input input { padding-right: 10px; font-weight: 500; }
.stx-input i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 0.74rem; color: var(--text-muted); pointer-events: none; }
.stx-q { margin-bottom: 14px; }
.stx-q-title { font-size: 0.86rem; font-weight: 700; margin-bottom: 6px; }
.stx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.stx-chip { border: 1px solid var(--border); background: #fff; border-radius: 12px; padding: 7px 12px; font-size: 0.84rem; font-weight: 600; color: var(--text-primary); cursor: pointer; display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.2; text-align: left; }
.stx-chip small { font-weight: 500; font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }
.stx-chip:hover { background: var(--bg-hover); }
.stx-chip.active { border-color: var(--ink); background: var(--bg-active); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.stx-hint { font-size: 0.75rem; color: var(--text-muted); margin: 6px 0 0; }
.stx-warn { color: var(--brand-ink); background: var(--brand-soft); border-radius: 8px; padding: 6px 10px; margin: 0 0 12px; }
.stx-check { display: flex; gap: 8px; align-items: center; font-size: 0.84rem; margin: 4px 0 12px; cursor: pointer; }
.stx-sub { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.stx-sub h4 { font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin: 0 0 10px; }
.stx-faces { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 6px; }
.stx-faces li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; background: var(--bg-soft, #f3f5f9); border-radius: 10px; padding: 8px 12px; font-size: 0.84rem; }
.stx-faces em { font-style: normal; color: var(--text-muted); font-size: 0.78rem; }
.stx-adv { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 6px; }
.stx-adv > summary { cursor: pointer; font-size: 0.82rem; font-weight: 600; color: var(--ink); }
.stx-adv[open] > summary { margin-bottom: 12px; }
.stx-adv .form-group { margin-bottom: 10px; }
.stx-detail { background: var(--bg-card, #fff); border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px; margin: 0; }
.stx-verdicts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.stx-verdict { background: var(--bg-card, #fff); border: 1px solid var(--border); border-left: 5px solid #94a3b8; border-radius: 14px; padding: 14px 16px; }
.stx-verdict p { margin: 4px 0 0; font-size: 0.8rem; color: var(--text-secondary); line-height: 1.4; }
.stx-v-head { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.stx-v-big { font-size: 1.7rem; font-weight: 650; margin-top: 6px; color: var(--text-primary); }
.stx-dot { width: 10px; height: 10px; border-radius: 50%; background: #94a3b8; }
.stx-verdict.ok { border-left-color: #16a34a; } .stx-verdict.ok .stx-dot { background: #16a34a; }
.stx-verdict.warn { border-left-color: var(--brand); } .stx-verdict.warn .stx-dot { background: var(--brand); }
.stx-verdict.error { border-left-color: #dc2626; } .stx-verdict.error .stx-dot { background: #dc2626; } .stx-verdict.error .stx-v-big { color: #b91c1c; }
.stx-notes { background: var(--brand-soft); border: 1px solid rgba(217,119,6,0.25); border-radius: 12px; padding: 10px 14px; font-size: 0.8rem; }
.stx-notes p { margin: 3px 0; }
/* «Cosa manca» checklist + step states (2026-11-30) */
.stx-card > header > div { flex: 1; min-width: 0; }
.stx-step-badge { font-size: 0.72rem; font-weight: 600; border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.stx-step-badge.todo { background: var(--brand-soft); color: var(--brand-ink); }
.stx-step-badge.ok { background: #e7f6ec; color: #15803d; }
.stx-locked { background: var(--bg-soft, #f3f5f9); }
.stx-locked .stx-n { background: #b8b6b1; }
.stx-todo h3 { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; margin: 0 0 4px; }
.stx-todo > p { margin: 0 0 12px; font-size: 0.82rem; color: var(--text-secondary); }
.stx-count { background: var(--brand); color: #fff; border-radius: 999px; font-size: 0.75rem; min-width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.stx-todo ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.stx-todo li { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border); }
.stx-todo li:first-child { border-top: 0; }
.stx-todo li b { font-size: 0.86rem; }
.stx-todo li p { margin: 2px 0 0; font-size: 0.76rem; color: var(--text-muted); line-height: 1.35; }
.stx-ck { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; }
.stx-todo li.need .stx-ck { background: var(--brand); color: #fff; }
.stx-todo li.opt .stx-ck { border: 1.5px solid #b8b6b1; color: #8a8883; }
.stx-todo li.done .stx-ck { background: #e7f6ec; color: #15803d; }
.stx-todo li.done b { color: var(--text-secondary); font-weight: 600; }
.stx-opt { font-size: 0.68rem; color: var(--text-muted); background: var(--bg-soft, #f3f5f9); border-radius: 6px; padding: 1px 6px; margin-left: 4px; }
.stx-todo.complete { border-left: 5px solid #16a34a; }
@keyframes stxFlash { 0%, 60% { box-shadow: 0 0 0 3px rgba(217,119,6,.45); } 100% { box-shadow: 0 0 0 3px rgba(217,119,6,0); } }
.stx-flash { animation: stxFlash 1.6s ease-out; border-radius: 10px; }
.stx-foot { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 0.75rem; color: var(--text-muted); }
.status-pill { padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; font-weight: 600; background: var(--bg-primary); }
.status-pill.ok { color: #0b7a53; } .status-pill.error { color: var(--error); }


/* ── Accessibility & feedback (UX pass) ───────────────────── */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.form-input:focus-visible, .form-select:focus-visible, .form-input-sm:focus-visible { outline: 3px solid var(--accent); outline-offset: 0; }
.phase-item:focus-visible, .tab:focus-visible, .btn:focus-visible, .btn-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* "Ghost" button was used everywhere but never defined */
.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Inline validation on inputs */
.field-warn { border-color: var(--warning) !important; box-shadow: 0 0 0 2px var(--warning-bg); }
.field-error { border-color: var(--error) !important; box-shadow: 0 0 0 2px var(--error-bg); }
.field-msg { display: block; font-size: 0.75rem; line-height: 1.3; margin-top: 3px; }
.field-msg.warn { color: var(--warning); } .field-msg.error { color: var(--error); }

/* Save indicator + validation badge as controls */
.save-status { font-size: 0.78rem; color: var(--success); font-weight: 600; white-space: nowrap; }
.save-status.dirty { color: var(--gold-dark); }
.validation-badge[role=button], #currentProjectName[role=button] { cursor: pointer; }

/* Keyboard shortcuts overlay */
.shortcuts-overlay { position: fixed; inset: 0; background: rgba(19,41,74,0.45); z-index: 3000; display: flex; align-items: center; justify-content: center; }
.shortcuts-box { background: #fff; border-radius: 12px; padding: 20px 24px; box-shadow: var(--shadow); max-width: 480px; width: calc(100% - 32px); }
.shortcuts-box h3 { margin-bottom: 12px; }
.shortcuts-box td { padding: 4px 8px; font-size: 0.85rem; }
.shortcuts-box kbd { background: var(--bg-primary); border: 1px solid var(--border-light); border-radius: 4px; padding: 1px 6px; font-size: 0.8rem; }
.shortcuts-box button { margin-top: 12px; }

/* Checklist */
.checklist { list-style: none; margin: 4px 0 8px; padding: 0; font-size: 0.8rem; }
.checklist li { padding: 2px 0; color: var(--text-secondary); }
.checklist li.done { color: var(--success); text-decoration: line-through; text-decoration-color: rgba(11,122,83,.4); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.btn-danger { background: var(--error); color: #fff; border: 1px solid var(--error); }


@media (prefers-reduced-motion: reduce) { * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
.preset-search { width: 100%; margin-bottom: 6px; }
.toolbar-sep { display: inline-block; width: 1px; height: 22px; background: var(--border); margin: 0 6px; vertical-align: middle; }

/* ── Design variants ─────────────────────────────────────── */
.variant-bar .form-select { max-width: 210px; }
.variant-lock-banner {
  display: flex; align-items: center; gap: 12px; padding: 8px 20px;
  background: var(--brand-soft); border-bottom: 1px solid rgba(217,119,6,0.3); color: var(--brand-ink); font-size: .9rem;
}
body.variant-locked .main-content { opacity: .75; }

/* ── Roof faces / obstacles ──────────────────────────────── */
.face-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.face-chip {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 4px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg-card, #fff); color: var(--text-primary);
  font-size: .82rem; font-weight: 600; cursor: pointer; line-height: 1.2;
}
.face-chip:hover { border-color: var(--accent); }
.face-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.face-chip-sub { font-size: .68rem; font-weight: 400; opacity: .8; }
.l2d-obstacle-row { display: grid; grid-template-columns: 1fr 64px 28px; gap: 4px; margin: 4px 0; align-items: center; }
.l2d-edges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; margin: 4px 0 8px; }
.l2d-edge { display: flex; flex-direction: column; font-size: .7rem; color: var(--text-muted); }

/* ── Layout 2D: sidebar a passi (details) ───────────────── */
.l2d-step > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between;
  margin: 0 0 8px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.02em; color: var(--accent);
}
.l2d-step > summary::-webkit-details-marker { display: none; }
.l2d-step > summary::after { content: '▸'; color: var(--text-muted); transition: transform .15s; }
.l2d-step[open] > summary::after { transform: rotate(90deg); }
.l2d-step:not([open]) { padding-bottom: 8px; }
.l2d-step:not([open]) > summary { margin-bottom: 0; }
.l2d-step > summary:focus-visible, .l2d-adv > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.l2d-adv { margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 6px; }
.l2d-adv > summary { cursor: pointer; font-size: 0.74rem; color: var(--text-muted); margin-bottom: 6px; }
.l2d-nodraw.is-hidden { display: none; }
.l2d-hint kbd { font: 600 0.68rem monospace; background: var(--bg-primary, #eaf0f7); border: 1px solid var(--border); border-radius: 3px; padding: 0 4px; }

/* ── Layout 2D: barra istruzioni + quota live sul canvas ─── */
.l2d-hintbar {
  position: absolute; left: 50%; top: 58px; transform: translateX(-50%); z-index: 8;
  max-width: min(640px, calc(100% - 420px)); padding: 7px 14px; border-radius: 999px;
  background: rgba(19, 41, 74, 0.92); color: #fff; font-size: 0.8rem; pointer-events: none; text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.l2d-hintbar kbd { font: 600 0.7rem monospace; background: rgba(255,255,255,.18); border-radius: 3px; padding: 0 4px; }
.l2d-dimtag {
  position: absolute; z-index: 9; pointer-events: none; transform: translate(14px, -26px);
  background: #e0a020; color: #13294a; font: 700 11px monospace; padding: 2px 6px; border-radius: 4px; white-space: nowrap;
}

/* ── Empty states (design: dashed box + icon) ───────────── */
.empty-state {
  border: 1.5px dashed var(--border-light); border-radius: var(--radius-lg); background: var(--bg-card);
  padding: 64px 24px; text-align: center; color: var(--text-secondary);
}
.empty-state .empty-icon {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
  background: var(--warning-bg); color: var(--gold-dark); font-size: 1.5rem;
}
.empty-state h3 { font-size: 1.1rem; color: var(--text-primary); margin-bottom: 6px; }
.empty-state p { font-size: 0.86rem; max-width: 420px; margin: 0 auto; line-height: 1.5; }

/* ============================================================
   STUDIO — Progettazione (redesign 2026-11, page 2 of the PDF)
   ============================================================ */
.studio-eyebrow { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.studio-muted { font-size: 0.76rem; color: var(--text-muted); }

/* left panel — Impianto */
.studio-summary-head { display: flex; justify-content: space-between; align-items: baseline; }
.studio-kwp { display: flex; align-items: baseline; gap: 6px; margin: 6px 0 12px; }
.studio-kwp #sum-power { font-size: 2.6rem; font-weight: 650; letter-spacing: -0.04em; line-height: 1; color: var(--text-primary); }
.studio-kwp-unit { font-size: 1rem; color: var(--text-secondary); font-weight: 600; }
.studio-badge { margin-left: auto; align-self: center; background: var(--warning-bg); color: var(--gold-dark); font-size: 0.74rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.studio-kpis { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: #fff; }
.studio-kpis > div { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.studio-kpis > div:nth-child(odd) { border-right: 1px solid var(--border); }
.studio-kpis > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
.studio-kpis span { font-size: 0.72rem; color: var(--text-muted); }
.studio-kpis b { font-size: 0.86rem; color: var(--text-primary); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* tab pills (Sito · Moduli · … · Layout) */
.layout2d-sidebar .tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 4px; border: none; padding: 0; }
.layout2d-sidebar .tab {
  padding: 7px 12px; font-size: 0.78rem; font-weight: 600; border-radius: 10px; border: none;
  background: var(--bg-soft); color: var(--text-secondary);
}
.layout2d-sidebar .tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.layout2d-sidebar .tab.active { background: var(--bg-active); color: var(--ink); box-shadow: none; }
.layout2d-sidebar .tab.active::after { display: none; }

.studio-block { border-top: 1px solid var(--border); padding-top: 14px; }
.studio-block-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.studio-add { border: 1px dashed var(--gold); color: var(--gold-dark); background: transparent; border-radius: 8px; padding: 4px 10px; font-size: 0.76rem; font-weight: 600; cursor: pointer; }
.studio-add:hover { background: var(--warning-bg); }
details.studio-block > summary { cursor: pointer; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); list-style: none; display: flex; justify-content: space-between; margin-bottom: 4px; }
details.studio-block > summary::-webkit-details-marker { display: none; }
details.studio-block > summary::after { content: '▸'; transition: transform .15s; }
details.studio-block[open] > summary::after { transform: rotate(90deg); }
.studio-cta { margin-bottom: 10px; padding: 11px 16px; font-size: 0.92rem; }

/* face cards */
.face-list { display: flex; flex-direction: column; gap: 8px; }
.face-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: #fff; cursor: pointer; transition: border-color .15s, background .15s; }
.face-card:hover { border-color: var(--border-light); }
.face-card.active { background: var(--bg-card); border-color: var(--ink); }
.face-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.face-card-bar { width: 5px; align-self: stretch; border-radius: 4px; flex: none; }
.face-card-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.face-card-body b { font-size: 0.92rem; }
.face-card-body small { font-size: 0.76rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.face-card-count { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.face-card-del { border: none; background: transparent; color: var(--text-muted); font-size: 1.1rem; cursor: pointer; padding: 0 4px; border-radius: 6px; }
.face-card-del:hover { color: var(--error); background: var(--error-bg); }

/* orientation: compass + tilt */
.studio-orient { display: flex; gap: 14px; align-items: center; }
.az-compass { width: 84px; height: 84px; flex: none; border: none; background: transparent; padding: 0; cursor: grab; touch-action: none; border-radius: 50%; }
.az-compass:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.az-compass svg { width: 100%; height: 100%; }
.az-ring { fill: #fff; stroke: var(--border); stroke-width: 2; }
.az-compass text { font: 700 9px Inter, sans-serif; fill: var(--text-muted); text-anchor: middle; }
.az-compass .az-s { fill: var(--gold-dark); }
.az-needle { stroke: var(--gold); stroke-width: 3; stroke-linecap: round; }
.az-tip { fill: var(--gold); }
.az-hub { fill: var(--text-primary); }
.studio-orient-fields { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.studio-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.74rem; color: var(--text-muted); }
.studio-field small { font-size: 0.68rem; }
.studio-input-unit { position: relative; display: block; }
.studio-input-unit input { padding-right: 26px !important; }
.studio-input-unit i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 0.76rem; color: var(--text-muted); pointer-events: none; }
.studio-orient-fields .form-input { padding: 8px 10px; font-size: 0.95rem; font-weight: 600; }

/* toolbar (top centre) */
.studio-toolbar {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 7;
  display: flex; align-items: center; gap: 4px; padding: 6px;
  background: var(--glass); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-float);
}
.studio-tool {
  width: 42px; height: 42px; border-radius: 12px; border: none; background: transparent; color: var(--text-primary);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s;
}
.studio-tool svg { width: 19px; height: 19px; }
.studio-tool:hover { background: var(--bg-hover); }
.studio-tool.active { background: var(--ink); color: #fff; box-shadow: none; }
.studio-tool-text { width: auto; padding: 0 12px; font-weight: 700; font-size: 0.82rem; background: var(--ink); color: #fff; }
.studio-tool-text:hover { background: var(--ink-hover); }
.studio-sep { width: 1px; height: 26px; background: var(--border); margin: 0 4px; }
.studio-pill { border: none; border-radius: 12px; padding: 0 14px; height: 42px; font-weight: 600; font-size: 0.82rem; cursor: pointer; background: var(--bg-soft); color: var(--text-secondary); }
.studio-pill.active { background: var(--bg-active); color: var(--ink); }

/* toolbar drop-down menus: «Ostacolo ▾» (preset kinds) and «Vista ▾» (background / layers) — 2026-11-24 */
.studio-menu-wrap { position: relative; display: inline-flex; }
.studio .studio-toolbar:has(.studio-menu:not([hidden])) { z-index: 12; }   /* open menu above the hint bar (z 8) */
.studio-tool-menu { width: auto; padding: 0 8px 0 11px; gap: 2px; }
.studio-caret { font-size: 0.7rem; opacity: 0.7; }
.studio-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 20; min-width: 250px; padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-float);
}
.studio-menu[hidden] { display: none; }
.studio-menu-right { left: auto; right: 0; }
.studio-menu-title { font-size: 0.72rem; color: var(--text-muted); padding: 4px 10px 6px; }
.studio-menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.studio-menu button {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; width: 100%; text-align: left;
  border: none; background: transparent; border-radius: 10px; padding: 9px 10px; font-size: 0.86rem; font-weight: 600; color: var(--text-primary); cursor: pointer;
}
.studio-menu button small { font-weight: 500; font-size: 0.74rem; color: var(--text-muted); white-space: nowrap; }
.studio-menu button:hover, .studio-menu button:focus-visible { background: var(--bg-hover); outline: none; }
.studio-menu-check::before { content: ''; width: 14px; height: 14px; flex: none; border-radius: 4px; border: 1.5px solid var(--border-strong, #c3cad6); margin-right: 8px; align-self: center; }
.studio-menu-check { justify-content: flex-start !important; }
.studio-menu-check.active::before { background: var(--ink); border-color: var(--ink); box-shadow: inset 0 0 0 2px #fff; }

/* face card: «Riempi falda» + «Rileva ostacoli» on top */
.studio-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 12px; }
.studio-actions .btn { justify-content: center; }
.studio-actions .studio-cta { margin-bottom: 0; }

/* selection card: align / distribute (Layout2D.alignSelection) */
.align-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.align-btn { height: 34px; border: 1px solid var(--border); background: #fff; border-radius: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-primary); padding: 0; }
.align-btn svg { width: 18px; height: 18px; }
.align-btn:hover { background: var(--bg-hover); }

/* obstacle card: type chips */
.obs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.obs-chip { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 5px 10px; font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; }
.obs-chip:hover { background: var(--bg-hover); }
.obs-chip.active { background: #fdecec; border-color: #e7a3a3; color: #a61b1b; }

/* right panel */
.studio-right {
  position: absolute; top: 16px; right: 16px; width: 300px; max-height: calc(100% - 32px); z-index: 6;
  display: flex; flex-direction: column; gap: 12px; overflow-y: auto; overflow-x: hidden;
}
.studio-card { background: var(--glass); backdrop-filter: blur(8px); border: 1px solid var(--border); border-radius: 14px; padding: 18px; box-shadow: var(--shadow-float); }
.studio-card[hidden] { display: none; }
details.studio-card > summary { cursor: pointer; font-weight: 700; font-size: 0.86rem; list-style: none; display: flex; justify-content: space-between; }
details.studio-card > summary::-webkit-details-marker { display: none; }
details.studio-card > summary::after { content: '▸'; color: var(--text-muted); transition: transform .15s; }
details.studio-card[open] > summary { margin-bottom: 10px; }
details.studio-card[open] > summary::after { transform: rotate(90deg); }
.studio-props-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.studio-props-head h4 { font-size: 1.02rem; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.studio-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--gold); flex: none; }
.studio-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.studio-tile { background: var(--bg-soft); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.studio-tile > span:first-child { font-size: 0.72rem; color: var(--text-muted); }
.studio-tile b { font-size: 1rem; font-weight: 700; }
.studio-tile-input { width: 100%; border: none; background: transparent; font: 700 1rem Inter, sans-serif; color: var(--text-primary); padding: 0; }
.studio-tile-input:focus { outline: none; box-shadow: 0 1px 0 var(--accent); }
.studio-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); margin: 4px 0 8px; }
.studio-seg { display: flex; background: var(--bg-soft); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 14px; }
.studio-seg button { flex: 1; border: none; background: transparent; border-radius: 9px; padding: 9px 6px; font-weight: 600; font-size: 0.84rem; color: var(--text-secondary); cursor: pointer; }
.studio-seg button.active { background: var(--ink); color: #fff; }
#studioFace > .form-select { margin-bottom: 14px; }
.studio-warn { background: var(--brand-soft); border: 1px solid rgba(217,119,6,0.25); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.studio-warn b { color: var(--gold-dark); font-size: 0.86rem; }
.studio-warn p { font-size: 0.78rem; color: var(--text-secondary); margin-top: 4px; line-height: 1.45; }
.studio-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.studio-row .form-input-sm { width: 64px; }
.studio-row-split .btn { flex: 1; justify-content: center; }
.studio-card .l2d-adv { margin-top: 12px; }
.studio-card .l2d-field .form-input-sm, .studio-card .l2d-field .form-select { width: 96px; }

/* next steps */
.steps-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.steps-head h4 { font-size: 0.98rem; font-weight: 700; }
.steps-ring { width: 46px; height: 46px; flex: none; transform: rotate(-90deg); }
.steps-ring circle { fill: none; stroke-width: 4; }
.steps-ring-bg { stroke: var(--bg-hover); }
.steps-ring-fg { stroke: var(--gold); stroke-linecap: round; }
.steps-ring text { transform: rotate(90deg); transform-origin: 22px 22px; font: 700 10px Inter, sans-serif; fill: var(--text-primary); text-anchor: middle; }
#projectChecklist .checklist { list-style: none; display: flex; flex-direction: column; gap: 9px; margin: 0 0 6px; padding: 0; }
#projectChecklist .checklist li { display: flex; align-items: center; gap: 10px; font-size: 0.84rem; color: var(--text-primary); }
#projectChecklist .checklist li a { color: inherit; text-decoration: none; }
#projectChecklist .checklist li a:hover { color: var(--accent); text-decoration: underline; }
#projectChecklist .checklist li.done { color: var(--text-muted); text-decoration: line-through; }
.check-box { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border-light); display: inline-flex; align-items: center; justify-content: center; font-size: 0.7rem; flex: none; color: #fff; }
li.done .check-box { background: var(--success); border-color: var(--success); }

/* legend + validation inside cards */
#layout2dLegend #legendItems { display: flex; flex-direction: column; gap: 6px; }
.studio-card.validation-panel { margin: 0; flex: none; overflow: visible; }

/* bottom chips */
.studio-bottom { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; gap: 10px; }
.studio-chip { display: flex; align-items: center; gap: 8px; background: var(--glass); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: 999px; padding: 9px 16px; box-shadow: var(--shadow-float); font-size: 0.84rem; }
.studio-search svg { width: 16px; height: 16px; color: var(--gold-dark); flex: none; }
.studio-search input { border: none; background: transparent; font: 600 0.86rem Inter, sans-serif; width: 230px; color: var(--text-primary); }
.studio-search input:focus { outline: none; }
.studio-scale { color: var(--text-secondary); font-size: 0.78rem; }
#studioScaleBar { display: inline-block; height: 6px; border: 1.5px solid var(--text-secondary); border-top: none; width: 40px; }

/* marquee + hint bar placement */
.l2d-marquee { position: absolute; z-index: 9; border: 1.5px dashed #2257c9; background: rgba(34,87,201,0.12); pointer-events: none; border-radius: 3px; }
.studio .l2d-hintbar { top: 82px; max-width: min(560px, calc(100% - 720px)); }
.pac-container { z-index: 2000 !important; border-radius: 12px; }
/* map search at the bottom (#mapSearch): suggestions open upwards (js/pvgis.js sets --pac-lift) */
body.pac-up .pac-container { transform: translateY(calc(-100% - var(--pac-lift, 56px))); box-shadow: 0 -8px 24px rgba(19,41,74,0.18); }

@media (max-width: 1280px) {
  .studio-right { width: 260px; }
  .layout2d-sidebar { width: 300px; }
  .studio-toolbar { top: auto; bottom: 80px; }
  .studio .l2d-hintbar { max-width: calc(100% - 620px); }
}
@media (max-width: 900px) {
  .studio-toolbar, .studio-right, .studio-bottom { position: static; transform: none; margin: 10px; width: auto; max-height: none; }
  .studio-bottom { flex-wrap: wrap; }
  .studio-search input { width: 100%; }
}
.studio .roof-stats-bar { display: none !important; }

/* header: keep the project block on one line */
.hdr-title-row { flex-wrap: nowrap; }
.variant-bar { white-space: nowrap; flex-wrap: nowrap; }
.project-name-badge { min-width: 60px; max-width: 180px; }
@media (max-width: 1600px) {
  .validation-badge #validationStatus { display: none; }
  .variant-bar .btn { display: none; }      /* «+ variante» / «confronta» stay in the variants manager */
}
/* shading results: normal text in the new panels */
.studio .shading-results.calc-result {
  font-family: inherit; background: var(--bg-soft); border: none; border-radius: 12px; font-size: 0.82rem; line-height: 1.45;
}

/* ── Page steps (Strutture, PVGIS, Report…) — redesign 2026-11 ── */
.phase-header-split { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.card-num-head { display: flex; gap: 14px; align-items: flex-start; margin: -2px 0 18px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.card-num-head h3 { margin: 0 0 2px !important; }
.card-num-head p { font-size: 0.8rem; color: var(--text-muted); }
.card-num { width: 36px; height: 36px; border-radius: 10px; background: var(--warning-bg); color: var(--gold-dark); font-weight: 650; font-size: 0.86rem; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.kpi-card { display: flex; flex-direction: column; position: relative; padding-top: 22px !important; border-radius: 14px !important; box-shadow: var(--shadow); }
.kpi-card::before { content: ''; position: absolute; top: 14px; left: 18px; width: 28px; height: 4px; border-radius: 3px; background: #7aa7e8; }
.kpi-grid > .kpi-card:nth-child(2)::before { background: #1b3a7a; }
.kpi-grid > .kpi-card:nth-child(3)::before { background: var(--gold); }
.kpi-grid > .kpi-card:nth-child(4)::before { background: #34c38f; }
.kpi-card .kpi-label { order: -1; margin: 6px 0 8px; }
.info-box.warning[role=note] { background: #e9f0fc; border-color: #c4d6f5; color: #1d3c78; }
.pvgis-grid { grid-template-columns: minmax(320px, 400px) 1fr; align-items: start; }
#pvgisResults:not([style*="none"]) ~ .pvgis-empty { display: none; }
.pvgis-empty .empty-state { padding: 120px 24px; }
.pv-summary { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 8px 0 18px; }
.pv-summary > div { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.pv-summary > div + div { border-left: 1px solid var(--border); }
.pv-summary span { font-size: 0.72rem; color: var(--text-muted); }
.pv-summary b { font-size: 0.9rem; }
@media (max-width: 1100px) { .pvgis-grid { grid-template-columns: 1fr; } }
/* Report step */
.report-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.report-main > .form-card:first-child, .report-main > .mt-4:first-child { margin-top: 0; }
.report-side { position: sticky; top: calc(var(--header-h) + 20px); display: flex; flex-direction: column; gap: 16px; }
.report-side .form-card { margin: 0; }
.report-need { background: var(--brand-soft) !important; border-color: rgba(217,119,6,0.25) !important; }
.report-need-val { display: flex; align-items: baseline; gap: 6px; margin: 8px 0 14px; }
.report-need-val b { font-size: 2.6rem; font-weight: 650; letter-spacing: -0.04em; }
.report-need-val span { color: var(--text-secondary); font-weight: 600; }
.need-bar { display: flex; height: 8px; border-radius: 6px; overflow: hidden; background: var(--bg-hover); margin-bottom: 14px; }
.need-bar i { display: block; height: 100%; }
.need-list, .ready-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 9px; font-size: 0.86rem; }
.need-list li, .ready-list li { display: flex; align-items: center; gap: 8px; }
.need-list b { margin-left: auto; }
.need-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.ready-list { margin: 12px 0 16px; }
.ready-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; }
.ready-dot.ok { background: var(--success); }
.ready-pill { margin-left: auto; font-size: 0.7rem; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--warning-bg); color: var(--gold-dark); }
.ready-pill.ok { background: var(--success-bg); color: var(--success); }
.report-side-row { display: flex; gap: 8px; margin: 10px 0; }
.report-side-row .btn { flex: 1; justify-content: center; }
@media (max-width: 1100px) { .report-layout { grid-template-columns: 1fr; } .report-side { position: static; } }

/* ============================================================
   STUDIO — docked panels, map fills the screen (2026-11-17 v2)
   ============================================================ */
body[data-phase="3"] { overflow: hidden; }
body[data-phase="3"] .app-layout { height: calc(100vh - var(--header-h)); min-height: 0; }
.studio .layout2d-main #layout2dMap { min-height: 0; }
.studio { --left-w: 316px; --right-w: 296px; overflow: hidden; }
.studio .layout2d-sidebar.studio-left {
  top: 0; left: 0; bottom: 0; width: var(--left-w); max-height: none; height: 100%;
  border-radius: 0; border: none; border-right: 1px solid var(--border); box-shadow: 8px 0 24px rgba(16,24,40,0.08);
  padding: 16px 16px 24px; gap: 12px; transition: transform .2s ease;
}
.studio .studio-right {
  top: 0; right: 0; bottom: 0; width: var(--right-w); max-height: none; height: 100%; gap: 0;
  background: var(--glass); backdrop-filter: blur(10px); border-left: 1px solid var(--border); box-shadow: -8px 0 24px rgba(16,24,40,0.08);
  transition: transform .2s ease;
}
.studio .studio-right .studio-card { border: none; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; background: transparent; backdrop-filter: none; padding: 16px; }
.studio .studio-right .studio-card:last-child { border-bottom: none; }
.studio.hide-left .studio-left { transform: translateX(-100%); }
.studio.hide-right .studio-right { transform: translateX(100%); }
/* toolbar, hint and bottom chips stay centred on the visible map */
.studio .studio-toolbar, .studio .studio-bottom, .studio .l2d-hintbar {
  left: calc(var(--left-w) + (100% - var(--left-w) - var(--right-w)) / 2); transition: left .2s ease;
}
.studio.hide-left { --left-w: 0px; }
.studio.hide-right { --right-w: 0px; }
.studio .l2d-hintbar { max-width: min(560px, calc(100% - var(--left-w) - var(--right-w) - 40px)); }
/* collapse handles on the panel edges */
.studio-handle {
  position: absolute; top: 50%; z-index: 7; width: 18px; height: 56px; transform: translateY(-50%);
  border: 1px solid var(--border); background: var(--glass); backdrop-filter: blur(10px); color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 1rem; padding: 0; transition: left .2s ease, right .2s ease;
}
.studio-handle:hover { color: var(--text-primary); background: #fff; }
.studio-handle-left { left: var(--left-w); border-left: none; border-radius: 0 10px 10px 0; }
.studio-handle-right { right: var(--right-w); border-right: none; border-radius: 10px 0 0 10px; }
.studio.hide-left .studio-handle-left span { transform: rotate(180deg); display: inline-block; }
.studio.hide-right .studio-handle-right span { transform: rotate(180deg); display: inline-block; }
/* Google map controls clear the right panel */
.studio .gmnoprint, .studio .gm-fullscreen-control { margin-right: calc(var(--right-w) + 6px) !important; }
@media (max-width: 1280px) { .studio { --left-w: 280px; --right-w: 260px; } .studio .studio-toolbar { top: 16px; bottom: auto; } }
@media (max-width: 900px) { .studio-handle { display: none; } body[data-phase="3"] { overflow: auto; } body[data-phase="3"] .app-layout { height: auto; } }

/* ============================================================
   STUDIO v3 — the map fills the whole window behind a floating header
   and floating side panels with small gaps (2026-11-17, user feedback)
   ============================================================ */
body[data-phase="3"] { --gap: 10px; --top: calc(var(--header-h) + 2 * var(--gap)); }
body[data-phase="3"] .app-header {
  top: var(--gap); left: var(--gap); right: var(--gap); height: calc(var(--header-h) - 4px);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-float);
}
body[data-phase="3"] .layout2d-workspace.studio { position: fixed; inset: 0; height: auto; z-index: 1; }
.studio .layout2d-main, .studio .layout2d-main #layout2dMap { height: 100% !important; min-height: 0; }
.studio .layout2d-sidebar.studio-left {
  top: var(--top); left: var(--gap); bottom: var(--gap); height: auto;
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-float);
}
.studio .studio-right {
  top: var(--top); right: var(--gap); bottom: var(--gap); height: auto; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-float);
}
.studio.hide-left .studio-left { transform: translateX(calc(-100% - 2 * var(--gap))); }
.studio.hide-right .studio-right { transform: translateX(calc(100% + 2 * var(--gap))); }
.studio .studio-toolbar { top: var(--top); }
.studio .l2d-hintbar { top: calc(var(--top) + 64px); }
.studio .studio-toolbar, .studio .studio-bottom, .studio .l2d-hintbar {
  left: calc(var(--gap) + var(--left-w) + (100% - var(--left-w) - var(--right-w) - 2 * var(--gap)) / 2);
}
.studio-handle-left { left: calc(var(--gap) + var(--left-w)); top: calc(50% + var(--header-h) / 2); }
.studio-handle-right { right: calc(var(--gap) + var(--right-w)); top: calc(50% + var(--header-h) / 2); }
.studio.hide-left .studio-handle-left { left: 0; border-left: 1px solid var(--border); }
.studio.hide-right .studio-handle-right { right: 0; border-right: 1px solid var(--border); }
.studio .gmnoprint, .studio .gm-fullscreen-control { margin-right: calc(var(--right-w) + 2 * var(--gap) + 6px) !important; }
@media (max-width: 900px) {
  body[data-phase="3"] .layout2d-workspace.studio { position: static; }
  body[data-phase="3"] .app-header { top: 0; left: 0; right: 0; border-radius: 0; }
}
.detect-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; max-height: 160px; overflow-y: auto; }
.detect-list li { display: flex; justify-content: space-between; align-items: center; font-size: 0.82rem; background: var(--bg-soft); border-radius: 8px; padding: 4px 6px 4px 10px; }
.detect-list .btn-icon { width: 24px; height: 24px; font-size: 0.8rem; }
/* confirmation dialog (UI.confirm) */
.ui-confirm-backdrop { position: fixed; inset: 0; z-index: 3000; background: rgba(13,20,36,0.45); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.ui-confirm { background: #fff; border-radius: 14px; box-shadow: var(--shadow-float); padding: 22px 24px; width: min(440px, 100%); }
.ui-confirm h3 { font-size: 1.1rem; margin-bottom: 8px; }
.ui-confirm p { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.5; margin-bottom: 18px; }
.ui-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }
/* map controls (north · fullscreen) — Progettazione */
.studio-mapctl { position: absolute; z-index: 7; display: flex; flex-direction: column; gap: 8px; }
.studio-mapctl { right: calc(var(--gap, 10px) + var(--right-w) + 22px); bottom: 150px; transition: right .2s ease; }
.mapctl-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: #fff; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-secondary); padding: 0; }
.mapctl-btn svg { width: 20px; height: 20px; }
.mapctl-btn:hover { color: var(--text-primary); }

/* ─── Editor schema unifilare (phase 6) ─────────────────────────── */
.sld-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: #eef2f7; margin: 0 0 12px; }
.sld-tab { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font: 600 13px Inter, system-ui, sans-serif; color: #475569; cursor: pointer; }
.sld-tab.active { background: #111827; color: #fff; }
.sld-editor { display: flex; flex-direction: column; height: calc(100vh - 210px); min-height: 520px; background: #fff; border-radius: 16px; box-shadow: var(--shadow-float, 0 4px 16px rgba(0,0,0,.08)); overflow: hidden; }
.sld-toolbar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 8px 10px; border-bottom: 1px solid #e5e7eb; }
.sld-group { display: flex; gap: 4px; align-items: center; }
.sld-group.sld-right { margin-left: auto; }
.sld-body { flex: 1; display: grid; grid-template-columns: 170px 1fr 240px; min-height: 0; }
.sld-palette { overflow-y: auto; border-right: 1px solid #e5e7eb; padding: 6px; background: #fafbfc; }
.sld-search { width: 100%; box-sizing: border-box; margin: 2px 0 6px; }
.sld-cat { margin: 0; }
.sld-cat > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; user-select: none; }
.sld-cat > summary::-webkit-details-marker { display: none; }
.sld-cat > summary::before { content: '▸'; margin-right: 4px; font-size: 9px; }
.sld-cat[open] > summary::before { content: '▾'; }
.sld-cat-title small { font-weight: 500; color: #94a3b8; margin-left: auto; }
.sld-sym[hidden], .sld-cat[hidden] { display: none; }
.ui-confirm.sld-import { width: min(520px, 100%); display: flex; flex-direction: column; gap: 10px; }
.sld-imp-opts { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.sld-imp-out { min-height: 18px; font-size: 12.5px; color: #475569; }
.sld-cat-title { font: 700 10px Inter, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: #64748b; margin: 8px 4px 4px; }
.sld-sym { display: flex; align-items: center; gap: 6px; width: 100%; border: 1px solid transparent; background: transparent; padding: 3px 4px; border-radius: 8px; cursor: pointer; text-align: left; font: 12px Inter, sans-serif; color: #1f2937; }
.sld-sym:hover { background: #fff; border-color: #e5e7eb; }
.sld-sym svg { flex: 0 0 26px; }
.sld-ico-txt { flex: 0 0 26px; text-align: center; font-size: 15px; }
.sld-stage { position: relative; background: #e9edf2; overflow: hidden; }
.sld-stage svg { display: block; cursor: crosshair; user-select: none; }
.sld-hint { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); background: rgba(17,24,39,.88); color: #fff; font: 12px Inter, sans-serif; padding: 6px 12px; border-radius: 10px; max-width: 80%; pointer-events: none; }
.sld-hint:empty { display: none; }
.sld-props { overflow-y: auto; border-left: 1px solid #e5e7eb; padding: 10px 12px; font: 12px Inter, sans-serif; }
.sld-props h4 { margin: 2px 0 10px; font-size: 14px; }
.sld-props label { display: block; margin: 0 0 9px; color: #475569; font-weight: 600; }
.sld-props input:not([type=checkbox]), .sld-props textarea, .sld-props select { display: block; width: 100%; margin-top: 3px; padding: 5px 7px; border: 1px solid #d1d5db; border-radius: 7px; font: 12px Inter, sans-serif; color: #111827; background: #fff; box-sizing: border-box; }
.sld-props .sld-check { display: flex; align-items: center; gap: 6px; }
.sld-tip { color: #64748b; line-height: 1.45; font-weight: 400; }
/* «Dati schema (JSON)» dialog */
.ui-confirm.sld-data { width: min(760px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; gap: 8px; }
.sld-data .sld-tip { margin: 0; font-size: 13px; }
.sld-data-json { width: 100%; min-height: 300px; flex: 1 1 auto; font: 12px/1.45 ui-monospace, Consolas, monospace; padding: 8px 10px; resize: vertical; box-sizing: border-box; }
.sld-data-out { max-height: 180px; overflow: auto; font-size: 12.5px; }
.sld-data-out ul { margin: 3px 0 6px 18px; padding: 0; }
.sld-data-err { color: #b91c1c; }
.sld-data-warn { color: #b45309; }
.sld-data-diff { color: #1d4ed8; }
.sld-data-note { color: #334155; }
.sld-data-ok { color: #15803d; margin: 4px 0; }
.sld-data-ai { border-top: 1px solid var(--border, #e7e6e4); margin-top: 6px; padding-top: 6px; }
.sld-data-ai ul { list-style: none; margin: 4px 0 8px; padding: 0; }
.sld-data-ai li { margin: 0 0 6px; }
.sld-data-ai li label { display: block; cursor: pointer; }
.sld-data-ai li .sld-tip { margin: 1px 0 0 22px; font-size: 12px; }
.sld-ai-corregge small { color: #15803d; }
.sld-ai-peggiora, .sld-ai-non-valida { opacity: .6; }
.sld-ai-peggiora small, .sld-ai-non-valida small { color: #b91c1c; }
.sld-ai-neutra small { color: #b45309; }
.sld-data .ui-confirm-actions { flex-wrap: wrap; }
@media (max-width: 900px) { .sld-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; } .sld-palette { max-height: 140px; } .sld-props { max-height: 200px; } }

/* ═══ Splash: video di caricamento (js/splash.js) ═══ */
.splash { position: fixed; inset: 0; z-index: 10000; background: #0b1220; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .3s ease; }
.splash.visible { opacity: 1; pointer-events: auto; }
.splash[hidden] { display: none; }
.splash video { width: 100%; height: 100%; object-fit: contain; background: #0b1220; }
.splash-skip { position: absolute; right: 20px; bottom: 20px; padding: 8px 16px; border: 1px solid rgba(255,255,255,.35); border-radius: 999px;
  background: rgba(0,0,0,.35); color: #fff; font: 600 13px/1 Inter, system-ui, sans-serif; cursor: pointer; backdrop-filter: blur(6px); }
.splash-skip:hover, .splash-skip:focus-visible { background: rgba(255,255,255,.2); outline: 2px solid var(--gold); }


.splash-fallback { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; color: #cbd5e1; font: 500 13px Inter, system-ui, sans-serif; }
.splash-fallback img { width: 84px; height: 84px; border-radius: 16px; }
.splash-bar { width: 180px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.14); overflow: hidden; }
.splash-bar i { display: block; height: 100%; width: 40%; border-radius: 4px; background: var(--brand); animation: splashBar 1.2s ease-in-out infinite; }
@keyframes splashBar { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
.splash video { position: relative; z-index: 1; }
.splash.no-video video { display: none; }
.splash-skip { z-index: 2; }
.btn.is-busy { opacity: .7; cursor: progress; }

/* ═══ Dashboard progetti (fase 10) — design «Sunject» minimal (2026-11-24) ═══
   Neutral warm greys, 1 px borders, no shadows; black = primary action, orange = state accent. */
body[data-phase="10"] .app-header { display: none; }
body[data-phase="10"] .app-layout { margin-top: 0; min-height: 100vh; }
body[data-phase="10"] .main-content { overflow: visible; padding: 0 !important; max-width: none !important; margin: 0 !important; }
.dash { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; color: var(--ink); background: var(--bg-primary); }
.dash button { font-family: inherit; }
.dash svg { width: 18px; height: 18px; flex: none; }

.dash-brand .brand-logo { width: 36px; height: 36px; object-fit: contain; flex: none; }

.dash-side { position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; background: var(--bg-side); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 22px 14px 14px; }
.dash-brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 26px; }
.dash-brand b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.dash-brand span { display: block; font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }
.dash-nav { display: flex; flex-direction: column; gap: 2px; }
.dash-nav a { display: flex; align-items: center; gap: 12px; padding: 9px 11px; border-radius: 9px; color: var(--text-secondary); font-size: 14px; text-decoration: none; transition: background var(--transition), color var(--transition); }
.dash-nav a svg { color: var(--text-muted); }
.dash-nav a i { margin-left: auto; font-style: normal; font-size: 12px; color: var(--text-muted); }
.dash-nav a:hover { background: var(--bg-hover); color: var(--ink); }
.dash-nav a.active { background: var(--bg-active); color: var(--ink); font-weight: 500; }
.dash-nav a.active svg { color: var(--ink); }
.dash-side-foot { margin-top: auto; display: flex; flex-direction: column; }
.dash-sync { margin: 0; padding: 12px 12px 14px; font-size: 12.5px; line-height: 1.5; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.dash-user { display: flex; align-items: center; gap: 11px; padding: 14px 6px 4px 10px; }
.dash-user div { flex: 1; min-width: 0; }
.dash-user b { display: block; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-user span { font-size: 12.5px; color: var(--text-muted); }
.dash-avatar { --av: 30; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: hsl(var(--av) 18% 93%); color: hsl(var(--av) 25% 25%); font-size: 11.5px; font-weight: 600; letter-spacing: .02em; }
.dash-avatar.empty { background: transparent; color: var(--text-muted); border: 1px dashed var(--border-light); font-size: 15px; font-weight: 400; }
.dash-avatar-btn { background: none; border: 0; padding: 0; cursor: pointer; border-radius: 50%; }
.dash-avatar-btn:hover .dash-avatar, .dash-avatar-btn:focus-visible .dash-avatar { box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 3.5px var(--ink); }
.dash-icon-btn { display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; cursor: pointer; width: 32px; height: 32px; border-radius: 8px; color: var(--text-muted); }
.dash-icon-btn:hover { background: var(--bg-hover); color: var(--ink); }

.dash-main { padding: 48px 56px 72px; width: 100%; max-width: 1440px; min-width: 0; }
.dash-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 40px; }
.dash-date { display: block; font-size: 14px; color: var(--text-muted); }
.dash-top h1 { margin: 6px 0 0; font-size: 32px; line-height: 1.15; letter-spacing: -.025em; font-weight: 600; }
.dash-top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dash-search { display: flex; align-items: center; gap: 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 0 8px 0 13px; height: 40px; width: 280px; transition: border-color var(--transition), box-shadow var(--transition); }
.dash-search:focus-within { border-color: var(--border-light); box-shadow: 0 0 0 3px var(--accent-dim); }
.dash-search svg { width: 16px; height: 16px; color: var(--text-muted); }
.dash-search input { border: 0; outline: 0; background: none; flex: 1; font: inherit; font-size: 14px; color: var(--ink); min-width: 0; }
.dash-search input::placeholder { color: var(--text-muted); }
.dash-search kbd { font: 500 11px Inter, sans-serif; color: var(--text-muted); border: 1px solid var(--border); border-radius: 5px; padding: 2px 6px; white-space: nowrap; }

/* buttons: primary = ink, default = white outline */
.dash-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-card); color: var(--ink); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background var(--transition), border-color var(--transition); }
.dash-btn svg { width: 16px; height: 16px; }
.dash-btn:hover { background: var(--bg-hover); border-color: var(--border-light); }
.dash-btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.dash-btn.primary:hover { background: var(--ink-hover); }
.dash-btn:disabled { opacity: .6; cursor: progress; }

.dash-top-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr); gap: 16px; margin-bottom: 48px; }
.dash-hero { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 28px 28px 26px; display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.dash-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); }
.dash-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); display: inline-block; flex: none; }
.dash-dot.ok { background: var(--success); margin-right: 6px; vertical-align: 2px; }
.dash-hero h2 { margin: 12px 0 0; font-size: 23px; line-height: 1.2; letter-spacing: -.02em; font-weight: 600; }
.dash-hero-sub { margin: 8px 0 0; color: var(--text-muted); font-size: 14.5px; }
.dash-hero-stats { display: flex; flex-wrap: wrap; gap: 14px 44px; margin: 32px 0 30px; }
.dash-hero-stats > div > span { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.dash-hero-stats b { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.dash-hero-stats small { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.dash-steps { display: flex; gap: 4px; padding-top: 8px; }
.dash-steps i { width: 24px; height: 3px; border-radius: 2px; background: var(--bg-active); }
.dash-steps i.on { background: var(--brand); }
.dash-hero.empty .dash-btn { margin-top: 26px; }

.dash-kpis { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.dash-kpi { padding: 22px 20px; display: flex; flex-direction: column; min-width: 0; }
.dash-kpi:nth-child(odd) { border-right: 1px solid var(--border); }
.dash-kpi:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
.dash-kpi span { font-size: 13px; color: var(--text-secondary); }
.dash-kpi b { font-size: 25px; line-height: 1.2; letter-spacing: -.02em; font-weight: 600; margin: 12px 0 10px; }
.dash-kpi em { font-style: normal; font-size: 14px; font-weight: 400; color: var(--text-muted); margin-left: 6px; }
.dash-kpi small { font-size: 13px; color: var(--text-muted); }

.dash-section-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.dash-section-head h3 { margin: 0; font-size: 17px; letter-spacing: -.01em; font-weight: 600; }
.dash-section-head h3 span { font-weight: 400; color: var(--text-muted); margin-left: 2px; }
.dash-controls { display: flex; gap: 12px; flex-wrap: wrap; }
.dash-seg { display: flex; gap: 2px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.dash-seg button { border: 0; background: none; height: 30px; padding: 0 13px; border-radius: 7px; font-size: 14px; color: var(--text-secondary); cursor: pointer; white-space: nowrap; transition: background var(--transition), color var(--transition); }
.dash-seg button:hover { color: var(--ink); }
.dash-seg button.active { background: var(--bg-active); color: var(--ink); font-weight: 500; }
.dash-seg.icons button { padding: 0 9px; display: flex; align-items: center; }
.dash-seg.icons svg { width: 17px; height: 17px; }

.dash-kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(184px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.dash-col { background: var(--bg-soft); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 280px; transition: background .15s, box-shadow .15s; }
.dash-col.over { background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.dash-col header { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 6px; font-size: 14px; }
.dash-col header b { font-weight: 500; }
.dash-col header i { font-style: normal; font-size: 13px; color: var(--text-muted); }
.dash-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 13px 14px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 14px; transition: border-color .12s, box-shadow .12s; }
.dash-card:hover, .dash-card:focus-visible { border-color: var(--border-light); box-shadow: 0 2px 8px rgba(28,25,23,.06); outline: none; }
.dash-card:focus-visible { box-shadow: 0 0 0 3px var(--accent-dim); }
.dash-card.current { border-color: var(--ink); }
.dash-card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.dash-card-top > div { min-width: 0; }
.dash-card h4 { margin: 0; font-size: 14.5px; font-weight: 500; letter-spacing: -.005em; }
.dash-card p { margin: 4px 0 0; font-size: 13px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-card .dash-avatar { width: 26px; height: 26px; font-size: 10px; }
.dash-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: -4px; }
.dash-tag { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--bg-soft); color: var(--text-secondary); }
.dash-tag.accent { background: var(--brand-soft); color: var(--brand-ink); }
.dash-card-foot { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; }
.dash-card-foot b { font-weight: 500; }
.dash-card-foot span { color: var(--text-muted); font-size: 13px; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.dash-empty { text-align: center; padding: 56px 14px; color: var(--text-muted); background: var(--bg-card); border: 1px dashed var(--border-light); border-radius: 14px; }
.dash-table-wrap { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; overflow-x: auto; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.dash-table th { text-align: left; padding: 11px 16px; font-size: 12.5px; font-weight: 500; color: var(--text-muted); border-bottom: 1px solid var(--border); background: var(--bg-side); }
.dash-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.dash-table td b { font-weight: 500; }
.dash-table tbody tr { cursor: pointer; }
.dash-table tbody tr:hover { background: var(--bg-side); }
.dash-table tr:last-child td { border-bottom: 0; }
.dash-table .num { text-align: right; white-space: nowrap; }
.dash-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.dash-stage { font-size: 13px; padding: 3px 9px; border-radius: 6px; background: var(--bg-soft); white-space: nowrap; }
.dash-assign-link { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; font-size: 13px; cursor: pointer; color: var(--ink); }
.dash-assign-link:hover { border-color: var(--border-light); background: var(--bg-hover); }
.dash-actions { text-align: right; }
.dash-muted { color: var(--text-muted); font-size: 13px; line-height: 1.5; margin: 0; }

.dash-menu { position: fixed; z-index: 9000; min-width: 220px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-float); padding: 5px; }
.dash-menu-title { font-size: 12px; color: var(--text-muted); padding: 8px 10px 4px; }
.dash-menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 7px 10px; border-radius: 8px; font: 400 14px Inter, sans-serif; color: var(--ink); cursor: pointer; text-align: left; }
.dash-menu button:hover { background: var(--bg-hover); }
.dash-menu button.on { background: var(--bg-active); font-weight: 500; }
.dash-menu .dash-avatar { width: 24px; height: 24px; font-size: 10px; }

.dash-modal-back { position: fixed; inset: 0; z-index: 9500; background: rgba(28,25,23,.32); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dash-modal { width: min(540px, 100%); background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 24px 26px; box-shadow: var(--shadow-float); display: flex; flex-direction: column; gap: 14px; color: var(--ink); }
.dash-modal header { display: flex; justify-content: space-between; align-items: flex-start; }
.dash-modal h2 { margin: 4px 0 0; font-size: 21px; letter-spacing: -.02em; font-weight: 600; }
.dash-modal label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.dash-modal input, .dash-modal select { height: 40px; border: 1px solid var(--border); background: var(--bg-card); border-radius: 10px; padding: 0 12px; font: 400 14px Inter, sans-serif; color: var(--ink); }
.dash-modal input:focus, .dash-modal select:focus { outline: none; border-color: var(--border-light); box-shadow: 0 0 0 3px var(--accent-dim); }
.dash-modal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dash-modal footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

@media (max-width: 1180px) { .dash-top-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .dash { grid-template-columns: 1fr; }
  .dash-side { display: none; }
  .dash-main { padding: 28px 16px 48px; }
  .dash-top-actions, .dash-search { width: 100%; }
  .dash-search { flex: 1; }
  .dash-modal-row { grid-template-columns: 1fr; }
}

/* Studio: il riepilogo «Impianto» resta fisso in alto, scorre solo il contenuto sotto (2026-11-23) */
.studio .layout2d-sidebar.studio-left { overscroll-behavior: contain; }
.studio .studio-left #sidebarSummary {
  position: sticky; top: -16px; z-index: 3; margin: -16px -16px 0; padding: 16px 16px 10px;
  background: #fff; border-bottom: 1px solid var(--border); flex-shrink: 0;
}

.dash-goto { margin-top: 22px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }


/* ═══ Sunject design (2026-11-24): section labels in sentence case, as in the dashboard ═══ */
.validation-panel h3, .subsection-title, .l2d-section > h4, .layout-legend h4, .stx-sub h4, .stx-v-head,
.studio-eyebrow, details.studio-block > summary, .studio-label, .sld-cat-title {
  text-transform: none !important; letter-spacing: 0 !important; font-weight: 500 !important;
  font-size: 0.93rem !important; color: var(--text-secondary) !important;
}
.sld-cat-title { font-size: 0.8rem !important; }

/* Progettazione: the project's orthophoto is loading (outline not editable meanwhile) */
.l2d-bg-status {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 30;
  background: var(--ink); color: #fff; font-size: 0.8rem; font-weight: 500;
  padding: 7px 14px; border-radius: 999px; box-shadow: var(--shadow-float); pointer-events: none;
}
.l2d-bg-status[hidden] { display: none; }
/* Google Maps did not load (no key / refused / offline): fixed explanation over the map */
.l2d-map-error { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 6; max-width: min(460px, calc(100% - 32px));
  display: flex; flex-direction: column; gap: 6px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-float); padding: 16px 18px; font-size: 0.86rem; color: var(--text-secondary); }
.l2d-map-error b { color: var(--text-primary); font-size: 0.95rem; }
.l2d-map-error code { font-size: 0.8rem; }
.l2d-map-error[hidden] { display: none; }

/* While the project's true orthophoto loads, Google's satellite photo (leaning on tall roofs) is hidden and nothing
   is drawn on it: the outline is never seen metres off the roof and then "fixing itself". The design fades in once
   the first correct paint is done. */
#layout2dMap { background: #e9e8e6; }
#layout2dMap > * { transition: opacity .45s ease; }
#layout2dMap.l2d-wait > * { opacity: 0; transition: none; }
.l2d-loader { pointer-events: none; position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 30; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 22px 30px 18px; background: rgba(255,255,255,.92); border: 1px solid var(--border, #e7e6e4); border-radius: 18px; box-shadow: var(--shadow-float, 0 8px 30px rgba(0,0,0,.12)); transition: opacity .35s ease; }
.l2d-loader[hidden] { display: none; }
.l2d-loader.done { opacity: 0; }
.l2d-loader svg { transform: rotate(-90deg); }
.l2d-loader .l2d-ring-bg { fill: none; stroke: #ecebe9; stroke-width: 5; }
.l2d-loader .l2d-ring { fill: none; stroke: var(--brand, #d97706); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.l2d-loader b { position: absolute; top: 22px; left: 0; right: 0; height: 84px; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; color: #1c1b19; }
.l2d-loader span { font-size: 13px; color: #6b6a66; }

/* ── Guida rapida (js/onboarding.js) ── */
.ob-root { position: fixed; inset: 0; z-index: 3000; pointer-events: none; }
.ob-spot { position: fixed; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(28, 27, 25, 0.55); outline: 2px solid var(--brand); transition: left .2s, top .2s, width .2s, height .2s; }
.ob-spot.ob-none { inset: 0; border-radius: 0; outline: none; box-shadow: none; background: rgba(28, 27, 25, 0.55); }
.ob-bubble { position: fixed; pointer-events: auto; width: min(360px, calc(100vw - 24px)); background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-float); padding: 14px 16px 12px; }
.ob-bubble h3 { margin: 2px 0 6px; font-size: 1rem; font-weight: 600; }
.ob-bubble p { margin: 0 0 12px; font-size: 0.88rem; line-height: 1.45; color: var(--text-secondary); }
.ob-count { font-size: 0.74rem; color: var(--brand); font-weight: 600; }
.ob-actions { display: flex; align-items: center; gap: 6px; }
.ob-grow { flex: 1; }
@media (prefers-reduced-motion: reduce) { .ob-spot { transition: none; } }


/* outline lock (js/layout2d.js editOutline): locked by default, ink when the vertex handles are on */
.studio-outline-edit { margin: 8px 0 2px; justify-content: center; color: var(--text-secondary); }
.studio-outline-edit.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── «Impianto elettrico» guided design (js/elecguide.js, 2026-12-02) ── */
.eg-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.eg-title h4 { margin: 0; font-size: 0.95rem; font-weight: 600; }
.eg-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.eg-step { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: #fff; }
.eg-step.eg-locked { opacity: 0.55; }
.eg-step.eg-now { border-color: var(--ink); }
.eg-step.eg-error { border-color: var(--error); }
.eg-step.eg-warn { border-color: var(--warning); }
.eg-head { display: flex; align-items: center; gap: 8px; font-size: 0.86rem; }
.eg-num { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 600; background: var(--bg-soft); color: var(--text-secondary); flex: none; }
.eg-now .eg-num { background: var(--ink); color: #fff; }
.eg-done .eg-num { background: var(--success); color: #fff; }
.eg-error .eg-num { background: var(--error); color: #fff; }
.eg-warn .eg-num { background: var(--warning); color: #fff; }
.eg-body { margin-top: 6px; font-size: 0.82rem; display: flex; flex-direction: column; gap: 6px; }
.eg-body p { margin: 0; }
.eg-hint { color: var(--text-secondary); font-size: 0.78rem; }
.eg-warn { color: var(--warning); }
.eg-warn-inline { color: var(--warning); font-weight: 600; }
.eg-good { color: var(--success); font-weight: 600; }
.eg-card { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; }
.eg-card.eg-blocked { background: var(--bg-soft); }
.eg-card-head { display: flex; justify-content: space-between; gap: 6px; }
.eg-ok { color: var(--success); font-size: 0.76rem; }
.eg-issue { color: var(--warning); font-size: 0.76rem; }
.eg-blocked .eg-issue { color: var(--error); }
.eg-mppt { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.eg-mppt th { text-align: left; font-weight: 500; color: var(--text-secondary); padding: 2px 0; }
.eg-mppt td { padding: 3px 0; vertical-align: top; border-top: 1px solid var(--border-light); }
.eg-mppt small { display: block; color: var(--text-muted); font-size: 0.7rem; }
.eg-pm { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.eg-pm button { width: 22px; height: 22px; border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer; line-height: 1; }
.eg-pm button:hover { background: var(--bg-soft); }
.eg-pm.eg-bad { color: var(--error); }
.eg-check { display: flex; gap: 6px; font-size: 0.78rem; }
.eg-check > span { flex: none; width: 16px; height: 16px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.65rem; color: #fff; font-weight: 700; }
.eg-check.eg-error > span { background: var(--error); }
.eg-check.eg-warn > span { background: var(--warning); }
.btn-xs { padding: 1px 6px; font-size: 0.72rem; }

/* PVGIS automatic status (js/pvgis.js autoRun, 2026-12-02) */
.pvgis-auto { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-soft); font-size: 0.82rem; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pvgis-err { color: var(--error); }
.pvgis-spin { width: 12px; height: 12px; border: 2px solid var(--border); border-top-color: var(--ink); border-radius: 50%; display: inline-block; animation: pvgis-spin 0.8s linear infinite; }
@keyframes pvgis-spin { to { transform: rotate(360deg); } }
.eg-seg { display: flex; align-items: center; gap: 4px; background: var(--bg-soft); border-radius: 9px; padding: 3px; font-size: 0.78rem; }
.eg-seg > span { padding: 0 6px; color: var(--text-secondary); flex: 1; }
.eg-seg button { border: none; background: transparent; border-radius: 7px; padding: 4px 12px; font-weight: 600; cursor: pointer; color: var(--text-secondary); }
.eg-seg button.active { background: var(--ink); color: #fff; }
.eg-tag { align-self: flex-start; font-size: 0.68rem; font-weight: 600; padding: 1px 6px; border-radius: 6px; background: var(--bg-soft); color: var(--text-secondary); }
.eg-tag-model, .eg-tag-series { background: var(--success-bg); color: var(--success); }
.eg-tag-voltage { background: var(--warning-bg); color: var(--warning); }
.eg-check > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.eg-check small { color: var(--text-muted); font-size: 0.7rem; }
.eg-fix { display: flex; flex-wrap: wrap; gap: 4px; }
.dash-more { margin: -24px 0 40px; }

.dash-group-tabs { margin: 0 0 18px; width: fit-content; }
.dash-group-tabs i { font-style: normal; color: var(--text-muted, #8a8782); font-size: 12px; margin-left: 4px; }
.dash-group { margin-bottom: 28px; }
.dash-group-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.dash-group-head h4 { margin: 0; font-size: 15px; font-weight: 600; }
.dash-group-head h4 span { color: var(--text-muted, #8a8782); font-weight: 500; margin-left: 4px; }
.dash-group-head small { color: var(--text-secondary); font-size: 13px; }

.dash-col-empty { margin: 8px 4px; font-size: 13px; }
.pac-container { z-index: 20000 !important; }

/* ── Account e impostazioni (Auth.openAccount) ── */
.acc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.acc-avatar { width: 46px; height: 46px; font-size: 1rem; cursor: default; }
.acc-who { flex: 1; min-width: 0; }
.acc-who h3 { margin: 0; font-size: 1.15rem; }
.acc-who span { font-size: .85rem; color: var(--text-muted); }
.acc-sec { border-top: 1px solid var(--border); padding: 14px 0 6px; }
.acc-sec h4 { margin: 0 0 10px; font-size: .95rem; font-weight: 600; }
.acc-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: .9rem; }
.acc-row span { color: var(--text-muted); }
.acc-row b { font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.acc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 12px; }
.acc-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.acc-actions-left { justify-content: flex-start; }
.acc-danger h4 { color: var(--error); }

/* ── Studio: live tilt + spacing between modules (2026-12-03) ── */
.tilt-live-val { font-size: 0.9rem; font-weight: 600; color: var(--text-primary, #1c1b19); }
.studio-block input.tilt-range { width: 100%; display: block; max-width: none; margin: 6px 0 4px; accent-color: var(--brand, #d97706); cursor: pointer; }
.tilt-preview { display: block; width: 100%; height: auto; background: var(--bg-soft, #f2f1ef); border: 1px solid var(--border, #e7e6e4); border-radius: 8px; }
.tilt-preview .tp-roof { stroke: #8a8782; stroke-width: 2; fill: none; }
.tilt-preview .tp-mod { stroke: #13294a; stroke-width: 5; stroke-linecap: round; }
.tilt-preview .tp-leg { stroke: #9aa4b2; stroke-width: 1.5; }
.tilt-preview .tp-sun { stroke: #d97706; stroke-width: 1; stroke-dasharray: 3 3; fill: none; }
.tilt-preview .tp-dim { stroke: #1c1b19; stroke-width: 0.8; }
.tilt-preview .tp-arc { stroke: #d97706; stroke-width: 1.2; fill: none; }
.tilt-preview text { font: 600 9px Inter, sans-serif; fill: #1c1b19; }
.tilt-preview text.tp-muted { font-weight: 400; fill: #6b6863; }
.studio-gap-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.studio-gap-fields .form-input { padding: 8px 10px; font-size: 0.95rem; font-weight: 600; }
.studio-gap-hint { margin: 6px 0 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand, #d97706); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
/* string chooser in the selection card */
.str-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.str-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border: 1px solid var(--border, #e7e6e4); border-radius: 999px; background: #fff; font: 600 0.78rem Inter, sans-serif; cursor: pointer; color: var(--text-primary, #1c1b19); }
.str-chip i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.str-chip small { font-weight: 400; color: var(--text-muted, #6b6863); }
.str-chip:hover { background: var(--bg-soft, #f2f1ef); }
.str-chip.on { border-color: var(--text-primary, #1c1b19); box-shadow: inset 0 0 0 1px var(--text-primary, #1c1b19); }
.str-chip.str-new { border-style: dashed; color: var(--text-muted, #6b6863); }
/* trash on an MPPT row (guide + «Stringhe & Array» table) */
.btn-trash { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; border: 1px solid var(--border, #e7e6e4); border-radius: 6px; background: #fff; color: var(--text-muted, #6b6863); cursor: pointer; }
.btn-trash:hover:not(:disabled) { color: #c62828; border-color: #c62828; background: #fdf1f1; }
.btn-trash:disabled { opacity: 0.35; cursor: default; }
.eg-mppt td:last-child { text-align: right; vertical-align: top; }
.eg-mppt tr.eg-free td { color: var(--text-muted, #6b6863); }
.eg-free-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.eg-free-txt { font-size: 0.8rem; }

/* ── Live collaboration (js/live.js): people in the project, «Condividi» ── */
.live-presence { display: flex; align-items: center; gap: 4px; margin-right: 6px; }
.live-presence[hidden] { display: none; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #c9c6c0; margin-right: 4px; flex: none; }
.live-dot.on { background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, .15); }
.live-avatar { --c: #8a8780; width: 26px; height: 26px; border-radius: 50%; background: var(--c); color: #fff; font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--bg-primary, #f8f8f7); margin-left: -6px; flex: none; cursor: default; }
.live-presence .live-avatar:first-of-type { margin-left: 0; }
.live-avatar.live-more { background: var(--bg-active, #ecebe8); color: var(--text-primary, #1c1b19); }
.live-share-btn { margin-left: 6px; }
.live-share { max-width: 520px; width: 94vw; text-align: left; }
.live-share-sub { margin: 0 0 12px; font-size: .85rem; }
.live-invite { display: flex; gap: 6px; flex-wrap: wrap; }
.live-invite[hidden] { display: none; }
.live-invite .form-input { flex: 1 1 200px; }
.live-invite .form-select { flex: 0 0 auto; width: auto; }
.live-invite-msg { min-height: 1.2em; font-size: .85rem; margin: 8px 0; word-break: break-all; }
.live-members { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow: auto; border-top: 1px solid var(--border, #e7e6e4); padding-top: 8px; }
.live-member { display: flex; align-items: center; gap: 10px; padding: 6px 2px; }
.live-member .live-avatar { margin-left: 0; }
.live-member-name { flex: 1; font-size: .9rem; line-height: 1.25; }
.live-member .form-select { width: auto; }
.live-role { font-size: .85rem; color: var(--text-muted, #6b6862); }
.live-online { color: #16a34a; font-size: .8rem; }
.dash-card-foot span .dash-share { margin-right: 6px; vertical-align: middle; width: 26px; height: 26px; }
