/* ==========================================================================
   print.css — report builder controls (dark, matches app) +
   the printable report itself (always rendered light/paper-styled,
   whether you're looking at the on-screen preview or the printed page).
   ========================================================================== */

/* ---------- report builder (screen only) ---------- */
.report-builder {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.rb-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}

.rb-toolbar-actions {
  display: flex;
  gap: 6px;
}

.rb-section {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-soft);
  transition: all .15s ease;
}

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

.rb-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  padding: 4px 0 10px;
}

.rb-section-head:hover .rb-title {
  color: var(--text);
}

.rb-title {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 0;
  transition: color .12s ease;
}

.rb-toggle-icon {
  font-size: 10px;
  color: var(--muted);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: transform .2s ease, color .15s ease, background .15s ease;
}

.rb-section-head:hover .rb-toggle-icon {
  color: var(--amber);
  border-color: var(--amber-dim);
}

.rb-section.collapsed .rb-section-body {
  display: none;
}

.rb-section.collapsed .rb-toggle-icon {
  transform: rotate(-90deg);
}

.rb-select-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.rb-select-actions .btn {
  flex: 1 1 auto;
  text-align: center;
  justify-content: center;
}

.rb-checklist {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-raised);
  -webkit-overflow-scrolling: touch;
}

.rb-check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12.5px;
  font-family: var(--mono);
  cursor: pointer;
  transition: background .12s ease;
}

.rb-check-row:hover {
  background: var(--panel);
}

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

.rb-check-row input[type=checkbox] {
  width: auto;
  flex-shrink: 0;
  margin-top: 3px;
}

.rb-check-row .rc-main {
  flex: 1;
  min-width: 0;
}

.rb-check-row .rc-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.rb-check-row .rc-name {
  color: var(--amber);
  font-weight: 600;
  font-size: 13.5px;
}

.rb-check-row .rc-lab-tag {
  font-size: 10.5px;
  color: var(--cyan);
  background: rgba(14, 165, 233, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(14, 165, 233, 0.25);
}

.rb-check-row .rc-detail {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
  word-break: break-word;
}

.rb-check-row .rc-status {
  font-size: 9.5px;
  padding: 1px 6px;
  border-radius: 8px;
  text-transform: uppercase;
  margin-left: auto;
}

.rb-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 8px;
  font-family: var(--body);
  line-height: 1.4;
}

.rb-check input {
  width: auto;
  margin-top: 3px;
  flex-shrink: 0;
}

.layout-chip.active {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #04201e;
}

/* ---------- QR Codes Sheet & Themes ---------- */
.qr-sheet {
  display: grid;
  grid-template-columns: repeat(var(--qr-per-row, 4), 1fr);
  gap: 16px;
  padding: 8px 0;
}

.qr-sheet-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 14px 10px 10px;
  break-inside: avoid;
  page-break-inside: avoid;
  position: relative;
  transition: all .15s ease;
}

.qr-sheet-code {
  margin-bottom: 8px;
  border: 1.5px solid #1a1a1a;
  border-radius: 4px;
  padding: 4px;
  background: #fff;
}

.qr-sheet-code svg {
  display: block;
}

.qr-sheet-name {
  font-family: var(--display, 'Inter', sans-serif);
  font-size: 12px;
  font-weight: 700;
  color: #15181c;
  margin-bottom: 3px;
  word-break: break-word;
}

.qr-sheet-meta {
  font-size: 10px;
  color: #6b7280;
  margin-bottom: 2px;
}

.qr-sheet-inv {
  font-family: monospace;
  font-size: 10px;
  color: #92610e;
  margin-top: 2px;
  font-weight: 600;
}

/* QR Sheet Format Themes */
.qr-sheet.qr-theme-bordered .qr-sheet-item {
  background: #ffffff;
  border: 2px solid #0f172a;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.qr-sheet.qr-theme-minimal .qr-sheet-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
}
.qr-sheet.qr-theme-minimal .qr-sheet-code {
  border: none;
  padding: 0;
}

.qr-sheet.qr-theme-stripe .qr-sheet-item {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-top: 4px solid #0d9488;
  border-radius: 6px;
}

