/* Report document — screen + print. Print IS the PDF path. */

.report-toolbar {
  position: sticky; top: 0; z-index: 20; background: var(--ink); color: #fff;
  padding: 12px 0;
}
.report-toolbar .wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.report-toolbar .logo { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; color: #fff; text-decoration: none; margin-right: auto; }
.report-toolbar .logo svg { width: 22px; height: 22px; }
.report-toolbar .btn-ghost { color: #fff; border-color: rgba(255,255,255,0.35); }
.report-toolbar .btn-ghost:hover { background: rgba(255,255,255,0.12); }

.sheet {
  background: #fff; max-width: 880px; margin: 36px auto 80px;
  border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow);
  padding: 56px 64px;
}

.doc-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid var(--ink); padding-bottom: 18px; margin-bottom: 22px; gap: 20px; }
.doc-head .brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.doc-head .brand svg { width: 26px; height: 26px; }
.doc-head .doc-type { text-align: right; }
.doc-head .doc-type h1 { font-size: 1.7rem; margin: 0; }
.doc-head .doc-type .doc-id { font-size: 0.75rem; color: var(--ink-soft); letter-spacing: 0.05em; }

.meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 36px; margin-bottom: 24px; }
.meta-grid .mrow { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding: 8px 0; font-size: 0.92rem; }
.meta-grid .mrow .k { color: var(--ink-soft); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; padding-top: 2px; }
.meta-grid .mrow .v { font-weight: 600; text-align: right; }

.report-ai-note { display: flex; gap: 10px; align-items: flex-start; background: var(--brand-soft); border: 1px solid #cfe3d9; border-radius: 8px; padding: 12px 14px; font-size: 0.85rem; color: var(--brand-dark); margin-bottom: 30px; }
.report-ai-note svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }

.room-section { margin-bottom: 36px; break-inside: auto; }
.room-section > h2 {
  font-size: 1.3rem; text-transform: capitalize; border-bottom: 2px solid var(--line);
  padding-bottom: 8px; margin-bottom: 14px; display: flex; align-items: baseline; gap: 10px;
}
.room-section > h2 .count { font: 500 0.8rem var(--font-ui); color: var(--ink-soft); }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.thumbs figure { margin: 0; break-inside: avoid; }
.thumbs img { width: 100%; height: 96px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); cursor: zoom-in; display: block; }
.thumbs figcaption { font-size: 0.68rem; color: var(--ink-soft); margin-top: 3px; }

table.cond { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin-bottom: 10px; }
table.cond th { text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); border-bottom: 2px solid var(--ink); padding: 6px 8px; }
table.cond td { border-bottom: 1px solid var(--line); padding: 8px; vertical-align: top; }
table.cond tr { break-inside: avoid; }
table.cond td.c-item { font-weight: 600; width: 26%; text-transform: capitalize; }
table.cond td.c-cond { width: 14%; white-space: nowrap; }
table.cond td.c-note { color: var(--ink-soft); }
table.cond td.c-ref { width: 10%; font-size: 0.72rem; color: var(--ink-soft); white-space: nowrap; }

.room-notes { font-size: 0.88rem; color: var(--ink-soft); background: #fbf9f5; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
.room-notes strong { color: var(--ink); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; display: block; margin-bottom: 4px; }

.needs-review { border: 1px dashed var(--amber); background: var(--amber-soft); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; font-size: 0.88rem; }
.needs-review .nr-head { font-weight: 700; color: var(--amber); margin-bottom: 6px; }
.needs-review textarea, .manual-note-input { width: 100%; border: 1px solid var(--line); border-radius: 6px; font: 0.88rem var(--font-ui); padding: 8px; min-height: 60px; }

.summary-block { background: #fbf9f5; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 8px; padding: 18px 22px; margin: 8px 0 36px; break-inside: avoid; }
.summary-block h2 { font-size: 1.15rem; margin-bottom: 8px; }
.summary-block p { margin: 0; font-size: 0.95rem; }

.signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-top: 44px; break-inside: avoid; }
.sig .line { border-bottom: 1.5px solid var(--ink); height: 44px; }
.sig .who { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); margin-top: 6px; display: flex; justify-content: space-between; }

.doc-foot { margin-top: 40px; border-top: 1px solid var(--line); padding-top: 12px; font-size: 0.72rem; color: var(--ink-soft); display: flex; justify-content: space-between; gap: 12px; }

/* editing */
.edit-on [data-edit] { outline: 1.5px dashed #b8c4d0; outline-offset: 2px; border-radius: 3px; min-width: 24px; }
.edit-on [data-edit]:focus { outline-color: var(--brand); background: #f2f9f6; }
.edit-on .chip[data-cond] { cursor: pointer; }
.edit-hint { display: none; }
.edit-on ~ * .edit-hint, body.editing .edit-hint { display: inline; }

/* lightbox */
dialog.lightbox { border: none; background: transparent; padding: 0; max-width: 92vw; }
dialog.lightbox::backdrop { background: rgba(15, 20, 26, 0.82); }
dialog.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 8px; display: block; }

.loading-state { text-align: center; padding: 100px 20px; color: var(--ink-soft); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 999px; margin: 0 auto 16px; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- PRINT (the PDF path) ---------- */
@media print {
  @page { size: letter; margin: 14mm 14mm 16mm; }
  body { background: #fff !important; font-size: 11px; }
  .report-toolbar, .toast, .no-print { display: none !important; }
  .sheet {
    box-shadow: none; border: none; border-radius: 0; max-width: none;
    margin: 0; padding: 0;
  }
  .thumbs { grid-template-columns: repeat(4, 1fr); }
  .thumbs img { height: 30mm; cursor: default; }
  .room-section > h2 { break-after: avoid; }
  table.cond { font-size: 10px; }
  .chip { border: 1px solid currentColor; }
  .signatures { margin-top: 10mm; }
  .sig .line { height: 14mm; }
  a { color: inherit; text-decoration: none; }
  .edit-on [data-edit] { outline: none; }
  .needs-review textarea { border: none; padding: 0; min-height: 0; }
  .summary-block, .signatures, .thumbs figure, table.cond tr { break-inside: avoid; }
}
