/*
 * ═══════════════════════════════════════════════════════════
 *  PJ CIRCULAR — REPORT PARTS CSS
 *  Shared stylesheet for all sub-report files:
 *  shaft inspection files, clearance files, rotor files
 *
 *  Loaded by:
 *    - 110-inspection.html  (for embedded injection)
 *    - 110-final.html       (for embedded injection)
 *    - Individual part files via <link> (for standalone use)
 * ═══════════════════════════════════════════════════════════
 */

/* ── Fonts (no-op if already loaded by parent via global.css) ── */
@import url('https://fonts.googleapis.com/css2?family=Titillium+Web:wght@400;600;700&family=Manrope:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

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

/* ── Body & container ───────────────────────────────────── */
body {
  font-family: 'Manrope', 'Titillium Web', system-ui, sans-serif;
  font-size: 14px;
  color: #222;
  background: #f5f5f5;
  padding: 20px;
}

.container {
  max-width: 1060px;
  margin: 0 auto;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* ── Header ─────────────────────────────────────────────── */
.header { background: #1a3a5c; color: #fff; padding: 16px 24px; }
.header h1 { font-family: 'Titillium Web', system-ui, sans-serif; font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.header p  { font-size: 12px; opacity: 0.75; }

/* ── Drawing section ────────────────────────────────────── */
.drawing-wrap { padding: 16px 24px; border-bottom: 1px solid #e0e0e0; background: #fafafa; }
.drawing-wrap h2 { font-size: 13px; color: #555; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.drawing-wrap img { max-width: 100%; max-height: 300px; width: auto; height: auto; border: 1px solid #ddd; border-radius: 4px; display: block; }
.img-missing,
.drawing-placeholder {
  padding: 32px 16px;
  text-align: center;
  color: #aab;
  border: 1px dashed #c5cdd8;
  border-radius: 4px;
  background: #f0f4f8;
  font-size: 12px;
}

/* ── Table section ──────────────────────────────────────── */
.table-wrap { padding: 16px 24px; }
.table-wrap h2 { font-size: 13px; color: #555; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
@media (max-width: 768px) {
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ── Base table styles ──────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 20px; }
thead tr { background: #1a3a5c; color: #fff; }
thead th { padding: 9px 10px; text-align: left; font-weight: 500; font-size: 12px; }
thead th.num-col { text-align: center; }
tbody tr { border-bottom: 1px solid #eee; }
tbody tr:hover { background: #f8f8f8; }
td { padding: 8px 10px; vertical-align: middle; }
td.point-col { font-weight: 600; color: #1a3a5c; width: 40px; text-align: center; }
td.ref-col { color: #888; font-style: italic; font-size: 11px; text-align: center; white-space: nowrap; }

/* ── Measurement inputs ─────────────────────────────────── */
.meas-cell { width: 100px; }
.ra-cell   { width: 90px; }
.meas-wrap { position: relative; }

.meas-wrap input,
.ra-cell input {
  width: 100%;
  border: 1.5px solid #ccc;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 13px;
  text-align: right;
  transition: border-color 0.2s, background 0.2s;
}
.ra-cell input { font-size: 12px; }
.ra-cell input:disabled { background: #f2f2f2; color: #bbb; border-color: #e0e0e0; cursor: not-allowed; }

.meas-wrap input:focus,
.ra-cell input:focus { outline: none; border-color: #1a3a5c; background: #f0f4ff; }

/* Status colours — set via inline style in JS for specificity */
.meas-wrap input.ok  { border-color: #2a9d5c !important; background: #edfaf3 !important; color: #1a6e3f !important; font-weight: 600; }
.meas-wrap input.nok { border-color: #d9534f !important; background: #fdf0ef !important; color: #a02020 !important; font-weight: 600; }

/* ── Status dot ─────────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #ddd;
  margin-right: 4px;
  vertical-align: middle;
  flex-shrink: 0;
}
.status-dot.ok  { background: #2a9d5c; }
.status-dot.nok { background: #d9534f; }

/* ── Remarks ────────────────────────────────────────────── */
.remarks-cell textarea {
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 12px;
  font-family: 'Manrope', 'Titillium Web', system-ui, sans-serif;
  resize: vertical;
  min-height: 32px;
}
.remarks-cell textarea:focus { outline: 2px solid #1a3a5c; border-color: transparent; }

/* ── Legend ─────────────────────────────────────────────── */
.legend { display: flex; gap: 20px; margin-bottom: 14px; font-size: 12px; color: #666; }
.legend-item { display: flex; align-items: center; gap: 6px; }

/* ── Buttons ────────────────────────────────────────────── */
.actions { display: flex; gap: 10px; margin-top: 8px; }
.btn-reset {
  padding: 8px 18px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
}
.btn-reset:hover { background: #fee; border-color: #c00; color: #c00; }

/* ── Tolerance guide ────────────────────────────────────── */
.tol-guide {
  margin-top: 16px; margin-bottom: 8px;
  background: #f7f9fc; border: 1px solid #dde3ea;
  border-radius: 6px; padding: 14px 16px;
  font-size: 12px;
}
.tol-guide h3 { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #1a3a5c; margin-bottom: 10px; }
.tol-guide table { width: auto; margin: 0; }
.tol-guide thead tr { background: #e4ecf5; }
.tol-guide thead th { color: #1a3a5c; font-size: 11px; padding: 5px 12px; }
.tol-guide tbody tr { border-bottom: 1px solid #e8ecf0; }
.tol-guide tbody td { padding: 5px 12px; font-size: 12px; color: #333; }
.tol-guide .tol-tr-row { margin-bottom: 8px; color: #555; }
.tol-guide .tol-tr-row strong { color: #1a3a5c; }

/* ── Clearance files (ihi-series, etc.) ─────────────────── */
.type-selector-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.type-selector-row label { font-size: 12px; color: #666; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.type-selector-row select { border: 1px solid #ccc; border-radius: 4px; padding: 6px 10px; font-size: 13px; color: #222; background: #fff; cursor: pointer; }
.type-selector-row select:focus { outline: 2px solid #1a3a5c; border-color: transparent; }

.ref-scroll { overflow-x: auto; margin-bottom: 24px; }

table.ref-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
table.ref-tbl thead tr.type-row th { background: #1a3a5c; color: #fff; padding: 8px 10px; text-align: center; font-weight: 600; font-size: 12px; white-space: nowrap; }
table.ref-tbl thead tr.type-row th.lbl { text-align: left; min-width: 110px; }
table.ref-tbl thead tr.type-row th.active { background: #d9443a; }
table.ref-tbl thead tr.sub-row th { background: #25486e; color: #fff; padding: 4px 10px; text-align: center; font-size: 10px; font-weight: 400; opacity: 0.9; }
table.ref-tbl tbody tr { border-bottom: 1px solid #eee; }
table.ref-tbl tbody tr:hover { background: #f8f8f8; }
table.ref-tbl tbody td { padding: 7px 10px; text-align: center; color: #666; font-family: 'JetBrains Mono', 'SF Mono', monospace; font-size: 12px; }
table.ref-tbl tbody td.lbl { text-align: left; font-family: 'Manrope', 'Titillium Web', system-ui, sans-serif; font-weight: 600; color: #1a3a5c; background: #f7f9fc; font-size: 13px; }
table.ref-tbl tbody td.active { background: #fff8f2; border-left: 2px solid rgba(217,68,58,.3); border-right: 2px solid rgba(217,68,58,.3); font-weight: 700; color: #222; }
table.ref-tbl tbody tr:last-child td.active { border-bottom: 2px solid rgba(217,68,58,.3); }
table.ref-tbl tbody td.na { color: #ccc; }

table.meas-tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 16px; }
table.meas-tbl thead tr { background: #1a3a5c; color: #fff; }
table.meas-tbl thead th { padding: 9px 10px; text-align: left; font-weight: 500; font-size: 12px; }
table.meas-tbl thead th.num { text-align: center; }
table.meas-tbl tbody tr { border-bottom: 1px solid #eee; }
table.meas-tbl tbody tr:hover { background: #f8f8f8; }
table.meas-tbl tbody td { padding: 8px 10px; vertical-align: middle; }
td.meas-label { font-weight: 600; color: #1a3a5c; min-width: 100px; }
td.range-cell { text-align: center; color: #555; font-family: 'JetBrains Mono', 'SF Mono', monospace; font-size: 12px; min-width: 110px; }
td.limit-cell { text-align: center; color: #d9443a; font-family: 'JetBrains Mono', 'SF Mono', monospace; font-size: 12px; min-width: 80px; font-weight: 600; }
td.limit-cell.no-limit { color: #bbb; font-weight: 400; }
.meas-wrap input:disabled,
.cl-input:disabled { background: #f3f3f3; border-color: #e0e0e0; cursor: not-allowed; }
tr.row-na td:not(.meas-label) { opacity: 0.35; }

/* ── Print ──────────────────────────────────────────────── */
@media print {
  body { background: white; padding: 0; }
  .container { box-shadow: none; border-radius: 0; }
  .actions, .type-selector-row { display: none; }
  .meas-wrap input { border-color: #999 !important; }
}

/* ══════════════════════════════════════════════════════════
   PARTS FILES — checkbox, quantity controls, footer
   Used by: tpl-a-*.html, tpl-b-*.html, ihi/*.html, etc.
   ══════════════════════════════════════════════════════════ */

/* Section divider bar (renamed from .section-title to avoid
   conflict with inspection.html's own .section-title) */
.parts-sec-title {
  background: #f0f4f8;
  color: #1b4472;
  padding: 9px 24px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-top: 2px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
}

/* ── Custom checkbox ─────────────────────────────────────── */
.cb-wrap { display: flex; align-items: center; justify-content: center; cursor: pointer; }
.cb-wrap input[type=checkbox] { display: none; }
.cb-box {
  width: 18px; height: 18px;
  border: 2px solid #aaa;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.cb-wrap input[type=checkbox]:checked + .cb-box { background: #1b4472; border-color: #1b4472; }
.cb-wrap input[type=checkbox]:checked + .cb-box::after { content: '✓'; color: #fff; font-size: 11px; line-height: 1; }

/* Selected row */
tbody tr.selected { background: #e8f0fe; }

/* ── Part number column ──────────────────────────────────── */
.part-no { font-family: 'JetBrains Mono', 'SF Mono', monospace; font-size: 11px; color: #666; width: 88px; }

/* ── Quantity cell ───────────────────────────────────────── */
.qty-cell { width: 120px; text-align: center; }
.qty-default { color: #999; }
.qty-ctrl { display: flex; align-items: center; gap: 6px; justify-content: center; }
.qty-ctrl button {
  width: 26px; height: 26px;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 4px;
  font-size: 15px;
  cursor: pointer;
  line-height: 1;
  transition: background 0.12s, border-color 0.12s;
}
.qty-ctrl button:hover { background: #e0e8f5; border-color: #1b4472; color: #1b4472; }
.qty-ctrl > span { font-weight: 600; min-width: 22px; text-align: center; color: #1b4472; font-family: 'JetBrains Mono', 'SF Mono', monospace; }

/* ── Badges & notes ──────────────────────────────────────── */
.badge-s   { display: inline-block; font-size: 9px; font-weight: 700; color: #1b4472; background: #dce8f7; border-radius: 3px; padding: 1px 4px; margin-left: 5px; vertical-align: middle; }
.badge-m   { display: inline-block; font-size: 9px; font-weight: 700; color: #5a3e00; background: #ffeaa0; border-radius: 3px; padding: 1px 4px; margin-left: 5px; vertical-align: middle; }
.badge-opt { display: inline-block; font-size: 9px; font-weight: 700; color: #7a5c00; background: #fff3cc; border-radius: 3px; padding: 1px 4px; margin-left: 5px; vertical-align: middle; }
.part-note { font-size: 11px; color: #888; margin-left: 4px; }

/* ── Parts footer ────────────────────────────────────────── */
.footer-wrap { padding: 16px 24px 20px; border-top: 2px solid #e0e0e0; margin-top: 8px; }
.summary-bar { display: flex; gap: 24px; padding: 10px 14px; background: #f0f4f8; border-radius: 6px; font-size: 13px; margin-bottom: 14px; }
.summary-bar span { color: #666; }
.summary-bar strong { color: #1b4472; font-size: 15px; margin-left: 4px; }
.selected-list-wrap { margin-bottom: 14px; }
.selected-list-wrap h3 { font-size: 11px; color: #666; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.selected-list { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.selected-list li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: #f5f8ff; border-left: 3px solid #1b4472; border-radius: 0 4px 4px 0; font-size: 13px; }
.selected-list .sl-no { font-family: 'JetBrains Mono', 'SF Mono', monospace; font-size: 10px; color: #666; width: 84px; flex-shrink: 0; }
.selected-list .sl-qty { font-family: 'JetBrains Mono', 'SF Mono', monospace; font-size: 12px; font-weight: 700; color: #1b4472; margin-left: auto; white-space: nowrap; }
.btn-clear { padding: 8px 18px; background: #fff; border: 1px solid #ccc; border-radius: 6px; cursor: pointer; font-size: 13px; transition: background 0.12s, border-color 0.12s, color 0.12s; }
.btn-clear:hover { background: #fee; border-color: #d9443a; color: #d9443a; }
.btn-row { margin-top: 4px; }

.badge-v { display: inline-block; font-size: 9px; font-weight: 700; color: #888; background: #eee; border-radius: 3px; padding: 1px 4px; margin-left: 5px; vertical-align: middle; letter-spacing: 0.04em; }

/* ── Approval banner ─────────────────────────────────────── */
.approval-banner {
  margin-top: 18px;
  border-radius: 6px;
  overflow: hidden;
  transition: background 0.2s, padding 0.2s;
}
.approval-banner:empty { margin: 0; min-height: 0; }
.approval-banner.approval-ok {
  background: #2a9d5c;
  color: #fff;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.04em;
}

/* Bemærk: den interne .header-bjælke er fjernet fra alle skabeloner (gammelt
   design-levn), så den tidligere skjul-regel er ikke længere nødvendig. */

/* ═══════════════════════════════════════════════════════════
   DELTE SKABELON-KOMPONENTER
   Flyttet hertil fra inline <style> i de fetchede skabeloner, så
   design/ændringer sker ét sted. Fil-specifikke afvigelser (fx blå
   note-bar, per-fil label-bredder, .vtr-ref) bevares inline i filen.
   ═══════════════════════════════════════════════════════════ */

/* Note-bar (standard gul) */
.note-bar { background:#fffbe6; border:1px solid #f0d060; border-radius:4px; padding:8px 12px; font-size:12px; color:#666; margin-bottom:16px; }

/* Måle-guide (kun skærm) */
.meas-guide { background:#f7f9fc; border:1px solid #dde3ea; border-radius:6px; padding:14px 18px; margin-bottom:18px; font-size:12px; color:#444; line-height:1.6; }
.meas-guide h3 { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:#1a3a5c; margin-bottom:10px; }
.meas-guide h4 { font-size:12px; font-weight:700; color:#1a3a5c; margin:10px 0 4px; }
.meas-guide ol, .meas-guide ul { padding-left:18px; }
.meas-guide li { margin-bottom:5px; }
.meas-guide .footnote { margin-top:8px; padding-top:8px; border-top:1px solid #e0e6ed; font-size:11px; color:#888; }
@media print { .meas-guide { display:none; } }

/* To-kolonne tegnings-grid */
.drawing-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
@media (max-width:600px) { .drawing-grid { grid-template-columns:1fr; } }

/* Reference-tabel celle-varianter */
table.ref-tbl td.limit-val { color:#d9443a; font-weight:600; }
table.ref-tbl td.na-val { color:#ccc; }

/* ─── MOBIL: større trykflader (checkbokse, antal-knapper) ─ */
@media (max-width: 768px) {
  .cb-wrap { padding: 10px; margin: -10px; }
  .cb-box { width: 22px; height: 22px; }
  .qty-ctrl button { width: 36px; height: 36px; font-size: 17px; }
}

/* Readonly-felter (auto-udfyldte målinger) */
input[readonly]     { background:#f0f4f8 !important; color:#555 !important; border-color:#c8d0db !important; font-style:italic; cursor:default; }
input[readonly].ok  { background:#edfaf3 !important; color:#1a6e3f !important; font-style:normal; }
input[readonly].nok { background:#fdf0ef !important; color:#a02020 !important; font-style:normal; }
td.calc-label { color:#888; font-size:11px; vertical-align:middle; }

/* Visuel tilstands-blok (bearing/rotor) — label-bredde sættes pr. fil */
.visual-cond-block { background:#f8fafc; border:1px solid var(--border,#d0d7e2); border-radius:6px; padding:10px 14px; margin-bottom:14px; display:flex; flex-direction:column; gap:8px; }
.visual-cond-row   { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.visual-cond-label { font-size:0.85rem; font-weight:600; color:var(--pj-navy,#1b4472); }

/* Manual-reference info-boks (shaft / compressor-wheel) */
.manual-ref { background:#e8f4fd; border:1px solid #a8c8e8; border-radius:4px; padding:8px 14px; font-size:13px; color:#1b4472; margin-bottom:18px; }
.manual-ref strong { font-weight:700; }
td.desc-col { font-size:12px; color:#555; padding-left:6px; }

/* Serie/model-vælger-række (skjules normalt via initClearance) */
.sel-row { display:flex; align-items:center; gap:16px; flex-wrap:wrap; margin-bottom:20px; }
.sel-row label { font-size:12px; color:#666; font-weight:600; text-transform:uppercase; letter-spacing:.04em; white-space:nowrap; }
.sel-row select { border:1px solid #ccc; border-radius:4px; padding:6px 10px; font-size:13px; background:#fff; cursor:pointer; }
.sel-row select:focus { outline:2px solid #1a3a5c; border-color:transparent; }