.qr-sheet.qr-theme-cutout .qr-sheet-item {
  background: #ffffff;
  border: 1.5px dashed #94a3b8;
  border-radius: 0;
}
.qr-sheet.qr-theme-cutout .qr-sheet-item::before {
  content: '✂';
  position: absolute;
  top: -8px;
  left: 6px;
  font-size: 10px;
  color: #94a3b8;
}



/* ---------- the report itself (paper look, shown as preview + used for print) ---------- */
#reportArea {
  background: #ffffff;
  color: #15181c;
  border-radius: 10px;
  padding: 36px 40px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.45);
  margin-bottom: 40px;
  width: 100%;
  box-sizing: border-box;
}

#reportArea .report-header {
  text-align: left;
  border-bottom: 2.5px solid #15181c;
  padding-bottom: 14px;
  margin-bottom: 22px;
  transition: text-align .15s ease;
}

#reportArea .report-header.text-center {
  text-align: center;
}

#reportArea .rh-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #8a6a2e;
  margin-bottom: 6px;
}

#reportArea .report-header h1 {
  font-family: var(--display);
  font-size: 22px;
  color: #15181c;
  margin: 0 0 4px;
}

#reportArea .rh-subtitle {
  font-size: 13px;
  color: #495057;
}

#reportArea .rh-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: #8a94a0;
  margin-top: 8px;
}

/* Table Wrapper for horizontal safety on screen */
.report-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-bottom: 12px;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  margin-bottom: 6px;
  table-layout: auto;
}

.print-table th,
.print-table td {
  border: 1px solid #cdd3d8;
  padding: 5px 6px;
  text-align: left;
  font-family: var(--mono);
  word-break: break-word;
}

.print-table th {
  background: #eef0f2;
  font-family: var(--mono);
  text-transform: uppercase;
  font-size: 8.5px;
  letter-spacing: .04em;
  color: #374151;
  white-space: nowrap;
}

.print-table tr:nth-child(even) td {
  background: #fafbfc;
}

/* ==========================================================================
   TABLE VISUAL THEMES
   ========================================================================== */

/* Classic Grid Theme */
.print-table.tb-theme-grid {
  border-collapse: collapse;
}
.print-table.tb-theme-grid th,
.print-table.tb-theme-grid td {
  border: 1px solid #cbd5e1;
}
.print-table.tb-theme-grid th {
  background: #f1f5f9;
  color: #0f172a;
  border-bottom: 2px solid #0f172a;
  font-weight: 700;
}

/* Minimal Clean Theme */
.print-table.tb-theme-minimal th,
.print-table.tb-theme-minimal td {
  border: none;
  border-bottom: 1px solid #e2e8f0;
}
.print-table.tb-theme-minimal th {
  background: #ffffff;
  border-bottom: 2px solid #0d9488;
  color: #0d9488;
  font-weight: 700;
}
.print-table.tb-theme-minimal tr:nth-child(even) td {
  background: transparent;
}

/* Striped Zebra Theme */
.print-table.tb-theme-striped th {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  font-weight: 700;
}
.print-table.tb-theme-striped td {
  border: 1px solid #e2e8f0;
}
.print-table.tb-theme-striped tr:nth-child(even) td {
  background: #f1f5f9;
}

/* Dense Spreadsheet Theme */
.print-table.tb-theme-compact {
  font-size: 9px;
}
.print-table.tb-theme-compact th,
.print-table.tb-theme-compact td {
  border: 0.5px solid #94a3b8;
  padding: 3px 5px !important;
}
.print-table.tb-theme-compact th {
  background: #e2e8f0;
  color: #1e293b;
  font-weight: 700;
}

.preset-chip {
  background: rgba(79, 209, 197, 0.08);
  border: 1px dashed var(--cyan);
  color: var(--cyan);
  font-size: 11.5px;
  cursor: pointer;
  transition: all .15s ease;
}
.preset-chip:hover {
  background: rgba(79, 209, 197, 0.2);
}
.preset-chip.active {
  background: var(--cyan);
  color: #04201e;
  border-style: solid;
}

