:root {
  --navy: #14407A;
  --navy-2: #1E5A9E;
  --accent: #F5A623;
  --green: #1B7A3D;
  --green-bg: #e6f5eb;
  --red: #b42318;
  --bg: #e8edf2;
  --card: #ffffff;
  --border: #c5d0dc;
  --text: #1a2332;
  --muted: #5a6a7a;
  --unk: #9a3412;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(20, 64, 122, 0.08);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); min-height: 100%; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.app { max-width: 920px; margin: 0 auto; padding: 0 12px 80px; }

.header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  background: var(--navy); color: #fff;
  margin: 0 -12px 16px; padding: 12px 16px;
  box-shadow: var(--shadow);
}
.header strong { display: block; font-size: 16px; }
.header .sub { font-size: 12px; opacity: 0.85; }
.pill {
  margin-left: auto; background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px; padding: 4px 10px; font-size: 11px; white-space: nowrap;
}

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 10px; font-size: 15px; color: var(--navy); }
.card h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.job-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
label.field input, label.field select, label.field textarea {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  background: #f8fafc; color: var(--text); font-weight: 500;
}
label.field input:focus, label.field textarea:focus { outline: 2px solid var(--navy-2); border-color: var(--navy-2); background: #fff; }

.notes-area {
  width: 100%; min-height: 140px; resize: vertical;
  border: 1px solid var(--border); border-radius: 8px; padding: 12px;
  background: #f8fafc; line-height: 1.45;
}

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

.btn {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  border-radius: 8px; padding: 10px 14px; font-weight: 600; font-size: 14px;
}
.btn:hover { background: #f1f5f9; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-primary:hover { background: var(--navy-2); }
.btn-accent { background: var(--accent); color: #1a2332; border-color: #d4890f; }
.btn-accent:hover { filter: brightness(1.05); }
.btn-green { background: var(--green); color: #fff; border-color: var(--green); }
.btn-sm { padding: 8px 12px; font-size: 13px; }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,0.35); }

.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: #f8fafc;
}
.checklist li.done { background: var(--green-bg); border-color: #8fd0a8; }
.checklist .mark {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--border); display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: transparent;
}
.checklist li.done .mark { background: var(--green); border-color: var(--green); color: #fff; }
.checklist .label { font-size: 14px; font-weight: 600; }
.checklist .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }

.progress-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.progress-text { font-size: 13px; color: var(--muted); font-weight: 600; }
.ready-badge {
  background: var(--green); color: #fff; font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
}

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.thumb {
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #f1f5f9;
  position: relative;
}
.thumb img { width: 100%; height: 100px; object-fit: cover; display: block; background: #dde3ea; }
.thumb .meta { padding: 6px 8px; font-size: 11px; }
.thumb .tag {
  display: inline-block; background: var(--navy); color: #fff;
  border-radius: 4px; padding: 2px 6px; font-weight: 700; margin-bottom: 4px;
}
.thumb .rm {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,0.65); color: #fff; border: 0; border-radius: 6px;
  width: 28px; height: 28px; font-size: 14px;
}

.footer-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: #fff; border-top: 1px solid var(--border);
  padding: 10px 16px; display: flex; gap: 10px; justify-content: center;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

/* Overlay / screens */
.overlay {
  position: fixed; inset: 0; z-index: 40; background: rgba(15, 30, 50, 0.55);
  display: none; align-items: stretch; justify-content: center; padding: 12px;
}
.overlay.open { display: flex; }
.modal {
  background: var(--bg); width: min(960px, 100%); max-height: 100%;
  border-radius: 12px; overflow: auto; display: flex; flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.modal-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--navy); color: #fff; padding: 12px 14px;
}
.modal-head h2 { margin: 0; font-size: 15px; flex: 1; }
.modal-body { padding: 14px; }

.edit-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px; margin-bottom: 14px;
}

