/* ResMech — values mirror the approved .dc.html designs. */
:root {
  --navy: #152244;
  --run: #2F7D32;
  --run-bg: #EEF6EE;
  --down: #C62828; /* Not Running = red (Zach 9/24) */
  --down-bg: #FDECEC;
  --page: #F3F4F6;
  --line: #D5D9E0;
  --line-soft: #EEF0F3;
  --input-line: #C9CED6;
  --off: #E3E6EB;
  --white: #FFFFFF;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--page);
  color: var(--navy);
  font-family: 'DM Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button { font: inherit; color: var(--navy); cursor: pointer; }
button:disabled { cursor: default; }
input, textarea { font: inherit; color: var(--navy); }
::placeholder { color: var(--navy); opacity: 0.6; }
b { font-weight: 700; }

.app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; background: var(--page); }
.hidden { display: none !important; }

/* ---------- Plain white screens (install, invite, reminders) ---------- */
.plain {
  min-height: 100vh; min-height: 100dvh;
  background: var(--white);
  display: flex; flex-direction: column;
  padding: calc(72px + var(--safe-top)) 24px calc(40px + var(--safe-bottom));
  gap: 24px;
}
.plain.signin { padding-top: calc(96px + var(--safe-top)); gap: 28px; }
.plain.notify { padding-top: calc(120px + var(--safe-top)); }
.plain.ios { padding-bottom: calc(96px + var(--safe-bottom)); }
.stack { display: flex; flex-direction: column; }
.gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-14 { gap: 14px; }

.flag-tile {
  width: 64px; height: 64px; border-radius: 16px;
  background: var(--white); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; padding: 9px;
}
.flag-tile img { width: 100%; height: 100%; object-fit: contain; display: block; }

.h-install { font-size: 30px; font-weight: 700; line-height: 1.1; }
.h-brand { font-size: 32px; font-weight: 700; line-height: 1.1; }
.lead { font-size: 17px; line-height: 1.4; }
.small { font-size: 15px; line-height: 1.4; }
.note-box { font-size: 14px; line-height: 1.4; padding: 12px 14px; border-radius: 12px; background: var(--page); }

.step {
  display: flex; gap: 14px; align-items: center;
  padding: 16px; border: 1px solid var(--line); border-radius: 16px;
}
.step-num {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 18px;
  background: var(--navy); color: var(--white);
  display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 700;
}
.step-text { font-size: 17px; line-height: 1.35; flex-grow: 1; }
.step svg { flex-shrink: 0; }

