/* Hearth: only what the brand bundle lacks (dashboard shell, auth pages, forms,
   tabs, menus). Tokens only: no hard-coded colours or sizes outside the 4px scale.
   Spec: wiki company/brand/dashboard-layouts. */

*, *::before, *::after { box-sizing: border-box; }
body { font-size: 14px; line-height: 20px; }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--moss); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; }

.hearth-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.hearth-skip { position: absolute; left: var(--space-4); top: calc(-1 * var(--space-16)); z-index: 30; padding: var(--space-2) var(--space-4); background: var(--paper-raised); border-radius: var(--radius-sm); }
.hearth-skip:focus { top: var(--space-4); }
.hearth-muted { color: var(--ink-muted); }
.hearth-strong { font-weight: 600; }
.hearth-break { overflow-wrap: anywhere; }
.hearth-rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* ---- dashboard shell ---- */
.hearth-shell { display: flex; min-height: 100vh; }
.hearth-sidebar { position: sticky; top: 0; height: 100vh; flex: none; overflow-y: auto; }
.hearth-sidebar .ct-sidebar__brand { height: var(--space-16); margin-bottom: var(--space-2); }
.hearth-sidebar .ct-sidebar__brand a { display: inline-flex; color: inherit; text-decoration: none; }
.hearth-nav-group { margin: var(--space-4) var(--space-3) var(--space-1); font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-subtle); }
.hearth-nav-group--admin { color: var(--danger); }
.hearth-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hearth-topbar { position: sticky; top: 0; z-index: 10; height: var(--topbar-height); display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-8); background: var(--paper); border-bottom: 1px solid var(--line); }
.hearth-topbar__right { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }
.hearth-crumbs ol { display: flex; gap: var(--space-2); margin: 0; padding: 0; list-style: none; color: var(--ink-muted); }
.hearth-crumbs li + li::before { content: "/"; margin-right: var(--space-2); color: var(--ink-subtle); }
.hearth-crumbs a { color: var(--ink-muted); text-decoration: none; }
.hearth-crumbs a:hover { color: var(--ink); text-decoration: underline; }
.hearth-crumbs [aria-current] { color: var(--ink); }
.hearth-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: var(--control-sm); height: var(--control-sm); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-muted); cursor: pointer; }
.hearth-iconbtn:hover { background: var(--paper-sunken); color: var(--ink); }
.hearth-topbar .hearth-topbar__mark, .hearth-topbar .hearth-menu-btn { display: none; }
.hearth-content { width: 100%; max-width: calc(var(--dashboard-max) + 2 * var(--space-8)); padding: var(--space-8); }
.hearth-content:focus { outline: none; }

/* account menu: <details> so it works without script */
.hearth-menu { position: relative; }
.hearth-menu > summary { list-style: none; }
.hearth-menu > summary::-webkit-details-marker { display: none; }
.hearth-avatar { display: inline-flex; align-items: center; justify-content: center; width: var(--control-sm); height: var(--control-sm); border-radius: var(--radius-full); background: var(--moss-soft); color: var(--moss); font-weight: 600; text-transform: uppercase; cursor: pointer; }
.hearth-menu__panel { position: absolute; right: 0; top: calc(100% + var(--space-2)); z-index: 20; min-width: 240px; padding: var(--space-2); background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.hearth-menu__who { padding: var(--space-2) var(--space-3); color: var(--ink-subtle); font-size: 12px; line-height: 16px; overflow-wrap: anywhere; }
.hearth-menu__name { display: block; color: var(--ink); font-size: 14px; line-height: 20px; font-weight: 500; }
.hearth-menu__item { display: flex; align-items: center; width: 100%; height: var(--control-md); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.hearth-menu__item:hover { background: var(--paper-sunken); }

/* page header: h3 title, description, right-aligned actions */
.hearth-pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-8); }
.hearth-pagehead__desc { margin-top: var(--space-1); max-width: 640px; color: var(--ink-muted); }
.hearth-pagehead__actions { display: flex; gap: var(--space-2); flex: none; }
.hearth-section { margin-bottom: var(--space-10); }
.hearth-section__title { margin-bottom: var(--space-4); }