.print-table td.flags-cell {
  color: #a4322f;
  font-size: 9.5px;
}

.print-table td.nowrap {
  white-space: nowrap;
}

.print-table td.center {
  text-align: center;
}

.print-table td.mono-compact {
  font-size: 9px;
  word-break: break-all;
}

.print-status {
  font-size: 8.5px;
  padding: 1px 5px;
  border-radius: 6px;
  text-transform: uppercase;
  font-family: var(--mono);
  white-space: nowrap;
}

.print-status.active {
  background: #e2f6ea;
  color: #1f7a44;
}

.print-status.handed {
  background: #fbe6e5;
  color: #a4322f;
}

/* ==========================================================================
   ASSET TAG LABELS & THEMES
   ========================================================================== */
.label-grid {
  display: grid;
  grid-template-columns: repeat(var(--label-cols, 2), 1fr);
  gap: 14px;
}

.asset-label {
  border: 1.6px solid #15181c;
  border-radius: 4px;
  padding: 12px 14px;
  background: #ffffff;
  break-inside: avoid;
  page-break-inside: avoid;
  position: relative;
}

/* Label Format Themes */
.label-grid.label-theme-chassis .asset-label {
  border: 2px solid #0f172a;
  border-radius: 2px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #e2e8f0;
}
.label-grid.label-theme-chassis .al-head-row {
  border-bottom: 2px solid #0f172a;
}

.label-grid.label-theme-modern .asset-label {
  border: 1.5px solid #0d9488;
  border-radius: 8px;
  background: #fafafa;
}
.label-grid.label-theme-modern .al-head-row {
  border-bottom: 1.5px solid #0d9488;
}
.label-grid.label-theme-modern .al-title {
  color: #0f172a;
}

.label-grid.label-theme-compact .asset-label {
  border: 1px solid #64748b;
  border-radius: 0;
  padding: 6px 8px;
}

.label-grid.label-theme-rounded .asset-label {
  border: 1.5px solid #334155;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.asset-label .al-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .02em;
}

.asset-label .al-head-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1.4px solid #15181c;
  padding-bottom: 6px;
  margin-bottom: 6px;
}

.asset-label .al-head-row .al-title {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.asset-label .al-lab-badge {
  font-family: var(--mono);
  font-size: 9.5px;
  color: #0d9488;
  font-weight: 700;
  letter-spacing: .03em;
}

.al-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px dotted #b6bcc2;
  padding: 3px 0;
  font-family: var(--mono);
  font-size: 10.5px;
}

.al-row:last-of-type {
  border-bottom: none;
}

.al-row .al-label {
  color: #5b636e;
}

.al-row .al-value {
  color: #15181c;
  font-weight: 600;
  text-align: right;
}

.al-checks {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 10px;
}

.al-checks .al-check-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.al-software {
  margin-top: 8px;
  border: 1px solid #15181c;
  border-radius: 2px;
  padding: 6px 8px;
}

.al-software .als-title {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid #15181c;
  padding-bottom: 3px;
  margin-bottom: 4px;
}

.al-software ul {
  margin: 0;
  padding-left: 14px;
  font-size: 10px;
}

.al-software li {
  margin-bottom: 1px;
}

/* ==========================================================================
   DETAILED SPEC SHEETS & DOSSIER THEMES
   ========================================================================== */
