/* ============================================================
   Home Inspection Report — home-inspection.css
   Mobile-first. Scoped to .hi-wrap.
   ============================================================ */

.hi-wrap *, .hi-wrap *::before, .hi-wrap *::after {
    box-sizing: border-box; margin: 0; padding: 0;
}
.hi-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1e293b; background: #fff;
    border: 1px solid #e2e8f0; border-radius: 16px;
    overflow: hidden; max-width: 860px; margin: 0 auto;
}

/* ── Header ──────────────────────────────────────────────── */
.hi-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    flex-wrap: wrap; gap: 14px; padding: 20px 24px 18px;
    background: #f0fdf4; border-bottom: 1px solid #dcfce7;
}
.hi-title    { font-size: 20px; font-weight: 700; color: #14532d; margin-bottom: 3px; }
.hi-subtitle { font-size: 13px; color: #4d7c5f; }

/* Progress wrap */
.hi-progress-wrap { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.hi-progress-ring-label { font-size: 11px; font-weight: 600; color: #4d7c5f; text-transform: uppercase; letter-spacing: .05em; }
.hi-progress-track { width: 140px; height: 8px; background: #bbf7d0; border-radius: 6px; overflow: hidden; }
.hi-progress-fill  { height: 100%; background: #16a34a; border-radius: 6px; transition: width .4s ease; width: 0%; }
.hi-progress-pct   { font-size: 13px; font-weight: 700; color: #16a34a; min-width: 36px; }

/* ── Property bar ────────────────────────────────────────── */
.hi-property-bar {
    display: flex; gap: 12px; padding: 14px 24px;
    background: #f8fafc; border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap; align-items: flex-end;
}
.hi-pb-field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 160px; }
.hi-pb-sm    { flex: 0 0 140px; }
.hi-pb-xs    { flex: 0 0 130px; }
.hi-pb-label { font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .05em; }
.hi-pb-input {
    padding: 8px 12px; border: 1.5px solid #cbd5e1; border-radius: 8px;
    font-size: 13.5px; color: #1e293b; background: #fff;
    font-family: inherit; outline: none; transition: border-color .18s;
}
.hi-pb-input:focus { border-color: #16a34a; }
select.hi-pb-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23718096' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }

/* ── Sections nav ────────────────────────────────────────── */
.hi-sections-nav {
    display: flex; overflow-x: auto; border-bottom: 1px solid #e2e8f0;
    background: #fff; scroll-behavior: smooth;
}
.hi-sections-nav::-webkit-scrollbar { height: 3px; }
.hi-sections-nav::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.hi-nav-btn {
    flex-shrink: 0; padding: 12px 16px; border: none;
    background: transparent; font-size: 13px; font-weight: 600;
    color: #64748b; cursor: pointer; border-bottom: 3px solid transparent;
    transition: all .15s; white-space: nowrap; display: flex; align-items: center; gap: 6px;
}
.hi-nav-btn:hover   { color: #16a34a; background: #f0fdf4; }
.hi-nav-btn.active  { color: #16a34a; border-bottom-color: #16a34a; background: #fff; }
.hi-nav-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #e2e8f0; flex-shrink: 0;
}
.hi-nav-dot.has-issues { background: #f59e0b; }
.hi-nav-dot.all-good   { background: #22c55e; }

/* ── Body / sections ─────────────────────────────────────── */
.hi-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 0; }
@media (max-width: 600px) { .hi-body { padding: 16px; } }

.hi-section { display: none; }
.hi-section.active { display: block; }

.hi-section-header {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 16px; padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}
.hi-section-icon {
    width: 36px; height: 36px; border-radius: 9px;
    background: #f0fdf4; display: flex; align-items: center;
    justify-content: center; flex-shrink: 0; color: #16a34a;
}
.hi-section-name { font-size: 17px; font-weight: 700; color: #14532d; }
.hi-section-count { font-size: 12px; color: #64748b; margin-left: auto; }

/* Item rows */
.hi-item {
    display: grid; grid-template-columns: 1fr auto;
    gap: 10px; align-items: start;
    padding: 10px 0; border-bottom: 1px solid #f1f5f9;
}
.hi-item:last-child { border-bottom: none; }

.hi-item-label { font-size: 13.5px; color: #334155; font-weight: 500; padding-top: 2px; }
.hi-item-sub   { font-size: 12px; color: #94a3b8; margin-top: 3px; line-height: 1.5; }

.hi-item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

/* Condition radio group */
.hi-condition-group { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.hi-cond-btn {
    padding: 5px 11px; border-radius: 6px; font-size: 12px; font-weight: 600;
    cursor: pointer; border: 1.5px solid #e2e8f0; background: #f8fafc;
    color: #64748b; transition: all .12s; white-space: nowrap;
}
.hi-cond-btn:hover { border-color: #94a3b8; }
.hi-cond-btn.sel-good     { background: #dcfce7; border-color: #86efac; color: #15803d; }
.hi-cond-btn.sel-fair     { background: #fef9c3; border-color: #fde047; color: #854d0e; }
.hi-cond-btn.sel-poor     { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.hi-cond-btn.sel-na       { background: #f1f5f9; border-color: #cbd5e1; color: #64748b; }

/* Priority flag */
.hi-flag-select {
    display: none; padding: 4px 8px; border: 1.5px solid #e2e8f0; border-radius: 6px;
    font-size: 11.5px; font-weight: 600; background: #fff;
    outline: none; cursor: pointer; color: #475569;
}
.hi-flag-select.visible { display: block; }
.hi-flag-select.flag-minor    { background: #fef9c3; border-color: #fde047; color: #854d0e; }
.hi-flag-select.flag-moderate { background: #ffedd5; border-color: #fdba74; color: #9a3412; }
.hi-flag-select.flag-safety   { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }

/* Notes */
.hi-item-notes {
    display: none; margin-top: 6px; grid-column: 1 / -1;
}
.hi-item-notes.visible { display: block; }
.hi-notes-input {
    width: 100%; padding: 8px 12px; border: 1.5px solid #e2e8f0;
    border-radius: 8px; font-size: 13px; color: #334155;
    font-family: inherit; resize: vertical; min-height: 52px;
    outline: none; transition: border-color .18s; background: #f8fafc;
}
.hi-notes-input:focus { border-color: #16a34a; background: #fff; }

/* Section nav buttons */
.hi-section-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; padding-top: 16px; border-top: 1px solid #e2e8f0; }
.hi-sec-btn {
    padding: 10px 20px; border-radius: 9px; font-size: 13.5px;
    font-weight: 600; cursor: pointer; border: 1.5px solid #e2e8f0;
    background: #fff; color: #475569; transition: all .15s;
}
.hi-sec-btn:hover    { border-color: #16a34a; color: #16a34a; }
.hi-sec-btn.primary  { background: #16a34a; border-color: #16a34a; color: #fff; }
.hi-sec-btn.primary:hover { opacity: .88; }
.hi-sec-btn:disabled { opacity: .4; cursor: default; }

/* ── Summary ─────────────────────────────────────────────── */
.hi-summary {
    padding: 20px 24px; border-top: 1px solid #e2e8f0; background: #f8fafc;
}
.hi-summary-title {
    font-size: 14px; font-weight: 700; color: #1e293b;
    margin-bottom: 14px; text-transform: uppercase; letter-spacing: .05em;
}
.hi-summary-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
@media (max-width: 480px) { .hi-summary-cards { grid-template-columns: 1fr 1fr; } }

.hi-sum-card {
    border-radius: 10px; padding: 12px; text-align: center; border: 1.5px solid;
}
.hi-sum-safety   { background: #fee2e2; border-color: #fca5a5; }
.hi-sum-moderate { background: #ffedd5; border-color: #fdba74; }
.hi-sum-minor    { background: #fef9c3; border-color: #fde047; }
.hi-sum-good     { background: #dcfce7; border-color: #86efac; }
.hi-sum-num  { font-size: 26px; font-weight: 800; }
.hi-sum-lbl  { font-size: 11px; font-weight: 600; margin-top: 3px; }
.hi-sum-safety .hi-sum-num   { color: #991b1b; }
.hi-sum-safety .hi-sum-lbl   { color: #b91c1c; }
.hi-sum-moderate .hi-sum-num { color: #9a3412; }
.hi-sum-moderate .hi-sum-lbl { color: #c2410c; }
.hi-sum-minor .hi-sum-num    { color: #854d0e; }
.hi-sum-minor .hi-sum-lbl    { color: #92400e; }
.hi-sum-good .hi-sum-num     { color: #15803d; }
.hi-sum-good .hi-sum-lbl     { color: #166534; }

/* Issues list */
.hi-issues-list { display: flex; flex-direction: column; gap: 8px; }
.hi-issue-row {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 12px; border-radius: 9px; font-size: 13px;
}
.hi-issue-flag {
    font-size: 10.5px; font-weight: 700; padding: 2px 8px;
    border-radius: 12px; white-space: nowrap; flex-shrink: 0; margin-top: 1px;
}
.issue-safety   { background: #fee2e2; color: #991b1b; }
.issue-moderate { background: #ffedd5; color: #9a3412; }
.issue-minor    { background: #fef9c3; color: #854d0e; }
.hi-issue-sec   { font-weight: 600; color: #475569; }
.hi-issue-item  { color: #334155; }
.hi-issue-note  { font-size: 12px; color: #64748b; margin-top: 2px; }

/* ── Actions ─────────────────────────────────────────────── */
.hi-actions {
    display: flex; gap: 8px; flex-wrap: wrap;
    padding: 16px 24px; border-top: 1px solid #e2e8f0; background: #fff;
}
.hi-btn {
    flex: 1; min-width: 110px; padding: 11px 10px;
    border-radius: 9px; font-size: 13.5px; font-weight: 600;
    cursor: pointer; border: none; transition: opacity .18s;
}
.hi-btn:hover    { opacity: .87; }
.hi-btn-pdf      { background: #16a34a; color: #fff; }
.hi-btn-print    { background: #0f766e; color: #fff; }
.hi-btn-reset    { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 480px) {
    .hi-header       { padding: 16px; flex-direction: column; }
    .hi-property-bar { padding: 12px 16px; }
    .hi-pb-sm, .hi-pb-xs { flex: 1 1 120px; }
    .hi-body  { padding: 14px; }
    .hi-title { font-size: 18px; }
    .hi-condition-group { gap: 3px; }
    .hi-cond-btn { padding: 4px 9px; font-size: 11.5px; }
    .hi-progress-track { width: 100px; }
}

/* ── Print ───────────────────────────────────────────────── */
@media print {
    .hi-sections-nav, .hi-actions, .hi-section-nav { display: none !important; }
    .hi-section { display: block !important; }
    .hi-wrap     { border: none; border-radius: 0; }
    .hi-header   { background: #fff; }
}
