/* Hangar — Aeromechanix MYF */
:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-hover: #22263a;
  --border: #2d3348;
  --text: #e0e2ea;
  --text-muted: #7c8198;
  --text-dim: #555a70;

  /* Colorblind-safe: blue / amber / gray */
  --active-bg: #1a2744;
  --active-border: #2563eb;
  --active-text: #60a5fa;
  --active-header: #1e3a6e;

  --sched-bg: #1f1d15;
  --sched-border: #92700a;
  --sched-text: #fbbf24;
  --sched-header: #433a10;

  --done-bg: #161618;
  --done-border: #3a3a42;
  --done-text: #8b8b96;
  --done-header: #26262e;

  --inv-inspection: #2563eb;
  --inv-labor: #f87171;
  --inv-part: #e0e2ea;
  --inv-service: #f59e0b;

  --comp-engine: #f87171;
  --comp-airframe: #60a5fa;
  --comp-propeller: #fbbf24;

  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
  height: 100vh;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 48px;
}
header h1 { font-size: 18px; font-weight: 700; white-space: nowrap; }
.header-left { display: flex; align-items: center; gap: 16px; }
.header-center { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.header-right { display: flex; align-items: center; }

/* Filter buttons */
.filter-group { display: flex; gap: 4px; }
.filter-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.filter-btn:hover { border-color: var(--text-muted); color: var(--text-muted); }
.filter-btn.active { background: var(--surface-hover); color: var(--text); border-color: var(--text-muted); }
.filter-sched.active { color: var(--sched-text); border-color: var(--sched-border); }
.filter-active.active { color: var(--active-text); border-color: var(--active-border); }
.filter-done.active { color: var(--done-text); border-color: var(--done-border); }

/* Page nav dots */
.page-nav { display: flex; align-items: center; gap: 8px; }
.page-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: all 0.2s;
}
.page-dot.active { background: var(--active-text); width: 10px; height: 10px; }
.page-arrow {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
}
.page-arrow:hover { color: var(--text); }
.page-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; }

/* Search */
.search-box {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 10px;
  gap: 6px;
}
.search-icon { font-size: 14px; color: var(--text-dim); }
.search-box input {
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  padding: 6px 0;
  width: 180px;
  outline: none;
}
.search-box input::placeholder { color: var(--text-dim); }
.search-box:focus-within { border-color: var(--active-border); }

/* ═══ Sliding Pages ═══ */
.slider-viewport {
  width: 100vw;
  height: calc(100vh - 48px);
  overflow: hidden;
  position: relative;
}
.page-track {
  display: flex;
  width: 300vw;
  height: 100%;
  transition: transform 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
  will-change: transform;
}
.page {
  width: 100vw;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex-shrink: 0;
}
.page-half {
  overflow-y: auto;
  overflow-x: auto;
}
.page-half:first-child { border-right: 2px solid var(--border); }
.page-full { grid-template-columns: 1fr !important; }
.page-full .page-half { border-right: none !important; }

.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  font-size: 24px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  user-select: none;
}
.cs-sub { font-size: 13px; font-weight: 400; margin-top: 8px; letter-spacing: 0; text-transform: none; }

/* ═══ Schedule Panel ═══ */
.schedule-panel {
  padding: 12px;
}

/* Section Blocks — clear visual separation */
.section-block {
  margin-bottom: 20px;
  border-radius: var(--radius);
  overflow: hidden;
}
.section-block:last-child { margin-bottom: 0; }