.hearth-card { padding: var(--space-5); background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-md); }
.hearth-stack { display: flex; flex-direction: column; gap: var(--space-4); }
.hearth-row { display: flex; align-items: center; gap: var(--space-4); }
.hearth-row > :first-child { flex: 1; min-width: 0; }
.hearth-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--space-3); }
.hearth-codes { display: grid; grid-template-columns: repeat(2, max-content); gap: var(--space-2) var(--space-8); margin: var(--space-4) 0; padding: 0; list-style: none; }
.hearth-totp { display: flex; gap: var(--space-6); align-items: flex-start; flex-wrap: wrap; }
.hearth-totp img { border-radius: var(--radius-sm); background: var(--paper-raised); }

/* tabs: 44px, 2px moss underline on the active tab */
.hearth-tabs { display: flex; gap: var(--space-6); margin-bottom: var(--space-8); border-bottom: 1px solid var(--line); overflow-x: auto; }
.hearth-tab { display: inline-flex; align-items: center; height: 44px; font-weight: 600; color: var(--ink-muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.hearth-tab:hover { color: var(--ink); }
.hearth-tab.is-active { color: var(--ink); border-bottom-color: var(--moss); }

/* tables: the whole row is a link (the name link stretches over the row) */
.ct-table tbody tr { position: relative; }
.hearth-rowlink { color: inherit; text-decoration: none; }
.hearth-rowlink::after { content: ""; position: absolute; inset: 0; }
.hearth-table--dense td { height: auto; padding-top: var(--space-2); padding-bottom: var(--space-2); }
.ct-table td .ct-caption { display: block; }

/* ---- forms ---- */
.hearth-form { display: flex; flex-direction: column; gap: var(--space-4); }
.hearth-form--narrow { max-width: 400px; }
.hearth-form--narrow > .ct-btn { align-self: flex-start; }
.hearth-inline-form { display: inline; margin-left: var(--space-2); }
.hearth-check { display: flex; gap: var(--space-3); align-items: flex-start; }
.hearth-check input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--moss); }
.hearth-or { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-5) 0; color: var(--ink-subtle); font-size: 12px; line-height: 16px; }
.hearth-or::before, .hearth-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.hearth-details { margin-top: var(--space-5); }
.hearth-details > summary { cursor: pointer; color: var(--moss); }
.hearth-details[open] > summary { margin-bottom: var(--space-4); }
/* app settings (deploy wizard step 2 and the Settings tab) */
.hearth-settings { display: flex; flex-direction: column; gap: var(--space-3); padding-top: var(--space-5); border-top: 1px solid var(--line); }
.hearth-settings__set { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: var(--space-4); }
.hearth-settings__set[disabled] { opacity: 0.7; }
.hearth-settings__form > .ct-btn { align-self: flex-start; }
.hearth-settings__group { margin: 0; }
.hearth-settings__group + .hearth-settings__group { margin-top: var(--space-2); }
.hearth-settings__title { margin: 0 0 var(--space-3); }
.hearth-settings__fields { display: flex; flex-direction: column; gap: var(--space-4); max-width: 480px; }
details.hearth-settings__group > summary { font-weight: 600; }
.hearth-settings__label { display: flex; align-items: center; gap: var(--space-2); }
.hearth-settings__label .ct-field__label { margin-bottom: 0; }
.hearth-settings__clear { margin-top: var(--space-2); align-items: center; }
.hearth-linkbtn { border: 0; padding: 0; background: none; color: var(--moss); font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---- signed-out pages ---- */
.hearth-auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: var(--space-16) var(--space-5); }
.hearth-auth__logo { display: inline-flex; margin-bottom: var(--space-8); color: inherit; text-decoration: none; }
.hearth-auth__card { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-8); background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.hearth-auth__card .hearth-form { margin-top: var(--space-2); }
.hearth-auth__foot { margin-top: var(--space-2); text-align: center; color: var(--ink-muted); }
/* Sign-up and sign-in from a Deploy on Cottage link: the app on the left, the form on the right.
   On narrow screens the app collapses to a short header above the form. */
