/* TL-SAG System CSS - Premium Light CAD Engineering Theme */

:root {
  --bg-dark: #f1f5f9;       /* soft gray-blue */
  --bg-panel: #ffffff;      /* crisp white panels */
  --bg-input: #f8fafc;      /* ultra-light input backgrounds */
  
  --text-main: #0f172a;     /* dark slate primary */
  --text-muted: #475569;    /* medium slate secondary */
  
  --primary: #1e40af;       /* deep structural blue */
  --primary-glow: rgba(30, 64, 175, 0.12);
  
  --success: #0f766e;       /* deep teal green for safe indicators */
  --success-glow: rgba(15, 118, 110, 0.1);
  
  --warning: #b45309;       /* dark amber for cautions */
  --warning-glow: rgba(180, 83, 9, 0.1);
  
  --danger: #b91c1c;        /* deep structural red for snapping risks */
  --danger-glow: rgba(185, 28, 28, 0.1);
  
  --border: #cbd5e1;        /* crisp slate border */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', "Courier New", Courier, monospace;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  padding: 1.5rem;
}

.container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}

.header-title h1 {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #60a5fa, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-title p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.2rem;
}

.header-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Tab navigation */
.tabs {
  display: flex;
  gap: 0.5rem;
  background: #cbd5e1;
  padding: 0.35rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.8rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.04);
}

.tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}
/* Grid Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.6fr;
  gap: 1.5rem;
  align-items: start;
}

.left-col,
.right-col {
  min-width: 0; /* prevent grid blowout from long content */
}

.right-col {
  position: sticky;
  top: 1rem;
}

@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .right-col {
    position: static;
  }
}

/* Card & Panels */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  margin-bottom: 1.5rem;
}

.panel h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
}

.form-section {
  margin-bottom: 1.5rem;
}

.form-section-title {
  font-size: 0.9rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 800;
  margin-bottom: 0.8rem;
  letter-spacing: 0.05em;
}

/* Form Layout Grid */
.input-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.input-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 500px) {
  .input-grid-2, .input-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Inputs and Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.form-group.no-margin {
  margin-bottom: 0;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input, .form-group select {
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  width: 100%;
  transition: all 0.2s;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-group input[readonly] {
  opacity: 0.75;
  background-color: #162030;
  cursor: not-allowed;
}

.unit-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: normal;
}

/* Sliders */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #cbd5e1;
  outline: none;
  margin: 0.4rem 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
  box-shadow: 0 0 12px var(--primary-glow);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-muted);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #059669;
  box-shadow: 0 0 12px var(--success-glow);
}

.btn-block {
  width: 100%;
}

/* Results Cards */
.results-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.results-header {
  font-size: 0.85rem;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}

.results-val {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 1rem;
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.result-item {
  border-top: 1px solid var(--border);
  padding-top: 0.8rem;
}

.result-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.result-data {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: bold;
}

/* Safety Gauge / Status Card */
.status-card {
  padding: 1.2rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.status-card.safe {
  background: rgba(16, 185, 129, 0.08);
  border-color: var(--success);
}

.status-card.caution {
  background: rgba(245, 158, 11, 0.08);
  border-color: var(--warning);
}

.status-card.danger {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--danger);
}

.status-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
}