.section-header-bar {
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.section-count { font-weight: 500; opacity: 0.6; }

/* Section colors + borders */
.sec-scheduled { border: 2px solid var(--sched-border); }
.sec-scheduled .section-header-bar { background: var(--sched-header); color: var(--sched-text); border-bottom: 2px solid var(--sched-border); }

.sec-active { border: 2px solid var(--active-border); }
.sec-active .section-header-bar { background: var(--active-header); color: var(--active-text); border-bottom: 2px solid var(--active-border); }

.sec-done { border: 2px solid var(--done-border); }
.sec-done .section-header-bar { background: var(--done-header); color: var(--done-text); border-bottom: 2px solid var(--done-border); }

/* Schedule table */
.schedule-table {
  width: 100%;
  border-collapse: collapse;
}
.schedule-table thead th {
  padding: 6px 8px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.sec-scheduled .schedule-table thead th { background: rgba(146, 112, 10, 0.08); }
.sec-active .schedule-table thead th { background: rgba(37, 99, 235, 0.08); }
.sec-done .schedule-table thead th { background: rgba(58, 58, 66, 0.08); }

/* Column sizing */
.th-btn { width: 32px; }
.col-btn { width: 32px; text-align: center; }
.col-wo { width: 80px; }
.col-tail { width: 80px; }
.col-cust { max-width: 170px; }
.col-desc { }
.col-tech { width: 55px; }
.col-date { width: 72px; }
.col-num { width: 60px; text-align: right; }

/* Job rows — bigger text */
.job-row td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(45, 51, 72, 0.3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 15px;
  line-height: 1.5;
}
.job-row .col-desc {
  white-space: normal;
  word-break: break-word;
}
.job-row .col-wo {
  font-weight: 700;
  font-size: 15px;
}
.job-row .col-tail {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 13px;
}
.job-row .col-cust {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Clickable cells */
.clickable {
  cursor: pointer;
  transition: color 0.1s;
}
.clickable:hover {
  text-decoration: underline;
}

/* Row colors */
.row-scheduled { background: var(--sched-bg); }
.row-scheduled td { color: var(--text); }
.row-scheduled .col-wo { color: var(--sched-text); }
.row-scheduled .col-tail { color: var(--sched-text); opacity: 0.75; }
.row-scheduled:hover { background: #2a2510; }

.row-active { background: var(--active-bg); }
.row-active td { color: var(--text); }
.row-active .col-wo { color: var(--active-text); }
.row-active .col-tail { color: var(--active-text); opacity: 0.75; }
.row-active:hover { background: #1e3050; }

.row-done { background: var(--done-bg); }
.row-done td { color: var(--done-text); }
.row-done .col-wo { color: var(--done-text); }
.row-done:hover { background: #1e1e24; }

/* Open RO icon button */
.btn-open {
  background: none;
  border: 1px solid var(--sched-border);
  border-radius: 4px;
  color: var(--sched-text);
  font-size: 16px;
  cursor: pointer;
  padding: 3px 6px;
  line-height: 1;
  transition: all 0.15s;
}
.btn-open:hover { background: var(--sched-text); color: #000; }

/* Date cells — icon-only until a date is set */
.date-cell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
}
.date-display {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s;
}
.date-display:hover { color: var(--active-text); text-decoration: underline; }
.date-dim { color: var(--text-dim); font-size: 13px; }
.date-dim:hover { color: var(--text-muted); text-decoration: none; }
.date-input-hidden {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
}
.work-date { position: relative; }

/* ═══ Right Panel ═══ */
.right-panel {
  background: var(--surface);
  padding: 20px;
}

.panel-header { margin-bottom: 16px; }
.panel-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.panel-wo {
  font-size: 24px;
  font-weight: 800;
  color: var(--active-text);
}
.panel-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}
.panel-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.panel-status.staging { background: var(--sched-header); color: var(--sched-text); }
.panel-status.in_progress { background: var(--active-header); color: var(--active-text); }
.panel-status.done { background: var(--done-header); color: var(--done-text); }
.panel-status.ready_to_invoice { background: var(--active-header); color: var(--active-text); }

.panel-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
  margin-bottom: 16px;
}
.panel-meta > div { display: flex; flex-direction: column; }
.panel-meta label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.panel-meta span { font-size: 14px; color: var(--text); }

.panel-aircraft {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
}
.ac-badge { font-weight: 700; font-size: 15px; }
.ac-year { color: var(--text-muted); }
.ac-serial { color: var(--text-muted); font-family: monospace; font-size: 13px; }

.panel-empty {
  color: var(--text-dim);
  text-align: center;
  padding: 40px 20px;
  font-size: 14px;
}

.panel-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
}

/* Config sections in aircraft/customer panels */
.config-section {
  margin-bottom: 16px;
}
.config-section h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.config-item {
  font-size: 14px;
  padding: 4px 0;
}
.config-item.dim { color: var(--text-dim); }

.tail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tail-badge {
  background: var(--bg);
  border: 1px solid var(--active-border);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 700;
  font-family: monospace;
  color: var(--active-text);
  cursor: pointer;
  transition: background 0.15s;
}
.tail-badge:hover { background: var(--active-bg); }

.history-table {
  width: 100%;
  border-collapse: collapse;
}
.history-table th {
  text-align: left;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.history-table td {
  padding: 6px 8px;
  font-size: 13px;
  border-bottom: 1px solid rgba(45, 51, 72, 0.3);
}
.history-table .col-wo { font-weight: 600; color: var(--active-text); }

/* ═══ Invoice Table (right panel) ═══ */
.inv-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}
.inv-table thead th {
  text-align: left;
  padding: 5px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border-bottom: 2px solid var(--border);
}
.inv-table thead th:nth-child(n+3) { text-align: right; }

.inv-line td {
  padding: 7px 9px;
  font-size: 14px;
  border-bottom: 1px solid rgba(45, 51, 72, 0.4);
}
.inv-desc { max-width: 220px; }
.inv-pn { font-family: monospace; font-size: 11px; color: var(--text-muted); }
.inv-qty, .inv-rate, .inv-price { text-align: right; font-variant-numeric: tabular-nums; }
.inv-tax { text-align: center; font-size: 11px; color: var(--text-dim); }

.inv-inspection .inv-desc { color: var(--inv-inspection); font-weight: 600; }
.inv-labor .inv-desc { color: var(--inv-labor); }
.inv-part .inv-desc { color: var(--inv-part); }
.inv-service .inv-desc { color: var(--inv-service); font-style: italic; }

.inv-totals {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  padding: 10px 0;
  border-top: 2px solid var(--border);
}
.inv-totals > div { display: flex; gap: 20px; font-size: 14px; }
.inv-totals label { color: var(--text-muted); min-width: 80px; text-align: right; }
.inv-totals span { font-variant-numeric: tabular-nums; min-width: 80px; text-align: right; }
.inv-grand { font-size: 18px; font-weight: 800; }
.inv-grand span { color: var(--active-text); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface-hover);
  color: var(--text);
  text-decoration: none;
  transition: all 0.15s;
}
.btn:hover { background: var(--border); }
.btn-primary { background: var(--active-border); border-color: var(--active-border); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }

/* ═══ Page 2: Invoice + Label Builder ═══ */
.inv-builder-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.inv-meta-strip {
  display: flex;
  gap: 16px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.inv-meta-strip b { color: var(--text); }
.drag-list-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 6px;
}
.drag-list-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--active-text);
}
.btn-propose {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-propose:hover { background: var(--active-border); color: #fff; border-color: var(--active-border); }
.inv-drag-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
}
.drag-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: grab;
  transition: all 0.15s;
  user-select: none;
}
.drag-line:hover { background: var(--surface-hover); border-color: var(--active-border); }
.drag-line:active { cursor: grabbing; }
.drag-handle { color: var(--text-dim); font-size: 18px; flex-shrink: 0; }
.drag-desc { flex: 1; font-size: 14px; font-weight: 600; }
.drag-pn { font-family: monospace; font-size: 11px; color: var(--text-dim); flex-shrink: 0; margin-left: 4px; }
.drag-ext { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.drag-expand { font-size: 11px; color: #d97706; flex-shrink: 0; margin-left: 6px; opacity: 0.9; }
.drag-line[data-log-body] { border-left: 2px solid #f59e0b; }
.drag-line.inv-inspection .drag-desc { color: var(--inv-inspection); }
.drag-line.inv-labor .drag-desc { color: var(--inv-labor); }
.drag-line.inv-part .drag-desc { color: var(--inv-part); }
.drag-line.inv-service .drag-desc { color: var(--inv-service); }
.drag-ghost { opacity: 0.4; }
.sortable-chosen { box-shadow: 0 4px 20px rgba(37,99,235,0.25); transform: scale(1.02); }

/* Label builder panel */
.label-builder-panel {
  padding: 12px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 40px;
}
/* Label formatting toolbar */
.label-toolbar {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: 8px;
  width: min(780px, 95vw);
}
.tb-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: Georgia, serif;
}
.tb-btn:hover { background: var(--surface-hover); border-color: var(--text-muted); }
.tb-btn:active { background: var(--active-border); color: #fff; }
.tb-hl {
  background: rgba(247,233,92,0.2);
  color: #d4a017;
  font-weight: 800;
  font-family: -apple-system, sans-serif;
}
.tb-hl:hover { background: rgba(247,233,92,0.4); }
.tb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }

.label-wrap { width: min(780px, 95vw); }
.label-spacer { height: 20px; }
.label-card { position: relative; }
.print-toggle {
  position: absolute;
  top: -4px;
  right: 0;
  cursor: pointer;
  z-index: 2;
}
.print-toggle input {
  width: 20px;
  height: 20px;
  accent-color: var(--active-text);
  cursor: pointer;
}
/* Collapsed unchecked labels — just show the banner */
.label-card.no-print .sheet { cursor: pointer; }
.label-card.no-print table.log tr:not(:first-child) { display: none; }
.label-card.no-print .watermark-overlay { display: none; }
.label-card.no-print .wm-toggle { display: none; }
.label-card.no-print .comp-title { opacity: 0.6; }

/* Watermark toggle — top left */
.wm-toggle {
  position: absolute;
  top: -4px;
  left: 0;
  cursor: pointer;
  z-index: 2;
}
.wm-toggle input {
  width: 20px;
  height: 20px;
  accent-color: var(--comp-airframe);
  cursor: pointer;
}

/* Watermark overlay */
.watermark-overlay {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1;
}
.label-card.has-watermark .watermark-overlay { display: block; }
.watermark-img {
  width: 420px;
  height: auto;
  filter: invert(1);
  opacity: 0.07;
  mix-blend-mode: multiply;
}
.sheet { position: relative; overflow: hidden; }
.hl-bold { background: rgba(247,233,92,0.56); padding: 0 2px; border-radius: 2px; font-style: italic; }

/* ═══ Codex Log Label ═══ */
.sheet {
  width: min(780px, 95vw);
  background: #fff;
  border: 1px solid #bfbfbf;
  padding: 8px;
  border-radius: 4px;
}
table.log {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  border: 1px solid #202020;
}
table.log td {
  border: 1px solid #202020;
  padding: 4px 8px;
  text-transform: uppercase;
  font-size: 14px;
  font-weight: 700;
  color: #111;
  vertical-align: top;
}
.comp-title {
  font-size: 18px !important;
  font-weight: 900;
  text-align: center;
  padding: 6px !important;
  background: #f0f0f0;
  letter-spacing: 0.15em;
}
.sheet[data-component="engine"] .comp-title { background: var(--comp-engine); color: #fff; }
.sheet[data-component="airframe"] .comp-title { background: var(--comp-airframe); color: #fff; }
.sheet[data-component="propeller"] .comp-title { background: var(--comp-propeller); color: #111; }
.sheet[data-component="engine"] { border-left: 4px solid var(--comp-engine); }
.sheet[data-component="airframe"] { border-left: 4px solid var(--comp-airframe); }
.sheet[data-component="propeller"] { border-left: 4px solid var(--comp-propeller); }
.shop-name {
  font-size: 15px !important;
  font-weight: 800;
  text-align: center;
  padding: 4px 6px !important;
}
.shop-addr {
  font-size: 11px !important;
  font-weight: 600;
  text-align: center;
  color: #444;
}
.work-date {
  font-size: 14px !important;
  text-align: center;
  padding: 6px !important;
  background: #fdfdf0;
}
.hl {
  background: rgba(247, 233, 92, 0.56);
  padding: 0 2px;
  border-radius: 2px;
}
.label-zone-cell {
  padding: 6px !important;
  position: relative;
}
.zone-services { min-height: 80px; }
.zone-parts { min-height: 80px; }
.zone-tag {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #aaa;
  margin-bottom: 2px;
}
.zone-services .narrative-line .narrative-text::before {
  content: "\2022\00a0";
}
.drop-placeholder {
  text-align: center;
  color: #aaa;
  font-size: 13px;
  font-weight: 600;
  padding: 32px 8px;
  border: 2px dashed #ccc;
  border-radius: 6px;
}
.label-narrative-list { min-height: 10px; }
.narrative-line {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding: 3px 2px;
  border-bottom: 1px solid #eee;
  cursor: default;
}
.narrative-text {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  color: #111;
  line-height: 1.4;
}
.narrative-remove {
  background: none;
  border: none;
  color: #c00;
  font-size: 15px;
  cursor: pointer;
  padding: 0 3px;
  font-weight: 700;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s;
}
.narrative-line:hover .narrative-remove { opacity: 0.7; }
.narrative-remove:hover { opacity: 1 !important; }
.sig-row { padding: 4px 6px !important; }
.sig-line {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-top: 1px solid #111;
  padding-top: 4px;
  margin-top: 4px;
}
.sig-name { font-size: 12px; font-weight: 700; color: #111; text-transform: uppercase; }
.mechanic-select {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #111;
  background: transparent;
  border: 1px dashed transparent;
  border-radius: 3px;
  padding: 1px 2px;
  cursor: pointer;
  font-family: inherit;
}
.mechanic-select:hover { border-color: #aaa; }
.label-date-edit {
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.15s;
}
.label-date-edit:hover { border-color: #888; }
.narrative-text[contenteditable] { outline: none; border-radius: 2px; }
.narrative-text[contenteditable]:focus { background: #fefce8; box-shadow: 0 0 0 2px rgba(247,233,92,0.4); }
.sig-img { height: 40px; width: auto; opacity: 0.85; }
.sig-date { font-size: 12px; color: #555; }
.label-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  width: min(780px, 95vw);
}
.btn-danger { border-color: #991b1b; color: #f87171; }
.btn-danger:hover { background: #991b1b; color: #fff; }
.save-indicator {
  font-size: 12px;
  font-weight: 600;
  color: #22c55e;
  opacity: 0;
  transition: opacity 0.3s;
  margin-right: 8px;
}
.save-indicator.visible { opacity: 1; }

/* 3rd Party button */
.btn-tp {
  background: var(--sched-header);
  border: 1px solid var(--sched-border);
  color: var(--sched-text);
  margin: 0 auto;
}
.btn-tp:hover { background: var(--sched-text); color: #000; }

/* 3rd Party QR popup */
.tp-qr-popup {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}
.tp-qr-content {
  background: var(--surface);
  border: 2px solid var(--sched-border);
  border-radius: 12px;
  padding: 28px 32px;
  text-align: center;
  position: relative;
  max-width: 340px;
}
.tp-qr-close {
  position: absolute; top: 6px; right: 10px;
  font-size: 24px; background: none; border: none;
  color: var(--text-dim); cursor: pointer;
}
.tp-qr-close:hover { color: var(--text); }
.tp-qr-title {
  font-size: 16px; font-weight: 800; color: var(--sched-text);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 6px;
}
.tp-qr-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.tp-qr-content svg { width: 200px; height: 200px; }
.tp-qr-url {
  font-size: 10px; color: var(--text-dim); font-family: monospace;
  margin-top: 10px; word-break: break-all; user-select: all;
}

/* 3rd Party label display section */
.tp-section {
  width: min(780px, 95vw);
  margin-top: 20px;
}
.tp-section-header {
  font-size: 14px; font-weight: 900; text-transform: uppercase;
  letter-spacing: 0.15em; color: var(--sched-text);
  border-bottom: 2px solid var(--sched-border);
  padding-bottom: 6px; margin-bottom: 10px;
}
.tp-label-cards {
  display: flex; flex-wrap: wrap; gap: 10px;
}
.tp-label-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden; width: 180px;
  position: relative;
}
.tp-label-delete {
  position: absolute; top: 4px; right: 4px;
  width: 24px; height: 24px;
  background: rgba(0,0,0,0.7); border: none; border-radius: 50%;
  color: #f87171; font-size: 16px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s;
}
.tp-label-card:hover .tp-label-delete { opacity: 1; }
.tp-label-delete:hover { background: #991b1b; color: #fff; }
.tp-label-img { width: 100%; height: 120px; object-fit: cover; cursor: pointer; }
.tp-label-info { padding: 8px; }
.tp-label-comp {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--sched-text);
}
.tp-label-serial { font-size: 12px; color: var(--text-muted); font-family: monospace; }
.tp-label-shop { font-size: 11px; color: var(--text-dim); }

/* ═══ Scan indicators on schedule ═══ */
.btn-scan-ready {
  background: #166534;
  border: 1px solid #22c55e;
  border-radius: 6px;
  color: #22c55e;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: all 0.15s;
  white-space: nowrap;
  animation: scan-pulse 2s ease-in-out infinite;
}
.btn-scan-ready:hover { background: #22c55e; color: #000; }
@keyframes scan-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  50% { box-shadow: 0 0 8px 2px rgba(34,197,94,0.3); }
}
.btn-scan-pending {
  background: none;
  border: 1px solid var(--active-border);
  border-radius: 6px;
  color: var(--active-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-scan-pending:hover { background: var(--active-border); color: #fff; }

/* scan_complete status badge */
.panel-status.scan_complete { background: #14532d; color: #22c55e; }
.row-active .btn-scan-ready { }

/* ═══ QR Code Section (job detail panel) ═══ */
.qr-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  text-align: center;
}
.qr-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.qr-code { display: inline-block; }
.qr-code svg { width: 160px; height: 160px; }
.qr-url {
  font-size: 11px;
  color: var(--text-dim);
  font-family: monospace;
  margin-top: 8px;
  word-break: break-all;
  user-select: all;
}

/* ═══ Scan Viewer (page 2 left panel) ═══ */
.scan-viewer {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.sv-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.sv-title { font-size: 16px; font-weight: 800; color: var(--text); }
.sv-count {
  font-size: 12px; font-weight: 600; color: var(--active-text);
  background: var(--active-bg); padding: 2px 8px; border-radius: 10px;
}
.sv-info { font-size: 13px; color: var(--text-muted); }
.sv-main {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: #000;
  cursor: zoom-in;
}
.sv-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
}
.sv-thumbs {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.sv-thumb {
  width: 64px; height: 64px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s;
}
.sv-thumb:hover { border-color: var(--text-muted); }
.sv-thumb.sv-active { border-color: var(--active-text); }
.sv-hint {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  padding: 4px;
}
.scan-viewer-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ═══ New Job Wizard ═══ */
.btn-new-job {
  background: var(--sched-header);
  border: 1px solid var(--sched-border);
  border-radius: 6px;
  color: var(--sched-text);
  font-size: 13px;
  font-weight: 800;
  padding: 5px 14px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.04em;
}
.btn-new-job:hover { background: var(--sched-text); color: #000; }

.wizard-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.wizard-paper {
  background: #fff;
  width: min(1100px, 96vw);
  max-height: 95vh;
  overflow-y: auto;
  border-radius: 8px;
  padding: 32px 40px;
  position: relative;
  color: #111;
  font-family: -apple-system, system-ui, sans-serif;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.wizard-close {
  position: absolute; top: 8px; right: 12px;
  font-size: 28px; background: none; border: none;
  color: #888; cursor: pointer; line-height: 1;
}
.wizard-close:hover { color: #111; }

/* Wizard — mirrors print RO */
.wz-page-hdr { text-align: center; font-size: 13px; font-weight: 900; letter-spacing: 0.12em;
  text-transform: uppercase; color: #111; padding: 0 0 8px 0; }
.wz-page-ftr { text-align: center; font-size: 8px; color: #999; margin-top: 8px; padding-top: 6px;
  border-top: 1px solid #ddd; }
.wz-top { display: flex; gap: 0; margin-bottom: 4px; width: 100%; }
.wz-qr { border: 2px solid #111; border-right: none; padding: 8px; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; width: 160px; background: #fafafa; }
.wz-qr-placeholder { width: 140px; height: 140px; border: 2px dashed #ccc; display: flex;
  align-items: center; justify-content: center; font-size: 16px; font-weight: 700; color: #ccc; }
.wz-qr img { width: 140px; height: 140px; display: block; image-rendering: pixelated; }
.wz-info-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 1fr; border: 2px solid #111; flex: 1; }
.wz-wp { width: 100%; border-collapse: collapse; margin-top: 4px; }
.wz-wp th { border: 2px solid #111; padding: 4px 8px; font-size: 9px; font-weight: 700;
  text-transform: uppercase; color: #555; background: #f5f5f5; }
.wz-wp td { border: 2px solid #111; padding: 10px 12px; }
.wz-custom-area { width: 100%; border: none; background: transparent; font-size: 13px;
  font-family: inherit; outline: none; resize: vertical; min-height: 60px; padding: 0; }

/* RO Grid (legacy fallback) */
.ro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 2px solid #111; margin-bottom: -2px; }
.ro-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.ro-grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.ro-grid-5 { grid-template-columns: 1fr 1fr 1fr 1fr 1fr; }
.ro-cell {
  border: 1px solid #111;
  padding: 6px 10px;
  position: relative;
}
.ro-cell label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #666;
  margin-bottom: 2px;
}
.ro-cell input, .ro-cell select {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 18px;
  font-weight: 700;
  color: #111;
  padding: 6px 0;
  outline: none;
  font-family: inherit;
}
.ro-cell input:focus, .ro-cell select:focus { background: #fefce8; }
.ro-cell input::placeholder { color: #bbb; font-weight: 400; font-size: 15px; }
.ro-cell-wide { grid-column: span 1; }
.ro-cell-s2 { grid-column: span 2; }
.ro-auto { display: block; font-size: 18px; font-weight: 700; color: #111; padding: 6px 0; }
.wz-twin-toggle { display: inline-flex !important; align-items: center; gap: 4px; font-size: 11px !important;
  color: #2563eb !important; cursor: pointer; margin-top: 2px; float: right; }
.wz-twin-toggle input { width: 14px; height: 14px; accent-color: #2563eb; cursor: pointer; }
.wz-twin-toggle span { font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.wz-twin-row .wz-info-grid { border: 2px solid #111; border-top: none; }
.wz-twin-row .ro-cell { background: #eff6ff; }

/* Autocomplete dropdown */
.ac-dropdown {
  display: none;
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: #fff;
  border: 2px solid #2563eb;
  border-top: none;
  border-radius: 0 0 6px 6px;
  z-index: 210;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.ac-dropdown.open { display: block; }
.ac-item {
  padding: 8px 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid #eee;
}
.ac-item:hover { background: #eff6ff; }
.ac-item .ac-tail { font-weight: 800; color: #2563eb; font-family: monospace; }
.ac-item .ac-meta { font-size: 11px; color: #888; font-weight: 400; }

/* Service checkboxes */
.ro-section { border: 2px solid #111; margin-bottom: -2px; padding: 10px 12px; }
.ro-section-title {
  display: block;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #666;
  margin-bottom: 8px;
}
.ro-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.ro-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 700;
  color: #111;
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
}
.ro-check input { width: 18px; height: 18px; accent-color: #2563eb; cursor: pointer; }
.ro-custom-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.ro-custom-input {
  flex: 1;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 13px;
  font-weight: 600;
  color: #111;
  outline: none;
}
.ro-custom-input:focus { border-color: #2563eb; background: #fefce8; }

/* Description preview */
.ro-desc-preview {
  font-size: 14px;
  font-weight: 700;
  color: #111;
  text-transform: uppercase;
  min-height: 24px;
  padding: 4px 0;
}

/* Status row */
.ro-status-row .ro-cell { display: flex; align-items: center; }
.ro-check-inline {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: #111; cursor: pointer;
}
.ro-check-inline input { width: 16px; height: 16px; accent-color: #2563eb; cursor: pointer; }

/* New customer toggle + expanded fields */
.ro-cell-label-row { display: flex; justify-content: space-between; align-items: center; }
.ro-new-cust-toggle {
  font-size: 11px; font-weight: 700; color: #2563eb; cursor: pointer;
  display: flex; align-items: center; gap: 4px;
}
.ro-new-cust-toggle input { width: 14px; height: 14px; accent-color: #2563eb; cursor: pointer; }
.ro-new-cust-fields { animation: fadeSlideDown 0.2s ease; }
@keyframes fadeSlideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* Wizard actions */
.wizard-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 2px solid #111;
}
.btn-wizard-draft {
  background: #f5f5f5;
  border: 1px solid #ccc;
  color: #555;
  border-radius: 6px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.btn-wizard-draft:hover { background: #e5e5e5; }
.btn-wizard-create {
  padding: 10px 28px;
  font-size: 14px;
}

/* Empty state placeholders (page 2 default) */
.empty-state-panel {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; text-align: center; color: var(--text-muted); padding: 60px 20px;
}

/* ═══ Invoice Panel v2 ═══ */
.inv-panel { padding: 20px; height: 100%; overflow-y: auto; }
.inv-hdr { display: flex; align-items: center; gap: 12px; }
.inv-hdr-wo { font-size: 28px; font-weight: 900; color: var(--active-text); }
.inv-hdr-badge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 12px; text-transform: uppercase;
  background: #14532d; color: #22c55e; }
.inv-hdr-badge.in_progress { background: #1a2744; color: #60a5fa; }
.inv-hdr-badge.scan_complete { background: #14532d; color: #22c55e; }
.inv-hdr-sub { font-size: 18px; font-weight: 600; margin-top: 4px; }
.inv-hdr-meta { font-size: 16px; color: var(--text-muted); margin-top: 4px; display: flex; gap: 16px; }
.inv-hdr-meta b { color: var(--text); }
.inv-hdr-desc { font-size: 14px; color: var(--text-dim); margin-top: 2px; margin-bottom: 12px; }

/* Template chips */
.inv-tmpl-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tmpl-chip {
  padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 700;
  cursor: pointer; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); transition: all 0.15s;
}
.tmpl-chip:hover { border-color: var(--active-text); color: var(--active-text); }

/* Add row forms */
.inv-add-row {
  display: flex; gap: 6px; align-items: center; padding: 8px 10px;
  border-radius: 8px; margin-bottom: 6px;
}
.inv-add-labor { background: rgba(96,165,250,0.08); border: 1px dashed rgba(96,165,250,0.3); }
.inv-add-part { background: rgba(251,191,36,0.06); border: 1px dashed rgba(251,191,36,0.25); }
.inv-add-type {
  font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-dim); width: 48px; flex-shrink: 0; text-align: center;
}
.inv-add-desc {
  flex: 1; min-width: 100px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px; color: var(--text); font-size: 15px; outline: none;
}
.inv-add-pn {
  width: 80px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px; color: var(--text); font-size: 14px; outline: none;
  font-family: monospace;
}
.inv-add-num {
  width: 70px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px 10px; color: var(--text); font-size: 15px; outline: none;
  text-align: center;
}
.inv-add-desc:focus, .inv-add-pn:focus, .inv-add-num:focus { border-color: var(--active-text); }
.inv-add-btn {
  width: 40px; height: 40px; border-radius: 8px; border: none;
  background: var(--active-text); color: #fff; font-size: 22px; font-weight: 900;
  cursor: pointer; flex-shrink: 0;
}

/* ═══ Invoice Line Rows (editable) ═══ */
.il-section-label {
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-dim); margin: 16px 0 6px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.il-row {
  padding: 8px 10px; border-radius: 8px; margin-bottom: 4px;
  border-left: 3px solid transparent;
}
.il-labor { background: rgba(96,165,250,0.05); border-left-color: #3b82f6; }
.il-part { background: rgba(251,191,36,0.04); border-left-color: #f59e0b; }
.il-top { display: flex; align-items: center; gap: 8px; }
.il-type {
  font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-dim); width: 44px; flex-shrink: 0;
}
.il-desc {
  flex: 1; background: transparent; border: 1px solid transparent; border-radius: 6px;
  padding: 4px 8px; color: var(--text); font-size: 16px; font-weight: 600; outline: none;
}
.il-desc:hover { border-color: var(--border); }
.il-desc:focus { border-color: var(--active-text); background: var(--surface); }
.il-del {
  background: none; border: none; color: var(--text-dim); font-size: 20px;
  cursor: pointer; padding: 4px 8px; border-radius: 4px;
}
.il-del:hover { color: #f87171; background: rgba(248,113,113,0.1); }
.il-bottom { display: flex; align-items: center; gap: 8px; margin-top: 4px; padding-left: 52px; }
.il-label { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.il-pn {
  width: 80px; background: transparent; border: 1px solid transparent; border-radius: 4px;
  padding: 3px 6px; color: var(--text-muted); font-size: 13px; font-family: monospace; outline: none;
}
.il-pn:hover { border-color: var(--border); }
.il-pn:focus { border-color: var(--active-text); background: var(--surface); }
.il-num {
  width: 64px; background: transparent; border: 1px solid transparent; border-radius: 4px;
  padding: 3px 6px; color: var(--text); font-size: 15px; font-weight: 700; text-align: center; outline: none;
}
.il-num:hover { border-color: var(--border); }
.il-num:focus { border-color: var(--active-text); background: var(--surface); }
.il-total { font-size: 16px; font-weight: 800; color: var(--text); min-width: 70px; text-align: right; }
.inv-empty { padding: 40px; text-align: center; color: var(--text-dim); font-size: 16px; }

/* Totals */
.inv-totals-big { margin-top: 16px; padding-top: 12px; border-top: 2px solid var(--border); }
.inv-total-row { display: flex; justify-content: space-between; padding: 4px 10px; font-size: 16px; }
.inv-total-row span:first-child { color: var(--text-muted); }
.inv-total-row span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; }
.inv-total-grand { font-size: 22px; font-weight: 900; margin-top: 4px; }
.inv-total-grand span:last-child { color: var(--active-text); }

/* Approve button */
.inv-approve-bar { text-align: center; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.inv-approve-btn {
  padding: 14px 36px; font-size: 18px; font-weight: 800;
  background: var(--active-text); color: #fff; border: none; border-radius: 10px;
  cursor: pointer; transition: background 0.15s;
}
.inv-approve-btn:hover { background: #4f8fea; }

/* Legacy chip-bar compat */
.chip-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.template-chip, .history-chip {
  padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700;
  cursor: pointer; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); transition: all 0.15s;
}
.template-chip:hover { border-color: var(--active-text); color: var(--active-text); }
.history-chip { border-color: var(--sched-border); color: var(--sched-text); }
.history-chip:hover { background: var(--sched-bg); }

/* Component badges */
.component-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 6px; border-radius: 4px;
}
.component-badge.airframe { background: rgba(96,165,250,0.2); color: var(--comp-airframe); }
.component-badge.engine { background: rgba(248,113,113,0.2); color: var(--comp-engine); }
.component-badge.propeller { background: rgba(251,191,36,0.2); color: var(--comp-propeller); }

/* Responsive */
@media (max-width: 900px) {
  .page { grid-template-columns: 1fr; }
  .page-half:first-child { border-right: none; border-bottom: 2px solid var(--border); }
  .filter-group { display: none; }
  .search-box input { width: 120px; }
}