.hearth-split { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.hearth-split__app { display: flex; flex-direction: column; gap: var(--space-12); padding: var(--space-10) clamp(var(--space-8), 6vw, var(--space-16)); background: var(--moss-soft); color: var(--ink); }
.hearth-split__logo { display: inline-flex; color: inherit; text-decoration: none; align-self: flex-start; }
.hearth-split__hero { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: var(--space-6); max-width: 460px; }
.hearth-split__icon { width: 72px; height: 72px; padding: 10px; border-radius: 18px; background: var(--paper-raised); box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 6px 18px rgba(47,93,70,.12); }
.hearth-split__title { display: flex; flex-direction: column; gap: var(--space-2); }
.hearth-split__title p, .hearth-split__title h2 { margin: 0; }
.hearth-split__eyebrow { font-size: .8125rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--moss); }
.hearth-split__name { font-family: var(--font-display, inherit); font-size: clamp(2rem, 3.2vw, 2.75rem); line-height: 1.1; }
.hearth-split__tag { font-size: 1.125rem; color: var(--ink-muted); }
.hearth-split__perks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.hearth-split__perks li { display: flex; gap: var(--space-3); align-items: flex-start; }
.hearth-split__perks svg { flex: none; margin-top: 2px; color: var(--moss); }
.hearth-split__more { align-self: flex-start; color: var(--moss); font-weight: 600; }
.hearth-split__steps { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--space-2); counter-reset: step; font-size: .875rem; color: var(--ink-muted); flex-wrap: wrap; }
.hearth-split__steps li { counter-increment: step; display: flex; align-items: center; gap: var(--space-2); }
.hearth-split__steps li + li::before { order: -2; content: ""; width: 20px; height: 1px; background: var(--line-strong); margin-right: var(--space-1); }
.hearth-split__steps li > :first-child, .hearth-split__steps li { white-space: nowrap; }
.hearth-split__steps li::after { order: -1; content: counter(step); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); font-size: .75rem; font-weight: 600; }
.hearth-split__steps li[aria-current="step"] { color: var(--ink); font-weight: 600; }
.hearth-split__steps li[aria-current="step"]::after { background: var(--moss); border-color: var(--moss); color: var(--on-moss); }
.hearth-split__form { display: flex; align-items: center; justify-content: center; padding: var(--space-10) var(--space-5); background: var(--paper); }
@media (max-width: 860px) {
  .hearth-split { grid-template-columns: 1fr; min-height: 0; }
  .hearth-split__app { gap: var(--space-5); padding: var(--space-5) var(--space-4) var(--space-6); }
  .hearth-split__hero { gap: var(--space-4); }
  .hearth-split__hero { display: grid; grid-template-columns: 56px 1fr; align-items: center; column-gap: var(--space-4); }
  .hearth-split__icon { width: 56px; height: 56px; padding: 8px; border-radius: 14px; }
  .hearth-split__name { font-size: 1.5rem; }
  .hearth-split__tag { font-size: 1rem; }
  .hearth-split__perks, .hearth-split__more { grid-column: 1 / -1; }
  .hearth-split__perks, .hearth-split__steps { display: none; }
  .hearth-split__more { font-size: .9375rem; }
  .hearth-split__form { padding: var(--space-6) var(--space-4) var(--space-10); align-items: flex-start; }
}

/* ---- toasts (bottom-right, 360px, 5 s) ---- */
.hearth-toasts { position: fixed; right: var(--space-6); bottom: var(--space-6); z-index: 40; display: flex; flex-direction: column; gap: var(--space-2); width: min(360px, calc(100vw - 2 * var(--space-5))); }

/* ---- mobile (< 1024px): off-canvas sidebar ---- */
@media (max-width: 1023px) {
  .hearth-sidebar { position: fixed; left: 0; top: 0; z-index: 30; transform: translateX(-100%); transition: transform 280ms cubic-bezier(0.2, 0, 0, 1); box-shadow: var(--shadow-lg); }
  .hearth-shell.is-nav-open .hearth-sidebar { transform: none; }
  .hearth-scrim { position: fixed; inset: 0; z-index: 25; background: var(--scrim); }
  .hearth-topbar { padding: 0 var(--space-5); }
  .hearth-topbar .hearth-topbar__mark, .hearth-topbar .hearth-menu-btn { display: inline-flex; }
  .hearth-crumbs { display: none; }
  .hearth-content { padding: var(--space-5); }
  .hearth-pagehead { flex-direction: column; }
}
@media (max-width: 767px) {
  .hearth-codes { grid-template-columns: max-content; }
  .ct-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .ct-table, .ct-table tbody, .ct-table tr, .ct-table td { display: block; }
  .ct-table tr { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); }
  .ct-table td { height: auto; padding: var(--space-1) 0; border: 0; }
  .ct-table td.ct-num { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .hearth-sidebar { transition: none; }
  .ct-spin { animation: none; }
}

