/* Bundled fonts (SIL Open Font License): Playfair Display for headings,
   Inter for text - the same pairing as the Pierr app. Latin + Latin Extended
   cover all 12 languages. */
@font-face { font-family: 'Playfair Display'; font-style: normal; font-display: swap; font-weight: 400 900;
  src: url(/fonts/playfair-display-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Playfair Display'; font-style: normal; font-display: swap; font-weight: 400 900;
  src: url(/fonts/playfair-display-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/fonts/inter-latin-ext-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/fonts/inter-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* =========================================================================
   Fengonize — mobile app design system
   Built for a Capacitor shell: safe areas, bottom tab bar, sheets, no hover
   dependence. Calm warm neutrals with the five elements as accents.
   ========================================================================= */

:root {
  color-scheme: light;

  --bg:            #f6f3ed;
  --bg-elevated:   #fffdfa;
  --bg-sunken:     #ece6db;
  --surface:       #ffffff;
  --surface-2:     #faf7f1;
  --border:        #e4ddd1;
  --border-strong: #cec3b1;

  --ink:           #201d18;
  --ink-soft:      #5d564a;
  --ink-faint:     #918a7c;

  --accent:        #8a6d3b;
  --accent-ink:    #ffffff;
  --accent-soft:   #b99a63;
  --accent-bg:     #f2e9d8;

  --el-wood:  #3f9d5a;
  --el-fire:  #e0533d;
  --el-earth: #c99a49;
  --el-metal: #8f9aa7;
  --el-water: #3a6ea5;

  --ok:     #3f9d5a;
  --warn:   #d98a2b;
  --danger: #d6482f;
  --info:   #3a6ea5;

  --r-sm: 10px;
  --r:    16px;
  --r-lg: 22px;
  --r-xl: 28px;

  --shadow-sm: 0 1px 2px rgba(32, 29, 24, .06);
  --shadow:    0 2px 8px rgba(32, 29, 24, .07), 0 12px 28px rgba(32, 29, 24, .05);
  --shadow-lg: 0 8px 24px rgba(32, 29, 24, .12), 0 28px 64px rgba(32, 29, 24, .14);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-display: "Playfair Display", "Iowan Old Style", "Palatino Linotype", Georgia, serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-h: 54px;
  --tabbar-h: 58px;
  --maxw: 560px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg:            #141310;
  --bg-elevated:   #1d1b16;
  --bg-sunken:     #0e0d0a;
  --surface:       #201e18;
  --surface-2:     #262319;
  --border:        #322e24;
  --border-strong: #4a4536;

  --ink:           #efeadf;
  --ink-soft:      #b4ad9e;
  --ink-faint:     #868071;

  --accent:        #c9a869;
  --accent-ink:    #1a1710;
  --accent-soft:   #8d7743;
  --accent-bg:     #2b2619;

  --el-metal: #9aa5b1;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow:    0 2px 10px rgba(0, 0, 0, .5);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { overflow: hidden; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.18; margin: 0 0 .35em; letter-spacing: -.015em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: .95rem; font-weight: 650; margin: 0 0 .4em; }
p { margin: 0 0 .9em; }
a { color: var(--accent); text-decoration: none; }
small { font-size: .8rem; }

/* ===================================================================== app */
#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 18px);
  animation: screenIn .22s cubic-bezier(.22, .9, .3, 1) both;
}
.screen.no-tabs { padding-bottom: calc(var(--safe-bottom) + 18px); }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.pad { padding: 0 16px; max-width: var(--maxw); margin: 0 auto; }
.pad-t { padding-top: 14px; }

/* ================================================================== header */
.appbar {
  flex: none;
  padding-top: var(--safe-top);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
  z-index: 20;
}
.appbar.scrolled { border-bottom-color: var(--border); }
.appbar-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  max-width: var(--maxw);
  margin: 0 auto;
}
.appbar-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 650;
  flex: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.appbar-btn {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border: none; background: none; color: var(--ink);
  border-radius: 50%; cursor: pointer;
  transition: background .15s;
}
.appbar-btn:active { background: var(--bg-sunken); }
.appbar-spacer { width: 38px; flex: none; }

/* Large title that sits under the bar */
.big-title { padding: 6px 16px 10px; max-width: var(--maxw); margin: 0 auto; }
.big-title h1 { margin: 0 0 3px; }
.big-title p { margin: 0; color: var(--ink-soft); font-size: .92rem; }

/* ================================================================ tab bar */
.tabbar {
  flex: none;
  position: relative;
  z-index: 30;
  padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--border);
}
.tabbar-inner {
  height: var(--tabbar-h);
  display: flex;
  max-width: var(--maxw);
  margin: 0 auto;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: none;
  color: var(--ink-faint);
  font: inherit;
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  padding: 0;
  transition: color .18s;
  position: relative;
}
.tab svg { width: 23px; height: 23px; transition: transform .2s cubic-bezier(.2,.9,.3,1); }
.tab.on { color: var(--accent); }
.tab.on svg { transform: translateY(-1px) scale(1.06); }
.tab:active svg { transform: scale(.9); }

/* prominent centre action */
.tab.primary { color: var(--ink-faint); }
.tab.primary .fab {
  width: 46px; height: 46px; margin-top: -4px; /* sits nearly in line with the other tabs */
  border-radius: 16px;
  background: linear-gradient(160deg, var(--accent-soft), var(--accent));
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 42%, transparent);
  transition: transform .18s cubic-bezier(.2,.9,.3,1);
}
.tab.primary:active .fab { transform: scale(.92); }
.tab.primary .fab svg { width: 24px; height: 24px; }