.status-card.safe .status-badge { background: var(--success); color: #000000; }
.status-card.caution .status-badge { background: var(--warning); color: #000000; }
.status-card.danger .status-badge { background: var(--danger); color: #ffffff; }

.status-title {
  font-size: 1.15rem;
  font-weight: bold;
}

.status-card.safe .status-title { color: #34d399; }
.status-card.caution .status-title { color: #fbbf24; }
.status-card.danger .status-title { color: #f87171; }

.status-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Tension Gauge Bar */
.gauge-bar-wrapper {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.gauge-track {
  width: 100%;
  height: 10px;
  background: #cbd5e1;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.gauge-fill {
  height: 100%;
  border-radius: 5px;
  width: 0%;
  transition: width 0.3s ease;
}

.status-card.safe .gauge-fill { background: var(--success); }
.status-card.caution .gauge-fill { background: var(--warning); }
.status-card.danger .gauge-fill { background: var(--danger); }

/* Monospaced Steps Card */
.steps-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-main);
  overflow-x: auto;
  white-space: pre-wrap;
  margin-top: 1rem;
}

.steps-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  font-weight: bold;
  color: var(--text-main);
  margin-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}

/* Technical Guideline Details */
.guide-content {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.guide-content h3 {
  color: var(--text-main);
  font-size: 1.1rem;
  margin-top: 1.2rem;
  margin-bottom: 0.5rem;
}

.guide-content p {
  margin-bottom: 0.8rem;
  line-height: 1.6;
}

.guide-content ol, .guide-content ul {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.guide-content li {
  margin-bottom: 0.4rem;
}

/* Monospaced inline text */
code {
  font-family: var(--font-mono);
  background: var(--bg-dark);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--text-main);
  border: 1px solid var(--border);
}

/* Text Formula Display Block */
.formula-block {
  background: var(--bg-dark);
  border-left: 3px solid var(--primary);
  padding: 0.6rem 1rem;
  font-family: var(--font-mono);
  color: var(--primary);
  font-size: 0.9rem;
  margin: 0.8rem 0;
  border-radius: 0 8px 8px 0;
}

/* Styled CAD tooltips for professional utility engineers */
.field-tooltip {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: 0.35rem;
  padding: 0.3rem 0.6rem;
  border-left: 2px solid var(--primary);
  background: rgba(30, 64, 175, 0.04);
  border-radius: 0 6px 6px 0;
  transition: all 0.2s ease;
}

.field-tooltip:hover {
  background: rgba(30, 64, 175, 0.08);
  color: var(--text-main);
  border-left-color: var(--success);
}

/* Engineering fonts for SVG dimension overlays */
.interactive-svg text {
  font-family: var(--font-sans);
  font-weight: 600;
  user-select: none;
}

/* Collapsible sections for secondary parameters */
.collapsible-trigger {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 1rem;
  transition: all 0.2s;
}

.collapsible-trigger:hover {
  background: #e2e8f0;
}

.collapsible-content {
  display: none;
  border: 1px solid var(--border);
  border-radius: 0 0 12px 12px;
  padding: 1.2rem;
  background: #ffffff;
  margin-top: -1.2rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.collapsible-content.active {
  display: block;
}

/* Collapsible field calculation helpers (GPS + Tower Height) */
.gps-toggle-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 700;
  text-align: left;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.3rem;
  transition: opacity 0.2s;
}

.gps-toggle-btn:hover {
  opacity: 0.85;
  text-decoration: underline;
}

.gps-helper-panel {
  display: none;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-top: 0.6rem;
  flex-direction: column;
  gap: 0.8rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.gps-helper-panel.active {
  display: flex;
}

/* Dynamic SVG Sag vs. Tension Chart */
.chart-area {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  margin-top: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.chart-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chart-svg {
  width: 100%;
  height: auto;
  max-height: 640px;
  background: #fafafa;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.chart-grid-line {
  stroke: #e2e8f0;
  stroke-width: 1;
}

.chart-axis {
  stroke: #475569;
  stroke-width: 1.5;
}

.chart-curve {
  fill: none;
  stroke: var(--primary);
  stroke-width: 3;
  stroke-linecap: round;
}

.chart-dot {
  fill: var(--danger);
  stroke: #ffffff;
  stroke-width: 2;
}

.chart-band-safe { fill: rgba(15, 118, 110, 0.06); }
.chart-band-caution { fill: rgba(180, 83, 9, 0.06); }
.chart-band-warning { fill: rgba(249, 115, 22, 0.05); }
.chart-band-danger { fill: rgba(185, 28, 28, 0.06); }

/* ==========================================================================
   PRINT LAYOUT - PROFESSIONAL ENGINEERING REPORT STYLE
   ========================================================================== */


#printable-report {
  display: none; /* Hidden on normal screen view */
}

@media print {
  /* Landscape orientation: gives the annotated photograph and geometry
     sketch the full page width they deserve */
  @page {
    size: A4 landscape;
    margin: 1.2cm;
  }

  /* HIDE ALL REGULAR INTERACTIVE DASHBOARD ELEMENTS */
  body {
    background-color: #ffffff !important;
    color: #0f172a !important;
    font-family: "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 10.5pt !important;
    line-height: 1.45 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .container, header, .tabs, .dashboard-grid, .panel, footer {
    display: none !important;
  }

  /* SHOW ONLY THE DESIGNATED FORMAL CALCULATION REPORT */
  #printable-report {
    display: block !important;
    background: #ffffff !important;
    color: #000000 !important;
    width: 100% !important;
    padding: 20mm !important;
  }

  /* Report Styling — carries the app's visual identity into print */
  #printable-report {
    padding: 0 !important;
  }

  /* Page-break discipline: keep headings with their content and never
     split a figure, table, card or the photo across pages — but allow
     breaks BETWEEN those blocks so pages fill naturally. */
  #printable-report h2 {
    break-after: avoid-page;
    page-break-after: avoid;
  }
  #printable-report img,
  #printable-report table.report-table,
  #printable-report .pr-figure-box,
  #printable-report .print-verdict-box,
  #printable-report .print-math-box,
  #printable-report #pr-sketch-box {
    break-inside: avoid-page;
    page-break-inside: avoid;
  }
  .report-header {
    break-after: avoid-page;
    page-break-after: avoid;
  }

  .report-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 3px solid #1d4ed8;
    padding-bottom: 0.7rem;
    margin-bottom: 1.6rem;
  }

  .report-header::before {
    content: "⚡ TL-SAG";
    font-size: 15pt;
    font-weight: 800;
    color: #1d4ed8;
    letter-spacing: 0.02em;
    white-space: nowrap;
  }

  .report-header h1 {
    font-size: 17pt;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
  }

  .report-header p {
    font-size: 9.5pt;
    color: #475569;
    margin: 0;
    text-align: right;
  }

  .report-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
  }

  .report-section {
    margin-bottom: 1.6rem;
  }

  .report-section h2 {
    font-size: 12pt;
    font-weight: 800;
    color: #1d4ed8;
    border-bottom: 2px solid #dbeafe;
    padding-bottom: 0.25rem;
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  table.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.2rem;
    border-radius: 8px;
    overflow: hidden;
  }

  table.report-table th, table.report-table td {
    border: 1px solid #cbd5e1;
    padding: 0.45rem 0.7rem;
    text-align: left;
    font-size: 9.5pt;
  }

  table.report-table th {
    background-color: #eff6ff !important;
    color: #1e3a5f;
    font-weight: 700;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  table.report-table td {
    background-color: #ffffff !important;
  }

  /* Figures cloned from the live dashboard (sketch, chart, MC histogram) */
  .pr-figure-box {
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #f8fafc !important;
    padding: 0.35cm;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  #pr-sketch-box {
    border: 1px solid #cbd5e1 !important;
    border-radius: 10px !important;
    background: #f8fafc !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Safety Assessment Banner — app-style status card */
  .print-verdict-box {
    border: 1px solid #cbd5e1;
    border-left: 8px solid #64748b;
    border-radius: 10px;
    padding: 0.8rem 1.2rem;
    margin-bottom: 1.6rem;
    text-align: left;
  }

  .print-verdict-box.print-safe {
    background-color: #ecfdf5 !important;
    border-left-color: #10b981;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-verdict-box.print-caution {
    background-color: #fffbeb !important;
    border-left-color: #f59e0b;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-verdict-box.print-danger {
    background-color: #fef2f2 !important;
    border-left-color: #ef4444;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-verdict-box h3 {
    font-size: 13pt;
    font-weight: 800;
    margin-bottom: 0.25rem;
  }

  .print-verdict-box.print-safe h3 { color: #047857; }
  .print-verdict-box.print-caution h3 { color: #b45309; }
  .print-verdict-box.print-danger h3 { color: #b91c1c; }

  .print-verdict-box p {
    font-size: 9.5pt;
    color: #334155;
    margin: 0;
  }

  /* Calculation log — console-style monospace card */
  .print-math-box {
    background-color: #f8fafc !important;
    border: 1px solid #cbd5e1;
    border-left: 4px solid #1d4ed8;
    border-radius: 8px;
    padding: 0.8rem 1rem;
    font-family: Consolas, "Courier New", monospace;
    font-size: 8.5pt;
    white-space: pre-wrap;
    line-height: 1.35;
    margin-bottom: 1.2rem;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ==========================================================================
   CAD VECTOR HELPERS FOR HIGH-CONTRAST SVG THEME ADAPTATION
   ========================================================================== */
.cad-text-primary { fill: var(--primary) !important; }
.cad-text-success { fill: var(--success) !important; }
.cad-text-warning { fill: var(--warning) !important; }
.cad-text-danger { fill: var(--danger) !important; }
.cad-text-muted { fill: var(--text-muted) !important; }
.cad-text-main { fill: var(--text-main) !important; }

.cad-line-primary { stroke: var(--primary) !important; }
.cad-line-success { stroke: var(--success) !important; }
.cad-line-warning { stroke: var(--warning) !important; }
.cad-line-danger { stroke: var(--danger) !important; }
.cad-line-muted { stroke: var(--text-muted) !important; }
.cad-line-border { stroke: var(--border) !important; }

.cad-grid-line { stroke: var(--border) !important; opacity: 0.35 !important; }
.cad-grid-bg { fill: var(--bg-panel) !important; }

/* Scale CAD results sheet styles */
.scale-cad-wrapper {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}
.scale-cad-title {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}

.interactive-svg {
  background: var(--bg-panel) !important;
  transition: background 0.3s ease, border-color 0.3s ease;
}

/* ==========================================================================
   CLIENT-SIDE PHOTO SAG CANVAS TRACKER STYLES
   ========================================================================== */
.canvas-tracker-container {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  background: var(--bg-panel);
  margin-top: 1rem;
}

.canvas-workspace {
  position: relative;
  width: 100%;
  max-width: 100%;
  background: #0f172a; /* nice dark slate backdrop for image */
  border-radius: 8px;
  overflow: auto;
  border: 2px solid var(--border);
  margin-top: 0.8rem;
  min-height: 300px;
  max-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#photo-tracker-canvas {
  display: block;
  cursor: crosshair;
  max-width: 100%;
}

/* Fullscreen photo editing: the workspace container fills the screen */
.canvas-workspace:fullscreen {
  width: 100vw !important;
  height: 100vh !important;
  max-height: none !important;
  border-radius: 0 !important;
  border: none !important;
}

.canvas-instructions {
  background: rgba(180, 83, 9, 0.04);
  border-left: 3px solid var(--warning);
  padding: 0.8rem 1rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.85rem;
  color: var(--warning);
  margin-bottom: 0.8rem;
  line-height: 1.5;
}

.import-export-container {
  display: flex;
  gap: 0.5rem;
}

/* Flagship photo tool panel: visually the star of the page */
.flagship-panel {
  border-top: 4px solid var(--success);
  box-shadow: 0 8px 28px rgba(16, 185, 129, 0.10);
}

.photo-panel-grid {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* The controls column is narrow — stack its fields so long select
   labels (calibration methods) are not truncated */
#photo-panel .input-grid-2 {
  grid-template-columns: 1fr;
}

/* Photo calibration explainer: diagram left, physics right */
.explainer-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  gap: 1.5rem;
  align-items: center;
  padding: 1rem 0.4rem;
}
@media (max-width: 1000px) {
  .explainer-grid { grid-template-columns: 1fr; }
}

/* Photo fit results: text bullets left, probability chart right */
.photo-results-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.15fr) minmax(300px, 1fr);
  gap: 1rem 2.5rem;
  align-items: center;
}
.mc-cell { min-width: 0; }
@media (max-width: 980px) {
  .photo-results-grid { grid-template-columns: 1fr; }
}

/* Floating toolbar overlaid on the photo canvas (also visible in fullscreen) */
.canvas-toolbar {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  display: flex;
  gap: 4px;
  align-items: center;
  background: rgba(15, 23, 42, 0.74);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 5px 6px;
  flex-wrap: wrap;
  max-width: calc(100% - 20px);
}

.ct-btn {
  background: none;
  border: 1px solid transparent;
  color: #e2e8f0;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.55rem;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.ct-btn:hover { background: rgba(255, 255, 255, 0.14); }
.ct-btn.active { background: var(--success); color: #ffffff; }
.ct-sep { width: 1px; height: 18px; background: rgba(255, 255, 255, 0.22); }

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

/* App version badge + update notice */
.version-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.15rem 0.45rem;
  vertical-align: middle;
  letter-spacing: 0.02em;
}

.update-notice {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid var(--success);
  border-radius: 10px;
  padding: 0.7rem 1.1rem;
  margin-bottom: 1.2rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.update-notice a { color: var(--success); font-weight: 600; }
.update-notice button {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
}

/* Full-width analysis panel: chart + sensitivity side by side */
.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 1.5rem;
}
@media (max-width: 1000px) {
  .analysis-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   PROJECT GATE — project-first entry overlay
   ========================================================================== */
.project-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 5vh 1rem 3vh;
}

.gate-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 740px;
  width: 100%;
  padding: 2rem 2.2rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  position: relative;
}

.gate-close {
  position: absolute;
  top: 0.8rem;
  right: 0.9rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
}
.gate-close:hover { color: var(--danger); border-color: var(--danger); }

.gate-brand {
  text-align: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin-bottom: 1.4rem;
}
.gate-brand h1 { font-size: 1.6rem; margin-bottom: 0.2rem; }
.gate-brand p { color: var(--text-muted); font-size: 0.85rem; }

.gate-card h2 { font-size: 1.15rem; margin-bottom: 0.3rem; }
.gate-sub { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1rem; line-height: 1.5; }
.gate-list-title { font-size: 0.9rem; margin: 1.4rem 0 0.5rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

.gate-new-row { display: flex; gap: 0.6rem; }
.gate-new-row input {
  flex: 1;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 0.9rem;
}

.gate-project-item { display: flex; gap: 0.4rem; margin-bottom: 0.4rem; }
.gate-project-open {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-main);
  font-size: 0.88rem;
  text-align: left;
}
.gate-project-open span { color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; }
.gate-project-open:hover { border-color: var(--primary); }
.gate-project-delete {
  border: 1px solid var(--border);
  background: none;
  color: var(--danger);
  border-radius: 8px;
  cursor: pointer;
  padding: 0 0.75rem;
  font-size: 0.9rem;
}
.gate-project-delete:hover { border-color: var(--danger); }

.gate-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.gate-method-card {
  text-align: left;
  padding: 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--text-main);
  font-size: 0.95rem;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.gate-method-card:hover { border-color: var(--success); transform: translateY(-1px); }
.gate-method-card .gm-icon { font-size: 1.5rem; }
.gate-method-card span:last-child { font-size: 0.78rem; color: var(--text-muted); line-height: 1.45; }

.gate-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.4rem;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.gate-skip {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  font-size: 0.83rem;
}
.gate-skip:hover { color: var(--text-main); }

#project-badge {
  font-size: 0.85rem;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  align-self: center;
}

@media (max-width: 640px) {
  .gate-methods { grid-template-columns: 1fr; }
  .gate-new-row { flex-direction: column; }
}