/* ---- milestone 2: apps ---- */
.hearth-gap { margin-bottom: var(--space-4); }
.hearth-gap-top { margin-top: var(--space-4); }
.hearth-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); }
.hearth-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6); }
.hearth-summary .hearth-card { padding: var(--space-5); }
.hearth-stat { margin-top: var(--space-1); font-size: 24px; line-height: 30px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hearth-stat__unit { font-size: 14px; font-weight: 500; color: var(--ink-muted); margin-left: 2px; }
.hearth-kv { display: flex; flex-direction: column; margin: 0; }
.hearth-kv > div { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); min-height: 36px; border-bottom: 1px solid var(--line); }
.hearth-kv > div:last-child { border-bottom: 0; }
.hearth-kv dt { color: var(--ink-muted); white-space: nowrap; }
.hearth-kv dd { margin: 0; text-align: right; white-space: nowrap; }
.hearth-kv--creds dd { white-space: normal; overflow-wrap: anywhere; }
/* A long value (an SSH host) goes under its label instead of overflowing the card. */
.hearth-kv > .hearth-kv__wide { flex-direction: column; align-items: stretch; gap: 2px; padding: var(--space-2) 0; }
.hearth-kv__wide dd { text-align: left; white-space: normal; }
.hearth-nowrap { white-space: nowrap; }

/* Custom domain card: name, status and Remove on one line; records and notes below. */
.hearth-domain__head { display: flex; align-items: center; gap: var(--space-3); }
.hearth-domain__name { flex: 1; min-width: 0; margin: 0; }
.hearth-domain__head form { margin: 0; }
.hearth-domain__body { margin-top: var(--space-4); }
.hearth-domain__body > :last-child { margin-bottom: 0; }
.hearth-domain__note { margin-top: var(--space-3); }
.hearth-kv--creds dd { display: flex; align-items: center; gap: var(--space-2); }
.hearth-actions { display: inline-flex; gap: var(--space-2); justify-content: flex-end; flex-wrap: wrap; }