/* Draft sheet preview */
.sheet {
  background: #fff; border: 1px solid #333; margin: 0 auto 16px;
  width: 100%; max-width: 8.5in; min-height: 10in;
  padding: 0.45in 0.5in; font-size: 11px; color: #111; position: relative;
  page-break-after: always;
}
.sheet .banner {
  display: flex; justify-content: space-between; gap: 8px;
  border-bottom: 2px solid #14407A; padding-bottom: 6px; margin-bottom: 8px;
  font-size: 10px; font-weight: 700; color: #14407A;
}
.sheet .subhead {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 9px; color: #444; margin-bottom: 10px;
}
.sheet h1 {
  text-align: center; font-size: 16px; margin: 6px 0 4px; letter-spacing: 0.02em;
}
.sheet .title-line { text-align: center; font-size: 12px; margin-bottom: 12px; }
.sheet .section {
  border: 1px solid #333; margin-bottom: 10px; border-radius: 2px;
}
.sheet .section-h {
  background: #14407A; color: #fff; font-weight: 700; font-size: 11px;
  padding: 4px 8px;
}
.sheet .section-b { padding: 8px; }
.sheet .kv {
  display: grid; grid-template-columns: 120px 1fr; gap: 4px 8px; margin-bottom: 4px;
}
.sheet .kv .k { font-weight: 700; color: #333; }
.sheet .v { font-weight: 600; }
.sheet .v.unk { color: var(--unk); font-style: italic; font-weight: 700; }
.sheet table { width: 100%; border-collapse: collapse; font-size: 10px; }
.sheet th, .sheet td { border: 1px solid #555; padding: 4px 6px; text-align: left; vertical-align: top; }
.sheet th { background: #eef2f7; }
.sheet .photo-cap {
  font-size: 9px; text-align: center; font-weight: 700; margin-top: 4px; color: #333;
}
.sheet .photo-box {
  border: 1px dashed #666; min-height: 160px; display: grid; place-items: center;
  background: #fafafa; overflow: hidden;
}
.sheet .photo-box img { max-width: 100%; max-height: 220px; object-fit: contain; }
.sheet .sheet-foot {
  display: flex; justify-content: space-between; gap: 8px;
  border-top: 1px solid #333; margin-top: 12px; padding-top: 6px;
  font-size: 9px; color: #444;
}
.notes-block { white-space: pre-wrap; font-size: 11px; line-height: 1.4; min-height: 48px; }

.toast {
  position: fixed; bottom: 72px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1a2332; color: #fff; padding: 10px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s; z-index: 50; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.source-picker {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,0.5);
  display: none; align-items: flex-end; justify-content: center;
}
.source-picker.open { display: flex; }
.source-sheet {
  background: #fff; width: min(480px, 100%); border-radius: 16px 16px 0 0;
  padding: 16px; max-height: 70vh; overflow: auto;
}
.source-sheet h3 { margin: 0 0 12px; }
.source-opts { display: grid; gap: 8px; }
.source-opts button {
  text-align: left; padding: 12px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: #f8fafc; font-weight: 600;
}

.install-banner {
  background: #fff7e6; border: 1px solid #f0c36d; color: #5c3d00;
  border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}
.install-banner[hidden] { display: none !important; }

@media (max-width: 600px) {
  .pill { display: none; }
  .sheet { padding: 0.35in 0.3in; font-size: 10px; }
}

/* ===== v2 capture-first layout ===== */
.app { max-width: 1400px; padding-bottom: 24px; }
.header { flex-wrap: wrap; gap: 10px 16px; padding: 10px 16px; margin-bottom: 0; }
.job-inline { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; justify-content: center; }
.job-inline label { display: flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; opacity: .9; }
.job-inline input { width: 110px; padding: 6px 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.12); color: #fff; font-weight: 600; }
.job-inline input.w-sm { width: 52px; }
.job-inline input::placeholder { color: rgba(255,255,255,.55); }
.btn-render { padding: 6px 12px; font-size: 13px; background: var(--accent); border-color: #d4890f; color: #1a2332; }
.btn-render:disabled { background: rgba(255,255,255,.15); color: rgba(255,255,255,.7); border-color: rgba(255,255,255,.25); opacity: 1; }

.chip-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 4px; margin-bottom: 8px; }
.chip-count { font-size: 12px; font-weight: 700; color: var(--muted); }
.chips { list-style: none; display: flex; gap: 6px; flex-wrap: wrap; margin: 0; padding: 0; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: #fff; color: var(--muted); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #c5d0dc; }
.chip.done { background: var(--green-bg); border-color: #8fd0a8; color: var(--green); }
.chip.done .dot { width: auto; height: auto; background: none; font-size: 11px; }
.chip-strip .ready-badge { font-size: 11px; padding: 3px 9px; }

.capture-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
@media (max-width: 900px) { .capture-layout { grid-template-columns: 1fr; } }
.capture-main, .capture-side { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.capture-main { display: flex; flex-direction: column; gap: 12px; }
.big-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.big-btn { min-height: 96px; border-radius: 14px; border: 2px solid var(--navy); background: #fff; color: var(--navy); font-size: 20px; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; touch-action: manipulation; }
.big-btn .ico { font-size: 34px; line-height: 1; }
.big-btn:active { transform: scale(.98); }
.big-camera { background: var(--navy); color: #fff; }
.big-notes { flex: 1; min-height: 420px; font-size: 17px; line-height: 1.5; padding: 14px; }
.capture-side h3 { margin: 0 0 8px; }
.tag-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.tag-btn { min-height: 64px; border-radius: 12px; border: 2px solid var(--border); background: #f8fafc; font-size: 15px; font-weight: 700; color: var(--text); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; touch-action: manipulation; }
.tag-btn .n { font-size: 11px; font-weight: 600; color: var(--muted); }
.tag-btn.has { border-color: #8fd0a8; background: var(--green-bg); }
.side-tools { display: flex; gap: 8px; margin-top: 12px; justify-content: flex-end; }
.source-opts { grid-template-columns: repeat(2, 1fr); gap: 10px; }
.source-opts button { min-height: 64px; font-size: 17px; text-align: center; }

/* ===== standalone PWA ===== */
.target-hint { font-size: 12px; color: var(--muted); margin-left: auto; }
.target-hint strong { color: var(--navy); font-family: ui-monospace, monospace; }
.save-status { font-size: 11px; color: var(--muted); font-style: italic; }
#issueResult { margin-top: 14px; }
.issue-title { font-weight: 800; color: var(--green); font-size: 16px; margin-bottom: 6px; }
.issue-files { font-size: 13px; margin-bottom: 6px; }
.issue-hint { font-size: 14px; margin-bottom: 10px; }
.issue-actions { gap: 12px; }
.issue-btn { min-height: 72px; font-size: 17px; padding: 0 20px; flex: 1; }
.issue-note { font-size: 12px; color: var(--muted); margin-top: 6px; }
@media (max-width: 900px) {
  .header { justify-content: space-between; }
  .job-inline { order: 3; flex-basis: 100%; justify-content: flex-start; }
  .big-notes { min-height: 320px; }
  .target-hint { margin-left: 0; flex-basis: 100%; }
}

/* ===== AI scan ===== */
.scan-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.scan-btn { min-height: 76px; flex-direction: row; gap: 10px; font-size: 18px; border-color: #7a5a00; color: #5c3d00; background: #fff7e6; }
.scan-btn .ico { font-size: 28px; }
.scan-sheet { width: min(760px, 100%); max-height: 92vh; }
.scan-preview { background: #1a2332; border-radius: 8px; display: grid; place-items: center; height: 46vh; overflow: hidden; }
.scan-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.scan-rot, .scan-go { display: flex; gap: 10px; margin-top: 10px; }
.scan-rot .big-btn, .scan-go .big-btn { flex: 1; min-height: 64px; font-size: 16px; flex-direction: row; }
.scan-go .btn { min-height: 64px; min-width: 110px; }
.scan-busy { margin-top: 10px; font-weight: 700; color: var(--navy); display: flex; align-items: center; gap: 10px; }
.ai-panel { margin-top: 14px; border: 2px solid #f0c36d; }
.ai-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ai-head h2 { margin: 0; }
.ai-pend { background: #f5a623; color: #1a2332; font-weight: 800; font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.ai-pend.done { background: var(--green); color: #fff; }
.ai-help { font-size: 12px; color: var(--muted); margin: 6px 0 10px; }
.ai-scan h3 small { font-weight: 500; text-transform: none; letter-spacing: 0; }
.ai-scan h4 { margin: 12px 0 6px; font-size: 13px; color: var(--navy); }
.ai-rows, .ai-chars { display: grid; gap: 6px; }
.ai-row { display: grid; grid-template-columns: 110px 1fr 54px minmax(80px, 180px) 48px 48px; gap: 6px; align-items: center;
  padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: #f8fafc; }
.ai-char { grid-template-columns: 32px 64px 150px 1fr 54px 48px 48px; }
.ai-row input { border: 1px solid var(--border); border-radius: 6px; padding: 8px; font-size: 14px; min-width: 0; background: #fff; }
.ai-row.st-pending { background: #fff3c4; border-color: #e0b100; }
.ai-row.st-pending input { background: #fffbe8; font-weight: 700; }
.ai-row.st-confirmed { background: var(--green-bg); border-color: #8fd0a8; }
.ai-row.st-rejected { opacity: .5; text-decoration: line-through; }
.ai-row.st-unknown { background: #f1f5f9; color: var(--muted); }
.ai-row.st-unknown input { color: var(--unk); font-style: italic; font-weight: 700; }
.ai-label { font-size: 12px; font-weight: 700; }
.ai-cno { font-weight: 800; text-align: center; }
.ai-src { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-conf { font-size: 11px; font-weight: 800; text-align: center; border-radius: 6px; padding: 3px 0; }
.ai-conf.hi { background: #d6f2df; color: var(--green); } .ai-conf.mid { background: #ffe8b3; color: #7a5a00; } .ai-conf.lo { background: #fde0dc; color: var(--red); }
.ai-unk { font-size: 10px; font-weight: 800; color: var(--unk); text-align: center; }
.ai-ok, .ai-no { min-height: 44px; border-radius: 8px; font-size: 20px; font-weight: 800; border: 2px solid; background: #fff; }
.ai-ok { color: var(--green); border-color: var(--green); } .ai-no { color: var(--red); border-color: #e3a29a; }
.st-confirmed .ai-ok { background: var(--green); color: #fff; }
@media (max-width: 900px) {
  .ai-row { grid-template-columns: 90px 1fr 48px 44px 44px; }
  .ai-row .ai-src { display: none; }
  .ai-char { grid-template-columns: 28px 56px 1fr 48px 44px 44px; }
  .ai-char .ai-cname { grid-column: 3; } .ai-char .ai-val { grid-column: 1 / span 3; grid-row: 2; }
}

/* ===== per-job AI policy ===== */
.ai-policy { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #f8fafc; }
.ai-switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 15px; cursor: pointer; min-height: 44px; }
.ai-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ai-switch .slider { width: 56px; height: 32px; border-radius: 999px; background: #c5d0dc; position: relative; transition: background .15s; flex-shrink: 0; }
.ai-switch .slider::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left .15s; }
.ai-switch input:checked + .slider { background: var(--green); }
.ai-switch input:checked + .slider::after { left: 27px; }
.ai-switch input:disabled + .slider { background: #e3a29a; }
.ai-switch input:focus-visible + .slider { outline: 2px solid var(--navy-2); outline-offset: 2px; }
.ai-restr { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.ai-restr select { min-height: 44px; border-radius: 8px; border: 1px solid var(--border); padding: 0 10px; font-size: 14px; max-width: 360px; background: #fff; }
.ai-reason { flex-basis: 100%; font-size: 13px; font-weight: 700; color: var(--muted); }
.ai-reason.blocked { color: var(--red); }
.ai-reason.ok { color: var(--green); }
.scan-btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(1); }
.sheet .ai-use-line { font-size: 9px; color: #333; margin-top: 8px; border-top: 1px dotted #999; padding-top: 4px; }

.ai-policy.locked { border: 2px solid var(--red); background: #fdecea; }
.export-block { margin: 10px 0; padding: 16px 18px; border: 4px solid #b00020; background: #fdecea; border-radius: 12px; color: #7a0014; }
.export-block .xb-title { font-size: 24px; font-weight: 900; line-height: 1.2; color: #b00020; }
.export-block .xb-sub { margin-top: 6px; font-weight: 700; font-size: 14px; }
.export-block ul { margin: 8px 0 0 18px; font-size: 14px; }
.scan-note { margin: 8px 0; padding: 10px 12px; border: 2px solid #c98a00; background: #fff6dd; border-radius: 10px; font-weight: 700; font-size: 14px; color: #6b4a00; }

/* ===== network folder bar / ready to copy ===== */
.folder-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; padding: 8px 14px; background: #eef3f8; border-bottom: 1px solid var(--border); }
.folder-bar label { display: flex; flex-direction: column; font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.folder-bar label small { text-transform: none; font-weight: 600; }
.folder-bar input[type=text], .folder-bar input:not([type]) { min-height: 40px; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; font-size: 15px; min-width: 200px; background: #fff; }
.folder-bar input.w-sm { min-width: 70px; width: 80px; }
.folder-bar input.invalid { border-color: var(--red); background: #fdecea; }
.legacy-toggle { flex-direction: row !important; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px; border: 2px solid #8a5a00; border-radius: 8px; background: #fff; color: #8a5a00 !important; cursor: pointer; }
.legacy-toggle input { width: 22px; height: 22px; }
.legacy-toggle:has(input:checked) { background: #8a5a00; color: #fff !important; }
.dest-hint { flex: 1 1 320px; font-size: 12px; color: var(--muted); align-self: center; word-break: break-all; }
.dest-hint code { font-size: 12px; color: var(--navy); font-weight: 700; }
.rev-pill { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--navy); color: #fff; font-weight: 800; font-size: 11px; margin-left: 4px; }
.btn-ready { min-height: 44px; font-weight: 800; }
.ready-n { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 12px; margin-left: 4px; }
.ready-n.zero { background: #9aa7b4; }
.ready-sheet { max-width: 980px; width: 96vw; max-height: 92vh; overflow: auto; }
.ready-head { display: flex; justify-content: space-between; align-items: center; }
.rjob { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 10px 0; background: #fff; }
.rjob h4 { margin: 0 0 4px; font-size: 16px; }
.rdest { font-family: ui-monospace, monospace; font-size: 12px; background: #f4f6f9; padding: 4px 8px; border-radius: 6px; word-break: break-all; }
.rarch { margin: 8px 0; padding: 8px 10px; border: 2px solid #c98a00; background: #fff6dd; border-radius: 8px; font-size: 13px; font-weight: 700; color: #6b4a00; }
.rarch code { font-weight: 800; }
.rfiles { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.rfiles td, .rfiles th { border-bottom: 1px solid #e4e8ee; padding: 4px 6px; text-align: left; vertical-align: top; word-break: break-all; }
.st { display: inline-block; padding: 1px 6px; border-radius: 6px; font-weight: 800; font-size: 11px; white-space: nowrap; }
.st-local_only { background: #fdecea; color: #b00020; }
.st-copied { background: #fff6dd; color: #6b4a00; }
.st-verified { background: #e3f6e8; color: #166534; }
.ractions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ractions .big-btn { min-height: 52px; font-size: 15px; padding: 0 16px; }
.ready-dev { margin-top: 8px; font-size: 12px; color: var(--muted); }
.sheet .legacy-mark { border: 2px solid #8a5a00; color: #8a5a00; font-weight: 900; font-size: 13px; text-align: center; padding: 3px; margin: 4px 0; letter-spacing: .5px; }

/* v7: Save Progress + full-screen preview */
.save-fab { position: fixed; right: 16px; bottom: 16px; z-index: 45; min-height: 64px; min-width: 200px;
  padding: 0 22px; font-size: 20px; font-weight: 800; border: 0; border-radius: 32px;
  background: #1f7a3a; color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
.save-fab:active { transform: scale(0.97); }
.app { padding-bottom: 96px; }
.toast { z-index: 80; font-size: 17px; padding: 14px 20px; }
.toast.ok { background: #1f7a3a; }
.preview-view { position: fixed; inset: 0; z-index: 70; background: #5a6575; display: flex; flex-direction: column; }
.preview-view[hidden] { display: none; }
.pv-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 14px; background: var(--navy); color: #fff; }
.pv-bar .big-btn { min-height: 64px; font-size: 19px; padding: 0 22px; flex: 0 0 auto; }
.pv-back { background: #fff; color: #14407A; }
.pv-approve { background: #1f7a3a; color: #fff; border-color: #1f7a3a; }
.pv-approve:disabled { background: #8a9; opacity: 0.6; }
.pv-title { flex: 1; display: flex; flex-direction: column; font-size: 13px; min-width: 200px; }
.pv-title strong { font-size: 17px; }
.pv-approver { display: flex; flex-direction: column; font-size: 12px; font-weight: 700; }
.pv-approver input { font-size: 20px; min-height: 52px; width: 200px; padding: 0 10px; border-radius: 8px; border: 2px solid #fff; }
.pv-approver input.invalid { border-color: #ff6b6b; background: #fff0f0; }
.pv-gaps { background: #fff4d6; color: #5a3d00; font-size: 15px; border-bottom: 2px solid #e0a800; position: relative; z-index: 2; }
.pv-gaps:empty { display: none; }
.pv-gaps .req { color: #b00020; font-weight: 800; }
.pv-gaps ul { margin: 4px 0 0; padding-left: 20px; }
.pv-scroll { flex: 1; overflow: auto; padding: 16px; }

/* ===== v8: Jobs list (multiple drafts) ===== */
.btn-jobs { min-height: 56px; min-width: 110px; font-size: 18px; font-weight: 800; background: #fff; color: var(--navy); border: 2px solid #fff; border-radius: 12px; }
body.on-home .save-fab { display: none; }
.home-view { position: fixed; inset: 0; z-index: 55; background: var(--bg); overflow-y: auto; }
.home-head { position: sticky; top: 0; z-index: 2; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; }
.home-head strong { display: block; font-size: 24px; }
.home-head .sub { font-size: 13px; opacity: .85; }
.home-new { min-height: 72px; padding: 0 28px; font-size: 22px; flex-direction: row; }
.home-body { max-width: 1100px; margin: 0 auto; padding: 16px 20px 40px; }
.home-search input { width: 100%; box-sizing: border-box; font-size: 20px; padding: 14px 16px; border: 2px solid var(--border); border-radius: 12px; margin-bottom: 14px; }
.home-list { display: flex; flex-direction: column; gap: 12px; }
.home-empty { padding: 30px; text-align: center; font-size: 18px; color: var(--muted); background: #fff; border-radius: 14px; border: 2px dashed var(--border); }
.dcard { display: flex; align-items: center; gap: 16px; background: #fff; border: 2px solid var(--border); border-radius: 14px; padding: 14px 18px; box-shadow: var(--shadow); }
.dcard.issued { background: #f3f6f9; }
.dc-main { flex: 1; min-width: 0; }
.dc-job { font-size: 26px; font-weight: 800; color: var(--navy); }
.dc-op { display: inline-block; font-size: 18px; background: #e3ebf5; border-radius: 8px; padding: 2px 10px; margin-left: 6px; vertical-align: middle; }
.dc-pn { font-size: 17px; margin: 4px 0 6px; }
.dc-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 15px; color: var(--muted); }
.dc-prog { font-weight: 700; color: var(--unk); } .dc-prog.ok { color: var(--green); }
.dc-mig { color: var(--navy-2); font-style: italic; }
.dc-acts { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.dc-open { min-height: 72px; min-width: 190px; font-size: 22px; padding: 0 18px; }
.btn-danger-ghost { min-height: 44px; color: var(--red); border: 1px solid #e3a9a3; background: #fff; border-radius: 10px; font-weight: 700; }
.btn-danger { background: var(--red) !important; border-color: var(--red) !important; color: #fff !important; }
.del-title { color: var(--red); font-size: 22px; }
.del-sheet p { font-size: 17px; }
.home-issued { margin-top: 22px; }
.home-issued summary { font-size: 18px; font-weight: 700; color: var(--navy); padding: 14px 4px; cursor: pointer; min-height: 48px; }
.storage-info { margin-top: 24px; font-size: 14px; color: var(--muted); }
.storage-info.low { color: var(--red); background: #fdecea; border: 1px solid #f1b8b2; border-radius: 10px; padding: 10px 14px; font-size: 16px; }
@media (max-width: 700px) { .dcard { flex-direction: column; align-items: stretch; } .home-head { flex-wrap: wrap; } }

.dc-mbig { font-size: 22px; font-weight: 900; color: #fff; background: var(--navy); border-radius: 10px; padding: 2px 14px; }
.home-filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.home-filters label { display: flex; flex-direction: column; font-size: 13px; font-weight: 700; color: var(--muted); }
.home-filters select { min-height: 52px; min-width: 200px; font-size: 18px; border-radius: 10px; border: 2px solid var(--border); padding: 0 10px; background: #fff; }
.grp-h { margin: 14px 0 2px; font-size: 18px; color: var(--navy); } .grp-h span { color: var(--muted); font-weight: 500; }
.new-sheet .field input { font-size: 20px; min-height: 52px; }
.new-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 12px 0; }
.invalid { outline: 2px solid var(--red); }

/* Analyze All */
.an-btn { width: 100%; min-height: 76px; margin: 10px 0; flex-direction: row; gap: 12px; font-size: 20px; background: #1f4e8c; color: #fff; border-color: #1f4e8c; }
.an-btn small { display: block; font-size: 12px; font-weight: 500; opacity: .85; }
.an-btn .an-n { margin-left: auto; background: #f5a623; color: #1a2332; border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 800; }
.an-btn .an-n:empty { display: none; }
.an-btn:disabled { opacity: .45; }
.an-panel { border-color: #1f4e8c; }
.an-rows { display: grid; gap: 8px; }
.an-row { display: grid; grid-template-columns: 132px 1fr 150px; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; border: 1px solid var(--border); background: #f8fafc; }
.an-row.st-pending, .an-row.st-unsure { background: #fff3c4; border-color: #e0b100; }
.an-row.an-conflict.st-pending, .an-row.an-conflict.st-unsure { background: #ffe2c4; border: 2px solid #e07b00; }
.an-row.st-accepted { background: var(--green-bg); border-color: #8fd0a8; }
.an-row.st-rejected { opacity: .55; }
.an-row.st-rejected .an-val { text-decoration: line-through; }
.an-row.st-same { opacity: .6; }
.an-src { display: flex; flex-wrap: wrap; gap: 4px; }
.an-th { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.an-chip { font-size: 11px; background: #e2e8f0; border-radius: 6px; padding: 3px 6px; }
.an-lab { font-size: 13px; font-weight: 800; margin-bottom: 4px; }
.an-lab small { font-weight: 500; color: var(--muted); }
.an-val { width: 100%; border: 1px solid var(--border); border-radius: 6px; padding: 10px; font-size: 16px; font-weight: 700; background: #fff; box-sizing: border-box; }
.an-cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.an-cmp b { display: block; font-size: 11px; text-transform: uppercase; color: var(--muted); }
.an-cur span { display: block; padding: 10px; border: 1px dashed #999; border-radius: 6px; font-size: 16px; background: #fff; }
.an-note { font-size: 12px; color: var(--muted); margin-top: 3px; }
.an-btns { display: grid; gap: 6px; }
.an-btns button { min-height: 48px; font-size: 16px; font-weight: 800; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; }
.an-ok { background: var(--green); color: #fff; border-color: var(--green) !important; }
.an-no { background: #fff; color: #b42318; }
.an-done { font-weight: 800; text-align: center; }
/* v9.3 Analyze All: per-photo status + notes included */
.an-mat{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:10px;text-align:left}
.an-mat h4{margin:4px 0}
.an-mat ul{list-style:none;margin:0;padding:0;max-height:260px;overflow:auto}
.an-ps{display:flex;gap:8px;align-items:center;padding:5px;border-radius:6px;margin-bottom:4px;background:#f3f5f8;font-size:13px}
.an-ps.ok{background:#e6f5eb}.an-ps.bad{background:#fde8e8}
.an-ps .an-th{width:44px;height:44px;object-fit:cover;flex:none}
.an-ns{padding:5px;background:#fff8e1;border-radius:6px;margin-bottom:4px;font-size:13px}
.an-warn{color:#a40000;font-weight:600}
.an-matbox{margin-top:10px}.an-matbox summary{cursor:pointer;font-weight:600}
@media (max-width:800px){.an-mat{grid-template-columns:1fr}}

/* v9.5 photo captions */
.thumb .cap { margin-top: 4px; font-size: 13px; line-height: 1.25; color: #0f172a; word-break: break-word; max-height: 4.9em; overflow: hidden; }
.thumb .cap.empty { color: var(--muted); font-style: italic; }
.thumb .cap-btn { display: block; width: 100%; min-height: 52px; border: 0; border-top: 1px solid var(--border); background: #e0ecff; color: var(--navy); font-size: 17px; font-weight: 700; }
.thumb .cap-btn:active { background: #c7dbff; }
.cap-editor { align-items: flex-start; padding-top: 3vh; }
.cap-sheet { border-radius: 16px; width: min(640px, 96%); max-height: 94vh; }
.cap-row { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.cap-row img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; background: #dde3ea; flex: none; }
.cap-tag-lab { flex: 1; display: flex; flex-direction: column; font-weight: 700; gap: 4px; }
.cap-tag { min-height: 56px; font-size: 18px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); }
.cap-lab { display: block; font-weight: 700; margin-bottom: 4px; }
.cap-lab small { font-weight: 400; color: var(--muted); }
#capText { width: 100%; box-sizing: border-box; font-size: 20px; line-height: 1.35; padding: 12px; min-height: 130px; border-radius: 8px; border: 2px solid var(--border); resize: vertical; }
#capText:focus { border-color: var(--navy); outline: none; }
.cap-actions { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 10px; margin-top: 12px; }
.cap-actions .btn { min-height: 60px; font-size: 18px; }
.sheet .photo-desc { font-size: 10px; text-align: center; margin: 2px 0 8px; color: #111; white-space: pre-wrap; word-break: break-word; }
/* v9.6 approval memory */
.an-all { min-height: 56px; font-size: 18px; font-weight: 800; background: var(--green); color: #fff; border-color: var(--green); margin: 6px 0 2px; }
.an-all-note { display: block; color: var(--muted); margin-bottom: 8px; }
.an-approved { margin-top: 12px; border: 1px solid #8fd0a8; border-radius: 10px; padding: 8px; background: #f3fbf6; }
.an-approved > summary { font-weight: 800; cursor: pointer; min-height: 40px; display: flex; align-items: center; font-size: 16px; }
.an-chg { color: #b45309; font-weight: 700; }
.ai-approved { margin-top: 8px; border: 1px solid #8fd0a8; border-radius: 10px; padding: 6px 8px; background: #f3fbf6; }
.ai-approved > summary { font-weight: 800; cursor: pointer; min-height: 36px; }
.an-full{display:flex;gap:10px;align-items:center;min-height:44px;font-weight:700;font-size:15px}.an-full input{width:24px;height:24px}
.an-full[hidden]{display:none}
.run-mark{background:#fff3cd;border:2px solid #b8860b;color:#7a5200;font-weight:700;text-align:center;padding:3px 6px;margin:4px 0;font-size:12px}
.pv-datacheck{margin-top:4px;font-size:13px}.pv-datacheck.ok{color:#1d6b35}.pv-datacheck.bad{color:#a40000;font-weight:600}
.run-form{display:grid;grid-template-columns:1fr 1fr 1fr;gap:8px;margin:8px 0}.run-form label{display:flex;flex-direction:column;font-size:13px;font-weight:600}.run-form .wide{grid-column:1/-1}.run-form input,.run-form textarea{font-size:16px;padding:8px}
.run-scroll{max-height:45vh;overflow:auto;background:#ddd;padding:6px}.rrun{margin-top:6px;padding:6px 8px;background:#fff8e1;border:1px solid #d9b44a;border-radius:6px;font-size:13px}

/* ===== v9.8 ===== */
.pvg-head { display: flex; width: 100%; align-items: center; gap: 12px; min-height: 40px; padding: 4px 14px; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 800; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; }
.pvg-sum { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.pvg-tap { font-size: 12px; font-weight: 600; opacity: .8; text-decoration: underline; }
.pvg-body { display: none; padding: 0 14px 8px; max-height: 40vh; overflow: auto; }
.pv-gaps.open .pvg-body { display: block; position: absolute; left: 0; right: 0; top: 100%; background: #fff4d6; border-bottom: 2px solid #e0a800; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.pv-gaps.lvl-bad { background: #ffe1e1; border-color: #c62828; color: #7a0010; }
.pv-gaps.lvl-bad .pvg-body { background: #ffe1e1; }
.pv-gaps.lvl-ok { background: #e3f4e8; border-color: #2e7d46; color: #1d6b35; }
.pv-gaps.lvl-ok .pvg-body { background: #e3f4e8; }
.pv-bar { padding: 6px 12px; gap: 10px; }
.pv-bar .big-btn { min-height: 52px; font-size: 17px; }
.pv-approver input { min-height: 44px; }
@media (max-width: 900px) { .pv-title { min-width: 0; flex-basis: 100%; order: 5; flex-direction: row; gap: 10px; font-size: 12px; } .pv-title strong { font-size: 14px; } }
.thumb.data-only img { opacity: .75; }
.sheet-badge { display: inline-block; margin-left: 4px; border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 800; border: 1px solid; cursor: pointer; min-height: 26px; }
.sheet-badge.on { background: #e3f4e8; color: #1d6b35; border-color: #2e7d46; }
.sheet-badge.off { background: #fff1d6; color: #7a4a00; border-color: #c98a00; }
.cap-onsheet { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; padding: 10px; border: 2px solid var(--border); border-radius: 10px; font-size: 16px; cursor: pointer; }
.cap-onsheet input { width: 28px; height: 28px; flex: 0 0 auto; }
.cap-onsheet small { display: block; font-size: 12px; color: var(--muted); }
.an-btn.an-running { background: #6b4fa0; border-color: #6b4fa0; opacity: 1; cursor: progress; }
.an-btn.an-done { background: #1f7a3a; border-color: #1f7a3a; }
.an-btn.an-stale { background: #c26a00; border-color: #c26a00; }
.spin { display: inline-block; width: 20px; height: 20px; margin-right: 10px; vertical-align: -3px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.scan-btn { position: relative; }
.scan-btn[data-state]::after { content: attr(data-state); position: absolute; right: 8px; top: 6px; font-size: 12px; font-weight: 800; padding: 1px 8px; border-radius: 999px; background: #6b4fa0; color: #fff; }
.scan-btn.scan-running { background: #efe7ff; border-color: #6b4fa0; cursor: progress; }
.scan-btn.scan-done { background: #e3f4e8; border-color: #2e7d46; }
.scan-btn.scan-done::after { background: #1f7a3a; }

/* v9.10 Analyze All states: clearly different colors; dialog button shows progress; pulse when done */
.an-btn { background: #1f4e8c; }
.an-btn.an-running { background: repeating-linear-gradient(45deg, #7b2fbf 0 14px, #8e45d1 14px 28px); background-size: 40px 40px; animation: stripes 1s linear infinite; border-color: #4b1d78; opacity: 1 !important; cursor: progress; }
.an-btn.an-running:disabled { opacity: 1 !important; }
.an-btn.an-done { background: #1f7a3a; border-color: #135a28; }
.an-btn.an-stale { background: #d35f00; border-color: #8f3f00; }
@keyframes stripes { to { background-position: 40px 0; } }
.an-btn.an-pulse { animation: apulse .9s ease-in-out 4; }
@keyframes apulse { 50% { transform: scale(1.03); box-shadow: 0 0 0 8px rgba(31,122,58,.35); } }
#btnAnGo.go-running { background: repeating-linear-gradient(45deg, #b05a00 0 14px, #d06f00 14px 28px); background-size: 40px 40px; animation: stripes 1s linear infinite; border-color: #6e3a00; color: #fff; cursor: progress; opacity: 1; pointer-events: none; }
#btnAnGo.go-running:disabled { opacity: 1; }
.ops-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; padding: 6px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.ops-row input { min-height: 44px; font-size: 15px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; }
.ops-n { font-weight: 800; width: 24px; text-align: center; }
.ops-desc { flex: 2 1 200px; } .ops-tool { flex: 0 0 80px; } .ops-notes { flex: 2 1 200px; }
.ops-src { font-size: 11px; color: var(--muted); } .ops-src.unconf { color: #a14b00; font-weight: 700; }
.ops-ok.on { background: #e3f4e8; border-color: #2e7d46; }
.ops-ed .btn { min-height: 44px; }
.ops-hdr { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 11px; margin-bottom: 6px; }
.ops-tbl .op-src { font-size: 9px; } .ops-tbl tr.op-unconf td { background: #fff4e0; } .ops-tbl a { color: #0b3a75; font-weight: 700; }
.req-ops { margin: 4px 0; }

/* v9.11 programs / part view / duplicate */
.prog-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; padding: 6px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.prog-row input { min-height: 44px; font-size: 15px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; }
.prog-num { flex: 0 0 110px; font-weight: 700; } .prog-desc { flex: 2 1 180px; } .prog-tools { flex: 1 1 140px; } .prog-offset { flex: 0 0 80px; } .prog-zero { flex: 1 1 120px; } .prog-notes { flex: 2 1 160px; }
.ops-prog { min-height: 44px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; max-width: 120px; }
.prog-tbl, .ops-tbl { width: 100%; } .prog-tbl th, .prog-tbl td { font-size: 11px; padding: 3px 5px; border: 1px solid #999; text-align: left; vertical-align: top; }
.part-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; } .part-bar .btn { min-height: 44px; }
.part-head { background: #fff; border: 2px solid var(--border); border-radius: 14px; padding: 12px 18px; margin-bottom: 8px; box-shadow: var(--shadow); }
.pt-job { font-size: 22px; font-weight: 800; color: var(--navy); } .pt-pn { font-size: 16px; } .pt-sub { font-size: 13px; color: var(--muted); }
.pt-status { display: inline-block; margin-left: 8px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #fff4e0; color: #8a4b00; border: 1px solid #e6b36a; }
.pt-status.iss { background: #e3f4e8; color: #1b6a35; border-color: #7fbf92; } .pt-status.run { background: #e8eef8; color: #14407A; border-color: #9db6dc; }
.pt-missing { font-size: 13px; color: #a14b00; margin-top: 4px; } .pt-missing.ok { color: #1b6a35; } .pt-miss { color: #b42318; }
.dp-chk { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; } .dp-chk input { width: 22px; height: 22px; }
.dp-note { font-size: 13px; color: var(--muted); margin: 8px 0; } .dp-note.bad { color: #b42318; font-weight: 700; }
.thumb .pl-badge { font-size: 10px; background: #e8eef8; color: #14407A; border-radius: 6px; padding: 1px 5px; }

/* v9.13 export block panel: matched text, thumbnail, re-check, supervisor override */
.export-block .xb-row { display: flex; gap: 12px; align-items: flex-start; margin-top: 8px; }
.export-block .xb-thumb { width: 120px; max-height: 120px; object-fit: cover; border: 2px solid #b00020; border-radius: 8px; flex: none; }
.export-block .xb-hint { font-weight: 500; }
.export-block .xb-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; align-items: center; }
.export-block .xb-ovr { margin-top: 10px; padding: 10px; background: #fff; border: 2px solid #b00020; border-radius: 10px; display: grid; gap: 8px; }
.export-block .xb-ovr label { display: grid; gap: 3px; font-weight: 700; font-size: 14px; }
.export-block .xb-ovr input[type=text] { font-size: 16px; padding: 8px; border: 1px solid #999; border-radius: 6px; }
.export-block .xb-chk { display: flex !important; grid-template-columns: none; gap: 8px; align-items: flex-start; }
.export-block .xb-err { color: #b00020; }
.export-block.xb-done { border-color: #1b7f3b; background: #e8f5ec; color: #14532d; }
.export-block.xb-done .xb-title { color: #14532d; }
#lockPanel { flex-basis: 100%; margin: 4px 0 0; }

/* v9.14 */
.thumb .res { font-size: 11px; color: #475569; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ===== v9.15 template-driven sheet (REV C) — landscape Letter ===== */
.sheet.tc { max-width: 11in; min-height: 8.5in; padding: 0.22in 0.25in; font-size: 10px; font-family: Arial, Helvetica, sans-serif; }
.sheet.tc .tbanner { display: flex; justify-content: space-between; background: #111; color: #fff; padding: 5px 8px; font-size: 11px; }
.sheet.tc .tsub { display: flex; justify-content: space-between; font-size: 8px; color: #444; margin: 2px 0 4px; }
.sheet.tc .trows { border: 2px solid #111; margin-bottom: 6px; }
.sheet.tc .trow { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid #111; }
.sheet.tc .trow:last-child { border-bottom: 0; }
.sheet.tc .tcell { border-right: 1px solid #111; padding: 2px 6px 3px; min-height: 28px; overflow-wrap: anywhere; }
.sheet.tc .trow .tcell:last-child, .sheet.tc .tboxes .tcell:last-child { border-right: 0; }
.sheet.tc .tcell i { display: block; font-style: normal; font-size: 7px; color: #444; letter-spacing: .04em; }
.sheet.tc .tcell .v { font-size: 11px; font-weight: 700; }
.sheet.tc .tcell .v.big { font-size: 14px; }
.sheet.tc .v.unk { color: #c00; font-style: italic; font-weight: 700; }
.sheet.tc .tcell small { font-size: 8px; color: #444; }
.sheet.tc .tgrid { display: grid; gap: 8px; align-items: start; margin-bottom: 8px; }
.sheet.tc .tcol { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sheet.tc .tsec { border: 2px solid #111; }
.sheet.tc .tbar { background: #555; color: #fff; font-weight: 700; letter-spacing: .08em; padding: 3px 8px; font-size: 10px; }
.sheet.tc .tbody { padding: 0; }
.sheet.tc .tchecks { display: grid; border-bottom: 1px solid #111; }
.sheet.tc .tchk { padding: 5px 8px; border-right: 1px solid #ccc; border-bottom: 1px solid #ccc; font-size: 11px; }
.sheet.tc .box { display: inline-block; width: 11px; height: 11px; border: 1.5px solid #111; vertical-align: -2px; text-align: center; line-height: 10px; font-size: 10px; font-weight: 900; margin-right: 3px; }
.sheet.tc .box.on { background: #111; color: #fff; }
.sheet.tc .tboxes { display: grid; border-bottom: 1px solid #111; }
.sheet.tc .tboxes .tcell { text-align: center; }
.sheet.tc .tsteps { padding: 4px 8px; border-bottom: 1px solid #111; font-size: 10px; }
.sheet.tc .tsteps i { font-style: normal; font-size: 7px; color: #444; display: block; }
.sheet.tc .tsteps ol { margin: 2px 0 0 16px; padding: 0; }
.sheet.tc .tphoto { background: #f3f3f3; }
.sheet.tc .tphoto .pbox { padding: 8px; text-align: center; }
.sheet.tc .pimg { position: relative; display: inline-block; max-width: 100%; }
.sheet.tc .pimg img { display: block; max-width: 100%; max-height: 3.2in; }
.sheet.tc .co { position: absolute; transform: translate(-50%, -50%); width: 20px; height: 20px; border-radius: 50%; background: #111; color: #fff; font-weight: 800; font-size: 11px; line-height: 20px; text-align: center; border: 2px solid #fff; }
.sheet.tc .colabels { padding: 2px 8px; font-size: 10px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.sheet.tc .pcap { background: #fff; border-top: 1px solid #111; text-align: center; font-weight: 700; font-size: 8px; padding: 2px; letter-spacing: .02em; }
.sheet.tc .tphoto .photo-desc { padding: 2px 8px; }
.sheet.tc .tsketch { display: flex; gap: 8px; align-items: center; padding: 4px 8px; border-top: 1px solid #111; }
.sheet.tc .datum { width: 55%; height: auto; }
.sheet.tc .tlegend { font-size: 9px; }
.sheet.tc .ttbl { width: 100%; border-collapse: collapse; font-size: 10px; }
.sheet.tc .ttbl th { background: #ddd; font-size: 8px; letter-spacing: .04em; text-align: left; border: 1px solid #111; padding: 3px 5px; }
.sheet.tc .ttbl td { border: 1px solid #111; padding: 4px 5px; vertical-align: top; overflow-wrap: anywhere; }
.sheet.tc .tnote { padding: 4px 8px; }
.sheet.tc .tops { list-style: none; margin: 0; padding: 0; }
.sheet.tc .tops li { display: flex; gap: 6px; align-items: baseline; padding: 6px 8px; border-bottom: 1px solid #111; font-size: 11px; }
.sheet.tc .tops li:last-child { border-bottom: 0; }
.sheet.tc .tops .n { display: inline-block; flex: none; width: 17px; height: 17px; border-radius: 50%; background: #111; color: #fff; text-align: center; font-weight: 800; font-size: 10px; line-height: 17px; }
.sheet.tc .tops em { font-style: normal; color: #333; }
.sheet.tc .tops small { color: #555; }
.sheet.tc .tops li.op-unconf { background: #fff4e0; }
.sheet.tc .tcheck { list-style: none; margin: 0; padding: 4px 8px; font-size: 11px; }
.sheet.tc .tcheck li { padding: 3px 0; }
.sheet.tc .truled { padding: 2px 8px 6px; }
.sheet.tc .rl { border-bottom: 1px solid #777; min-height: 20px; font-size: 10px; line-height: 20px; white-space: pre-wrap; }
.sheet.tc .tsign { display: grid; grid-template-columns: 1fr 1fr; }
.sheet.tc .tsign .tcell { min-height: 48px; }
.sheet.tc .sline { border-bottom: 1px solid #111; margin-top: 12px; }
.sheet.tc .sheet-foot { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid #111; margin-top: 8px; padding-top: 3px; font-size: 8px; }
.sheet.tc .tsec .kv { padding: 2px 8px; }
/* settings: template picker */
.tpl-row { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.tpl-row select { min-height: 48px; font-size: 16px; flex: 1; }
/* editor: big tablet checkboxes + callout tool */
.sx-ed { border: 1px solid var(--border, #ccc); border-radius: 10px; padding: 10px; margin-bottom: 12px; }
.sx-checks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 10px; }
.sx-chk { display: flex; align-items: center; gap: 10px; min-height: 56px; border: 2px solid #888; border-radius: 10px; padding: 0 12px; font-size: 18px; font-weight: 600; cursor: pointer; background: #fff; }
.sx-chk input { width: 30px; height: 30px; }
.sx-chk.on { border-color: #14407A; background: #e8f0fb; }
.sx-box3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sx-box3 input, .sx-trow input { min-height: 52px; font-size: 18px; }
.sx-trow { display: grid; grid-template-columns: 70px 1.4fr 1fr 1fr 1fr; gap: 6px; align-items: center; margin-bottom: 6px; }
.sx-trow b { font-size: 16px; }
.sx-photo { position: relative; display: inline-block; max-width: 100%; touch-action: manipulation; cursor: crosshair; }
.sx-photo img { display: block; max-width: 100%; max-height: 420px; }
.sx-photo .co { position: absolute; transform: translate(-50%, -50%); width: 30px; height: 30px; border-radius: 50%; background: #111; color: #fff; font-weight: 800; font-size: 16px; line-height: 30px; text-align: center; border: 2px solid #fff; }
.sx-colab { display: grid; grid-template-columns: 44px 1fr 56px; gap: 6px; margin-top: 6px; align-items: center; }
.sx-colab input { min-height: 48px; font-size: 16px; }
.sheet.tc .ttbl .v.unk { font-size: 8px; }

/* ===== v9.16 sheet-shaped confirmation checklist (.ck) — mirrors the REV C sheet pages/sections ===== */
.ck { margin-top: 8px; }
.ck-sum { position: sticky; top: 76px; z-index: 3; background: #1f2937; color: #fff; padding: 8px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 8px; }
.ck-sum small { opacity: .8; margin-left: 6px; }
.ck-page { border: 2px solid #222; background: #fff; padding: 8px; margin-bottom: 14px; border-radius: 4px; }
.ck-pghead { font-size: 12px; font-weight: 800; letter-spacing: .04em; color: #333; border-bottom: 2px solid #222; padding-bottom: 4px; margin-bottom: 6px; }
.ck-grid { display: grid; gap: 8px; margin-bottom: 8px; align-items: start; }
.ck-col { display: grid; gap: 8px; min-width: 0; }
.ck-sec { border: 1.5px solid #222; border-radius: 3px; overflow: hidden; background: #fff; }
.ck-bar { background: #222; color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .05em; padding: 3px 8px; }
.ck-body { padding: 6px; display: grid; gap: 6px; }
.ck-rows { border: 2px solid #222; display: grid; margin-bottom: 8px; }
.ck-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0; }
.ck-rows .ck-row { grid-template-columns: repeat(7, 1fr); border-top: 1px solid #222; }
.ck-rows .ck-row:first-child { border-top: 0; }
.ck-rows .ck-row:nth-child(2) { grid-template-columns: repeat(7, 1fr); }
.ck-rows .ck-row:nth-child(3) { grid-template-columns: repeat(7, 1fr); }
.ck-cell { padding: 4px 6px; border: 1px solid #bbb; min-width: 0; display: grid; gap: 2px; align-content: start; background: #fff; }
.ck-sec .ck-row { gap: 6px; }
.ck-sec .ck-cell { border-radius: 4px; }
.ck-cell > i { font-size: 10px; font-style: normal; font-weight: 800; color: #444; text-transform: uppercase; }
.ck-in { width: 100%; box-sizing: border-box; border: 1px solid #aaa; border-radius: 5px; padding: 8px; font-size: 16px; font-weight: 700; min-height: 40px; background: #fff; font-family: inherit; }
.ck-big .ck-in { font-size: 18px; }
.ck-ro { font-size: 16px; font-weight: 700; padding: 6px 2px; min-height: 28px; display: block; }
.ck-dash { color: #888; font-weight: 400; }
.ck-src { font-size: 11px; color: #4b5563; }
.ck-ok > .ck-in { border-color: #2e7d46; }
.ck-miss { background: #ffe1e1; }
.ck-cell.ck-miss { border: 2px solid #c62828; }
.ck-miss > .ck-in, td.ck-miss .ck-in { border: 2px solid #c62828; background: #fff5f5; }
.ck-miss > .ck-in::placeholder, td.ck-miss .ck-in::placeholder { color: #b00020; font-weight: 800; }
.ck-ai { background: #fff3c4; }
.ck-cell.ck-ai { border: 2px solid #e0b100; }
.ck-empty { padding: 8px; font-weight: 800; border-radius: 4px; color: #b00020; }
.ck-empty.ck-ai { color: #7a5a00; }
.ck-empty.ck-none { color: #666; font-weight: 400; background: transparent; }
.ck-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px; border-radius: 4px; }
.ck-opt { display: flex; align-items: center; gap: 6px; min-height: 40px; border: 1px solid #aaa; border-radius: 6px; padding: 4px 8px; font-weight: 700; background: #fff; }
.ck-opt.on { background: #e3f4e8; border-color: #2e7d46; }
.ck-opt input { width: 22px; height: 22px; }
.ck-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ck-table th { background: #e5e7eb; font-size: 10px; text-align: left; padding: 3px 4px; border: 1px solid #999; }
.ck-table td { border: 1px solid #999; padding: 2px; vertical-align: middle; word-break: break-word; font-size: 14px; }
.ck-table td.ck-miss { background: #ffe1e1; }
.ck-table td .ck-in { padding: 4px 5px; min-height: 34px; font-size: 14px; }
.ck-op { display: grid; grid-template-columns: 24px 1.6fr .6fr auto auto 40px; gap: 6px; align-items: center; padding: 3px; border-radius: 4px; }
.ck-op.ck-infer { background: #fff3c4; outline: 2px solid #e0b100; }
.ck-badge { font-size: 11px; font-weight: 800; color: #7a5a00; }
.ck-ok { min-height: 40px; border-radius: 8px; border: 1px solid #2e7d46; background: #fff; color: #1d6b35; font-weight: 800; padding: 0 10px; cursor: pointer; }
.ck-ok.on { background: #2e7d46; color: #fff; }
.ck-x { min-height: 36px; min-width: 36px; border-radius: 8px; border: 1px solid #bbb; background: #fff; cursor: pointer; }
.ck-list { margin: 0; padding-left: 18px; font-size: 14px; }
.ck-add { display: flex; gap: 6px; }
.ck-add .ck-in { flex: 1; }
.ck-sugg { display: grid; gap: 6px; margin-top: 4px; }
.ck .an-row { grid-template-columns: 1fr; grid-template-areas: "src" "main" "btns"; gap: 4px; padding: 6px; }
.ck .an-row .an-src { grid-area: src; }
.ck .an-row .an-main { grid-area: main; min-width: 0; }
.ck .an-row .an-btns { grid-area: btns; grid-template-columns: 1fr 1fr; align-items: center; }
.ck .an-row .an-btns .an-done { text-align: left; }
.ck .an-row .an-th { width: 34px; height: 34px; }
.ck .an-row .an-val { font-size: 15px; padding: 7px; }
.ck .an-lab { font-size: 12px; }
.ck .an-btns button { min-height: 44px; }
.ck-photos { display: flex; flex-wrap: wrap; gap: 6px; }
.ck-ph { display: flex; align-items: center; gap: 6px; font-size: 12px; border: 1px solid #bbb; border-radius: 6px; padding: 3px 6px; }
.ck-ph img { width: 34px; height: 34px; object-fit: cover; border-radius: 4px; }
.ck-ph.off { background: #eef0f3; color: #555; }

/* v9.17 issued-PDF buttons */
.pdf-acts { margin: 12px 0; flex-basis: 100%; }
.pdf-row { display: flex; flex-wrap: wrap; gap: 10px; }
.pdf-btn { min-height: 64px; font-size: 18px; flex: 1 1 150px; padding: 0 16px; }
.pdf-note { font-size: 13px; opacity: .75; margin-top: 4px; }
.dcard .dc-main .pdf-acts { margin-bottom: 0; }
/* v9.19 machine-type toggle + isometric figure */
.ck-mtype { display: flex; align-items: center; gap: 10px; padding: 6px 4px; flex-wrap: wrap; }
.ck-seg { display: inline-flex; border: 2px solid #333; border-radius: 8px; overflow: hidden; }
.ck-segb { min-height: 44px; min-width: 80px; border: 0; background: #fff; font-weight: 800; font-size: 15px; cursor: pointer; }
.ck-segb + .ck-segb { border-left: 2px solid #333; }
.ck-segb.on { background: #1769d1; color: #fff; }
.ck-fig { flex: 1 1 100%; max-width: 360px; }
.ck-fig svg { width: 100%; height: auto; border: 1px solid #ccc; background: #fff; }
.sheet.tc .datum.iso { width: 62%; height: auto; }
/* v9.20 */
.sheet.tc .ttbl tr.op-unconf td { background: #fff4e0; }
.feat-row, .ck-feat { display: flex; gap: 6px; align-items: center; margin: 4px 0; flex-wrap: wrap; }
.feat-row input, .ck-feat input { flex: 1 1 140px; min-height: 44px; }
.ck-table tr.ck-infer td { background: #fff4e0; }
.sx-tok { min-height: 40px; }

/* v9.21 unified tool list editor (Preview) + checklist tool table inputs */
.tool-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; padding: 6px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.tool-row.unconf { border-color: #d98f00; background: #fff8e6; }
.tool-row input { flex: 1 1 130px; min-height: 44px; font-size: 15px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; }
.tool-row input.tl-t { flex: 0 0 76px; font-weight: 700; }
.tool-row input.tl-d { flex: 2 1 220px; }
.tool-row .tl-ed, .ck-table .ck-tact small { color: #8a5a00; font-size: 11px; margin: 0 4px; }
.ck-table tr.ck-edited td:first-child { box-shadow: inset 3px 0 0 #8a5a00; }
.ck-table .ck-tact { white-space: nowrap; }

/* v9.22 generated setup image: original | AI image, three buttons */
.gen-sheet { width: min(980px, 100%); max-height: 92vh; }
.gen-cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gen-cmp figure { margin: 0; text-align: center; }
.gen-cmp img { width: 100%; max-height: 40vh; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.gen-cmp figcaption { font-size: 13px; font-weight: 600; margin-top: 4px; }
.gen-wait { display: flex; align-items: center; justify-content: center; min-height: 200px; border: 2px dashed var(--border); border-radius: 8px; color: var(--muted); font-size: 14px; }
.gen-err { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; border-radius: 8px; padding: 8px 10px; margin-top: 8px; font-size: 14px; }
.gen-by { display: block; margin-top: 10px; font-size: 13px; }
.gen-by input { display: block; width: 100%; min-height: 44px; margin-top: 2px; }
.gen-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.gen-btns .btn { min-height: 56px; }
.gen-pending { border: 2px solid #f0c36d; background: #fff7e6; border-radius: 10px; padding: 10px; margin-bottom: 12px; }
.gen-card + .gen-card { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.cap-btn.gen-btn.on { background: #dcfce7; border-color: #16a34a; }
/* v9.26 candidate strip */
.gen-strip { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.gen-cmp .gen-th, .gen-th { width: 64px; height: 84px; max-height: none; object-fit: cover; border: 3px solid var(--border); border-radius: 8px; cursor: pointer; background: #fff; }
.gen-th.sel { border-color: #16a34a; box-shadow: 0 0 0 2px #bbf7d0; }
.gen-nav { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 8px; font-size: 26px; cursor: pointer; user-select: none; background: #fff; }
.gen-nav[aria-disabled="true"] { opacity: .35; pointer-events: none; }
.gen-count { font-size: 14px; font-weight: 700; margin-left: 4px; }
@media (max-width: 600px) { .gen-cmp img { max-height: 30vh; } }

/* ===== v9.23 FAI page (REV C-DRAFT v4) ===== */
.sheet.tc .fai-strip { display: grid; grid-template-columns: 2fr 1fr 1fr; border: 1px solid #111; border-top: 0; margin-bottom: 4px; }
.sheet.tc .fai-strip .tcell { border-right: 1px solid #111; padding: 3px 6px; min-height: 36px; } .sheet.tc .fai-strip .tcell:last-child { border-right: 0; }
.sheet.tc .fai-strip .tcell i { display: block; font-size: 7px; font-style: normal; letter-spacing: .05em; }
.sheet.tc .fai-strip .sline { margin-top: 2px; }
.sheet.tc .fai-tbl td { height: 30px; } .sheet.tc .fai-tbl td.fai-no { font-size: 9px; vertical-align: top; }
.sheet.tc .fai-tbl td.fai-actual { font-weight: 700; }
.ck-actual { max-width: 160px; } .ck-fai-head { margin-bottom: 6px; }
.ck-list li .ck-actual { margin-left: 8px; min-height: 36px; }
.feat-fai { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 6px; } .feat-fai input { flex: 1 1 140px; min-height: 44px; }
.ck-segs { min-width: 52px; }
.ck-axl { font-size: 13px; font-weight: 700; }
.ck-orgl { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
.ck-orgl input { min-height: 40px; width: 12em; font-size: 15px; font-weight: 700; padding: 0 8px; border: 2px solid #333; border-radius: 6px; }

/* v9.27: compact always-available review-copy buttons in the preview bar */
.pv-review { display: flex; gap: 6px; flex: 0 0 auto; }
.pv-rbtn { min-height: 44px; padding: 0 10px; font-size: 15px; font-weight: 700; border-radius: 8px; border: 2px solid #fff; background: transparent; color: #fff; cursor: pointer; white-space: nowrap; }
.pv-rbtn:disabled { opacity: 0.5; }
@media (max-width: 900px) { .pv-rbtn { font-size: 13px; padding: 0 6px; min-height: 40px; } .pv-review { gap: 4px; } .pv-bar .big-btn { padding: 0 12px; font-size: 16px; } .pv-approver input { width: 110px; } .pv-approver { font-size: 10.5px; } .pv-bar { gap: 8px; } .pv-bar .big-btn { padding: 0 10px; } }

/* ===== v9.28 REV C sheet TEXT SIZE SCALE (see SIZE_SCALE in js/sheet-template.js) =====
   --fs-l label 7px · --fs-h table header 8px · --fs-v body value 10px · --fs-k key/box value 11px · --fs-b big header value 14px.
   Every cell of one type uses the same class; UNKNOWN keeps the size of its cell. --fs-v / --fs-b may be auto-shrunk per page
   (js/pdf.js fitSheet) only when the page overflows, never below --fs-v-min 8px / --fs-b-min 11px. */
.sheet.tc { --fs-l: 7px; --fs-h: 8px; --fs-v: 10px; --fs-k: 11px; --fs-b: 14px; }
.sheet.tc .tcell i, .sheet.tc .tsteps i, .sheet.tc .fai-strip .tcell i { font-size: var(--fs-l); }
.sheet.tc .ttbl th { font-size: var(--fs-h); }
.sheet.tc .tcell small, .sheet.tc .pcap, .sheet.tc .tsub, .sheet.tc .sheet-foot, .sheet.tc .ai-use-line { font-size: var(--fs-h); }
.sheet.tc .tsteps, .sheet.tc .tsteps li, .sheet.tc .ttbl, .sheet.tc .ttbl td, .sheet.tc .ttbl td b, .sheet.tc .ttbl .v, .sheet.tc .ttbl .v.unk,
.sheet.tc .tops li, .sheet.tc .tchk, .sheet.tc .tcheck, .sheet.tc .rl, .sheet.tc .tnote, .sheet.tc .tnote .v, .sheet.tc .colabels,
.sheet.tc .photo-desc, .sheet.tc .tlegend, .sheet.tc .tsec .kv, .sheet.tc .fai-tbl td.fai-no, .sheet.tc .notes-block { font-size: var(--fs-v); }
.sheet.tc .tnote small { font-size: var(--fs-h); }
.sheet.tc .tcell .v, .sheet.tc .tsign .tcell .v, .sheet.tc .fai-strip .tcell .v { font-size: var(--fs-k); }
.sheet.tc .tcell .v.big, .sheet.tc .fai-strip .tcell .v.big { font-size: var(--fs-b); }
.sheet.tc .rl { line-height: 2; }
.sheet.tc .tsketch .datum { flex: 0 0 55%; } .sheet.tc .tlegend { min-width: 0; flex: 1 1 0; }
/* v9.29 rotate buttons on photo thumbnails */
.thumb .rot-btns { display: flex; border-top: 1px solid var(--border); }
.thumb .rot-btn { flex: 1; min-height: 48px; border: 0; background: #f1f5f9; color: var(--navy); font-size: 17px; font-weight: 700; }
.thumb .rot-btn + .rot-btn { border-left: 1px solid var(--border); }
.thumb .rot-btn:active { background: #dbe4ee; }
/* v9.29 self-check panel */
.mp-panel { border-left: 6px solid #f59e0b; }
.mp-row .an-note { font-style: italic; }
.mp-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.mp-row .an-main { min-width: 0; }
.mp-row .an-btns { display: flex; flex-direction: row; gap: 6px; }
.mp-row .an-btns button { min-width: 96px; min-height: 48px; }

/* ===== v9.30 Legacy paper capture (LEGACY-PACK STYLE2 v1) ===== */
.lg-view { position: fixed; inset: 0; z-index: 900; background: #f3f5f8; overflow: auto; }
body.lg-open-body { overflow: hidden; }
.lg-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; background: #123a73; color: #fff; flex-wrap: wrap; }
.lg-only { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 6px; background: #ffd34d; color: #111; font-size: 12px; font-weight: 700; }
.lg-body-ui { padding: 12px; display: grid; gap: 12px; }
.lg-body-ui .card { padding: 12px; }
.lg-body-ui h3 { margin: 0 0 8px; font-size: 17px; }
.lg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.lg-f { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.lg-f.wide { grid-column: span 2; }
.lg-f input { min-height: 40px; font-size: 16px; padding: 4px 8px; border: 1px solid #99a; border-radius: 6px; }
.lg-pend input, tr.lg-pend input, .lg-prog.lg-pend { background: #fff6d6; border-color: #e0a800; }
.lg-okbtn { background: #e0a800; color: #111; font-weight: 700; }
.lg-ok { color: #1a7f37; font-weight: 700; font-size: 12px; }
.lg-prob { color: #b35c00; font-weight: 700; }
.lg-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.lg-row textarea { flex: 1; min-width: 260px; font-size: 13px; }
.lg-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.lg-thumb { border: 1px solid #ccd; border-radius: 8px; padding: 6px; background: #fff; }
.lg-thumb img { width: 100%; height: 150px; object-fit: contain; background: #eee; }
.lg-ta { display: flex; gap: 4px; }
.lg-tl { font-size: 12px; }
.lg-prog, .lg-cam { border: 1px solid #ccd; border-radius: 8px; padding: 8px; margin: 8px 0; background: #fff; }
.lg-num { font-size: 18px; font-weight: 700; min-height: 40px; width: 260px; }
.lg-ed { border-collapse: collapse; width: 100%; font-size: 12px; }
.lg-ed td, .lg-ed th { border: 1px solid #ccd; padding: 2px; }
.lg-ed input { width: 100%; min-width: 50px; font-size: 13px; }
.lg-status { margin-top: 6px; font-weight: 700; color: #123a73; }
.lg-iss { margin: 4px 0; }
.lg-sheets { display: grid; gap: 14px; justify-items: center; }
.lg-sheets .sheet { width: 11in; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.2); }
/* printed pages */
.sheet.tc.lgp { height: 8.5in; display: flex; flex-direction: column; overflow: hidden; color: #111; box-sizing: border-box; }
.lgp .unk { color: #c00000; font-weight: 700; }
.lgp .lg-unc { color: #b35c00; font-weight: 700; }
.lgp .lg-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.lgp .lg-title small { font-size: 11px; font-weight: 400; margin-left: 10px; }
.lgp .lg-statement { border: 2px solid #111; padding: 10px 14px; font-size: 14px; font-weight: 700; margin-bottom: 10px; background: #f6f6f6; }
.lgp .lg-cover { display: grid; grid-template-columns: 0.8fr 1.6fr; gap: 12px; flex: 1; min-height: 0; align-items: start; }
.lgp .lg-t { border-collapse: collapse; width: 100%; font-size: 10.5px; border: 2px solid #111; }
.lgp .lg-t th, .lgp .lg-t td { border: 1px solid #555; padding: 3px 5px; text-align: left; vertical-align: top; }
.lgp .lg-t th { background: #e9edf2; }
.lgp .lg-h { font-weight: 700; font-size: 12px; margin: 2px 0 3px; }
.lgp .lg-sub { font-size: 10px; margin-bottom: 4px; }
.lgp .lg-band { display: grid; grid-template-columns: repeat(11, 1fr); border: 2px solid #111; }
.lgp .lg-c { border-right: 1px solid #555; padding: 2px 4px; min-width: 0; overflow-wrap: anywhere; }
.lgp .lg-c:last-child { border-right: 0; }
.lgp .lg-c i { display: block; font-style: normal; font-size: 7.5px; font-weight: 700; text-transform: uppercase; color: #333; }
.lgp .lg-c b { font-size: 10px; }
.lgp .lg-ptitle { font-size: 15px; font-weight: 700; margin: 5px 0; }
.lgp .lg-body { display: grid; grid-template-columns: 1fr 1.15fr; gap: 10px; flex: 1; min-height: 0; }
.lgp .lg-photo { display: grid; gap: 4px; min-height: 0; border: 1px solid #999; }
.lgp .lg-photo.n2 { grid-template-rows: 1fr 1fr; } .lgp .lg-photo.n3 { grid-template-rows: 1fr 1fr 1fr; }
.lgp .lg-photo img { width: 100%; height: 100%; max-height: 100%; object-fit: contain; min-height: 0; display: block; }
.lgp .lg-nophoto { display: flex; align-items: center; justify-content: center; font-size: 14px; }
.lgp .lg-right { min-width: 0; overflow: hidden; }
.lgp .lg-ops { font-size: 9.5px; }
.lgp .lg-ops tr.lg-unc-row td { background: #fff3cd; }
.lgp .lg-notes { border: 2px solid #111; margin-top: 8px; padding: 6px 8px; font-size: 11px; display: grid; gap: 4px; }
.lgp .lg-ul { border: 2px solid #111; padding: 10px 10px 10px 34px; font-size: 12px; margin: 0; flex: 1; columns: 2; column-gap: 26px; }
.lgp .lg-ul li { margin-bottom: 3px; break-inside: avoid; }
.lgp .lg-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 8.5px; color: #333; border-top: 1px solid #777; margin-top: 6px; padding-top: 3px; }

/* v9.31 tap-to-edit on the preview (screen only — .pv-edit-on is removed in every PDF clone) */
.pv-edit-on [data-ref] { cursor: pointer; border-radius: 3px; }
.pv-edit-on [data-ref]:hover, .pv-edit-on [data-ref]:focus-within { background: #fff7d6; box-shadow: inset 0 0 0 2px #f59e0b; }
.pv-edit-on [data-ref] .v.unk { outline: 2px dashed #dc2626; outline-offset: 1px; padding: 0 3px; }
.pv-edit-on [data-ref] .v.unk::after { content: ' ✎'; color: #b91c1c; }
.pv-edit-on .tsheet, .pv-edit-on .sheet { -webkit-tap-highlight-color: rgba(245, 158, 11, .25); }
.pve-pop { position: fixed; z-index: 2000; background: #fff; border: 2px solid #1e3a8a; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.35); padding: 10px 12px; font-size: 16px; }
.pve-pop .pve-t { font-weight: 800; margin-bottom: 6px; color: #1e3a8a; }
.pve-pop input, .pve-pop textarea { width: 100%; box-sizing: border-box; font-size: 18px; padding: 8px; border: 1.5px solid #64748b; border-radius: 6px; }
.pve-pop .pve-h { font-size: 12.5px; color: #475569; margin: 6px 0; }
.pve-pop .pve-b { display: flex; gap: 8px; justify-content: flex-end; }
.pve-fix { background: none; border: 0; padding: 2px 0; font: inherit; color: inherit; text-align: left; text-decoration: underline dotted; cursor: pointer; }
.pve-fix .pve-pen { font-size: .85em; color: #1d4ed8; text-decoration: none; margin-left: 4px; }
.pv-datacheck.info { color: #334155; background: #f1f5f9; font-weight: 500; }

/* v9.32 hybrid edit screen: former modal fields as collapsible sections, styled like the capture screen */
.hybrid-edit { margin: 12px 10px 90px; display: flex; flex-direction: column; gap: 10px; }
.hx-intro { font-size: 13px; color: var(--muted, #5b6573); padding: 0 4px; }
.hx-sec { background: #fff; border: 2px solid #123a73; border-radius: 14px; overflow: hidden; }
.hx-sec > summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 2px; padding: 14px 48px 14px 16px; min-height: 60px;
  background: linear-gradient(#17407d, #123a73); color: #fff; position: relative; }
.hx-sec > summary::-webkit-details-marker { display: none; }
.hx-sec > summary::after { content: '▸'; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 22px; transition: transform .15s; }
.hx-sec[open] > summary::after { transform: translateY(-50%) rotate(90deg); }
.hx-t { font-size: 19px; font-weight: 800; }
.hx-s { font-size: 12.5px; opacity: .85; }
.hx-body { padding: 14px 14px 16px; }
.hx-body.edit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 12px; }
.hx-body .field input { min-height: 48px; font-size: 17px; }
.hx-go { display: flex; justify-content: flex-end; }
.hx-go .big-btn { min-height: 64px; font-size: 20px; padding: 0 28px; }
.hx-sec.hx-flash > summary { box-shadow: inset 0 0 0 4px #f6b73c; }