/* ================================================================== cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}
.card.flush { padding: 0; overflow: hidden; }
.card.accent { background: var(--accent-bg); border-color: var(--accent-soft); }
.card-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.card-head h3, .card-head h4 { margin: 0; flex: 1; }

.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: none; border-left: none; border-right: none; border-top: none;
  width: 100%; text-align: left; font: inherit; color: var(--ink);
  cursor: pointer;
}
.list-row:last-child { border-bottom: none; }
.list-row:active { background: var(--bg-sunken); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .chev { color: var(--ink-faint); flex: none; }
.row-title { font-weight: 600; font-size: .95rem; }
.row-sub { font-size: .82rem; color: var(--ink-soft); margin-top: 1px; }

/* ================================================================ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 20px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink);
  font: inherit; font-weight: 650; font-size: .95rem;
  cursor: pointer;
  transition: transform .12s, opacity .12s;
  min-height: 46px;
}
.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .45; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; border-color: var(--border-strong); color: var(--ink); }
.btn.subtle { background: var(--bg-sunken); color: var(--ink); }
.btn.sm { padding: 8px 14px; font-size: .85rem; min-height: 36px; border-radius: 11px; }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.link { background: none; color: var(--accent); padding: 6px 4px; min-height: 0; font-weight: 600; }

/* ================================================================== forms */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: .82rem; font-weight: 650; color: var(--ink-soft); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select, textarea {
  width: 100%;
  padding: 13px 14px;
  font: inherit;
  font-size: 16px; /* prevents iOS zoom on focus */
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 13px;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-faint) 50%),
                    linear-gradient(135deg, var(--ink-faint) 50%, transparent 50%);
  background-position: calc(100% - 19px) 50%, calc(100% - 14px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 38px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
textarea { resize: none; min-height: 100px; line-height: 1.5; }
.hint { font-size: .79rem; color: var(--ink-faint); margin-top: 5px; line-height: 1.45; }

/* segmented control */
.seg {
  display: flex; background: var(--bg-sunken); border-radius: 12px; padding: 3px; gap: 3px;
}
.seg button {
  flex: 1; border: none; background: none; color: var(--ink-soft);
  padding: 8px 10px; border-radius: 9px; font: inherit; font-size: .85rem;
  font-weight: 600; cursor: pointer; transition: .16s;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* choice chips / tiles */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 14px; border-radius: 999px;
  border: 1.5px solid var(--border); background: var(--surface);
  font: inherit; font-size: .87rem; font-weight: 600; color: var(--ink);
  cursor: pointer; transition: .15s;
}
.chip.on { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.chip:active { transform: scale(.96); }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.tile {
  border: 1.5px solid var(--border); background: var(--surface);
  border-radius: var(--r-sm); padding: 13px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  font: inherit; font-size: .76rem; font-weight: 600; color: var(--ink);
  cursor: pointer; transition: .15s; text-align: center; line-height: 1.2;
}
.tile svg { width: 26px; height: 26px; opacity: .8; }
.tile.on { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.tile.on svg { opacity: 1; }
.tile:active { transform: scale(.96); }

/* toggle switch */
.switch { position: relative; width: 48px; height: 29px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i {
  position: absolute; inset: 0; border-radius: 99px;
  background: var(--border-strong); transition: background .2s; pointer-events: none;
}
.switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 23px; height: 23px; border-radius: 50%; background: #fff;
  box-shadow: var(--shadow-sm); transition: transform .2s cubic-bezier(.2,.9,.3,1);
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(19px); }

/* ================================================================= badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font-size: .72rem; font-weight: 700; letter-spacing: .01em;
  background: var(--bg-sunken); color: var(--ink-soft);
}
.badge.pro { background: linear-gradient(135deg, #c9a869, #8a6d3b); color: #fff; }
.badge.sev-5, .badge.sev-4 { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.badge.sev-3 { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge.sev-2, .badge.sev-1 { background: color-mix(in srgb, var(--info) 14%, transparent); color: var(--info); }
.badge.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }

.act-chip {
  flex: none; padding: 3px 8px; border-radius: 7px;
  font-size: .68rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .04em; color: #fff;
}

/* ============================================================= score ring */
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .num { font-family: var(--font-display); font-size: 2.3rem; font-weight: 650; line-height: 1; }
.ring .lbl { font-size: .68rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; }

/* =============================================================== findings */
.finding {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--r-sm); padding: 14px; margin-bottom: 10px;
}
.finding.s5, .finding.s4 { border-left-color: var(--danger); }
.finding.s3 { border-left-color: var(--warn); }
.finding.s2, .finding.s1 { border-left-color: var(--info); }
.finding h4 { margin: 0 0 3px; }
.finding .principle { font-size: .73rem; color: var(--ink-faint); font-style: italic; }
.finding .msg { font-size: .9rem; margin: 7px 0 0; }
.finding .why { font-size: .86rem; color: var(--ink-soft); margin: 7px 0 0; }

.action {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 0 0; margin-top: 11px; border-top: 1px dashed var(--border);
}
.action .txt { font-size: .85rem; min-width: 0; }
.action .txt strong { display: block; font-size: .89rem; margin-bottom: 2px; }
.action .txt span { color: var(--ink-soft); }

/* =============================================================== tasks */
.task {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 13px; margin-bottom: 9px;
  transition: opacity .2s;
}
.task.done { opacity: .5; }
.task.done .t-title { text-decoration: line-through; }
.task .cbx {
  width: 24px; height: 24px; flex: none; margin-top: 1px;
  border-radius: 8px; border: 2px solid var(--border-strong);
  display: grid; place-items: center; cursor: pointer;
  background: none; color: transparent; transition: .15s; padding: 0;
}
.task.done .cbx { background: var(--ok); border-color: var(--ok); color: #fff; }
.t-title { font-weight: 600; font-size: .92rem; }
.t-detail { font-size: .84rem; color: var(--ink-soft); margin-top: 3px; }

.progress { height: 7px; border-radius: 99px; background: var(--bg-sunken); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent-soft), var(--accent)); transition: width .5s cubic-bezier(.2,.9,.3,1); }

/* ============================================================ scroll tabs */
.stabs {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px 16px 12px;
  scrollbar-width: none; max-width: var(--maxw); margin: 0 auto;
}
.stabs::-webkit-scrollbar { display: none; }
.stabs button {
  flex: none; border: 1px solid var(--border); background: var(--surface);
  color: var(--ink-soft); font: inherit; font-size: .84rem; font-weight: 600;
  padding: 8px 14px; border-radius: 999px; cursor: pointer; transition: .15s;
}
.stabs button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ============================================================== floorplan */
.plan-wrap {
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--r); padding: 10px; margin-bottom: 12px;
}
.plan-wrap canvas { width: 100%; height: auto; display: block; border-radius: var(--r-sm); touch-action: manipulation; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: .75rem; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.swatch { width: 11px; height: 11px; border-radius: 3px; }

/* ================================================================= locked */
.locked {
  border: 1px dashed var(--accent-soft); border-radius: var(--r);
  padding: 22px 18px; text-align: center; background: var(--accent-bg);
  margin-bottom: 12px;
}
.locked .ico { font-size: 1.6rem; margin-bottom: 4px; }
.locked strong { display: block; margin-bottom: 4px; }
.locked p { font-size: .86rem; color: var(--ink-soft); margin: 0 0 14px; }

/* ================================================================ capture */
.capture {
  border: 2px dashed var(--border-strong); border-radius: var(--r);
  padding: 28px 18px; text-align: center; background: var(--surface-2);
  cursor: pointer; transition: .18s;
}
.capture:active { transform: scale(.99); border-color: var(--accent); }
.capture .big { font-size: 1.9rem; margin-bottom: 6px; }

.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: var(--bg-sunken); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button {
  position: absolute; top: 5px; right: 5px; width: 24px; height: 24px;
  border-radius: 50%; border: none; background: rgba(0,0,0,.6); color: #fff;
  font-size: .85rem; line-height: 1; cursor: pointer; display: grid; place-items: center;
}

/* ================================================================== chat */
.chat-log { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 8px; }
.msg { padding: 11px 14px; border-radius: 17px; max-width: 86%; font-size: .9rem; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 5px; }
.msg.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.chat-bar { display: flex; gap: 8px; align-items: flex-end; }
.chat-bar input { flex: 1; }

/* ============================================================== bagua map */
.bagua { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.bagua-cell {
  aspect-ratio: 1; border-radius: var(--r-sm); padding: 8px;
  display: flex; flex-direction: column; justify-content: space-between;
  border: 1px solid var(--border); font-size: .7rem; line-height: 1.2;
  cursor: pointer; transition: transform .15s;
}
.bagua-cell:active { transform: scale(.96); }
.bagua-cell .zn { font-weight: 700; }
.bagua-cell .zs { font-family: var(--font-display); font-size: 1.05rem; font-weight: 650; }

/* ================================================================= sheets */
.scrim {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0, 0, 0, .42);
  animation: fadeIn .18s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 91;
  background: var(--bg-elevated);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 10px 16px calc(18px + var(--safe-bottom));
  max-height: 86vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: sheetUp .28s cubic-bezier(.22, .9, .3, 1) both;
  max-width: var(--maxw); margin: 0 auto;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet-grip { width: 38px; height: 4px; border-radius: 99px; background: var(--border-strong); margin: 0 auto 14px; }
.sheet h3 { margin-bottom: 10px; }

/* ================================================================= toasts */
.toasts {
  position: fixed; left: 0; right: 0; z-index: 120;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; padding: 0 16px;
}
.toast {
  background: var(--ink); color: var(--bg);
  padding: 11px 18px; border-radius: 999px;
  font-size: .87rem; font-weight: 550; box-shadow: var(--shadow-lg);
  max-width: 100%; text-align: center;
  animation: toastIn .24s cubic-bezier(.2,.9,.3,1) both;
}
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }

/* ================================================================ loaders */
.loader { text-align: center; padding: 48px 20px; }
.spinner {
  width: 40px; height: 40px; margin: 0 auto 16px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.steps { list-style: none; padding: 0; margin: 20px auto 0; max-width: 300px; text-align: left; font-size: .88rem; }
.steps li { padding: 6px 0 6px 26px; color: var(--ink-faint); position: relative; transition: color .3s; }
.steps li::before { content: "○"; position: absolute; left: 4px; }
.steps li.on { color: var(--ink); font-weight: 600; }
.steps li.on::before { content: "◍"; color: var(--accent); }
.steps li.done { color: var(--ok); }
.steps li.done::before { content: "●"; color: var(--ok); }

.skeleton {
  background: linear-gradient(90deg, var(--bg-sunken) 25%, var(--surface-2) 50%, var(--bg-sunken) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ================================================================== empty */
.empty { text-align: center; padding: 48px 24px; color: var(--ink-faint); }
.empty .big { font-size: 2.4rem; margin-bottom: 10px; opacity: .6; }
.empty h3 { color: var(--ink); }

/* ================================================================= misc */
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mt { margin-top: 14px; }
.mt-lg { margin-top: 26px; }
.mb0 { margin-bottom: 0; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); border: none; margin: 18px 0; }
.stat-num { font-family: var(--font-display); font-size: 1.4rem; font-weight: 650; line-height: 1.1; }
.stat-lbl { font-size: .72rem; color: var(--ink-faint); }
.el-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }

/* onboarding hero */
.hero { padding: 26px 20px 20px; text-align: center; }
.hero .mark { width: 72px; height: 72px; margin: 0 auto 18px; color: var(--accent); }
.hero h1 { font-size: 2rem; }
.hero p { color: var(--ink-soft); font-size: .98rem; }

.feature-row { display: flex; gap: 13px; align-items: flex-start; margin-bottom: 18px; text-align: left; }
.feature-row .ico {
  width: 38px; height: 38px; flex: none; border-radius: 11px;
  background: var(--accent-bg); color: var(--accent); display: grid; place-items: center;
}
.feature-row h4 { margin: 0 0 2px; }
.feature-row p { margin: 0; font-size: .86rem; color: var(--ink-soft); }

/* learn article */
.article-body p { font-size: .95rem; line-height: 1.62; color: var(--ink-soft); }
.article-body p:first-child { color: var(--ink); font-size: 1rem; }
.glossary-term { font-weight: 650; font-size: .93rem; }
.glossary-def { font-size: .86rem; color: var(--ink-soft); margin-top: 2px; }

/* plan cards */
.plan-card { border: 1.5px solid var(--border); border-radius: var(--r-lg); padding: 20px; background: var(--surface); margin-bottom: 14px; }
.plan-card.hl { border-color: var(--accent); box-shadow: var(--shadow); }
.plan-card .price { font-family: var(--font-display); font-size: 1.9rem; font-weight: 650; margin: 4px 0 0; }
.plan-card ul { list-style: none; padding: 0; margin: 16px 0; }
.plan-card li { padding: 5px 0 5px 24px; position: relative; font-size: .88rem; color: var(--ink-soft); }
.plan-card li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 800; }

@media (min-width: 620px) {
  .screen { padding-left: 0; padding-right: 0; }
}

/* =========================================================================
   Shared report — a client-facing page that also prints cleanly to PDF
   ========================================================================= */

.report-head {
  text-align: center;
  padding: 18px 0 8px;
}
.report-head .brand {
  font-family: var(--font-display);
  font-size: .82rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 14px;
}
.report-head h1 { margin: 0 0 4px; }
.report-meta { color: var(--ink-soft); font-size: .86rem; }

.report-section { margin-top: 26px; }
.report-section > h2 {
  font-size: 1.15rem;
  padding-bottom: 7px;
  border-bottom: 2px solid var(--accent);
  margin-bottom: 14px;
}

.report-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  break-inside: avoid;
}
.report-item:last-child { border-bottom: none; }
.report-item h4 { margin: 0 0 3px; }
.report-item .why { font-size: .86rem; color: var(--ink-soft); margin: 6px 0 0; }

