/* ── styles.css ───────────────────────────────────────────────────────────────
   OPTIFOUND — Modern Professional UI
   Engineering-grade design system
─────────────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
  --primary:       #1a3a5c;
  --primary-dark:  #0f2540;
  --primary-light: #2563eb;
  --accent:        #0ea5e9;
  --accent-light:  #e0f2fe;
  --success:       #059669;
  --success-light: #d1fae5;
  --warning:       #d97706;
  --warning-light: #fef3c7;
  --danger:        #dc2626;
  --danger-light:  #fee2e2;
  --bg:            #f0f4f8;
  --bg-subtle:     #f8fafc;
  --surface:       #ffffff;
  --border:        #e2e8f0;
  --border-strong: #cbd5e1;
  --text:          #0f172a;
  --text-muted:    #64748b;
  --text-faint:    #94a3b8;
  --radius-sm:     4px;
  --radius:        8px;
  --radius-lg:     12px;
  --radius-xl:     16px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:        0 4px 12px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg:     0 12px 32px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
  --transition:    0.18s ease;
}

/* ── Reset & Base ──────────────────────────────────────────────────────────── */

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

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── App Shell ─────────────────────────────────────────────────────────────── */

.app {
  max-width: 1440px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */

header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #1e4d8c 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 0 28px;
  height: 68px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(15,37,64,0.28);
}

header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--primary-light), var(--accent));
}

header .header-logo {
  height: 42px;
  width: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

header > div {
  display: flex;
  align-items: center;
  gap: 14px;
}

header h1 {
  font-size: 1.45rem;
  margin: 0;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
}

header span {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.72);
  font-weight: 400;
  line-height: 1;
}

header span::before {
  content: "—";
  margin-right: 10px;
  color: var(--accent);
  opacity: 0.8;
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  overflow-y: auto;
  min-height: 0;
}

/* ── Panel / Card ───────────────────────────────────────────────────────────── */

.panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 0;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ── Tabs ────────────────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 0 20px;
  gap: 0;
}

.tab {
  padding: 14px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.tab:hover { color: var(--primary-light); }

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary-light);
}

.tab-content {
  overflow-y: auto;
  padding: 20px;
  min-height: 0;
}

/* ── Sections ───────────────────────────────────────────────────────────────── */

.section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 14px;
  background: linear-gradient(180deg, var(--primary-light), var(--accent));
  border-radius: 2px;
}

/* ── Form Grid ──────────────────────────────────────────────────────────────── */

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 24px;
}

.field {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 5px;
}

.field.span-2 { grid-column: span 2; }
.field.span-3 { grid-column: span 3; }
.ecc-row      { grid-column: span 2; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; }

.field label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.field input:not([type="checkbox"]),
.field select {
  font-size: 0.82rem;
  font-family: inherit;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  width: 100%;
  max-width: 220px;
  min-width: 0;
  height: 32px;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
}

.field input:not([type="checkbox"]):hover,
.field select:hover {
  border-color: var(--primary-light);
}

.field input:not([type="checkbox"]):focus,
.field select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  background: #fafcff;
}

.field input:not([type="checkbox"]):disabled,
.field select:disabled {
  background: var(--bg);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.8;
}

/* ── Checkbox ───────────────────────────────────────────────────────────────── */

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text);
  cursor: pointer;
  padding: 5px 0;
}

.checkbox-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--primary-light);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Small note ─────────────────────────────────────────────────────────────── */

.small-note {
  font-size: 0.75rem;
  color: var(--text-faint);
  line-height: 1.4;
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */

button {
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-light), #1d4ed8);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface);
  color: var(--primary);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--primary);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, var(--success));
  color: #fff !important;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.32);
}

.btn-success:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--success), #047857);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.42);
  transform: translateY(-1px);
}

.section-title--inline { margin-bottom: 0; }

/* ── Codal Provisions header ────────────────────────────────────────────────── */

.codal-provisions-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

/* ── Textarea ───────────────────────────────────────────────────────────────── */

textarea {
  font-family: 'Inter', inherit;
  font-size: 0.85rem;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  resize: vertical;
}

textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#chatInput { flex: 1; min-height: 60px; max-height: 160px; }

/* ── JSON tab ────────────────────────────────────────────────────────────────── */

#jsonText {
  width: 100%;
  min-height: 260px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
}

.json-buttons { display: flex; gap: 8px; margin-top: 8px; }

/* ── Load Combos ────────────────────────────────────────────────────────────── */

.loadcomb-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}

.loadcomb-controls {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.etabs-upload-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
}

