/* Homebuilder frame — the Email reader panel on the Email tab (M2 §4): the
   list-head button, per-mailbox consent switches, usage, the "Found in email"
   review list and the accuracy table. It renders in the reading pane, so pane
   visibility on phone/desktop comes from homes-layout.css. */

/* ---- list-head button ---- */
.hm-er-entry { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; margin-left: auto; padding: 0 10px; font: inherit; font-size: 13px; font-weight: 600; color: var(--hm-text); background: var(--app-surface); border: 1px solid var(--hm-line-strong); border-radius: var(--radius-pill); cursor: pointer; white-space: nowrap; transition: background var(--motion-fast), border-color var(--motion-fast); }
.hm-er-entry[hidden] { display: none; }
.hm-er-entry:hover { background: var(--app-surface-2); }
.hm-er-entry.is-open { color: var(--app-navy); background: var(--app-accent-soft); border-color: transparent; }
.hm-er-entry .hm-ic { width: 15px; height: 15px; color: var(--app-accent); }
.hm-er-entry-state { font-size: 11.5px; font-weight: 650; color: var(--hm-faint); }
.hm-er-entry-state.is-on { color: var(--app-ok); }
.hm-er-waiting { color: var(--app-warn); background: var(--app-warn-bg); }

/* ---- panel ---- */
.hm-er { display: grid; gap: 4px; padding: 6px 0 28px; }
.hm-er > .hm-banner { margin: 10px 0 0; }
.hm-er .hm-section-title { margin-top: 20px; }
.hm-er-head .hm-reader-subject { margin-bottom: 6px; }
.hm-er-lede { margin: 0 0 12px; font-size: 14px; line-height: 1.55; color: var(--hm-text); max-width: 68ch; }
.hm-er-mode { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.hm-er-mode small { font-size: 12px; color: var(--hm-faint); }
.hm-er-k { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--hm-faint); }
.hm-er .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hm-er .hm-banner a { font-weight: 650; color: inherit; }

/* ---- mailboxes ---- */
.hm-er-boxes, .hm-er-found { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.hm-er-box { display: grid; gap: 8px; padding: 12px 14px; background: var(--app-surface); border: 1px solid var(--hm-line); border-radius: var(--hm-radius); }
.hm-er-box-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.hm-er-box-top b { overflow: hidden; font-size: 14.5px; font-weight: 650; color: var(--hm-ink); white-space: nowrap; text-overflow: ellipsis; }
.hm-er-note { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--hm-muted); }
.hm-er-box > .hm-btn { justify-self: start; }

/* The switch is a real checkbox (role="switch"), so keyboard and screen
   readers get on/off for free; the track is drawn beside it. */
.hm-er-switch { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 14px; font-weight: 550; line-height: 1.35; color: var(--hm-text); cursor: pointer; }
.hm-er-switch input { position: absolute; width: 44px; height: 26px; margin: 0; opacity: 0; cursor: pointer; }
.hm-er-track { position: relative; flex: none; width: 44px; height: 26px; background: var(--app-surface-3); border: 1px solid var(--hm-line-strong); border-radius: 13px; transition: background var(--motion-fast), border-color var(--motion-fast); }
.hm-er-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(15, 23, 42, .25); transition: transform var(--motion-fast); }
.hm-er-switch input:checked + .hm-er-track { background: var(--app-accent); border-color: var(--app-accent); }
.hm-er-switch input:checked + .hm-er-track::after { transform: translateX(18px); }
.hm-er-switch input:focus-visible + .hm-er-track { outline: 3px solid color-mix(in srgb, var(--app-accent) 35%, white); outline-offset: 2px; }
.hm-er-switch input:disabled + .hm-er-track { opacity: .55; }
.hm-er-switch:has(input:disabled) { cursor: progress; }

/* ---- usage ---- */
.hm-er-usage-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 8px; font-size: 14px; color: var(--hm-muted); }
.hm-er-usage-row b { font-size: 17px; color: var(--hm-ink); font-variant-numeric: tabular-nums; }
.hm-er-cost { font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---- found in email ---- */
.hm-er-item { display: grid; gap: 6px; padding: 12px 14px; background: var(--app-surface); border: 1px dashed var(--hm-line-strong); border-radius: var(--hm-radius); }
.hm-er-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hm-er-kind { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--hm-faint); }
.hm-er-item-main { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; }
.hm-er-item-main b { min-width: 0; font-size: 14.5px; font-weight: 650; color: var(--hm-ink); overflow-wrap: anywhere; }
.hm-er-item-main .num { font-size: 14.5px; font-weight: 650; color: var(--hm-muted); }
.hm-er-item-meta { margin: 0; font-size: 12.5px; color: var(--hm-muted); }
.hm-er-mail { display: flex; align-items: flex-start; gap: 8px; width: 100%; min-height: 44px; padding: 8px 10px; font: inherit; text-align: left; color: inherit; background: var(--app-surface-2); border: 0; border-radius: 10px; cursor: pointer; }
.hm-er-mail:hover { background: var(--app-surface-3); }
.hm-er-mail .hm-ic { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--hm-muted); }
.hm-er-mail > span { display: grid; gap: 1px; min-width: 0; }
.hm-er-mail b { overflow: hidden; font-size: 13.5px; font-weight: 600; color: var(--app-navy); white-space: nowrap; text-overflow: ellipsis; }
.hm-er-mail small { overflow: hidden; font-size: 12px; color: var(--hm-muted); white-space: nowrap; text-overflow: ellipsis; }
.hm-er-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }

/* ---- accuracy (table on desktop; the summary sentence on phone) ---- */
.hm-er-acc-table { display: none; }
.hm-er-acc-table .hm-table th, .hm-er-acc-table .hm-table td { padding: 9px 12px; font-size: 13px; }
.hm-er-acc-table .num { text-align: right; }

@media (min-width: 1024px) {
  .hm-er { max-width: 820px; padding-top: 20px; }
  .hm-er-acc-table { display: block; margin-top: 8px; }
  .hm-er-item { grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; }
  .hm-er-item > * { grid-column: 1; }
  .hm-er-item > .hm-er-acts { grid-column: 2; grid-row: 2 / span 3; align-self: center; flex-direction: column; margin: 0; }
}

/* ---- assign sheet: remember the sender as the homeowner ---- */
.hm-er-remember { display: grid; gap: 2px; padding: 10px 12px; background: var(--app-surface-2); border-radius: var(--hm-radius); }
.hm-er-remember .hm-check { align-items: flex-start; min-height: 0; padding: 2px 0; font-size: 14px; font-weight: 550; line-height: 1.35; color: var(--hm-text); }
.hm-er-remember .hm-check input { flex: none; margin-top: 1px; }
.hm-er-remember .hm-field-help { margin: 0 0 0 26px; overflow-wrap: anywhere; }
.hm-er-assigned { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 14.5px; color: var(--app-ok); }
.hm-er-assigned b { color: var(--hm-ink); }
.hm-er-assigned .hm-ic { flex: none; width: 18px; height: 18px; }
