/* ── Hide number input spinners ── */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* ── Two-Column Layout ── */
.two-col {
  display: flex;
  height: calc(100vh - 47px);
  overflow: hidden;
}
.col-input {
  width: 380px;
  min-width: 380px;
  overflow-y: auto;
  border-right: 1px solid #ddd;
  background: #fff;
}
.col-report {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2rem 3rem;
  background: #f7f8fa;
}
.input-panel {
  padding: 1rem 1.2rem 2rem;
}

/* ── Design Sheet Header ── */
.ds-table {
  width: 100%;
  border-collapse: collapse;
  border: 2px solid #333;
  margin-bottom: 16px;
}
.ds-table td {
  border: 1px solid #aaa;
  padding: 5px 10px;
  vertical-align: middle;
}
.ds-logo-cell {
  width: 72px;
  text-align: center;
}
.ds-logo-cell img { height: 48px; }
.ds-title-cell {
  text-align: center;
  font-size: 1.45em;
  font-weight: bold;
  letter-spacing: 3px;
  padding: 12px 0;
  color: #222;
  background: #f6f6f6;
}
.ds-lbl {
  font-weight: bold;
  white-space: nowrap;
  color: #333;
  width: 72px;
}
.ds-val { min-width: 160px; }
.ds-sub { color: #666; font-size: 0.9em; }
.ds-right-cell {
  text-align: left;
  min-width: 160px;
  line-height: 1.7;
}
.ds-lbl-i { font-weight: bold; color: #333; }
.ds-item-cell {
  text-align: center;
  font-weight: bold;
  letter-spacing: 1px;
  font-size: 0.95em;
}

/* ── Summary Box ── */
.summary-box {
  background: #f0f7ff;
  border-left: 4px solid #2185d0;
  padding: 14px 18px;
  margin: 10px 0;
  border-radius: 4px;
  font-size: 0.95em;
}
.summary-box.pass { background: #f0fff4; border-left-color: #21ba45; }
.summary-box.fail { background: #fff6f6; border-left-color: #db2828; }
.check-pass { color: #21ba45; font-weight: 600; }
.check-fail { color: #db2828; font-weight: 600; }

/* ── Bearing Data / Variable Descriptions ── */
.bearing-data { margin: 14px 0 6px; padding: 0 4px; }
.bd-item { margin-bottom: 2px; }
.bd-desc { color: #555; font-size: 0.88em; margin-top: 8px; }
.bd-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.calc-block { margin: 6px 0 10px 0; }
.calc-block.indent { margin-left: 48px; }
.art-ref {
  color: #2185d0;
  font-weight: 400;
  font-size: 0.88em;
  cursor: default;
}

/* ── Report ── */
#report, #shear-report {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 20px 28px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
#report h2, #shear-report h2 {
  font-size: 1.1rem;
  color: #1b1c1d;
  margin-bottom: 1rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid #e0e0e0;
}

.report-section {
  margin-bottom: 0;
}
.report-section h4 {
  font-size: .95rem;
  color: #1b1c1d;
  margin: 1.2rem 0 .4rem;
  padding-bottom: .2rem;
  border-bottom: 1px solid #ddd;
}

.narrative {
  margin: 6px 0 8px 0;
  font-size: 0.92em;
  color: #444;
  line-height: 1.6;
  font-style: italic;
}

.calc-line {
  margin: 4px 0;
  padding: 4px 0;
  font-size: 1.05em;
}
.ref-tag {
  display: inline-block;
  background: #e8f4fd;
  color: #2185d0;
  font-size: .72rem;
  padding: .15rem .5rem;
  border-radius: 10px;
  margin-left: .5rem;
  font-style: normal;
}

/* ── Iteration Table ── */
.iter-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .78rem;
  margin: .8rem 0;
  border: 1px solid #ddd;
}
.iter-table th {
  background: #2185d0;
  color: #fff;
  padding: .4rem .5rem;
  text-align: center;
  font-weight: 600;
}
.iter-table td {
  padding: .3rem .4rem;
  text-align: center;
  border-bottom: 1px solid #eee;
}
.summary-table td:first-child { text-align: left; font-weight: 600; }
.iter-table tr:nth-child(even) { background: #f8f9fa; }
.iter-table tr:last-child { font-weight: 700; background: #e8f4fd; }

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .two-col { flex-direction: column; height: auto; }
  .col-input { width: 100%; min-width: 100%; border-right: none; border-bottom: 1px solid #ddd; max-height: 50vh; }
  .col-report { max-height: none; }
}

/* ──────────────────────────────────────────── */
/* Tabulation tab                              */
/* ──────────────────────────────────────────── */
[data-tab="tabulate"].tab.segment {
  padding: 1rem 1.4rem 2rem;
  height: calc(100vh - 47px);
  overflow-y: auto;
}
.tab-header {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0e0e0;
}
.tab-globals {
  background: #f9fbfd;
  border: 1px solid #e0e6ed;
  border-radius: 4px;
  padding: 10px 14px 4px;
  margin-bottom: 14px;
}
.tab-globals .inline.fields { margin: 0; align-items: flex-end; }
.tab-globals .field { margin-right: 18px !important; }
.tab-globals label { font-weight: 600; font-size: 0.85em; }

.sub-tabs { margin-bottom: 12px !important; }
.sub-tab-pane { display: none; }
.sub-tab-pane.active { display: block; }

.tab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 8px 0 12px;
}
.tab-actions .hint {
  font-size: 0.82em;
  color: #777;
  margin-left: 8px;
  font-style: italic;
}

.section-label {
  font-size: 0.95rem;
  color: #1b1c1d;
  margin: 14px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #ddd;
}

.hot-container {
  width: 100%;
  height: 440px;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid #d0d6dc;
  border-radius: 3px;
}

.globals-note {
  display: inline-block;
  font-size: 0.82em;
  color: #666;
  font-style: italic;
  line-height: 1.5;
  padding-bottom: 4px;
  max-width: 520px;
}

/* FRP global inputs panel — per-batch CFRP system */
.frp-globals {
  background: #f4f8fc;
  border: 1px solid #c8d6e5;
  border-radius: 4px;
  padding: 10px 14px 6px;
  margin: 8px 0 12px;
}
.frp-globals-title {
  font-weight: 600;
  color: #1f4566;
  font-size: 0.86em;
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}
.frp-row { margin: 0 !important; align-items: flex-end; flex-wrap: wrap; }
.frp-row .field { margin: 0 14px 6px 0 !important; }
.frp-row label { font-weight: 600; font-size: 0.78em; color: #333; }
.frp-row input { padding: 4px 6px !important; font-size: 0.85em !important; }

/* Two-band banner used by FRP result tables */
.eval-table thead th.section-banner.exist { background: #2c5b8a; }
.eval-table thead th.section-banner.frp   { background: #1e7a4a; }
.eval-table thead th.subhead.exist        { background: #4d80b3; }
.eval-table thead th.subhead.frp          { background: #3aa372; }
.eval-table tbody td.col-divider { border-left: 3px solid #1e7a4a; }
.eval-table tbody td.col-divider-exist { border-left: 3px solid #2c5b8a; }
.eval-table tbody td.frp-pass { color: #1b6e1b; font-weight: 600; }
.eval-table tbody td.frp-fail { color: #c0392b; font-weight: 700; background: #ffeaea !important; }
.eval-table tbody td.frp-skip { color: #999; font-style: italic; text-align: center; }

/* MIDAS source band — MAPI-Key + Fetch / Upload row */
.midas-source {
  background: #fff8e6;
  border: 1px solid #e7d49b;
  border-radius: 4px;
  padding: 10px 14px 12px;
  margin: 0 0 10px 0;
}
.midas-source-title {
  font-weight: 600;
  font-size: 0.92em;
  color: #6a4f00;
  margin-bottom: 6px;
}
.midas-source-row { margin: 0 !important; align-items: flex-end; flex-wrap: wrap; }
.midas-source-row .field { margin: 0 14px 0 0 !important; }
.midas-source-row .field.field-key { flex: 1 1 480px !important; min-width: 360px; }
.midas-source-row label { font-weight: 600; font-size: 0.78em; color: #333; }
.midas-source-row input[type="password"] {
  font-family: ui-monospace, Menlo, Consolas, monospace !important;
  padding: 6px 10px !important;
  font-size: 0.88em !important;
  width: 100% !important;
}
.midas-source-sep {
  margin: 0 8px;
  font-size: 0.85em;
  color: #888;
  text-transform: uppercase;
  font-weight: 600;
}
.midas-source-note {
  margin-top: 6px;
  font-size: 0.78em;
  color: #6a4f00;
}
.midas-source-note code {
  background: rgba(255,255,255,0.6);
  padding: 1px 4px;
  border-radius: 2px;
  font-size: 0.95em;
}

/* Load Extract Probe panel */
.probe-wrap {
  margin: 12px 0 16px;
  border: 1px solid #c5d0db;
  border-radius: 4px;
  background: #f7fafc;
}
.probe-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid #c5d0db;
  background: #e8eef4;
  border-radius: 4px 4px 0 0;
}
.probe-title { font-weight: 600; color: #2c5b8a; flex: 0 0 auto; }
.probe-meta { color: #555; font-size: 0.85em; flex: 1; }
.probe-table-scroll {
  max-height: 420px;
  overflow: auto;
  padding: 0;
}
.probe-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82em;
}
.probe-table thead th {
  background: #2c5b8a;
  color: #fff;
  font-weight: 600;
  text-align: center;
  padding: 6px 8px;
  position: sticky;
  top: 0;
  z-index: 1;
  border: 1px solid #1d3e60;
}
.probe-table thead th.probe-grp { background: #3a6ea5; }
.probe-table tbody td {
  padding: 4px 8px;
  border: 1px solid #d6dee6;
  text-align: right;
  white-space: nowrap;
  background: #fff;
}
.probe-table tbody td.probe-text { text-align: left; font-weight: 600; color: #1a3b5c; background: #fff; }
.probe-table tbody td.probe-loc {
  text-align: center;
  font-weight: 700;
  text-transform: uppercase;
  background: #f0f4f8;
  color: #2c5b8a;
}
.probe-table tbody tr.probe-beam-start td { border-top: 2px solid #2c5b8a; }
.probe-table tbody td.probe-load-pos { color: #1b6e1b; }
.probe-table tbody td.probe-load-neg { color: #c0392b; }
.probe-table tbody td.probe-load-zero { color: #999; }

/* 4 RETROFIT-style result table — banded section headers, scrollable */
.retrofit-scroll {
  width: 100%;
  overflow: auto;
  max-height: 600px;
  border: 1px solid #d0d6dc;
  background: #fff;
}
.retrofit-table {
  border-collapse: collapse;
  font-size: 0.78em;
  white-space: nowrap;
}
.retrofit-table thead th {
  position: sticky; top: 0;
  border: 1px solid rgba(0,0,0,0.2);
  padding: 4px 8px;
  text-align: center;
  font-weight: 600;
  z-index: 2;
}
.retrofit-table thead tr.rf-banner th {
  font-size: 1.05em;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  top: 0;
  z-index: 3;
}
.retrofit-table thead tr.rf-cols th {
  background: #eef2f7;
  color: #1a3b5c;
  top: 28px;
  font-weight: 700;
}
.retrofit-table tbody td {
  border: 1px solid #d6dee6;
  padding: 3px 6px;
}
.retrofit-table tbody td.num {
  text-align: right;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.95em;
}
.retrofit-table tbody tr.rf-beam-start td {
  border-top: 2px solid #2c5b8a;
}
.retrofit-table tbody tr:nth-child(even) td { background: #fafbfc; }
.retrofit-table tbody td.dc-fail { background: #ffe5e5 !important; color: #c0392b; font-weight: 700; }
.retrofit-table tbody td.dc-pass { color: #1b6e1b; font-weight: 600; }
.retrofit-table tbody td.rf-pass { color: #1b6e1b; font-weight: 700; }
.retrofit-table tbody td.rf-fail { color: #c0392b; font-weight: 700; }
.retrofit-table tbody td.rf-remark-safe     { background: #e6f7e6 !important; color: #1b6e1b; font-weight: 700; }
.retrofit-table tbody td.rf-remark-retrofit { background: #fff8e1 !important; color: #b87000; font-weight: 700; }
.retrofit-table tbody td.rf-remark-retrofit-w-note { background: #ffe9d6 !important; color: #c75300; font-weight: 700; cursor: help; }
.retrofit-table tbody td.rf-remark-retrofit-w-note::after { content: ""; }
/* Legacy class kept for backwards compatibility on any cached HTML */
.retrofit-table tbody td.rf-remark-not-applicable { background: #ffe9d6 !important; color: #c75300; font-weight: 700; }
.retrofit-table .beam-id-link {
  color: #2c5b8a;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px dotted #2c5b8a;
}
.retrofit-table .beam-id-link:hover { color: #c0392b; border-bottom-color: #c0392b; }

.midas-pdf-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  padding-left: 10px;
  border-left: 1px solid #d0d6dc;
}
.midas-pdf-controls input[type="text"] {
  padding: 6px 9px;
  font-size: 0.86em;
  border: 1px solid #c0c8d0;
  border-radius: 3px;
  background: #fff;
}
.midas-pdf-controls input[type="text"]:focus {
  border-color: #2c5b8a;
  outline: none;
  box-shadow: 0 0 0 2px rgba(44, 91, 138, 0.15);
}

/* Beam-ID link in result table — clickable for detail report */
.eval-table tbody td.beam-id .beam-id-link {
  color: #2c5b8a;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border-bottom: 1px dotted #2c5b8a;
}
.eval-table tbody td.beam-id .beam-id-link:hover {
  color: #c0392b;
  border-bottom-color: #c0392b;
}

/* Section column with mini SVG cross-section */
.probe-table tbody td.probe-section-cell { padding: 6px 8px; vertical-align: middle; }
.probe-section-row { display: flex; align-items: center; gap: 10px; }
.probe-sect-svg { width: 44px; height: 44px; flex: 0 0 auto; }
.probe-section-text { font-weight: 600; color: #1a3b5c; }

/* Copyable error modal (replaces alert() for diagnostic-rich errors) */
.copy-error-modal {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.copy-error-backdrop {
  position: absolute; inset: 0;
  background: rgba(20, 30, 45, 0.55);
}
.copy-error-box {
  position: relative;
  background: #fff;
  border-radius: 6px;
  width: min(720px, 92vw);
  max-height: 80vh;
  display: flex; flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.copy-error-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: #c0392b;
  color: #fff;
}
.copy-error-title { font-weight: 700; font-size: 1em; }
.copy-error-close {
  background: transparent; color: #fff; border: 0;
  font-size: 1.5em; cursor: pointer; line-height: 1;
}
.copy-error-body {
  flex: 1;
  resize: none;
  border: 0;
  border-bottom: 1px solid #e0e6ec;
  padding: 14px 16px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.85em;
  color: #1b1c1d;
  background: #fafafa;
  white-space: pre;
  overflow: auto;
  min-height: 240px;
}
.copy-error-actions {
  display: flex; gap: 8px;
  padding: 10px 16px;
  background: #f6f7f9;
}
.copy-error-hint {
  padding: 8px 16px 12px;
  background: #f6f7f9;
  font-size: 0.8em;
  color: #6c757d;
}

.result-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #d0d6dc;
  border-radius: 3px;
  background: #fff;
}
.result-wrap.empty { background: #fafbfc; }
.result-empty {
  text-align: center;
  color: #888;
  padding: 28px;
  font-size: 0.92em;
}

.eval-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78em;
  min-width: 1400px;
}
.eval-table thead th {
  background: #2c5b8a;
  color: #fff;
  font-weight: 600;
  text-align: center;
  padding: 6px 4px;
  border: 1px solid #1f4566;
  font-size: 0.92em;
  position: sticky;
  top: 0;
  z-index: 2;
}
.eval-table thead th.subhead {
  background: #4d80b3;
  font-weight: 500;
  font-size: 0.85em;
}
.eval-table thead th.section-banner {
  background: #5a8fc5;
  font-style: italic;
  letter-spacing: 1px;
}
.eval-table tbody td {
  padding: 4px 6px;
  text-align: center;
  border: 1px solid #d8dde2;
  white-space: nowrap;
}
.eval-table tbody td.beam-id { text-align: left; font-weight: 500; min-width: 180px; background: #f6f8fb; }
.eval-table tbody tr:nth-child(even) td { background: #f9fafc; }
.eval-table tbody tr:nth-child(even) td.beam-id { background: #f0f3f8; }
.eval-table tbody td.dc-fail { background: #ffe5e5 !important; color: #c0392b; font-weight: 700; }
.eval-table tbody td.dc-pass { color: #1b6e1b; font-weight: 600; }
.eval-table tbody td.remark-tc { color: #1f6f3a; font-size: 0.92em; }
.eval-table tbody td.remark-other { color: #b06c00; font-size: 0.92em; font-style: italic; }

/* Handsontable overrides — tighter for our use */
.handsontable .htCore td { font-size: 0.85em; }
.handsontable .htCore th { font-size: 0.82em; font-weight: 600; }