.etabs-upload-group label {
  font-size: 0.69rem;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.etabs-upload-group input[type="file"] {
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
}

.etabs-upload-note {
  margin-top: 8px;
  font-size: 0.74rem;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.etabs-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Tables (shared base) ───────────────────────────────────────────────────── */

.loadcomb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.loadcomb-table th,
.loadcomb-table td {
  border: 1px solid var(--border);
  padding: 5px 6px;
  text-align: center;
}

.loadcomb-table th {
  background: linear-gradient(180deg, #f1f5f9, #e8edf4);
  font-weight: 700;
  color: var(--primary);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 1;
}

.loadcomb-table tbody tr:nth-child(even) { background: #f8fafc; }
.loadcomb-table tbody tr:hover { background: var(--accent-light); }
.loadcomb-table input[type="text"] { box-sizing: border-box; }

/* Table scroll containers */
#loadCombTableContainer,
#loadCaseTemplateSection > div {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}

/* ── ETABS footings panel ───────────────────────────────────────────────────── */

.etabs-footings-container {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  padding: 10px;
  display: none;
}

.etabs-node {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.etabs-node:hover { box-shadow: var(--shadow); }
.etabs-node:last-child { margin-bottom: 0; }

.etabs-node > summary {
  cursor: pointer;
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  border-radius: var(--radius);
  transition: background var(--transition);
}

.etabs-node > summary:hover { background: var(--accent-light); }
.etabs-node > summary::-webkit-details-marker { display: none; }

.etabs-node > summary::before {
  content: "▶";
  display: inline-block;
  width: 16px;
  color: var(--primary-light);
  font-size: 0.65rem;
  transition: transform var(--transition);
}

.etabs-node[open] > summary::before { transform: rotate(90deg); }

.etabs-node-body {
  border-top: 1px solid var(--border);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.etabs-inner {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.etabs-inner > summary {
  cursor: pointer;
  padding: 7px 10px;
  list-style: none;
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: background var(--transition);
}

.etabs-inner > summary:hover { background: var(--accent-light); }
.etabs-inner > summary::-webkit-details-marker { display: none; }

.etabs-inner > summary::before {
  content: "▶";
  display: inline-block;
  width: 14px;
  color: var(--text-faint);
  font-size: 0.6rem;
  transition: transform var(--transition);
}

.etabs-inner[open] > summary::before { transform: rotate(90deg); }
.etabs-inner-body { padding: 10px; border-top: 1px solid var(--border); }

.etabs-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; }

.etabs-field { display: flex; flex-direction: column; min-width: 0; gap: 4px; }
.etabs-field label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); }

.etabs-field input,
.etabs-field select {
  font-size: 0.76rem;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  width: 100%;
  height: 30px;
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.etabs-field input:focus,
.etabs-field select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.etabs-field .etabs-checkbox-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding-top: 2px;
}

.etabs-field .etabs-checkbox-row input[type="checkbox"] {
  width: auto;
  height: auto;
  border: none;
  padding: 0;
  margin: 0;
  accent-color: var(--primary-light);
}

.etabs-field .etabs-checkbox-row span { font-size: 0.76rem; color: var(--text); line-height: 1.2; }

.etabs-node-meta { font-size: 0.72rem; color: var(--text-faint); font-weight: 500; }

/* ── Master data ────────────────────────────────────────────────────────────── */

.master-data-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }

#masterDataTableSelect {
  font-size: 0.82rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  min-width: 320px;
  max-width: 100%;
  height: 34px;
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition);
}

#masterDataTableSelect:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
#masterDataStatus { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 6px; }

.master-data-table { width: 100%; border-collapse: collapse; font-size: 0.76rem; }
.master-data-table th,
.master-data-table td {
  border: 1px solid var(--border);
  padding: 5px 8px;
  text-align: left;
  vertical-align: top;
}
.master-data-table th {
  background: linear-gradient(180deg, #f1f5f9, #e8edf4);
  font-weight: 700;
  color: var(--primary);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.master-data-table tbody tr:nth-child(even) { background: #f8fafc; }
.master-data-notes { margin-top: 10px; font-size: 0.75rem; color: var(--text); padding-left: 18px; }

#masterDataContainer {
  display: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--bg-subtle);
  margin-top: 6px;
}

/* ── Results Panel ──────────────────────────────────────────────────────────── */

.results-panel {
  border-top: 3px solid var(--primary-light);
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-subtle), var(--surface));
  gap: 12px;
  flex-wrap: wrap;
}

.results-header > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.results-header > div:first-child > span:first-child,
.results-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.01em;
}

.results-header > div:last-child {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Progress Bar ───────────────────────────────────────────────────────────── */

.operation-progress {
  display: none;
  margin: 0 20px 12px;
  padding: 10px 14px;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ecfdf5, #f0fdf4);
}

.operation-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.8rem;
}