.report-actions { list-style: none; padding: 0; margin: 9px 0 0; }
.report-actions li {
  font-size: .86rem;
  padding: 5px 0 5px 16px;
  position: relative;
  color: var(--ink-soft);
}
.report-actions li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
}
.report-actions li strong { color: var(--ink); }

.report-footer {
  margin-top: 30px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: .76rem;
  color: var(--ink-faint);
  text-align: center;
}

@media print {
  /* Chrome/Safari "Save as PDF" produces a proper file from this. */
  :root { --bg: #fff; --surface: #fff; --bg-sunken: #f4f1ea; }
  html, body { background: #fff; height: auto; overflow: visible; font-size: 11pt; }
  body { color: #000; }

  #app { position: static; display: block; }
  .screen { overflow: visible; padding: 0; animation: none; }
  .appbar, .tabbar, .toasts, .no-print { display: none !important; }

  .pad { max-width: none; padding: 0; }
  .card { box-shadow: none; border-color: #ddd; break-inside: avoid; }
  .report-section { break-inside: auto; }
  .report-section > h2 { break-after: avoid; }
  .plan-wrap { border-color: #ddd; background: #fff; break-inside: avoid; }
  canvas { max-width: 100%; }
  a { text-decoration: none; color: #000; }
  @page { margin: 16mm 14mm; }
}

/* ------------------------------------------------------------ credits */
.credit-card .credit-total {
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--accent);
}

.price-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.price-table th {
  text-align: left;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-faint);
  padding: 10px 14px 6px;
  border-bottom: 1px solid var(--border);
}
.price-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.price-table tr:last-child td { border-bottom: 0; }
.price-table .pt-label { font-weight: 600; color: var(--ink); }
.price-table .pt-note { font-size: .78rem; color: var(--ink-faint); margin-top: 2px; }
.price-table .pt-cost {
  text-align: right;
  white-space: nowrap;
  font-weight: 700;
  color: var(--accent);
}
.price-table .pt-cost.free { color: var(--ok); }
.price-table th.pt-cost { color: var(--ink-faint); font-weight: 600; }
.price-table .pt-pro td { background: var(--accent-bg); }

.pack-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 4px;
}
.pack {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px 8px 12px;
  text-align: center;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.pack.best { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.pack .pack-n { font-size: 1.6rem; font-weight: 700; color: var(--ink); line-height: 1.1; }
.pack .pack-unit { font-size: .75rem; color: var(--ink-faint); }
.pack .pack-price { margin-top: 8px; font-size: .85rem; font-weight: 600; color: var(--accent); }
.pack .pack-star {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: var(--accent-ink);
  font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: 99px;
}
.pack:disabled { opacity: .6; }

/* -------------------------------------------------------- collapsibles */
.fold { margin-top: 12px; }
.fold-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  list-style: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.fold-head::-webkit-details-marker { display: none; }
.fold-head::marker { content: ''; }
.fold-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fold-ico { display: inline-flex; color: var(--accent); flex: none; }
.fold-ico svg { width: 20px; height: 20px; }
.fold-title { flex: 1; font-weight: 600; font-size: .98rem; color: var(--ink); }
.fold-chev { display: inline-flex; color: var(--ink-faint); flex: none; transition: transform .2s ease; }
.fold-chev svg { width: 18px; height: 18px; }
.fold[open] > .fold-head .fold-chev { transform: rotate(90deg); }
.fold-body { padding-top: 8px; }
.fold-body > .card:last-child { margin-bottom: 0; }
@media (prefers-reduced-motion: reduce) { .fold-chev { transition: none; } }
.plan-card .price .per { font-family: var(--font); font-size: .9rem; font-weight: 500; color: var(--ink-faint); }

/* ------------------------------------------------------------ sign-up */
.auth-mark { width: 92px; height: 72px; color: var(--accent); margin: 6px auto 20px; }
.field-label { font-size: .82rem; font-weight: 600; color: var(--ink-soft); margin: 4px 0 8px; }
.field-error { color: var(--danger); font-size: .82rem; margin: 6px 0 0; }
.type-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  padding: 14px 13px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font: inherit;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.type-option:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.type-option[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-bg);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.type-ico { display: inline-flex; color: var(--accent); margin-bottom: 4px; }
.type-ico svg { width: 22px; height: 22px; }
.type-title { font-weight: 700; font-size: .95rem; color: var(--ink); }
.type-sub { font-size: .78rem; color: var(--ink-faint); line-height: 1.35; }

.delete-note {
  font-size: .85rem;
  color: var(--ink);
  background: var(--accent-bg);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin: 0 0 14px;
}

.lang-select {
  flex: none;
  width: auto;
  padding: 0 12px;
  min-height: 46px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

/* ---------------------------------------------- Sign in with Apple / Google */
.social-box { margin: 4px 0 6px; }
.social-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 600; margin-bottom: 10px;
}
.social-btn .social-logo { display: inline-flex; }
/* Apple's rule: black with white text, or white on a dark background. */
.social-btn.apple { background: #000; color: #fff; border: 1px solid #000; }
.social-btn.google { background: #fff; color: #1f1f1f; border: 1px solid #dadce0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .social-btn.apple { background: #fff; color: #000; border-color: #fff; }
}
:root[data-theme="dark"] .social-btn.apple { background: #fff; color: #000; border-color: #fff; }
.or-divider {
  display: flex; align-items: center; gap: 12px; margin: 8px 0 14px;
  color: var(--ink-faint); font-size: .82rem;
}
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ------------------------------------------------------------ Kua calculator */
.kua-hero { display:flex; align-items:center; gap:16px; }
.kua-number {
  width:64px; height:64px; border-radius:50%; flex:none;
  display:flex; align-items:center; justify-content:center;
  background:var(--accent); color:#fff; font:600 2rem/1 Georgia, serif;
}
.kua-label { font-size:.8rem; color:var(--ink-faint); text-transform:uppercase; letter-spacing:.06em; }
.kua-group { font-weight:600; font-size:1.05rem; margin:2px 0; }
.kua-quick { display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--border); font-size:.92rem; }
.kua-quick:last-child { border-bottom:0; }
.kua-dir { padding:8px 0 8px 10px; border-left:3px solid var(--border); margin-bottom:8px; }
.kua-dir.good { border-left-color:#5a8f5a; }
.kua-dir.bad { border-left-color:#b5574b; }
.kua-dir-head { display:flex; justify-content:space-between; gap:10px; font-size:.92rem; }
.kua-dir-head span { color:var(--ink-soft); text-align:right; }
.kua-dir p { margin:3px 0 0; font-size:.84rem; color:var(--ink-soft); }

/* Which feng shui school a finding comes from */
.school-tag {
  display:inline-block; font-size:.68rem; font-weight:600; letter-spacing:.03em; text-transform:uppercase;
  padding:1px 7px; margin-right:6px; border-radius:999px; vertical-align:1px;
  border:1px solid var(--border-strong); color:var(--ink-soft);
}

/* -------------------------------------------- picking pieces on the plan */
.tappable { cursor: pointer; }
.finding.tappable:active, .row.tappable:active { opacity: .85; }
.picked { background: var(--accent-bg); }
.show-on-plan {
  display: flex; align-items: center; gap: 6px; margin-top: 10px;
  font-size: .8rem; font-weight: 600; color: var(--accent);
}
.pick-card { position: relative; border-color: var(--accent); }
.pick-card .pick-item + .pick-item { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.pick-close {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-soft); display: flex; align-items: center; justify-content: center;
}
.pick-close svg { width: 16px; height: 16px; }

/* door / window / balcony door / balcony switch: two rows on narrow screens */
.seg.wrap4 { flex-wrap: wrap; }
.seg.wrap4 button { flex: 1 1 45%; }

/* ------------------------------------------------------------ shop links */
.shop-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font-size: .78rem; }
.shop-chip {
  display: inline-block; padding: 4px 10px; border-radius: 999px; text-decoration: none;
  border: 1px solid var(--border-strong); color: var(--ink); background: var(--surface);
  font-weight: 600; font-size: .78rem;
}
.shop-chip:active { transform: scale(.96); }

/* =====================================================================
   Home - magazine style (after the Pierr app)
   ===================================================================== */
.home { padding-top: calc(env(safe-area-inset-top, 0px) + 18px); }
.home-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 4px 0 18px; }
.home-date { color: var(--ink-faint); font-size: .92rem; text-transform: lowercase; }
.home-date::first-letter { text-transform: uppercase; }
.home-hello { font-family: var(--font-display); font-size: 1.55rem; font-weight: 600; margin: 2px 0 0; letter-spacing: -.01em; }
.home-avatar {
  width: 52px; height: 52px; border-radius: 50%; border: 0; flex: none; cursor: pointer;
  background: #b5634b; color: #fff; font: 600 1.35rem var(--font-display);
}

.hero-card {
  position: relative; overflow: hidden; border-radius: 28px; min-height: 300px;
  background-size: cover; background-position: center right; color: #fff;
  box-shadow: var(--shadow); display: flex; align-items: flex-end;
}
.hero-shade {
  position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(28, 22, 16, .86) 0%, rgba(28, 22, 16, .62) 48%, rgba(28, 22, 16, .10) 100%),
              linear-gradient(0deg, rgba(28, 22, 16, .55) 0%, rgba(28, 22, 16, 0) 45%);
}
.hero-body { position: relative; padding: 26px 22px 24px; max-width: 92%; }
.eyebrow { font-size: .74rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: #d9b26a; }
.hero-title { font-family: var(--font-display); color: #fff; font-size: 2.05rem; line-height: 1.12; margin: 10px 0 10px; }
.hero-sub { color: rgba(255, 255, 255, .86); font-size: .98rem; line-height: 1.45; margin: 0 0 18px; }
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer;
  border-radius: 999px; padding: 14px 24px; font: 600 1rem var(--font); margin: 0 0 10px; width: 100%;
}
.pill svg { width: 20px; height: 20px; }
.pill.light { background: #faf6ef; color: #201a14; border: 0; }
.pill.outline { background: transparent; color: #fff; border: 1.5px solid rgba(255, 255, 255, .7); }
.pill:active { transform: scale(.98); }

.section-label {
  margin: 28px 4px 12px; font-size: .78rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-soft);
}

.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.photo-card {
  position: relative; overflow: hidden; display: block; width: 100%; border: 0; padding: 0; cursor: pointer;
  border-radius: 24px; aspect-ratio: 3 / 4; background-size: cover; background-position: center;
  color: #fff; text-align: left; font: inherit; box-shadow: var(--shadow-sm);
}
.photo-card.wide { aspect-ratio: 16 / 10; margin-bottom: 12px; }
.photo-shade { position: absolute; inset: 0; background: linear-gradient(0deg, rgba(24, 19, 14, .78) 0%, rgba(24, 19, 14, .12) 55%, rgba(24, 19, 14, 0) 100%); }
.photo-text { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 18px; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.photo-title { font: 600 1.12rem var(--font); line-height: 1.25; }
.photo-card.wide .photo-title { font: 600 1.45rem var(--font-display); }
.photo-sub { font-size: .86rem; opacity: .88; margin-top: 4px; line-height: 1.35; }
.photo-arrow { flex: none; display: flex; }
/* Small round icon in the corner of a photo card (the two start cards). */
.photo-icon {
  position: absolute; top: 14px; left: 14px; width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(250, 246, 239, .92); color: #2b2219;
}
.photo-icon svg { width: 20px; height: 20px; }
.start-grid { margin-top: 0; }
.start-grid .photo-card { aspect-ratio: 4 / 5; }
.photo-arrow svg { width: 20px; height: 20px; }
.photo-card:active { transform: scale(.985); }

.nudge {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 14px; padding: 14px 16px; cursor: pointer;
  border-radius: 20px; border: 1px solid var(--accent-soft); background: var(--accent-bg); color: var(--ink); text-align: left; font: inherit;
}
.nudge p { margin: 3px 0 0; font-size: .84rem; color: var(--ink-soft); }
.room-card { border-radius: 22px; }
.room-score {
  width: 50px; height: 50px; border-radius: 50%; border: 2px solid; flex: none;
  display: flex; align-items: center; justify-content: center; font: 600 1.25rem var(--font-display);
}

/* =====================================================================
   AI advisor (centre tab)
   ===================================================================== */
/* A screen that fills the height and does not scroll as a page (see renderView fill). */
.screen.fill { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0; }

.advisor {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 0;
}
/* Only the conversation scrolls; the header and the input stay put. */
.advisor-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
.advisor-head { flex: none; display: flex; align-items: center; gap: 14px; margin: 0 0 14px; }
.advisor-avatar {
  width: 52px; height: 52px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center;
  background: #2b2219; color: #d9b26a;
}
.advisor-avatar svg { width: 24px; height: 24px; }
.eyebrow.dark { color: var(--accent); }
.advisor .chat-log { gap: 12px; }
.advisor .msg { font-size: .95rem; line-height: 1.45; }
.msg.typing { color: var(--ink-faint); }
/* Suggested questions: stacked under the greeting, as quick replies. */
.advisor-suggest { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: 12px 0 0; }
.advisor-suggest:empty { display: none; }
.advisor-suggest .chip { text-align: left; white-space: normal; padding: 10px 16px; border-radius: 18px; }
.advisor-suggest .chip { cursor: pointer; font: 500 .86rem var(--font); }
/* Simply at the end of the conversation, under the suggested questions - nothing
   scrolls behind it. The screen opens (and stays) scrolled to the end. */
.advisor-bar { flex: none; padding: 8px 0 10px; }
.advisor-input {
  display: flex; align-items: flex-end; gap: 8px; max-width: 680px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 26px; padding: 4px 4px 4px 16px;
  box-shadow: var(--shadow);
}
/* Override the global form-field look: one line that grows, no box of its own. */
.advisor-input textarea,
.advisor-input textarea:focus {
  flex: 1; min-width: 0; width: auto; min-height: 0; height: 40px; max-height: 140px;
  border: 0; border-radius: 0; outline: 0; box-shadow: none; resize: none;
  background: transparent; color: var(--ink); font: 400 1rem/1.4 var(--font); padding: 9px 0;
}
.advisor-send {
  width: 42px; height: 42px; border-radius: 50%; border: 0; flex: none; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center;
}
.advisor-send svg { width: 20px; height: 20px; }
.advisor-send:disabled { opacity: .5; }

.empty-rooms { display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }

/* ---------------------------------------------- Scan: room type tiles */
.room-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.room-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 16px 6px 12px; min-height: 104px; cursor: pointer; font: inherit; text-align: center;
  border-radius: 18px; border: 1.5px solid var(--border); background: var(--surface); color: var(--ink);
  transition: border-color .15s, background .15s;
}
.room-tile-icon {
  width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--bg-sunken); color: var(--ink-soft);
}
.room-tile-icon svg { width: 24px; height: 24px; }
.room-tile-name { font-size: .78rem; font-weight: 600; line-height: 1.2; }
.room-tile-check {
  position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%;
  display: none; align-items: center; justify-content: center; background: var(--accent); color: #fff;
}
.room-tile-check svg { width: 12px; height: 12px; }
.room-tile.on { border-color: var(--accent); background: var(--accent-bg); }
.room-tile.on .room-tile-icon { background: var(--accent); color: #fff; }
.room-tile.on .room-tile-check { display: flex; }
.room-tile:active { transform: scale(.97); }

/* =====================================================================
   Page header (shared by every screen, after the Home screen)
   ===================================================================== */
.screen > .pad:first-child .page-head:first-child,
.screen > .pad:first-child .page-banner:first-child { margin-top: calc(env(safe-area-inset-top, 0px) + 14px); }
.page-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; }
.page-title { font-family: var(--font-display); font-size: 2.05rem; font-weight: 600; margin: 2px 0 0; letter-spacing: -.01em; }
.page-sub { color: var(--ink-soft); font-size: .95rem; margin: 6px 0 0; line-height: 1.45; }
.page-banner {
  position: relative; overflow: hidden; border-radius: 26px; min-height: 190px; margin: 4px 0 6px;
  background-size: cover; background-position: center; color: #fff; display: flex; align-items: flex-end;
  box-shadow: var(--shadow);
}
.page-banner-shade {
  position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(28, 22, 16, .84) 0%, rgba(28, 22, 16, .55) 55%, rgba(28, 22, 16, .15) 100%),
              linear-gradient(0deg, rgba(28, 22, 16, .45) 0%, rgba(28, 22, 16, 0) 50%);
}
.page-banner-body { position: relative; padding: 20px 20px 18px; max-width: 92%; }
.page-banner-title { font-family: var(--font-display); color: #fff; font-size: 1.9rem; line-height: 1.12; margin: 8px 0 6px; }
.page-banner-sub { color: rgba(255, 255, 255, .86); font-size: .92rem; line-height: 1.4; margin: 0; }
.monogram {
  width: 52px; height: 52px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center;
  background: #b5634b; color: #fff; font: 600 1.35rem var(--font-display);
}

/* Credit card: dark, with a gold figure (Profile, Credits) */
.credit-card { background: #2b2219; border-color: #2b2219; color: #f6efe4; border-radius: 22px; }
.credit-card .faint, .credit-card .hint { color: rgba(246, 239, 228, .7); }
.credit-card .credit-total { color: #d9b26a; font-family: var(--font-display); font-weight: 600; }
.credit-card .btn { background: #d9b26a; color: #2b2219; border-color: #d9b26a; }

/* Back button for screens without a top bar */
.float-back {
  position: fixed; z-index: 25; left: 12px; top: calc(env(safe-area-inset-top, 0px) + 10px);
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent); color: var(--ink);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: var(--shadow-sm);
}
.float-back svg { width: 20px; height: 20px; }
/* leave room for it above the page header */
.screen.has-float-back > .pad:first-child { padding-top: 46px; }

/* ------------------------------------------ Plan: add a piece (sheet) */
.piece-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; max-height: 60vh; overflow-y: auto; padding-bottom: 4px; }
.piece-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left;
  padding: 12px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface);
  color: var(--ink); font: inherit; cursor: pointer;
}
.piece-tile:active { border-color: var(--accent); background: var(--accent-bg); }
.piece-name { font-size: .86rem; font-weight: 600; line-height: 1.2; }
.piece-meta { font-size: .74rem; color: var(--ink-faint); }

/* ------------------------------------------- Plan: layout variations */
.variant-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.variant {
  display: flex; flex-direction: column; gap: 4px; text-align: left; min-width: 0;
  padding: 10px 11px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface);
  color: var(--ink); font: inherit; cursor: pointer; transition: border-color .15s, background .15s;
}
.variant.on { border-color: var(--accent); background: var(--accent-bg); }
.variant-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.variant-name { font-size: .8rem; font-weight: 700; }
.variant-score { font-size: 1rem; font-weight: 700; font-family: 'Playfair Display', Georgia, serif; }
.variant-sub { font-size: .7rem; color: var(--ink-soft); line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ----------------------------------------------------- live compass */
.compass-row { display: flex; gap: 8px; align-items: stretch; }
.compass-row input { flex: 1; min-width: 0; }
.compass-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; }
.compass-btn svg { width: 18px; height: 18px; }
.compass-box { text-align: center; }
.compass-dial {
  position: relative; width: 200px; height: 200px; margin: 4px auto 14px; border-radius: 50%;
  border: 2px solid var(--border-strong); background: var(--surface); transition: transform .12s linear;
}
.compass-dial::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px;
  border-radius: 50%; background: var(--ink);
}
.compass-mark { position: absolute; font-weight: 700; font-size: .9rem; color: var(--ink-soft); }
.compass-mark.m-N { top: 8px; left: 50%; transform: translateX(-50%); color: var(--danger); }
.compass-mark.m-S { bottom: 8px; left: 50%; transform: translateX(-50%); }
.compass-mark.m-E { right: 10px; top: 50%; transform: translateY(-50%); }
.compass-mark.m-W { left: 10px; top: 50%; transform: translateY(-50%); }
.compass-needle {
  position: absolute; left: 50%; top: 22px; bottom: 50%; width: 4px; margin-left: -2px;
  background: var(--danger); border-radius: 2px;
}
.compass-pointer {
  display: block; width: 0; height: 0; margin: 0 auto -2px;
  border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 12px solid var(--accent);
}
.compass-readout { font-family: 'Playfair Display', Georgia, serif; font-size: 1.9rem; font-weight: 700; }

/* ------------------------------------------------ annual stars list */
.star-row { display: flex; gap: 11px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--border); }
.star-dot {
  flex: none; width: 26px; height: 26px; border-radius: 50%; color: #fff; font-weight: 700; font-size: .85rem;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.star-row strong { font-size: .88rem; }
.star-flag { margin: 4px 0 0; font-size: .78rem; color: var(--danger); }

/* -------------------------------------- compared with the last scan */
.cmp-score { font-family: 'Playfair Display', Georgia, serif; font-size: 1.25rem; white-space: nowrap; }
.cmp-delta { font-family: inherit; font-weight: 700; font-size: 1rem; }
.cmp-head { margin: 12px 0 4px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
.cmp-row { display: flex; gap: 8px; font-size: .86rem; padding: 3px 0; }
.cmp-mark { font-weight: 700; flex: none; width: 12px; }

/* --------------------------------------------- whole-home bagua map */
.homemap-canvas { touch-action: none; cursor: move; }
.homemap-steps { margin: 4px 0 0; padding-left: 20px; font-size: .88rem; color: var(--ink-soft); }
.homemap-steps li { margin-bottom: 6px; }
.field-label { display: block; font-size: .82rem; font-weight: 650; color: var(--ink-soft); margin-bottom: 6px; }
.seg.seg4 button { padding-left: 4px; padding-right: 4px; }
.seg button:disabled { opacity: .45; cursor: not-allowed; }

/* ------------------------------------------- Home: today + challenge */
.daily-card { padding: 0; overflow: hidden; }
.daily-tip { display: flex; gap: 12px; padding: 16px 16px 14px; }
.daily-icon {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--accent-bg); color: var(--accent);
}
.daily-label { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.daily-text { margin: 4px 0 0; font-family: 'Playfair Display', Georgia, serif; font-size: 1.05rem; line-height: 1.4; color: var(--ink); }
.daily-challenge {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px 16px; text-align: left;
  background: var(--bg-sunken); border: 0; border-top: 1px solid var(--border); color: var(--ink); font: inherit; cursor: pointer;
}
.daily-progress { display: flex; gap: 5px; margin-top: 8px; }
.daily-progress span { flex: 1; height: 5px; border-radius: 3px; background: var(--border-strong); }
.daily-progress span.on { background: var(--accent); }
.ch-row {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; padding: 11px 2px;
  background: none; border: 0; border-bottom: 1px solid var(--border); color: var(--ink); font: inherit; cursor: pointer;
}
.ch-check {
  flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; color: var(--ink-soft);
}
.ch-row.done .ch-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.ch-row.done strong { text-decoration: line-through; color: var(--ink-soft); }

/* ------------------------------------------ before / after pictures */
.ba-box { position: relative; border-radius: var(--r); overflow: hidden; touch-action: none; user-select: none; background: var(--bg-sunken); }
.ba-img { display: block; width: 100%; height: auto; pointer-events: none; }
.ba-before { position: absolute; inset: 0; }
.ba-before .ba-img { width: 100%; height: 100%; object-fit: cover; }
.ba-handle { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 6px rgba(0,0,0,.35); }
.ba-handle span {
  position: absolute; top: 50%; left: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.3);
}
.ba-tag { position: absolute; top: 10px; padding: 3px 9px; border-radius: 99px; font-size: .72rem; font-weight: 700; background: rgba(0,0,0,.5); color: #fff; }
.ba-tag.left { left: 10px; }
.ba-tag.right { right: 10px; }
.ba-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.ba-thumbs:empty { display: none; }
.ba-thumb { padding: 0; border: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--bg-sunken); cursor: pointer; }
.ba-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ba-full { width: 100%; border-radius: var(--r); display: block; }
.stars-ask { margin-bottom: 12px; border-color: var(--accent); }

/* star rows: tappable, the picked one marked */
.star-row { width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-bottom: 0; color: var(--ink); font: inherit; cursor: pointer; border-radius: 0; }
.star-row.picked { background: var(--accent-bg); margin: 0 -10px; padding-left: 10px; padding-right: 10px; width: calc(100% + 20px); border-radius: 10px; }
.star-tips { margin-top: 8px; }
.star-tips-head { font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-soft); }
.star-tips ul { margin: 4px 0 0; padding-left: 17px; font-size: .83rem; color: var(--ink); }
.star-tips li { margin-bottom: 3px; }
.star-here { margin: 6px 0 0; font-size: .8rem; color: var(--ink-soft); }

/* ------------------------------------------- Pro plans: swipeable row */
.plan-slider {
  display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 8px -16px 0; padding: 4px 16px 6px; scroll-padding: 0 16px;
}
.plan-slider::-webkit-scrollbar { display: none; }
.plan-slider .plan-card { flex: 0 0 86%; scroll-snap-align: center; margin-bottom: 0; display: flex; flex-direction: column; }
.plan-slider .plan-card ul { flex: 1; }
.plan-dots { display: flex; justify-content: center; gap: 7px; margin: 10px 0 4px; }
.plan-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); cursor: pointer; transition: width .2s, background .2s; }
.plan-dots span.on { width: 20px; border-radius: 4px; background: var(--accent); }
.plan-card.tier-home .badge { background: var(--accent-bg); color: var(--accent); }

