/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: #222; background: #f4f4f4; min-height: 100vh; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── CSS variables ────────────────────────────────────────── */
:root {
  --teal: #0097B2;
  --teal-dark: #006D80;
  --teal-light: #E0F4F8;
  --teal-border: #5CC3D4;
  --border: #e0e0e0;
  --border-mid: #ccc;
  --bg: #fff;
  --bg-alt: #f8f8f8;
  --text: #222;
  --text-mid: #555;
  --text-light: #888;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

/* ── App bar ──────────────────────────────────────────────── */
.app-bar { background: var(--teal); padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.app-bar-brand { display: flex; align-items: center; gap: 10px; }
.app-bar-icon { width: 34px; height: 34px; background: rgba(255,255,255,0.2); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 18px; color: #fff; }
.app-bar-title { color: #fff; font-size: 15px; font-weight: 600; }
.app-bar-sub { color: rgba(255,255,255,0.75); font-size: 11px; }
.app-bar-actions { display: flex; gap: 8px; }
.ab-btn { background: rgba(255,255,255,0.18); border: none; border-radius: 8px; color: #fff; font-size: 13px; padding: 7px 12px; display: flex; align-items: center; gap: 5px; }
.ab-btn:active { opacity: 0.75; }
.ab-btn-export { background: rgba(255,255,255,0.28); font-weight: 500; }

/* ── Progress ─────────────────────────────────────────────── */
.progress-wrap { background: var(--teal-dark); padding: 10px 16px 12px; }
.progress-row { display: flex; justify-content: space-between; margin-bottom: 5px; }
.progress-row span { color: rgba(255,255,255,0.85); font-size: 12px; }
.progress-track { height: 4px; background: rgba(255,255,255,0.25); border-radius: 2px; }
.progress-fill { height: 100%; background: #fff; border-radius: 2px; transition: width 0.4s; width: 0%; }

/* ── Room nav pills ───────────────────────────────────────── */
.room-nav { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px; background: #fff; border-bottom: 0.5px solid var(--border); -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.room-nav::-webkit-scrollbar { display: none; }
.room-pill { flex-shrink: 0; padding: 7px 14px; border-radius: 20px; font-size: 13px; border: 0.5px solid var(--border-mid); background: #fff; color: var(--text-light); white-space: nowrap; }
.room-pill.active { background: var(--teal); color: #fff; border-color: var(--teal); }
.room-pill.done { background: var(--teal-light); color: var(--teal-dark); border-color: var(--teal-border); }

/* ── Voice banner ─────────────────────────────────────────── */
.voice-banner { padding: 8px 16px; font-size: 12px; display: none; }
.voice-banner.ready { display: flex; align-items: center; gap: 8px; background: var(--teal-light); color: var(--teal-dark); border-bottom: 0.5px solid var(--teal-border); }
.voice-banner.error { display: flex; align-items: center; gap: 8px; background: #FCEBEB; color: #791F1F; border-bottom: 0.5px solid #F09595; }

/* ── Form content ─────────────────────────────────────────── */
.form-content { padding: 12px 16px 100px; }

/* Section cards */
.sec-card { background: #fff; border-radius: var(--radius); border: 0.5px solid var(--border); margin-bottom: 12px; overflow: hidden; box-shadow: var(--shadow); }
.sec-card-header { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; background: #fff; }
.sec-card-header-left { display: flex; align-items: center; gap: 10px; }
.sec-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--teal-light); display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--teal); flex-shrink: 0; }
.sec-label { font-size: 15px; font-weight: 500; }
.sec-body { padding: 0 16px 16px; display: none; border-top: 0.5px solid var(--border); }
.sec-body.open { display: block; }

/* Cover — logo upload */
.logo-upload-area { display: flex; justify-content: center; padding: 16px 0 10px; }
.logo-slot { width: 160px; height: 80px; border: 1.5px dashed var(--border-mid); border-radius: var(--radius); background: var(--bg-alt); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; position: relative; overflow: hidden; }
.logo-slot:hover { border-color: var(--teal); }
.logo-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.logo-slot-label { font-size: 11px; color: var(--text-light); text-align: center; }

/* Cover — property photo 62% A4 */
.prop-photo-zone { width: 100%; background: #d8d8d8; position: relative; overflow: hidden; border-top: 0.5px solid var(--border); border-bottom: 0.5px solid var(--border); }
.prop-photo-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; cursor: pointer; /* height = 184/210 of container width = 87.6% */ height: calc(100vw * 0.876); max-height: 500px; min-height: 240px; background: #e8e8e8; }
.prop-photo-empty i { font-size: 32px; color: #aaa; }
.prop-photo-empty p { font-size: 13px; color: #888; }
.prop-photo-empty .size-tag { font-size: 11px; color: #aaa; background: #fff; border: 0.5px solid var(--border); border-radius: 20px; padding: 3px 12px; }
.prop-photo-preview { width: 100%; height: calc(100vw * 0.876); max-height: 500px; min-height: 240px; object-fit: cover; display: none; }
.prop-photo-bar { background: rgba(0,0,0,0.5); padding: 8px 14px; display: none; align-items: center; justify-content: space-between; }
.prop-photo-bar span { color: #fff; font-size: 12px; display: flex; align-items: center; gap: 5px; }
.prop-photo-bar button { background: rgba(255,255,255,0.2); border: none; border-radius: 6px; color: #fff; font-size: 11px; padding: 4px 10px; display: flex; align-items: center; gap: 4px; margin-left: 8px; }

/* Form fields */
.field-group { margin-bottom: 12px; }
.field-group label { display: block; font-size: 12px; color: var(--text-light); margin-bottom: 4px; }
.field-group input, .field-group select, .field-group textarea { width: 100%; padding: 11px 12px; font-size: 14px; border: 0.5px solid var(--border-mid); border-radius: var(--radius-sm); background: #fff; color: var(--text); }
.field-group input:focus, .field-group textarea:focus { outline: none; border-color: var(--teal); }
.field-group textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Condition chips */
.cond-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.cond-chip { padding: 7px 12px; border-radius: 20px; font-size: 12px; border: 0.5px solid var(--border-mid); background: #fff; color: var(--text-light); white-space: nowrap; cursor: pointer; }
.cond-chip.ok { background: #222; color: #fff; border-color: #222; font-weight: 500; }
.cond-chip.amber { background: #222; color: #fff; border-color: #222; font-weight: 500; }
.cond-chip.red { background: #FCEBEB; color: #791F1F; border-color: #F09595; font-weight: 600; }

/* Notes + mic */
.notes-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.notes-row textarea { flex: 1; }
.mic-btn { width: 44px; height: 44px; border-radius: 50%; border: 0.5px solid var(--border-mid); background: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--text-light); flex-shrink: 0; }
.mic-btn.listening { background: #FCEBEB; border-color: #E24B4A; color: #E24B4A; animation: pulse 1s infinite; }
.mic-btn.done { background: var(--teal-light); border-color: var(--teal-border); color: var(--teal-dark); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

/* Photo strips */
.photo-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin-bottom: 8px; }
.photo-strip::-webkit-scrollbar { display: none; }
.photo-slot { flex-shrink: 0; width: 80px; height: 80px; border-radius: var(--radius-sm); background: var(--bg-alt); border: 0.5px solid var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; position: relative; overflow: hidden; font-size: 11px; color: var(--text-light); }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot.add { border-style: dashed; border-color: var(--border-mid); background: #fff; }
.photo-slot .ts-badge { position: absolute; bottom: 2px; left: 2px; right: 2px; background: rgba(0,0,0,0.55); color: #fff; font-size: 8px; padding: 1px 3px; border-radius: 2px; font-family: monospace; text-align: center; }

/* Condition detail textarea label */
.cond-detail-label {
  font-size: 11px;
  color: var(--text-light);
  margin-bottom: 3px;
  display: block;
}

/* Item rows (room tables) */
.item-card { background: var(--bg-alt); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 8px; border: 0.5px solid var(--border); }
.item-name { font-size: 14px; font-weight: 500; margin-bottom: 8px; }

/* Meters */
.meter-block { background: var(--bg-alt); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; border: 0.5px solid var(--border); }
.meter-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-light); margin-bottom: 10px; }
.meter-photo-btn { width: 100%; padding: 12px; border: 1.5px dashed var(--border-mid); border-radius: var(--radius-sm); background: #fff; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--text-light); font-size: 13px; margin-top: 8px; }
.meter-photo-btn.captured { background: var(--teal-light); border-color: var(--teal-border); color: var(--teal-dark); }

/* Alarms */
.alarm-card { background: var(--bg-alt); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 8px; border: 0.5px solid var(--border); }
.alarm-photo-circle { width: 54px; height: 54px; border-radius: var(--radius-sm); border: 1.5px dashed var(--border-mid); background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; font-size: 10px; color: var(--text-light); gap: 2px; flex-shrink: 0; }
.alarm-photo-circle.captured { background: var(--teal-light); border-color: var(--teal-border); color: var(--teal-dark); }

/* Keys photos */
.key-na { background: var(--bg-alt); border: 0.5px solid var(--border); border-radius: var(--radius-sm); padding: 8px 14px; font-size: 12px; color: var(--text-light); font-style: italic; display: inline-block; margin-top: 8px; }

/* Signature blocks */
.sig-block { border: 0.5px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 8px; }
.sig-label { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-light); letter-spacing: 0.05em; margin-bottom: 10px; }
.sig-line-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.sig-line-group .sig-line { border-bottom: 0.5px solid #888; min-height: 24px; margin-bottom: 3px; }
.sig-line-group .sig-lbl { font-size: 10px; text-transform: uppercase; color: #aaa; letter-spacing: 0.04em; }

/* Tenant portal box */
.tenant-portal-box { border: 1.5px solid var(--teal); border-radius: var(--radius-sm); padding: 12px; margin-top: 12px; background: var(--teal-light); }
.tpb-title { font-size: 13px; font-weight: 600; color: var(--teal-dark); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.tpb-desc { font-size: 12px; color: var(--teal-dark); line-height: 1.6; margin-bottom: 8px; }
.tpb-url { font-size: 11px; color: var(--teal); background: #fff; border: 0.5px solid var(--teal-border); border-radius: 4px; padding: 6px 10px; font-family: monospace; word-break: break-all; display: block; margin-bottom: 6px; }
.tpb-expiry { font-size: 11px; color: var(--teal-dark); display: flex; align-items: center; gap: 4px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: var(--radius-sm); font-size: 13px; border: 0.5px solid var(--border-mid); background: #fff; color: var(--text); }
.btn-teal { background: var(--teal); color: #fff; border-color: transparent; }
.btn-teal:active { opacity: 0.85; }
.btn-outline-teal { color: var(--teal); border-color: var(--teal); background: transparent; }
.btn-outline-teal:hover { background: var(--teal-light); }
.btn-full { width: 100%; justify-content: center; padding: 14px; font-size: 15px; font-weight: 500; }

/* Summary grid */
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Complete / export state */
.complete-wrap { text-align: center; padding: 2rem 1rem; }
.complete-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--teal-light); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; font-size: 30px; color: var(--teal); }

/* Bottom nav */
.bottom-nav { position: sticky; bottom: 0; background: #fff; border-top: 0.5px solid var(--border); padding: 10px 16px; display: flex; gap: 10px; z-index: 100; }
.nav-prev { flex: 1; padding: 14px; border: 0.5px solid var(--border-mid); border-radius: var(--radius-sm); background: #fff; color: var(--text); font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.nav-next { flex: 2; padding: 14px; border: none; border-radius: var(--radius-sm); background: var(--teal); color: #fff; font-size: 15px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 6px; }
.nav-prev:active, .nav-next:active { opacity: 0.8; }

/* Toast */
.toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: #222; color: #fff; padding: 9px 18px; border-radius: 20px; font-size: 13px; opacity: 0; transition: opacity 0.25s; pointer-events: none; z-index: 9999; white-space: nowrap; }
.toast.show { opacity: 1; }

/* Tablet & desktop */
@media (min-width: 600px) {
  .form-content { max-width: 720px; margin: 0 auto; padding: 16px 24px 120px; }
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  .prop-photo-empty, .prop-photo-preview { height: 360px; max-height: 360px; }
  .app-bar-title { font-size: 17px; }
}
@media (min-width: 900px) {
  .form-content { max-width: 900px; }
}