.spec-sheet-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.spec-sheet-container.grid-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.spec-sheet {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 22px 26px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.spec-sheet.break-after {
  break-after: page;
  page-break-after: always;
  margin-bottom: 0;
}

/* Spec Sheet Themes */
.spec-sheet.sheet-theme-dossier {
  border: 2px solid #0f172a;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}
.spec-sheet.sheet-theme-dossier .ss-head {
  border-bottom: 2px solid #0f172a;
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.spec-sheet.sheet-theme-duo {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 14px 16px;
}
.spec-sheet.sheet-theme-duo .ss-head {
  border-bottom: 1px solid #0d9488;
  padding-bottom: 8px;
  margin-bottom: 10px;
}
.spec-sheet.sheet-theme-duo .ss-name {
  font-size: 16px;
}

.spec-sheet.sheet-theme-executive {
  border: 1px solid #e2e8f0;
  border-left: 5px solid #0d9488;
  border-radius: 6px;
  background: #fdfdfd;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.spec-sheet.sheet-theme-executive .ss-head {
  border-bottom: 1px solid #e2e8f0;
}

.spec-sheet:last-child {
  margin-bottom: 0;
}

.spec-sheet .ss-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1.5px solid #15181c;
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.spec-sheet .ss-name {
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
}

.spec-sheet .ss-spec {
  font-size: 12px;
  color: #495057;
  margin-top: 2px;
}

.spec-sheet .ss-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 22px;
}

.spec-sheet .ss-item {
  border-bottom: 1px dotted #cdd3d8;
  padding-bottom: 6px;
}

.spec-sheet .ss-item.full {
  grid-column: 1 / -1;
}

.spec-sheet .ss-label {
  font-family: var(--mono);
  font-size: 9.5px;
  color: #8a94a0;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.spec-sheet .ss-value {
  font-size: 12.5px;
  font-family: var(--mono);
  color: #15181c;
  margin-top: 2px;
}

.spec-sheet .ss-flags {
  margin-top: 12px;
  background: #fbe6e5;
  border: 1px solid #e5b0ae;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 11px;
  color: #a4322f;
}

.signoff {
  margin-top: 36px;
  padding-top: 16px;
  border-top: 1px solid #cdd3d8;
}

.signoff-line {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #15181c;
  margin-bottom: 26px;
  font-family: var(--mono);
}

.report-pagebreak {
  break-before: page;
  page-break-before: always;
  height: 0;
}

.hidden {
  display: none !important;
}

/* QR Codes in asset tags and spec sheets */
.al-qr {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 3px;
  border: 1px solid #15181c;
  border-radius: 3px;
  margin-left: 8px;
}

.al-qr svg {
  display: block;
  width: 68px;
  height: 68px;
}

.ss-qr {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 3px;
  border: 1px solid #cdd3d8;
  border-radius: 4px;
}

.ss-qr svg {
  display: block;
  width: 64px;
  height: 64px;
}

/* ---------- screen responsive rules ---------- */
@media screen and (max-width: 768px) {
  .report-builder {
    padding: 16px 14px;
  }

  .rb-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .rb-toolbar-actions {
    width: 100%;
  }

  .rb-toolbar-actions .btn {
    flex: 1;
    text-align: center;
    justify-content: center;
  }

  #reportArea {
    padding: 20px 14px;
    box-shadow: none;
    border: 1px solid var(--border);
  }

  .spec-sheet {
    padding: 16px 14px;
  }

  .spec-sheet .ss-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .label-grid {
    grid-template-columns: 1fr;
  }

  .actions-row {
    flex-direction: column;
    width: 100%;
  }

  .actions-row .btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
}

/* ---------- print media ---------- */
@media print {
  body {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .no-print,
  header,
  footer,
  .nav-links,
  .search-wrap,
  .view-toggle {
    display: none !important;
  }

  #screenWrap {
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }

  #reportArea {
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }

  .spec-sheet {
    break-inside: avoid;
    page-break-inside: avoid;
    border: none;
    padding: 0;
    margin-bottom: 28px;
  }

  .spec-sheet:not(:last-child) {
    break-after: page;
    page-break-after: always;
  }

  .qr-sheet {
    display: grid !important;
    grid-template-columns: repeat(var(--qr-per-row, 4), 1fr) !important;
    gap: 12px !important;
    width: 100% !important;
  }

  .qr-sheet-item {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
    border: 1px solid #111 !important;
    background: #fff !important;
    padding: 8px 6px !important;
  }

  .qr-sheet-code {
    border-color: #000 !important;
  }

  .print-table {
    width: 100% !important;
    font-size: 9px !important;
  }

  .print-table th,
  .print-table td {
    padding: 3px 4px !important;
  }

  @page {
    size: A4 landscape;
    margin: 8mm;
  }
}