.share-hint {
  position: fixed; left: 0; right: 0; bottom: calc(18px + var(--safe-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 15px; font-weight: 700; pointer-events: none;
}

.btn-primary {
  height: 60px; width: 100%; border-radius: 14px; border: none;
  background: var(--navy); color: var(--white);
  font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-primary.big { height: 64px; font-size: 19px; }
.btn-primary:disabled { background: var(--off); color: var(--navy); }

.installed-card {
  display: flex; gap: 14px; align-items: center;
  padding: 16px; border: 2px solid var(--run); border-radius: 16px; background: var(--run-bg);
}
.check-dot {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 18px; background: var(--run); color: var(--white);
  display: flex; align-items: center; justify-content: center;
}

.bell-circle {
  width: 88px; height: 88px; border-radius: 44px; background: var(--page);
  display: flex; align-items: center; justify-content: center;
}
.warn-box {
  font-size: 15px; line-height: 1.4; padding: 12px 14px; border-radius: 12px;
  border: 2px solid var(--down); background: var(--down-bg);
}

/* ---------- Main: Today's Check ---------- */
.main { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--page); }
.header {
  padding: calc(20px + var(--safe-top)) 20px 16px; background: var(--white); border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 14px;
}
.header-top { display: flex; align-items: center; justify-content: space-between; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.icon-btn {
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  border-radius: 12px; border: 1px solid var(--line); background: var(--white); color: var(--navy); padding: 0;
}
.bldg-name { font-size: 26px; font-weight: 700; line-height: 1.15; }
.bldg-sub { font-size: 15px; }
.progress-row { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; }
.header-hint { font-size: 14px; }

.grid-wrap { flex-grow: 1; padding: 16px 16px calc(120px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 10px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.tile {
  min-height: 104px; padding: 9px; border-radius: 14px; gap: 6px;
  border: 2px solid var(--line); background: var(--white); color: var(--navy);
  display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; text-align: left;
}
.tile.run { border-color: var(--run); background: var(--run-bg); }
.tile.down { border-color: var(--down); background: var(--down-bg); }
.tile-top { display: flex; justify-content: space-between; align-items: flex-start; width: 100%; }
.unit-icon {
  width: 34px; height: 34px; border-radius: 9px; background: var(--page);
  display: flex; align-items: center; justify-content: center; color: var(--navy);
}
.badge { width: 22px; height: 22px; border-radius: 11px; color: var(--white); display: flex; align-items: center; justify-content: center; }
.badge.run { background: var(--run); }
.badge.down { background: var(--down); }
.tile-text { display: flex; flex-direction: column; gap: 2px; width: 100%; }
.unit-name { font-size: 15px; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.unit-kind { font-size: 11.5px; line-height: 1.2; }
.unit-status { font-size: 12px; font-weight: 700; margin-top: 3px; }
.unit-why {
  font-size: 11.5px; line-height: 1.2; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.unit-icon svg { width: 24px; height: 24px; }
.badge svg { width: 13px; height: 13px; }

.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto;
  padding: 14px 16px calc(26px + var(--safe-bottom)); background: var(--white); border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 8px; z-index: 10;
}
.main-btn { height: 60px; width: 100%; border-radius: 14px; border: none; font-size: 18px; font-weight: 700; }
.main-btn.all { background: var(--run); color: var(--white); }
.main-btn.submit { background: var(--navy); color: var(--white); }

/* Submitted */
.done-wrap { flex-grow: 1; padding: 28px 20px calc(28px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 18px; }
.done-hero { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px 0; text-align: center; }
.big-check { width: 84px; height: 84px; border-radius: 42px; background: var(--run); color: var(--white); display: flex; align-items: center; justify-content: center; }
.done-title { font-size: 24px; font-weight: 700; }
.done-time { font-size: 15px; }
.summary { background: var(--white); border: 1px solid var(--line); border-radius: 16px; display: flex; flex-direction: column; }
.summary-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--line-soft); gap: 12px; }
.summary-row:last-child { border-bottom: none; }
.summary-row .name { font-size: 16px; font-weight: 700; }
.summary-row .why { font-size: 13px; }
.status-run { font-size: 15px; font-weight: 700; color: var(--run); white-space: nowrap; }
.status-down { font-size: 15px; font-weight: 700; color: var(--down); white-space: nowrap; }
.btn-outline {
  height: 48px; border-radius: 12px; border: 1px solid var(--navy); background: var(--white); color: var(--navy);
  font-size: 16px; font-weight: 700;
}

/* Bottom sheet */
.overlay {
  position: fixed; inset: 0; background: rgba(21, 34, 68, 0.45); z-index: 20;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
}
.sheet {
  width: 100%; max-width: 520px; background: var(--white); border-radius: 22px 22px 0 0;
  padding: 12px 20px calc(30px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 16px;
  max-height: 92dvh; overflow-y: auto;
}
.sheet.anim { animation: sheet-up 0.18s ease-out; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.grabber { align-self: center; width: 44px; height: 5px; border-radius: 3px; background: var(--input-line); }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; }
.sheet-title { font-size: 24px; font-weight: 700; }
.sheet-kind { font-size: 14px; }
.close-btn {
  width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: var(--white); color: var(--navy);
  display: flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0;
}
.q { font-size: 16px; font-weight: 700; }
.choice {
  height: 72px; border-radius: 16px; font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
}
.choice.run { border: none; background: var(--run); color: var(--white); }
.choice.down { border: 2px solid var(--down); background: var(--white); color: var(--navy); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 0 16px; border-radius: 22px; font-size: 15px; font-weight: 700;
  border: 1px solid var(--input-line); background: var(--white); color: var(--navy);
}
.chip.on { border: 2px solid var(--navy); background: var(--navy); color: var(--white); }
.field-label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; }
.field-label textarea {
  font-size: 16px; font-weight: 400; padding: 12px; border-radius: 12px; border: 1px solid var(--input-line); resize: none;
}
.row-btns { display: flex; gap: 10px; }
.btn-back {
  height: 56px; padding: 0 20px; border-radius: 14px; border: 1px solid var(--input-line); background: var(--white);
  font-size: 16px; font-weight: 700;
}
.btn-mark { flex-grow: 1; height: 56px; border-radius: 14px; border: none; font-size: 17px; font-weight: 700; background: var(--off); color: var(--navy); }
.btn-mark.ready { background: var(--down); color: var(--white); }

/* ---------- History ---------- */
.hist-head {
  padding: calc(20px + var(--safe-top)) 20px 20px; background: var(--white); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.hist-title { font-size: 22px; font-weight: 700; }
.hist-sub { font-size: 14px; }
.hist-list { padding: 16px 16px calc(16px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 10px; }
.day {
  background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.day .d { font-size: 16px; font-weight: 700; }
.day .detail { font-size: 14px; }
.result-ok { font-size: 15px; font-weight: 700; color: var(--run); white-space: nowrap; }
.result-warn { font-size: 15px; font-weight: 700; color: var(--down); white-space: nowrap; }
.result-open { font-size: 15px; font-weight: 700; color: var(--navy); white-space: nowrap; }

/* ---------- Loading / themed modal ---------- */
.loading { min-height: 100dvh; display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 700; background: var(--white); }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(21, 34, 68, 0.45); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  width: 100%; max-width: 380px; background: var(--white); border-radius: 18px; padding: 22px 20px 18px;
  display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 50px rgba(21, 34, 68, 0.25);
}
.modal-title { font-size: 20px; font-weight: 700; }
.modal-body { font-size: 16px; line-height: 1.4; word-break: break-word; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.modal-actions button { flex: 1; height: 52px; border-radius: 14px; font-size: 16px; font-weight: 700; }
.modal-actions .primary { border: none; background: var(--navy); color: var(--white); }
.modal-actions .secondary { border: 1px solid var(--input-line); background: var(--white); color: var(--navy); }

/* ---------- Sign in ---------- */
.btn-google {
  height: 60px; width: 100%; border-radius: 14px; border: 1px solid #747775; background: var(--white); color: var(--navy);
  font-size: 18px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 12px;
}
/* ---------- Demo account only ---------- */
.header-actions { display: flex; gap: 8px; }
.demo-tag {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; padding: 3px 8px; border-radius: 6px;
  border: 1px solid var(--navy); margin-left: 8px; vertical-align: 2px;
}
.demo-list { display: flex; flex-direction: column; gap: 8px; }
.demo-item {
  min-height: 60px; text-align: left; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--white);
  display: flex; flex-direction: column; gap: 2px; font-size: 15px; color: var(--navy);
}
.demo-item span { font-size: 14px; }

/* ---------- Multi-building sections ---------- */
.bldg-section { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.bldg-section-name { font-size: 19px; font-weight: 700; }
.bldg-section-addr { font-size: 14px; }
.summary-bldg { font-size: 16px; font-weight: 700; margin-bottom: -8px; }

/* Navy focus ring (never the browser's default amber) */
textarea:focus, input:focus { outline: 2px solid var(--navy); outline-offset: 0; border-color: var(--navy); }
button:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