/* ------------------------------------------------- profile picture */
.avatar { overflow: hidden; padding: 0; display: flex; align-items: center; justify-content: center; }
.avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-head { display: flex; gap: 16px; align-items: center; margin: 6px 0 18px; }
.profile-pic { position: relative; flex: none; }
.profile-avatar { width: 76px; height: 76px; border: 0; cursor: pointer; font-size: 1.9rem; }
.profile-pic-badge {
  position: absolute; right: -2px; bottom: -2px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center; pointer-events: none;
}
.profile-pic-badge svg { width: 15px; height: 15px; }

/* Google's own button on the website */
.google-web-btn { display: flex; justify-content: center; min-height: 44px; margin-bottom: 10px; }
.auth-brand { text-align: center; font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; color: var(--accent); letter-spacing: .02em; margin: -12px 0 22px; }
.plan-tiers { margin: 0; }
.plan-card.current { border-color: var(--ok); }
.plan-card.tier-free .price { color: var(--ink-soft); }

/* ------------------------------------------------------------ homes */
.home-card { margin-bottom: 10px; }
.home-members { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.home-member { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; font-size: .86rem; }
.home-member-name { color: var(--ink); }
.member-row { border: 1px solid var(--border); border-radius: 12px; padding: 10px; margin-bottom: 8px; display: grid; gap: 8px; }
.stars-period { margin: 0 0 12px; }

/* ------------------------------------------------------- good days */
.cal-filters { margin: 4px 0 12px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.day-card { margin-bottom: 10px; }
.day-card.today { border-color: var(--accent); }
.act-row { display: flex; flex-wrap: wrap; gap: 6px; }
.act { font-size: .74rem; font-weight: 600; padding: 4px 9px; border-radius: 999px; }
.act.r2 { background: #e3f1e8; color: #2f7a4d; }
.act.r1 { background: var(--bg-sunken); color: var(--ink-soft); }
.act.r0 { background: #f7e4e1; color: #b0443a; text-decoration: line-through; }
.off-success, .off-open, .off-stable { background: #e3f1e8 !important; color: #2f7a4d !important; }
.off-destruction, .off-danger { background: #f7e4e1 !important; color: #b0443a !important; }

/* ------------------------------------------------- this year at home */
.year-room { margin-bottom: 12px; }
.year-cell { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--border); }
.year-good { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.year-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; padding: 3px 9px 3px 3px; border-radius: 999px; background: var(--bg-sunken); }
.star-dot.sm { width: 20px; height: 20px; font-size: .72rem; margin: 0; }
.report-brand { font-family: var(--font-display); color: var(--accent); font-weight: 600; letter-spacing: .03em; }

/* Page change in progress: a thin bar at the top instead of a spinner. */
body.route-loading::after {
  content: ''; position: fixed; left: 0; right: 0; z-index: 1000;
  top: env(safe-area-inset-top, 0px); height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 50% 100%; background-repeat: no-repeat;
  animation: route-bar 0.9s ease-in-out infinite;
}
@keyframes route-bar { from { background-position: -50% 0; } to { background-position: 150% 0; } }

/* Chat: a grip to pull the panel down and close it */
.advisor-grip { flex: none; width: 100%; height: 22px; margin: -6px 0 2px; touch-action: none; cursor: grab; position: relative; }
.advisor-grip::after { content: ''; position: absolute; left: 50%; top: 9px; width: 38px; height: 5px; margin-left: -19px; border-radius: 99px; background: var(--border-strong); }
.advisor-head { touch-action: none; }
.advisor { will-change: transform; }

/* Chat as a sheet: it starts lower, with rounded top corners over a dimmed page */
.screen.fill:has(.advisor) { background: color-mix(in srgb, var(--ink) 30%, var(--bg)); }
.advisor {
  margin-top: calc(env(safe-area-inset-top, 0px) + 34px);
  padding-top: 8px;
  background: var(--bg);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .12);
}
.advisor-tool {
  flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-sunken); color: var(--ink-soft); cursor: pointer;
}
.advisor-tool svg { width: 18px; height: 18px; }
.advisor-tool:disabled { opacity: .5; }
.advisor-head { gap: 10px; }

/* An icon inside a button stays icon-sized (it has no width of its own) */
.btn > svg { width: 20px; height: 20px; flex: none; }