/* wizard: centred 640px column, 48px top padding, 3-step indicator */
.hearth-wizard { max-width: 640px; margin: 0 auto; padding-top: var(--space-12); }
.hearth-wizard__steps { display: flex; gap: var(--space-6); margin: 0 0 var(--space-8); padding: 0; list-style: none; color: var(--ink-muted); }
.hearth-wizard__step { display: flex; align-items: center; gap: var(--space-2); min-height: 32px; }
.hearth-wizard__num { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: var(--radius-full); border: 1px solid var(--line-strong); font-size: 12px; font-weight: 600; }
.hearth-wizard__step.is-done, .hearth-wizard__step.is-current { color: var(--ink); }
.hearth-wizard__step.is-done .hearth-wizard__num, .hearth-wizard__step.is-current .hearth-wizard__num { background: var(--moss); border-color: var(--moss); color: var(--on-moss); }
.hearth-wizard__title { margin-bottom: var(--space-6); }
.hearth-wizard__app { display: flex; gap: var(--space-4); align-items: center; margin-bottom: var(--space-6); }
.hearth-wizard__actions { display: flex; justify-content: flex-end; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-6); }
.hearth-wizard .hearth-grid2 .ct-appcard { height: 100%; }
.hearth-wizard--wide { max-width: 1040px; }
/* Deploy picker: compact cards, three across on wide screens. */
.hearth-picklist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: var(--space-3); }
.hearth-pick { display: flex; gap: var(--space-3); align-items: flex-start; height: 100%; box-sizing: border-box; padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper-raised); color: var(--ink); text-decoration: none; transition: border-color 120ms, box-shadow 120ms; }
.hearth-pick:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.hearth-pick:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.hearth-pick__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.hearth-pick__meta { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); }
.hearth-pick__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hearth-pick__price { flex: none; font-size: 13px; color: var(--ink-subtle); }
.hearth-pick__price strong { color: var(--ink); font-weight: 600; }
.hearth-pick__cat { font-size: 12px; color: var(--ink-subtle); }
.hearth-pick__tagline { margin-top: var(--space-1); font-size: 14px; line-height: 20px; color: var(--ink-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hearth-pick__empty { margin-top: var(--space-6); }

/* deploy progress: the logo's centre pod lights up (hearth fade) when the app is live */
/* Deploy progress: the house is the progress bar (views.launchPods). */
.hearth-launch { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); padding: var(--space-12) var(--space-6) var(--space-8); text-align: center; background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.hearth-launch__mark { width: auto; height: 112px; max-width: 70vw; margin-bottom: var(--space-5); overflow: visible; }
.hearth-launch__roof { stroke: var(--moss); transition: stroke 600ms ease; }
.hearth-launch__pod { transition: fill 400ms ease, stroke 400ms ease; }
.hearth-launch__pod.is-done { fill: var(--moss); }
.hearth-launch__pod.is-current { fill: var(--hearth); animation: ct-glow 1.6s ease-in-out infinite; }
.hearth-launch__pod.is-todo { fill: transparent; stroke: var(--line-strong); stroke-width: 1.5; }
.hearth-launch__pod.is-failed { fill: var(--danger); }
.hearth-launch__pod.is-warm { fill: var(--hearth); }
.hearth-launch__mark.is-warm .hearth-launch__roof { stroke: var(--hearth); }
.hearth-launch .hearth-muted { max-width: 440px; }
.hearth-launch__step { font-weight: 600; color: var(--ink); }
.hearth-launch__count { margin-right: var(--space-2); font-weight: 400; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.hearth-launch__actions { justify-content: center; margin-top: var(--space-4); }
.hearth-progress__note { flex-basis: 100%; text-align: center; }

/* app detail */
.hearth-apphead { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-6); }
.hearth-apphead__titles { flex: 1; min-width: 0; }
.hearth-apphead__name { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.hearth-apphead__addr { display: flex; align-items: center; gap: var(--space-1); margin-top: var(--space-1); color: var(--ink-muted); }
.hearth-apphead .hearth-menu > summary { list-style: none; }
.hearth-cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: var(--space-6); align-items: start; }
.hearth-prose { max-width: var(--prose-max); }
.hearth-prose h2 { font-size: 16px; line-height: 24px; margin: var(--space-4) 0 var(--space-2); }
.hearth-prose p, .hearth-prose ol, .hearth-prose ul { margin: 0 0 var(--space-3); }
.hearth-prose ol, .hearth-prose ul { padding-left: var(--space-5); }
.hearth-prose code { font-family: var(--font-mono); font-size: 13px; overflow-wrap: anywhere; }
/* A command in a README scrolls sideways inside the card instead of running out of it. */
.hearth-prose pre { max-width: 100%; overflow-x: auto; margin: 0 0 var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper-sunken); }
.hearth-prose pre code { overflow-wrap: normal; white-space: pre; }
.hearth-card, .hearth-stack > * { min-width: 0; }
.hearth-live { display: flex; flex-direction: column; gap: var(--space-4); margin: 0; padding: 0; list-style: none; }
.hearth-bar { height: 8px; margin: var(--space-2) 0 var(--space-1); border-radius: var(--radius-full); background: var(--paper-sunken); overflow: hidden; }
.hearth-bar__fill { display: block; height: 100%; border-radius: var(--radius-full); background: var(--moss); }
.hearth-bar__fill.is-warning { background: var(--warning); }
.hearth-bar__fill.is-danger { background: var(--danger); }
.hearth-cap + .hearth-cap { margin-top: var(--space-1); }
.hearth-logs { margin: 0; max-height: 560px; overflow: auto; padding: var(--space-3); background: var(--paper-sunken); border-radius: var(--radius-md); font-family: var(--font-mono); font-size: 13px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.hearth-danger { border-color: var(--danger); }

@media (max-width: 1023px) {
  .hearth-cols, .hearth-grid2, .hearth-summary { grid-template-columns: minmax(0, 1fr); }
  .hearth-wizard { padding-top: 0; }
  .hearth-apphead { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .hearth-launch__pod, .hearth-launch__roof { transition: none; }
  .hearth-launch__pod.is-current { animation: none; }
}

/* apps table: the address truncates (spec) and the table scrolls rather than clipping the cost */
@media (min-width: 768px) {
  .ct-table-wrap { overflow-x: auto; }
  .ct-table__addr { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
  .ct-table td.ct-num { white-space: nowrap; }
}

/* ---- milestone 3: billing ---- */
.hearth-presets { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: 0; padding: 0; border: 0; }
.hearth-presets legend { margin-bottom: var(--space-2); padding: 0; }
.hearth-preset { position: relative; display: flex; flex-direction: column; justify-content: center; min-width: 96px; min-height: 56px; padding: var(--space-2) var(--space-4); border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--paper-raised); cursor: pointer; }
.hearth-preset input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.hearth-preset__amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.hearth-preset:has(input:checked) { border-color: var(--moss); box-shadow: inset 0 0 0 1px var(--moss); background: var(--moss-soft); }
.hearth-preset:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.hearth-chart { margin: 0; }
.hearth-chart svg { display: block; }
.hearth-chart__axis { stroke: var(--line-strong); stroke-width: 1; }
.hearth-chart__bar { fill: var(--moss); }
.hearth-chart__bar.is-today { fill: var(--hearth); }
.hearth-chart__caption { display: flex; justify-content: space-between; margin-top: var(--space-2); }
.hearth-inline-refund { display: inline-flex; gap: var(--space-2); align-items: center; }
.hearth-input-sm { height: var(--control-sm); width: 120px; padding: 0 var(--space-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--paper-raised); color: var(--ink); font: inherit; }
.ct-balance .hearth-kv { margin-top: var(--space-4); }
.ct-balance .hearth-check { margin-top: var(--space-4); align-items: center; }
.ct-balance .hearth-check > div { flex: 1; }

/* ---- milestone 4 ---- */
.hearth-form > .ct-btn--sm { align-self: flex-start; }
.hearth-window { align-items: flex-end; }
.hearth-window > .ct-field { flex: 1; }
.hearth-confirm { width: 300px; padding: var(--space-4); white-space: normal; text-align: left; }

/* ---- maintainers, payouts, abuse (milestone 5) ---- */
.hearth-check .ct-caption { display: block; margin-top: var(--space-1); }
.hearth-badge { margin: var(--space-4) 0 var(--space-3); line-height: 0; }
.hearth-code { margin: var(--space-3) 0; padding: var(--space-3) var(--space-4); font-family: var(--font-mono); font-size: 13px; line-height: 20px; background: var(--paper-sunken); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.hearth-terms { max-height: 360px; overflow-y: auto; padding-right: var(--space-2); }
.hearth-terms h1 { display: none; }
.hearth-textarea { width: 100%; min-height: 120px; padding: var(--space-2) var(--space-3); font: inherit; color: var(--ink); background: var(--paper-raised); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); resize: vertical; }
.hearth-textarea:focus { outline: 2px solid var(--focus); outline-offset: 1px; }
.hearth-error-text { color: var(--danger); }
.hearth-card .hearth-list .ct-caption, .hearth-list .ct-caption.hearth-break { display: block; }
details > summary { cursor: pointer; }
fieldset.hearth-card { margin: 0; min-width: 0; }
fieldset.hearth-card > legend { float: left; width: 100%; padding: 0; margin-bottom: var(--space-4); }
fieldset.hearth-card > legend + * { clear: both; }

/* ---- spacing and form fixes ---- */
/* Whatever directly follows a banner (its buttons, a form) gets room to breathe. */
.ct-banner + * { margin-top: var(--space-4); }
/* A divider between blocks gets space on both sides, not only below. */
.hearth-rule.hearth-gap { margin-block: var(--space-6); }
/* Selects: our own chevron, inset from the right edge like the text padding. */
select.ct-field__input { appearance: none; -webkit-appearance: none; padding-right: calc(var(--space-3) * 2 + 16px); cursor: pointer; }
.ct-field__control:has(> select) { position: relative; }
.ct-field__control:has(> select)::after {
  content: ""; position: absolute; right: var(--space-3); top: 50%; width: 16px; height: 16px; margin-top: -8px;
  background: var(--ink-muted); pointer-events: none;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
}

/* account limits: one row per limit, with a bar that warms as it fills */
.hearth-limits__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-2); }
.hearth-limits__head .hearth-section__title { margin-bottom: 0; }
.hearth-limits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.hearth-limits__row { display: grid; grid-template-columns: 1fr auto; gap: var(--space-1) var(--space-3); align-items: baseline; }
.hearth-limits__label { font-weight: 600; }
.hearth-limits__track { grid-column: 1 / -1; display: block; height: 8px; border-radius: var(--radius-full); background: var(--paper-sunken); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.hearth-limits__fill { display: block; height: 100%; border-radius: inherit; background: var(--moss); }
.hearth-limits__track.is-high .hearth-limits__fill { background: var(--warning); }
.hearth-limits__track.is-full .hearth-limits__fill { background: var(--danger); }
.hearth-limits__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-3); }
.hearth-quote { margin: 0; padding: var(--space-2) var(--space-3); border-left: 3px solid var(--line-strong); color: var(--ink-muted); white-space: pre-wrap; }