.operation-progress-label { color: #065f46; font-weight: 700; }
.operation-progress-value { color: var(--text-muted); white-space: nowrap; font-size: 0.75rem; }

.operation-progress-bar {
  height: 7px;
  border-radius: 999px;
  background: #d1d5db;
  overflow: hidden;
  position: relative;
}

.operation-progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #34d399, #059669);
  transition: width 0.3s ease;
}

.operation-progress-fill.indeterminate {
  width: 35%;
  position: relative;
  animation: operation-progress-indeterminate 1.4s ease-in-out infinite;
}

@keyframes operation-progress-indeterminate {
  0%   { left: -35%; }
  100% { left: 100%; }
}

/* ── Operation Overlay ──────────────────────────────────────────────────────── */

.operation-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 20, 40, 0.45);
  backdrop-filter: blur(3px);
  z-index: 9999;
  padding: 20px;
}

.operation-overlay-card {
  width: min(480px, 100%);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px 26px;
  border: 1px solid var(--border);
}

.operation-overlay-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.operation-overlay-text {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.operation-overlay .operation-progress-bar {
  height: 10px;
  background: var(--border);
}

.operation-overlay-meta {
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: right;
}

/* ── Pills ──────────────────────────────────────────────────────────────────── */

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pill-safe   { background: var(--success-light); color: #065f46; border: 1px solid #6ee7b7; }
.pill-unsafe { background: var(--danger-light);  color: #991b1b; border: 1px solid #fca5a5; }

/* ── Results boxes ──────────────────────────────────────────────────────────── */

.results-grid { display: grid; grid-template-columns: 1.2fr 2fr; gap: 12px; }

.results-box {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px 16px;
  background: var(--surface);
  overflow: auto;
  min-width: 0;
  margin: 0 20px 16px;
}

.results-box h3 {
  font-size: 0.8rem;
  margin: 0 0 10px 0;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.results-box h3::before {
  content: '';
  display: block;
  width: 3px;
  height: 12px;
  background: linear-gradient(180deg, var(--primary-light), var(--accent));
  border-radius: 2px;
}

.cost-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
}

.cost-row:last-child { border-bottom: none; }

/* ── Checks table ───────────────────────────────────────────────────────────── */

.checks-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
}

.checks-table th,
.checks-table td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  text-align: left;
}

.checks-table th {
  background: linear-gradient(180deg, #f1f5f9, #e8edf4);
  font-weight: 700;
  color: var(--primary);
  font-size: 0.69rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 1;
}

.checks-table tbody tr:nth-child(even) { background: #f8fafc; }
.checks-table tbody tr:hover { background: var(--accent-light); }
.checks-table .util-combined-col { width: 190px; text-align: center; }

/* ── Util bar ───────────────────────────────────────────────────────────────── */

.util-combined-cell { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.util-value { min-width: 42px; text-align: right; font-weight: 600; font-size: 0.8rem; }
.util-separator { width: 1px; height: 16px; background: var(--border-strong); }
.util-bar-wrapper { flex: 1; display: flex; align-items: center; }
.util-bar { height: 7px; border-radius: 999px; background: var(--border); overflow: hidden; width: 100%; }
.util-fill { height: 100%; background: var(--success); transition: width 0.35s ease; border-radius: 999px; }
.util-fill.high { background: #f59e0b; }
.util-fill.fail { background: var(--danger); }

/* ── Intermediate panel ─────────────────────────────────────────────────────── */

.intermediate-table-wrapper {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.intermediate-table { width: 100%; border-collapse: collapse; font-size: 0.76rem; }
.intermediate-table th,
.intermediate-table td {
  border: 1px solid var(--border);
  padding: 4px 6px;
  text-align: left;
  vertical-align: top;
}
.intermediate-table th {
  background: linear-gradient(180deg, #f1f5f9, #e8edf4);
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--primary);
}

#intermediateJson {
  width: 100%;
  min-height: 240px;
  resize: vertical;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.78rem;
}

#designOutputJson {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
}

/* ── Multi-footing results ──────────────────────────────────────────────────── */

.multi-footing-results {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px 16px;
  margin: 0 20px 16px;
  display: none;
}

.multi-footing-results h3 {
  margin: 0 0 10px 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.multi-footing-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--bg-subtle);
  transition: box-shadow var(--transition);
}

.multi-footing-row:hover { box-shadow: var(--shadow-sm); }
.multi-footing-row:last-child { margin-bottom: 0; }

.multi-footing-row > summary {
  cursor: pointer;
  list-style: none;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  transition: background var(--transition);
  border-radius: var(--radius-sm);
}

.multi-footing-row > summary:hover { background: var(--accent-light); }
.multi-footing-row > summary::-webkit-details-marker { display: none; }

.multi-footing-row > summary::before {
  content: "▶";
  display: inline-block;
  width: 14px;
  color: var(--primary-light);
  font-size: 0.6rem;
  transition: transform var(--transition);
}

.multi-footing-row[open] > summary::before { transform: rotate(90deg); }

.multi-footing-summary-right { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-weight: 500; }
.multi-footing-safe   { color: var(--success); }
.multi-footing-unsafe { color: var(--danger); }

.multi-footing-body {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 10px 12px;
  font-size: 0.76rem;
}

.multi-footing-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 12px;
  margin-bottom: 10px;
}

.multi-footing-checks { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
.multi-footing-checks th,
.multi-footing-checks td {
  border: 1px solid var(--border);
  padding: 4px 6px;
  text-align: left;
}
.multi-footing-checks th {
  background: linear-gradient(180deg, #f1f5f9, #e8edf4);
  font-weight: 700;
  color: var(--primary);
  font-size: 0.68rem;
  text-transform: uppercase;
}
.multi-footing-checks tbody tr:nth-child(even) { background: #f8fafc; }

/* ── Cost optimisation summary table ────────────────────────────────────────── */

.opt-cost-summary-wrapper { margin-top: 12px; }
.opt-cost-summary-title { font-size: 0.85rem; font-weight: 700; margin-bottom: 8px; color: var(--primary); }

.opt-cost-summary-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}

.opt-cost-summary-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.68rem;
  table-layout: auto;
}

.opt-cost-summary-table th,
.opt-cost-summary-table td {
  border: 1px solid var(--border-strong);
  padding: 5px 9px;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.opt-cost-summary-table .ocs-node-header   { background: var(--primary);      color: #fff; font-weight: 700; }
.opt-cost-summary-table .ocs-group-header  { background: var(--primary);      color: #fff; font-weight: 700; }
.opt-cost-summary-table .ocs-sub-header    { background: #dbeafe;             color: #1e40af; font-weight: 600; }
.opt-cost-summary-table .ocs-leaf-header   { background: #f0f4ff;             color: var(--text-muted); font-weight: 600; }
.opt-cost-summary-table tbody tr:nth-child(even) { background: #f8fafc; }
.opt-cost-summary-table tbody tr:hover     { background: var(--accent-light); }
.opt-cost-summary-table .ocs-node-cell     { font-weight: 600; color: var(--primary); text-align: left; }
.opt-cost-summary-table .ocs-out-cell      { background: var(--success-light); color: #024230; font-weight: 500; }
.opt-cost-summary-table .ocs-error-cell    { color: var(--danger); font-weight: 600; text-align: left; }
.opt-cost-summary-table .ocs-diff-cell     { background: #a7f3d0; color: #024230; font-weight: 500; }
.opt-cost-summary-table .ocs-cost-group-header { background: var(--primary); color: #fff; }
.opt-cost-summary-table .ocs-cost-sub-header   { background: #dbeafe; color: #1e40af; font-weight: 600; }
.opt-cost-summary-table .ocs-total-col-header  { background: #dbeafe; color: #1e40af; font-weight: 600; }
.opt-cost-summary-table .ocs-cost-cell         { background: var(--success-light); color: #024230; font-weight: 500; }
.opt-cost-summary-table .ocs-total-col-cell    { background: #a7f3d0; color: #024230; font-weight: 700; }
.opt-cost-summary-table .ocs-totals-row        { border-top: 2px solid var(--primary); }
.opt-cost-summary-table .ocs-totals-label      { background: var(--primary); color: #fff; font-weight: 700; text-align: right; padding-right: 10px; }
.opt-cost-summary-table .ocs-totals-cell       { font-weight: 700; }

/* ── Clash summary table ────────────────────────────────────────────────────── */

.clash-summary-wrapper { margin-top: 12px; }
.clash-summary-title { font-size: 0.85rem; font-weight: 700; margin-bottom: 8px; color: var(--primary); }
.clash-summary-note  { font-size: 0.74rem; color: var(--text-muted); margin-bottom: 8px; }
.clash-summary-table { width: 100%; border-collapse: collapse; font-size: 0.73rem; }
.clash-summary-table th,
.clash-summary-table td {
  border: 1px solid var(--border-strong);
  padding: 4px 6px;
  text-align: center;
  vertical-align: middle;
}
.clash-summary-table th { background: linear-gradient(180deg, #f1f5f9, #e8edf4); font-weight: 700; color: var(--primary); }
.clash-summary-table tbody tr:nth-child(even) { background: #f8fafc; }
.clash-ok  { color: var(--success); font-weight: 600; }
.clash-hit { color: var(--danger);  font-weight: 700; }
.clash-combined-col { background: #f0f7ff !important; color: var(--primary); }
.clash-combined-value { font-weight: 700; color: #1a56db; }
.clash-combined-loading { color: #94a3b8; font-weight: 400; font-style: italic; animation: clash-pulse 1.2s ease-in-out infinite; }
@keyframes clash-pulse { 0%,100%{opacity:1} 50%{opacity:0.35} }
.clash-group-table .clash-group-nodes { text-align: left; font-size: 0.70rem; max-width: 260px; word-break: break-word; }
.clash-group-table tbody tr { background: #fafbff; }
.clash-group-table tbody tr:nth-child(even) { background: #f0f5ff; }
.clash-cg-col { background: #f0faf4 !important; color: #166534; font-weight: 600; }
.clash-placement-col { background: #fffbeb !important; color: #92400e; font-weight: 600; }
.clash-coord-cell { font-family: monospace; font-size: 0.70rem; white-space: nowrap; letter-spacing: 0.01em; }

/* ── Corner pressure columns ──────────────────────────────────────────────── */
.clash-pressure-col { background: #f0f4ff !important; color: #1e3a8a; font-weight: 600; text-align: right; white-space: nowrap; }
.clash-pressure-col.clash-combined-value { background: #dbeafe !important; color: #1d4ed8; }
.clash-pressure-uplift { background: #fef2f2 !important; color: #dc2626 !important; font-weight: 700; }
.clash-pressure-uplift::after { content: " \2191"; }

/* SLS bearing header / cells — blue tint */
.clash-pressure-sls-header { background: #dbeafe !important; color: #1e40af !important; }
.clash-pressure-sls-cell   { background: #eff6ff !important; color: #1d4ed8; text-align: right; white-space: nowrap; }
.clash-pressure-sls-cell.clash-combined-value { background: #dbeafe !important; }

/* ULS strip-design header / cells — green tint */
.clash-pressure-uls-header { background: #d1fae5 !important; color: #065f46 !important; }
.clash-pressure-uls-cell   { background: #f0fdf4 !important; color: #166534; text-align: right; white-space: nowrap; }
.clash-pressure-uls-cell.clash-combined-value { background: #dcfce7 !important; }

/* Strip design pressures – sourced from ComputeColumnStripComboDemands (ULS governing, per-column resultant) */
.strip-design-pressure { background: #ecfdf5 !important; color: #065f46 !important; font-weight: 700; border-left: 3px solid #10b981; }

/* ── CG Debug panel ─────────────────────────────────────────────────────── */
.cg-debug-panel {
  margin: 10px 0 6px 0; border: 1px solid #c7d8f8; border-radius: 6px;
  background: #f0f6ff; font-size: 0.73rem;
}
.cg-debug-summary {
  cursor: pointer; padding: 6px 10px; font-weight: 700; color: #1e40af;
  user-select: none; list-style: none;
}
.cg-debug-summary::marker, .cg-debug-summary::-webkit-details-marker { display: none; }
.cg-debug-summary::before { content: "\25B6\00a0"; font-size: 0.65rem; }
details[open] .cg-debug-summary::before { content: "\25BC\00a0"; }
.cg-debug-body { padding: 6px 12px 10px 12px; }
.cg-debug-step {
  margin: 6px 0 4px 0; padding: 4px 8px; background: #e0edff;
  border-radius: 4px; color: #1e3a8a; line-height: 1.6;
}
.cg-debug-table { border-collapse: collapse; width: 100%; margin: 4px 0 6px 0; font-size: 0.72rem; }
.cg-debug-table th, .cg-debug-table td {
  border: 1px solid #bfdbfe; padding: 3px 8px; text-align: right;
}
.cg-debug-table th { background: #dbeafe; color: #1e40af; font-weight: 700; }
.cg-debug-table td:first-child { text-align: center; font-weight: 600; }
.cg-debug-totals td { background: #bfdbfe; font-weight: 700; color: #1e3a8a; }
.strip-debug-section {
  margin-top: 8px; padding: 6px 8px; border-radius: 5px; border: 1px solid #bfdbfe;
}
.strip-debug-section--sls { background: #eff6ff; border-color: #93c5fd; }
.strip-debug-section--uls { background: #f0fdf4; border-color: #86efac; color: #14532d; }

/* ── Clash Avoided feedback ──────────────────────────────────────────────── */
.clash-avoided-container { margin-bottom: 10px; }
.clash-avoided-title {
  font-size: 0.82rem; font-weight: 700; color: #166534; margin-bottom: 6px;
  padding: 6px 10px; background: #dcfce7; border-radius: 6px; border: 1px solid #86efac;
}
.clash-avoided-item {
  font-size: 0.73rem; color: #15803d; padding: 3px 10px; margin-left: 4px;
  border-left: 3px solid #86efac;
}

/* ── Message / chat (legacy) ────────────────────────────────────────────────── */

.message { padding: 8px 12px; border-radius: 8px; max-width: 90%; font-size: 0.88rem; white-space: pre-wrap; }
.message.user      { background: var(--accent-light); align-self: flex-end; }
.message.assistant { background: var(--bg-subtle); align-self: flex-start; }
.role-label { font-size: 0.68rem; text-transform: uppercase; font-weight: 700; opacity: 0.65; margin-bottom: 3px; }
.status { font-size: 0.78rem; color: var(--text-faint); margin-top: 4px; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .form-grid  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .form-grid  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .etabs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field.span-2, .field.span-3 { grid-column: span 1; }
  .ecc-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .results-grid { grid-template-columns: 1fr; }

  header > div { flex-direction: column; gap: 4px; text-align: center; }
  header span::before { content: ""; margin-right: 0; }
  header { height: auto; padding: 14px 20px; }
}

@media (max-width: 600px) {
  main { padding: 12px; gap: 12px; }
  .form-grid  { grid-template-columns: 1fr; }
  .etabs-grid { grid-template-columns: 1fr; }
  .field.span-2, .field.span-3 { grid-column: span 1; }
  .ecc-row { grid-template-columns: 1fr; }
  .tab-content { padding: 14px; }
  .results-box { margin: 0 12px 12px; }
  .multi-footing-results { margin: 0 12px 12px; }
}

/* ── Option Cards (Design Options toggles) ──────────────────────────────────── */

.option-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.option-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  transition: all var(--transition);
  user-select: none;
}

.option-card:hover {
  border-color: var(--primary-light);
  background: var(--accent-light);
  color: var(--primary);
}

.option-card input[type="checkbox"] {
  accent-color: var(--primary-light);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.option-card:has(input:checked) {
  border-color: var(--primary-light);
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary);
  font-weight: 600;
}

.option-card--select {
  cursor: default;
  gap: 10px;
  padding: 6px 10px 6px 14px;
}

.option-card--select:hover {
  border-color: var(--primary-light);
  background: rgba(37, 99, 235, 0.04);
  color: var(--text-muted);
}

.option-card__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.option-card--select select {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  height: 28px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.option-card--select select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ── Status Badges (PASS / FAIL) ────────────────────────────────────────────── */

.badge-pass {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--success-light);
  color: #065f46;
  border: 1px solid #6ee7b7;
  white-space: nowrap;
}

.badge-fail {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--danger-light);
  color: #991b1b;
  border: 1px solid #fca5a5;
  white-space: nowrap;
}

/* ── Cost Detail Blocks ─────────────────────────────────────────────────────── */

.cost-details-block {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.8rem;
}

.cost-details-block__title {
  font-weight: 700;
  font-size: 0.82rem;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed currentColor;
  opacity: 0.85;
}

.cost-details-block--provided {
  border: 1px solid #93c5fd;
  background: #eff6ff;
}

.cost-details-block--provided .cost-details-block__title {
  color: #1d4ed8;
}

.cost-details-block--optimized {
  border: 1px solid #6ee7b7;
  background: #ecfdf5;
}

.cost-details-block--optimized .cost-details-block__title {
  color: var(--success);
}

.cost-details-block--trapezoidal {
  border: 1px solid #c084fc;
  background: #faf5ff;
}

.cost-details-block--trapezoidal .cost-details-block__title {
  color: #7c3aed;
}

.trap-comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.trap-comparison-table th,
.trap-comparison-table td {
  padding: 5px 8px;
  text-align: right;
  border-bottom: 1px solid #e9d5ff;
}

.trap-comparison-table th:first-child,
.trap-comparison-table td:first-child {
  text-align: left;
  font-weight: 600;
}

.trap-comparison-table thead th {
  background: #f3e8ff;
  font-weight: 700;
  font-size: 0.75rem;
  color: #6b21a8;
}

.trap-totals-row td {
  font-weight: 700;
  border-top: 2px solid #c084fc;
}

.cost-saving-positive {
  color: #059669;
  font-weight: 700;
}

.cost-saving-zero {
  color: var(--text-secondary);
}

/* ── Warnings & Notes Lists ─────────────────────────────────────────────────── */

.warnings-list {
  margin: 6px 0 0 0;
  padding-left: 18px;
}

.warnings-list li {
  color: var(--danger);
  font-weight: 600;
  font-size: 0.8rem;
  margin-bottom: 3px;
}

.notes-list {
  margin: 6px 0 0 0;
  padding-left: 18px;
}

.notes-list li {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.notes-list li.note-optimization {
  color: var(--success);
  font-weight: 700;
  font-size: 0.9rem;
  list-style: none;
  margin-left: -18px;
  padding: 4px 0;
}

/* ── Error text ─────────────────────────────────────────────────────────────── */

.text-error {
  color: var(--danger);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 6px;
  border-left: 3px solid var(--danger);
  background: var(--danger-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ── File Input Styling ─────────────────────────────────────────────────────── */

.etabs-upload-group input[type="file"] {
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
  max-width: 100%;
}

.etabs-upload-group input[type="file"]::file-selector-button {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 4px 9px;
  cursor: pointer;
  margin-right: 6px;
  transition: all var(--transition);
}

.etabs-upload-group input[type="file"]::file-selector-button:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

/* ── Master Data Table Wrapper ──────────────────────────────────────────────── */

.master-data-table-wrapper {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ── ETABS Load Table Wrapper ───────────────────────────────────────────────── */

.etabs-load-table-wrapper {
  max-height: 200px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ── Selection Toolbar ──────────────────────────────────────────────────────── */

.selection-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.selection-toolbar .selection-info {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 500;
  flex: 1;
  min-width: 160px;
}

/* ── Results Header button group ────────────────────────────────────────────── */

.btn-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Info banner (used in ETABS) ────────────────────────────────────────────── */

.info-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: var(--accent-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  font-size: 0.78rem;
  color: var(--primary);
  line-height: 1.4;
}

.info-banner::before {
  content: 'ℹ';
  font-size: 0.9rem;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Node result status colors (in ETABS details summary) ───────────────────── */

.node-safe   { color: var(--success); font-weight: 700; }
.node-unsafe { color: var(--danger);  font-weight: 700; }
.node-error  { color: var(--warning); font-weight: 700; }

/* ── Toast Notifications ────────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 400px;
  width: calc(100vw - 48px);
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--text-faint);
  font-size: 0.82rem;
  color: var(--text);
  pointer-events: all;
  opacity: 0;
  transform: translateX(24px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  line-height: 1.45;
}

.toast--visible { opacity: 1; transform: translateX(0); }
.toast--hiding  { opacity: 0; transform: translateX(24px); }

.toast--info    { border-left-color: var(--accent); }
.toast--success { border-left-color: var(--success); }
.toast--warning { border-left-color: var(--warning); }
.toast--error   { border-left-color: var(--danger); }

.toast__icon {
  flex-shrink: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  font-weight: 700;
}

.toast--info    .toast__icon { color: var(--accent); }
.toast--success .toast__icon { color: var(--success); }
.toast--warning .toast__icon { color: var(--warning); }
.toast--error   .toast__icon { color: var(--danger); }

.toast__text { flex: 1; min-width: 0; }

.toast__close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text-faint);
  padding: 0;
  height: auto;
  width: auto;
  border-radius: 2px;
  transition: color var(--transition);
}

.toast__close:hover { color: var(--text); }

/* ── Input with unit suffix ─────────────────────────────────────────────────── */

.input-unit {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 220px;
}

.input-unit input {
  padding-right: 46px;
  max-width: 100%;
  width: 100%;
}

.input-unit__suffix {
  position: absolute;
  right: 8px;
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--text-faint);
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: 0.02em;
  background: linear-gradient(to left, var(--surface) 60%, transparent);
  padding-left: 6px;
}

/* ── Empty state ────────────────────────────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 20px;
  text-align: center;
}

.empty-state__icon {
  font-size: 2.2rem;
  margin-bottom: 12px;
  color: var(--text-faint);
  opacity: 0.5;
  line-height: 1;
}

.empty-state__title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.empty-state__text {
  font-size: 0.76rem;
  color: var(--text-faint);
  max-width: 260px;
  line-height: 1.55;
}

/* ── Info Banner Variants ───────────────────────────────────────────────────── */

.info-banner--success {
  background: var(--success-light);
  border-color: #6ee7b7;
  color: #065f46;
}

.info-banner--success::before { content: '✓'; }

.info-banner--warning {
  background: var(--warning-light);
  border-color: #fcd34d;
  color: #78350f;
}

.info-banner--warning::before { content: '⚠'; }

/* ── Table container with CSS border ────────────────────────────────────────── */

.table-scroll-container {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}

.table-scroll-container--sm  { max-height: 140px; }
.table-scroll-container--md  { max-height: 180px; }

/* ── Scrollbar styling ──────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); border-radius: 999px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ── Selection ──────────────────────────────────────────────────────────────── */

::selection { background: rgba(37, 99, 235, 0.18); color: var(--text); }

/* ── Visualize Footings button ──────────────────────────────────────────────── */

.btn-viz {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  border-color: #4f46e5;
  color: #fff;
  gap: 5px;
}
.btn-viz:hover {
  background: linear-gradient(135deg, #4338ca 0%, #6d28d9 100%);
  border-color: #4338ca;
}

/* ── Footing Visualizer Modal ───────────────────────────────────────────────── */

.viz-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  padding: 16px;
}

.viz-modal-inner {
  background: #0f1117;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  width: 92vw;
  max-width: 1200px;
  height: 82vh;
  max-height: 860px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7);
}

.viz-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.09);
  flex-shrink: 0;
  gap: 12px;
}

.viz-modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #e2e8f0;
  letter-spacing: 0.01em;
}

.viz-modal-icon {
  color: #818cf8;
  font-size: 16px;
}

.viz-modal-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ── View mode toggle (All Footings / Final Design) ─────────────────────────── */

.viz-mode-toggle {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}

.viz-mode-btn {
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  line-height: 1.5;
}

.viz-mode-btn:hover {
  color: #cbd5e1;
  background: rgba(255,255,255,0.07);
}

.viz-mode-btn--active {
  background: rgba(99,102,241,0.28);
  color: #c7d2fe;
  font-weight: 600;
}

.viz-hint {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
}

.viz-fit-btn,
.viz-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
  line-height: 1;
}

.viz-fit-btn {
  padding: 5px 11px;
  font-size: 12px;
  gap: 5px;
}

.viz-close-btn {
  padding: 4px 9px;
  font-size: 18px;
}

.viz-fit-btn:hover,
.viz-close-btn:hover {
  background: rgba(255,255,255,0.12);
  color: #e2e8f0;
}

.viz-canvas-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.viz-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
}

.viz-modal-footer {
  padding: 7px 18px;
  font-size: 11px;
  color: #475569;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sfd-bmd-chart-wrap {
  margin-top: 14px;
  margin-bottom: 10px;
  padding: 14px 16px 10px;
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(241, 245, 249, 0.65) 0%, rgba(255, 255, 255, 0.55) 100%);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

.sfd-bmd-chart-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: #0f3f75;
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

.sfd-bmd-chart {
  width: 100%;
  max-width: 850px;
  height: auto;
  display: block;
}

.sfd-bmd-plot-bg {
  fill: rgba(255, 255, 255, 0.7);
  stroke: rgba(37, 99, 235, 0.15);
  stroke-width: 0.5;
}

.sfd-bmd-zero {
  stroke: rgba(15, 23, 42, 0.3);
  stroke-width: 1;
  stroke-dasharray: 5 3;
}

.sfd-bmd-tick {
  stroke: rgba(15, 23, 42, 0.3);
  stroke-width: 1;
}

.sfd-bmd-fill {
  opacity: 0.18;
}

.sfd-bmd-fill--shear {
  fill: #2563eb;
}

.sfd-bmd-fill--moment {
  fill: #dc2626;
}

.sfd-bmd-line {
  fill: none;
  stroke-width: 2.2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.sfd-bmd-line--shear {
  stroke: #2563eb;
}

.sfd-bmd-line--moment {
  stroke: #dc2626;
}

.sfd-bmd-dot {
  stroke: #fff;
  stroke-width: 1.5;
}

.sfd-bmd-dot--shear {
  fill: #2563eb;
}

.sfd-bmd-dot--moment {
  fill: #dc2626;
}

.sfd-bmd-val {
  font-size: 10px;
  font-weight: 700;
}

.sfd-bmd-val--shear {
  fill: #1e40af;
}

.sfd-bmd-val--moment {
  fill: #991b1b;
}

.sfd-bmd-axis-text {
  fill: #475569;
  font-size: 10px;
}

.sfd-bmd-label {
  fill: #1e293b;
  font-size: 11px;
  font-weight: 700;
}

.sfd-bmd-legend-text {
  fill: #334155;
  font-size: 11px;
}

.strip-diagrams-details {
  margin-top: 12px;
  border-top: 1px solid rgba(59, 130, 246, 0.15);
  padding-top: 4px;
}

.strip-diagrams-summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  color: #0f3f75;
  padding: 6px 4px;
  user-select: none;
  list-style: disclosure-closed;
}

.strip-diagrams-details[open] > .strip-diagrams-summary {
  list-style: disclosure-open;
  margin-bottom: 6px;
}

.strip-diagrams-section {
  padding-top: 4px;
}
