/* =========================================================
   全维家 OmniHome — design system
   ========================================================= */
:root {
  --bg: #f2f0e9;
  --bg-deep: #ebe7dd;
  --surface: #fbfaf7;
  --surface-2: #f6f3ec;
  --surface-3: #efece3;
  --ink: #1c2921;
  --ink-2: #35443a;
  --muted: #5f6d64;
  --faint: #7d8a81;
  --line: #e4e0d6;
  --line-strong: #d5d0c3;
  --forest: #18362a;
  --forest-2: #234a39;
  --forest-3: #2e5945;
  --sage: #7e9e88;
  --sage-light: #dfe9e2;
  --gold: #d2a05d;
  --gold-light: #f0e2c8;
  --cream: #f5eddd;
  --clay: #c47b5a;
  --clay-light: #f4e4dc;
  --blue: #6c8fa8;
  --blue-light: #e1ebf1;
  --plum: #8b7e9e;
  --danger: #b45f4a;
  --success: #4f7c61;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow-sm: 0 1px 2px rgba(24, 40, 31, 0.04), 0 6px 18px rgba(24, 40, 31, 0.035);
  --shadow-md: 0 12px 36px rgba(24, 40, 31, 0.08);
  --shadow-lg: 0 28px 70px rgba(18, 34, 25, 0.18);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-serif: "Songti SC", "Noto Serif SC", "STSong", "SimSun", Georgia, serif;
  --font-number: "Avenir Next", "Helvetica Neue", "Segoe UI", var(--font-sans);
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
*::selection { background: rgba(210, 160, 93, 0.28); }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1000px 520px at 82% -12%, rgba(210, 160, 93, 0.07), transparent 65%),
    radial-gradient(800px 500px at 8% 105%, rgba(126, 158, 136, 0.07), transparent 70%);
  pointer-events: none;
}
body.modal-open, body.search-open { overflow: hidden; }
h1, h2, h3, h4, p, blockquote { margin: 0; }
button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid rgba(63, 107, 87, 0.55);
  outline-offset: 2px;
}
[hidden] { display: none !important; }
img, svg { display: block; }
.icon { flex: none; }
.text-green { color: var(--success); }
.text-muted { color: var(--muted); }
.muted-text { color: var(--muted); font-size: 13px; }
.align-right { text-align: right; }

/* Scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(60, 78, 66, 0.18); border: 3px solid transparent; background-clip: content-box; border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: rgba(60, 78, 66, 0.32); border: 3px solid transparent; background-clip: content-box; }

/* =========================================================
   Brand
   ========================================================= */
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  border-radius: 13px; border: 1px solid rgba(231, 211, 167, 0.32);
  background: linear-gradient(145deg, rgba(231, 211, 167, 0.12), rgba(255, 255, 255, 0.02));
  color: #e7d3a7; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.brand-mark-dark { border-color: rgba(24, 54, 42, 0.16); background: var(--forest); color: var(--gold-light); }
.brand-word { display: flex; flex-direction: column; line-height: 1.05; }
.brand-word strong { font-size: 20px; font-weight: 650; letter-spacing: 0.08em; color: #f6f1e6; }
.brand-word small { margin-top: 4px; font-size: 8.5px; font-weight: 600; letter-spacing: 0.28em; color: rgba(246, 241, 230, 0.45); }

/* =========================================================
   Login
   ========================================================= */
.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(440px, 0.78fr); background: var(--surface); }
.login-visual {
  position: relative; overflow: hidden; display: flex; flex-direction: column;
  padding: 40px 54px 34px; color: #f4efe3;
  background:
    radial-gradient(900px 600px at 82% 12%, rgba(210, 160, 93, 0.23), transparent 58%),
    radial-gradient(800px 600px at 4% 95%, rgba(101, 143, 120, 0.23), transparent 60%),
    linear-gradient(146deg, #1a3a2c 0%, #142d23 52%, #10261d 100%);
}
.login-visual::before {
  content: ""; position: absolute; inset: 0; opacity: 0.32; pointer-events: none;
  background-image: radial-gradient(rgba(244, 239, 227, 0.26) 0.5px, transparent 0.5px);
  background-size: 23px 23px;
  mask-image: radial-gradient(circle at 42% 48%, #000 0%, transparent 72%);
}
.login-visual::after {
  content: ""; position: absolute; width: 640px; height: 640px; right: -320px; top: 8%;
  border: 1px solid rgba(231, 211, 167, 0.13); border-radius: 50%;
  box-shadow: 0 0 0 84px rgba(231, 211, 167, 0.028), 0 0 0 168px rgba(231, 211, 167, 0.022);
  pointer-events: none;
}
.login-visual-top { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; }
.login-edition { font-size: 9px; letter-spacing: 0.25em; color: rgba(244, 239, 227, 0.42); border: 1px solid rgba(244, 239, 227, 0.14); padding: 6px 10px; border-radius: 20px; }
.login-hero { position: relative; z-index: 2; margin-top: clamp(36px, 6.4vh, 74px); }
.login-eyebrow { display: flex; align-items: center; gap: 9px; font-size: 11.5px; letter-spacing: 0.16em; color: rgba(244, 239, 227, 0.6); }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: #9fc3a9; box-shadow: 0 0 0 4px rgba(159, 195, 169, 0.13); animation: pulse-dot 2.4s infinite; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.42; } }
.login-hero h1 {
  margin-top: 20px; font-family: var(--font-serif); font-size: clamp(50px, 5.2vw, 76px);
  font-weight: 500; line-height: 1.12; letter-spacing: -0.02em; color: #f7f2e7;
}
.login-hero h1 em { font-style: normal; color: #e7c890; position: relative; }
.login-hero h1 em::after { content: ""; position: absolute; left: 2px; right: 2px; bottom: 4px; height: 1px; background: linear-gradient(90deg, rgba(231, 200, 144, 0.7), transparent); }
.login-lede { max-width: 440px; margin-top: 22px; font-size: 14.5px; line-height: 1.85; color: rgba(244, 239, 227, 0.61); }
.login-orbit { position: relative; z-index: 2; flex: 1; min-height: 260px; max-height: 330px; margin-top: 22px; }
.orbit-core {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 156px; height: 156px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 1px solid rgba(231, 211, 167, 0.28);
  background: radial-gradient(circle at 35% 25%, rgba(231, 211, 167, 0.18), rgba(16, 38, 29, 0.7));
  box-shadow: 0 0 0 24px rgba(231, 211, 167, 0.026), 0 24px 60px rgba(0, 0, 0, 0.18);
  color: #e7d3a7;
}
.core-symbol { margin-bottom: 2px; }
.orbit-core strong { font-size: 12.5px; font-weight: 600; color: #f6f1e6; }
.orbit-core small { font-size: 8px; letter-spacing: 0.13em; color: rgba(246, 241, 230, 0.4); text-transform: uppercase; }
.orbit-pill {
  position: absolute; display: flex; align-items: center; gap: 7px;
  font-size: 11px; color: rgba(246, 241, 230, 0.78); padding: 7px 12px; border-radius: 30px;
  border: 1px solid rgba(244, 239, 227, 0.14); background: rgba(20, 45, 34, 0.64);
  backdrop-filter: blur(10px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.orbit-pill i { width: 4px; height: 4px; border-radius: 50%; background: #d5ae71; }
.orbit-pill.p1 { left: 2%; top: 13%; }
.orbit-pill.p2 { right: 6%; top: 6%; }
.orbit-pill.p3 { right: 0%; top: 38%; }
.orbit-pill.p4 { right: 9%; bottom: 8%; }
.orbit-pill.p5 { left: 23%; bottom: 1%; }
.orbit-pill.p6 { left: 0%; bottom: 25%; }
.orbit-pill.p7 { left: 10%; top: 38%; }
.orbit-pill.p8 { right: 18%; top: 20%; color: #efd5a4; border-color: rgba(231, 200, 144, 0.32); }
.orbit-line { position: absolute; left: 50%; top: 50%; width: 1px; height: 41%; background: linear-gradient(rgba(231, 211, 167, 0.22), transparent); transform-origin: top; opacity: 0.5; }
.orbit-line.l1 { transform: rotate(38deg); }
.orbit-line.l2 { transform: rotate(150deg); }
.orbit-line.l3 { transform: rotate(260deg); }
.login-quote { position: relative; z-index: 2; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: start; margin-top: 14px; }
.quote-mark { font-family: var(--font-serif); font-size: 45px; line-height: 1; color: rgba(231, 200, 144, 0.55); }
.login-quote p { font-family: var(--font-serif); font-size: 15px; line-height: 1.75; color: rgba(244, 239, 227, 0.68); }
.quote-source { grid-column: 2; font-size: 9.5px; letter-spacing: 0.12em; color: rgba(244, 239, 227, 0.31); }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 48px 38px; background: var(--surface); position: relative; }
.login-panel::before { content: ""; position: absolute; left: 0; top: 12%; bottom: 12%; width: 1px; background: linear-gradient(transparent, var(--line), transparent); }
.login-panel-inner { width: min(100%, 400px); }
.login-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 34px; }
.login-mobile-brand span:last-child { display: flex; flex-direction: column; line-height: 1.1; }
.login-mobile-brand strong { color: var(--ink); font-size: 19px; letter-spacing: 0.08em; }
.login-mobile-brand small { font-size: 8px; letter-spacing: 0.26em; color: var(--muted); margin-top: 4px; }
.login-panel-eyebrow { font-size: 9.5px; font-weight: 700; letter-spacing: 0.27em; color: var(--gold); }
.login-panel h2 { margin-top: 14px; font-family: var(--font-serif); font-size: 39px; font-weight: 500; letter-spacing: -0.01em; }
.login-panel-sub { margin-top: 9px; margin-bottom: 30px; color: var(--muted); font-size: 13.5px; }
.login-form { display: flex; flex-direction: column; gap: 17px; }
.login-field { display: flex; flex-direction: column; gap: 8px; }
.login-field > span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.login-input-wrap {
  height: 49px; display: flex; align-items: center; gap: 10px; padding: 0 14px;
  border: 1px solid var(--line-strong); background: #fff; border-radius: 13px; color: var(--faint);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.login-input-wrap:focus-within { border-color: var(--forest-3); box-shadow: 0 0 0 3px rgba(46, 89, 69, 0.08); color: var(--forest); }
.login-input-wrap input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 13.5px; color: var(--ink); height: 100%; }
.login-input-wrap input::placeholder { color: #aab1aa; }
.password-toggle { border: 0; background: none; color: var(--muted); font-size: 11.5px; padding: 4px; }
.password-toggle:hover { color: var(--ink); }
.login-error { padding: 10px 13px; border-radius: 10px; background: #f8e9e4; color: var(--danger); font-size: 12.5px; border: 1px solid #eed4c9; }
.login-submit {
  margin-top: 5px; height: 50px; padding: 0 18px; border: 0; border-radius: 13px; display: flex; align-items: center; justify-content: space-between;
  background: var(--forest); color: #f7f2e7; font-size: 13.5px; font-weight: 600; letter-spacing: 0.02em;
  box-shadow: 0 12px 28px rgba(24, 54, 42, 0.2); transition: transform 0.2s, background 0.2s;
}
.login-submit:hover { background: var(--forest-2); transform: translateY(-1px); }
.login-submit:disabled { opacity: 0.7; cursor: wait; }
.login-submit.is-loading span::after { content: "…"; }
.login-demo { width: 100%; margin-top: 9px; display: flex; align-items: center; gap: 11px; padding: 11px 13px; text-align: left; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); color: var(--muted); transition: border-color .2s, background .2s, transform .2s; }
.login-demo:hover { border-color: var(--gold); background: var(--gold-light); transform: translateY(-1px); }
.login-demo-icon { width: 31px; height: 31px; flex: none; display: grid; place-items: center; border-radius: 9px; color: var(--gold); background: rgba(210, 160, 93, .12); }
.login-demo-copy { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.login-demo-copy strong { font-size: 11px; font-weight: 600; color: var(--ink); }
.login-demo-copy small { font-size: 8.5px; color: var(--muted); }
.login-assurance {
  display: flex; align-items: flex-start; gap: 11px; margin-top: 25px; padding: 14px;
  border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2);
}
.login-assurance-icon {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px;
  background: var(--sage-light); color: var(--success);
}
.login-assurance > div { display: flex; flex-direction: column; gap: 2px; }
.login-assurance strong { font-size: 11.5px; font-weight: 600; color: var(--ink); }
.login-assurance span { font-size: 10.5px; line-height: 1.65; color: var(--muted); }
.login-foot { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-size: 9.5px; color: var(--faint); letter-spacing: 0.04em; }
.login-secure { display: flex; align-items: center; gap: 6px; }

/* =========================================================
   App shell / sidebar
   ========================================================= */
.app-shell { min-height: 100vh; display: flex; }
.sidebar {
  width: var(--sidebar-w); flex: none; position: sticky; top: 0; height: 100vh; z-index: 50;
  display: flex; flex-direction: column; padding: 24px 16px 16px;
  color: #f4efe3;
  background:
    radial-gradient(500px 380px at 100% 0%, rgba(210, 160, 93, 0.14), transparent 65%),
    radial-gradient(600px 500px at 0% 110%, rgba(99, 144, 120, 0.14), transparent 62%),
    linear-gradient(165deg, #1b3a2c 0%, #163024 56%, #12291f 100%);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
}
.sidebar::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.22;
  background-image: radial-gradient(rgba(244, 239, 227, 0.2) 0.45px, transparent 0.45px);
  background-size: 19px 19px;
  mask-image: linear-gradient(#000, transparent 65%);
}
.sidebar > * { position: relative; z-index: 1; }
.sidebar-brand { padding: 2px 8px 22px; gap: 10px; }
.sidebar-brand .brand-mark { width: 37px; height: 37px; border-radius: 12px; }
.sidebar-brand .brand-word strong { font-size: 19px; }
.brand-version { margin-left: auto; font-size: 8px; letter-spacing: 0.14em; color: rgba(244, 239, 227, 0.36); border: 1px solid rgba(244, 239, 227, 0.12); border-radius: 5px; padding: 2px 5px; }
.family-switcher {
  width: 100%; display: flex; align-items: center; gap: 9px; padding: 10px 11px; margin-bottom: 18px;
  border-radius: 13px; background: rgba(255, 255, 255, 0.045); border: 1px solid rgba(255, 255, 255, 0.07);
  cursor: pointer; transition: background 0.2s; text-align: left; font-family: inherit; color: inherit;
}
.family-switcher:hover { background: rgba(255, 255, 255, 0.075); }
.family-avatar-stack { display: flex; }
.family-avatar-stack .avatar { margin-left: -7px; box-shadow: 0 0 0 2px #1a372a; }
.family-avatar-stack .avatar:first-child { margin-left: 0; }
.family-switch-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.family-switch-copy strong { font-size: 12px; font-weight: 600; color: #f6f1e6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.family-switch-copy small { font-size: 9.5px; color: rgba(244, 239, 227, 0.4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.family-chevron { color: rgba(244, 239, 227, 0.35); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0 2px; scrollbar-width: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }
.nav-group { margin-bottom: 15px; }
.nav-label { padding: 0 12px; margin-bottom: 8px; font-size: 8.5px; letter-spacing: 0.22em; font-weight: 650; color: rgba(244, 239, 227, 0.29); }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px; height: 40px; padding: 0 12px; margin-bottom: 3px;
  border-radius: 11px; color: rgba(244, 239, 227, 0.62); font-size: 12.5px; font-weight: 450;
  transition: background 0.18s, color 0.18s, transform 0.18s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #f6f1e6; }
.nav-item.active { background: #f2ead9; color: #1e3a2c; font-weight: 600; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14); }
.nav-item.active .nav-icon { color: #3d6a52; }
.nav-icon { color: rgba(244, 239, 227, 0.48); display: grid; place-items: center; width: 20px; transition: color 0.18s; }
.nav-item:hover .nav-icon { color: #e7d3a7; }
.nav-badge { margin-left: auto; font-style: normal; font-size: 7.5px; letter-spacing: 0.12em; color: #bcd7c5; background: rgba(140, 180, 154, 0.15); border: 1px solid rgba(140, 180, 154, 0.18); border-radius: 4px; padding: 2px 4px; }
.nav-ai { margin-top: 4px; border: 1px solid rgba(231, 200, 144, 0.22); background: linear-gradient(100deg, rgba(231, 200, 144, 0.1), rgba(255, 255, 255, 0.025)); color: #edd7ad; }
.nav-ai:hover { border-color: rgba(231, 200, 144, 0.4); background: linear-gradient(100deg, rgba(231, 200, 144, 0.15), rgba(255, 255, 255, 0.04)); }
.nav-ai em { margin-left: auto; font-style: normal; font-size: 7.5px; font-weight: 700; letter-spacing: 0.1em; color: #123025; background: #dcb97f; padding: 2px 5px; border-radius: 4px; }
.nav-ai.active { background: #e7d3a7; color: #1c382a; border-color: transparent; }
.nav-ai.active em { background: #18362a; color: #e7d3a7; }
.nav-ai.active .nav-icon { color: #2f5943; }
.sidebar-bottom { margin-top: 12px; display: flex; flex-direction: column; gap: 9px; }
.sidebar-status {
  display: flex; align-items: center; gap: 10px; padding: 10px 11px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.06);
}
.status-pulse { display: flex; align-items: flex-end; gap: 2px; height: 14px; }
.status-pulse span { width: 2.5px; background: #8fbfa0; border-radius: 2px; animation: equalize 1.8s ease-in-out infinite; }
.status-pulse span:nth-child(1) { height: 7px; animation-delay: -0.2s; }
.status-pulse span:nth-child(2) { height: 12px; animation-delay: -0.7s; }
.status-pulse span:nth-child(3) { height: 9px; animation-delay: -1.1s; }
@keyframes equalize { 0%, 100% { transform: scaleY(0.55); opacity: 0.6; } 50% { transform: scaleY(1); opacity: 1; } }
.sidebar-status > div:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.sidebar-status strong { font-size: 10.5px; font-weight: 550; color: rgba(246, 241, 230, 0.8); }
.sidebar-status small { font-size: 8.5px; color: rgba(246, 241, 230, 0.33); }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: #8fbfa0; }
.sidebar-note { display: flex; gap: 9px; padding: 10px 11px; border-radius: 12px; border: 1px dashed rgba(231, 200, 144, 0.16); color: rgba(231, 200, 144, 0.65); font-size: 9.5px; line-height: 1.55; }
.sidebar-note strong { color: #e7c890; font-weight: 600; }
.sidebar-note svg { margin-top: 1px; color: #c7a970; }
.sidebar-user { display: flex; align-items: center; gap: 9px; padding-top: 11px; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.sidebar-user .avatar { --avatar-size: 33px; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08); }
.sidebar-user > div { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sidebar-user strong { font-size: 11.5px; font-weight: 600; color: #f4efe3; }
.sidebar-user span { font-size: 8.5px; color: rgba(244, 239, 227, 0.38); }
.sidebar-user .icon-btn { width: 30px; height: 30px; color: rgba(244, 239, 227, 0.45); }
.sidebar-user .icon-btn:hover { color: #e7d3a7; background: rgba(255, 255, 255, 0.07); }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 15px 32px; min-height: 82px;
  background: rgba(242, 240, 233, 0.84); backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid rgba(228, 224, 214, 0.75);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.menu-btn { display: none; }
.page-heading { min-width: 0; }
.crumb-line { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.crumb-line i { font-style: normal; color: #c4c8c2; }
.crumb-line strong { font-weight: 600; font-size: 15px; color: var(--ink); letter-spacing: -0.01em; }
.page-heading p { margin-top: 2px; font-size: 10px; color: var(--faint); letter-spacing: 0.02em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-date { display: flex; align-items: center; gap: 8px; border: 0; background: none; text-align: left; padding: 5px 8px; border-radius: 9px; }
.topbar-date:hover { background: rgba(255, 255, 255, 0.6); }
.reload-icon { color: var(--faint); display: grid; place-items: center; }
.topbar-date > span:last-child { display: flex; flex-direction: column; gap: 0; }
.topbar-date strong { font-size: 10.5px; font-weight: 600; color: var(--ink-2); }
.topbar-date small { font-size: 8.5px; color: var(--faint); }
.search-trigger {
  display: flex; align-items: center; gap: 8px; height: 37px; padding: 0 10px 0 12px; min-width: 176px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.6); border-radius: 10px; color: var(--muted); font-size: 11px;
  transition: border-color 0.2s, background 0.2s;
}
.search-trigger:hover { background: #fff; border-color: var(--line-strong); }
.search-trigger span { flex: 1; text-align: left; }
kbd { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 8.5px; color: var(--faint); background: var(--surface-3); border: 1px solid var(--line); border-radius: 4px; padding: 2px 4px; }
.topbar-icon { width: 37px; height: 37px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.6); position: relative; }
.topbar-icon:hover { background: #fff; }
.notification-badge {
  position: absolute; right: -4px; top: -4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 9px; background: var(--clay); color: #fff; font-size: 8.5px; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--bg);
}
.profile-btn { display: flex; align-items: center; gap: 5px; border: 0; background: none; padding: 2px; border-radius: 20px; color: var(--faint); }
.profile-btn .avatar { --avatar-size: 34px; }
.profile-menu {
  position: absolute; right: 30px; top: 72px; width: 226px; padding: 10px; z-index: 60;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; transform: translateY(-7px) scale(0.98); transition: 0.18s;
}
.profile-menu.is-open { opacity: 1; visibility: visible; transform: none; }
.profile-menu-head { display: flex; gap: 10px; align-items: center; padding: 8px; }
.profile-menu-head .avatar { --avatar-size: 37px; }
.profile-menu-head > div { display: flex; flex-direction: column; }
.profile-menu-head strong { font-size: 12.5px; }
.profile-menu-head span { font-size: 10px; color: var(--muted); }
.profile-menu-meta { display: flex; justify-content: space-between; margin: 6px 8px 9px; padding: 7px 9px; border-radius: 8px; background: var(--surface-2); font-size: 9.5px; color: var(--muted); }
.profile-menu-meta em { font-style: normal; color: var(--faint); }
.profile-menu-item { width: 100%; display: flex; align-items: center; gap: 9px; border: 0; background: none; padding: 9px; border-radius: 8px; font-size: 11.5px; color: var(--danger); }
.profile-menu-item:hover { background: #f8ece7; }
.profile-menu-item.member-menu-item { color: var(--ink-2); }
.profile-menu-item.member-menu-item:hover { background: var(--surface-2); }
.profile-menu-item.member-menu-item > svg { color: var(--muted); }
.member-count-chip {
  margin-left: auto; min-width: 19px; height: 18px; padding: 0 5px; display: grid; place-items: center;
  border-radius: 9px; background: var(--surface-2); color: var(--muted); font-size: 8.5px;
}
.view-root { width: 100%; max-width: 1560px; margin: 0 auto; padding: 26px 32px 48px; flex: 1; }
.view-loading { display: flex; flex-direction: column; gap: 18px; }
.skeleton { background: linear-gradient(90deg, #eae6dc 20%, #f3f0e8 45%, #eae6dc 70%); background-size: 240% 100%; border-radius: 22px; animation: shimmer 1.5s infinite linear; }
.skeleton-hero { height: 290px; }
.skeleton-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.skeleton-row .skeleton { height: 120px; }
.skeleton-block { height: 220px; }
@keyframes shimmer { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
.view-error { min-height: 52vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; }
.error-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: var(--clay-light); color: var(--clay); margin-bottom: 4px; }
.view-error h2 { font-family: var(--font-serif); font-size: 26px; font-weight: 500; }
.view-error p { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }

/* =========================================================
   Primitive components
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 41px; padding: 0 17px;
  border: 1px solid transparent; border-radius: 11px; font-size: 12px; font-weight: 550; white-space: nowrap;
  transition: transform 0.18s, background 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.55; cursor: wait; transform: none; }
.btn-primary { background: var(--forest); color: #f7f2e7; box-shadow: 0 8px 20px rgba(24, 54, 42, 0.15); }
.btn-primary:hover { background: var(--forest-2); }
.btn-soft { background: var(--surface); border-color: var(--line-strong); color: var(--ink-2); }
.btn-soft:hover { border-color: var(--forest-3); color: var(--forest); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-cream { background: #f2e6cd; color: #284332; border-color: transparent; }
.btn-cream:hover { background: #f7eedc; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost-danger { color: var(--danger); border-color: transparent; background: transparent; padding-left: 6px; }
.btn-ghost-danger:hover { background: #f8ece7; }
.btn-sm { height: 34px; padding: 0 13px; font-size: 11px; border-radius: 9px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); transition: background 0.18s, color 0.18s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.danger:hover { background: #f8ece7; color: var(--danger); }
.icon-btn.is-pinned { color: var(--gold); background: #f8f0df; }
.row-action { width: 28px; height: 28px; display: inline-grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--faint); }
.row-action:hover { background: var(--surface-2); color: var(--ink); }
.row-action.danger:hover { background: #f8ece7; color: var(--danger); }
.text-link { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; color: var(--muted); font-size: 10.5px; padding: 0; }
.text-link:hover { color: var(--ink); }
.text-link svg { transition: transform 0.2s; }
.text-link:hover svg { transform: translateX(2px); }
.avatar {
  width: var(--avatar-size, 34px); height: var(--avatar-size, 34px); flex: none; display: inline-grid; place-items: center;
  border-radius: 50%; background: var(--avatar-bg, #3f6b57); color: #fff; font-size: calc(var(--avatar-size, 34px) * 0.31);
  font-weight: 650; letter-spacing: -0.02em; line-height: 1; user-select: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.avatar-ring { box-shadow: 0 0 0 2px var(--bg), inset 0 1px 0 rgba(255, 255, 255, 0.22); }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -9px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.progress { height: 6px; width: 100%; border-radius: 8px; background: rgba(44, 59, 50, 0.075); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 8px; transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
.progress-slim { height: 4px; }
.progress-thin { height: 5px; }
.segmented { display: inline-flex; align-items: center; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; gap: 2px; }
.segmented button { border: 0; background: none; height: 33px; padding: 0 13px; border-radius: 7px; font-size: 12px; font-weight: 550; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.segmented button span { font-size: 8.5px; color: var(--faint); background: rgba(0, 0, 0, 0.04); border-radius: 4px; padding: 1px 4px; }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: 0 2px 6px rgba(24, 40, 31, 0.08); font-weight: 600; }
.segmented button.active span { background: var(--forest); color: #f5efe2; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 52px 20px; }
.empty-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 15px; background: var(--surface-3); color: var(--muted); margin-bottom: 3px; }
.empty-state h3 { font-size: 15px; font-weight: 600; }
.empty-state p { font-size: 11.5px; color: var(--muted); max-width: 280px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow-sm); transition: border-color .25s ease, box-shadow .25s ease; }
.panel:hover { border-color: var(--line-strong); box-shadow: 0 10px 30px rgba(24, 40, 31, 0.06); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 19px; }
.panel-head.compact { margin-bottom: 15px; }
.panel-kicker { display: block; font-size: 8px; letter-spacing: 0.22em; font-weight: 700; color: var(--faint); margin-bottom: 5px; }
.panel-head h2 { font-family: var(--font-serif); font-size: 21px; line-height: 1.2; font-weight: 500; letter-spacing: -0.01em; }
.panel-count { font-size: 9.5px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 20px; padding: 4px 9px; white-space: nowrap; }
.panel-subhead { display: flex; justify-content: space-between; align-items: center; font-size: 10px; color: var(--muted); }
.panel-subhead strong { font-size: 13px; color: var(--ink); font-weight: 600; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 27px 0 14px; }
.section-head h2 { font-family: var(--font-serif); font-size: 24px; font-weight: 500; line-height: 1.2; }
.section-head p { margin-top: 3px; font-size: 10.5px; color: var(--muted); }
.section-note { display: flex; align-items: center; gap: 5px; font-size: 9.5px; color: var(--faint); }
.view-enter { animation: view-in 0.42s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes view-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
body:not([data-view="dashboard"]) .view-head > div:first-child { display: none; }
body:not([data-view="dashboard"]) .view-head { justify-content: flex-end; margin-bottom: 16px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.eyebrow { display: flex; align-items: center; gap: 7px; font-size: 8.5px; font-weight: 650; letter-spacing: 0.19em; color: var(--muted); text-transform: uppercase; }
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--gold); }
.finance-tabs { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-bottom: 13px; }
.finance-tabs button { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 17px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 550; }
.finance-tabs button:hover { border-color: var(--line-strong); color: var(--ink-2); }
.finance-tabs button.active { color: var(--forest); border-color: var(--forest-3); background: var(--sage-light); }
[data-theme="dark"] .finance-tabs button.active { color: #b7d5a6; border-color: #54705a; background: #22362a; }
.finance-panel[hidden] { display: none; }
.overview-recent-panel { margin-top: 18px; }
.overview-bottom-grid { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.28fr); gap: 13px; margin-top: 13px; }
.overview-category-panel, .overview-latest-panel { min-width: 0; }
.overview-category-panel .panel-head p, .overview-latest-panel .panel-head p { margin: 4px 0 0; font-size: 9.5px; color: var(--muted); }
.overview-category-body { display: flex; align-items: center; gap: 20px; min-height: 225px; }
.overview-category-donut { flex: none; }
.overview-category-body .donut-legend { flex: 1; }
.overview-category-body .donut-center strong { font-size: 21px; }
.latest-bill-list { display: flex; flex-direction: column; }
.latest-bill-list .overview-tx-row { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.latest-bill-list .overview-tx-row:last-child { border-bottom: 0; }
.latest-bill-list .overview-tx-row strong { font-size: 11px; }
.latest-bill-list .overview-tx-row small { font-size: 9px; color: var(--muted); }
.ledger-manage-panel { margin-top: 13px; }
.ledger-manage-panel .panel-head p { margin: 4px 0 0; font-size: 9.5px; color: var(--muted); }
.ledger-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 9px; }
.ledger-card { min-height: 102px; padding: 13px; display: flex; flex-direction: column; align-items: flex-start; gap: 7px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); text-align: left; }
.ledger-card > div { display: flex; flex-direction: column; gap: 3px; }
.ledger-card strong { font-size: 11.5px; font-weight: 600; color: var(--ink); }
.ledger-card small { font-size: 9px; line-height: 1.55; color: var(--muted); }
.ledger-card em { margin-top: auto; font-size: 8.5px; font-style: normal; color: var(--faint); }
.ledger-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; color: var(--plum); background: color-mix(in srgb, var(--plum) 12%, transparent); }
.ledger-icon.family { color: var(--gold); background: var(--gold-light); }
.ledger-new { align-items: center; justify-content: center; border-style: dashed; border-color: var(--line-strong); background: transparent; color: var(--muted); }
.ledger-new:hover { border-color: var(--gold); color: var(--ink-2); background: var(--surface-2); }
.ledger-plus { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 50%; color: var(--gold); background: var(--gold-light); }
.overview-tx-row { display: flex; align-items: center; gap: 9px; padding: 9px 2px; border-bottom: 1px dashed var(--line); }
.overview-tx-row:last-child { border-bottom: 0; }
.overview-tx-row > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.overview-tx-row strong { font-size: 10.5px; font-weight: 550; }
.overview-tx-row small { font-size: 8.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.overview-tx-row .tx-amount { font-family: var(--font-number); font-size: 11px; }
[data-finance-panel="analysis"] .finance-mid-grid { grid-template-columns: 1fr; }
[data-finance-panel="analysis"] .accounts-panel { display: none; }
.account-edit, .account-delete { flex: none; }
.account-delete { margin-left: 1px; }
.account-card > div small { display: block; }
.asset-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.asset-kpi { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-height: 126px; padding: 21px 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.asset-kpi > div { display: flex; flex-direction: column; gap: 22px; }
.asset-kpi span { font-size: 10px; color: var(--muted); }
.asset-kpi strong { font-family: var(--font-number); font-size: 29px; font-weight: 500; letter-spacing: -0.03em; color: var(--ink); }
.asset-kpi strong em { margin-left: 3px; font-family: var(--font-sans); font-size: 10px; font-style: normal; font-weight: 400; color: var(--faint); }
.asset-kpi-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; color: var(--forest-3); background: var(--sage-light); }
.asset-kpi-icon.liability { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.asset-layout { display: grid; grid-template-columns: minmax(280px, .82fr) minmax(0, 1.55fr); gap: 14px; align-items: stretch; }
.asset-structure-card { padding: 20px; }
.asset-subtitle { margin: 4px 0 0; font-size: 9px; color: var(--faint); }
.asset-structure-body { display: flex; align-items: center; gap: 20px; margin-top: 18px; }
.asset-structure-body .donut-wrap { flex: none; }
.asset-structure-body .donut-center strong { font-size: 20px; }
.asset-structure-body .donut-label { font-size: 8px; }
.asset-legend { flex: 1; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.asset-legend-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 9px; font-size: 9.5px; }
.asset-legend-row span { display: flex; align-items: center; gap: 6px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-legend-row i { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.asset-legend-row strong { font-family: var(--font-number); font-size: 10px; font-weight: 500; color: var(--ink-2); }
.asset-legend-row em { font-size: 8.5px; font-style: normal; color: var(--faint); min-width: 34px; text-align: right; }
.asset-empty-copy { font-size: 9px; color: var(--faint); }
.asset-register-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; height: 100%; }
.asset-register-card > [data-account-subpanel]:not([hidden]) { display: flex; flex-direction: column; flex: 1; }
.asset-register-card > [data-account-subpanel="accounts"] .asset-account-list { flex: 1; }
.asset-register-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.asset-register-tabs { display: flex; align-self: stretch; gap: 20px; }
.asset-register-tabs button { position: relative; border: 0; background: transparent; color: var(--muted); font-size: 10px; font-weight: 550; }
.asset-register-tabs button::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px; background: transparent; }
.asset-register-tabs button.active { color: var(--ink); }
.asset-register-tabs button.active::after { background: var(--gold); }
.asset-register-actions { display: flex; align-items: center; gap: 6px; }
.asset-register-actions .btn { height: 30px; }
.asset-account-list { padding: 2px 0; }
.asset-account-row { display: flex; align-items: center; gap: 10px; min-height: 67px; padding: 10px 18px; border-bottom: 1px solid var(--line-soft); }
.asset-account-row:last-child { border-bottom: 0; }
.asset-account-icon { width: 33px; height: 33px; flex: none; display: grid; place-items: center; border-radius: 8px; color: var(--account-color); background: color-mix(in srgb, var(--account-color) 12%, var(--surface)); }
.asset-account-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.asset-account-main strong { font-size: 10.5px; font-weight: 600; color: var(--ink); }
.asset-account-main small { font-size: 8.5px; color: var(--faint); }
.asset-account-badge { padding: 3px 6px; border: 1px solid var(--line); border-radius: 5px; font-size: 8px; color: var(--success); background: var(--sage-light); white-space: nowrap; }
.asset-account-badge.liability { color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, transparent); }
.asset-account-balance { min-width: 92px; text-align: right; font-family: var(--font-number); font-size: 15px; font-weight: 500; color: var(--ink); }
.asset-account-actions { display: flex; align-items: center; gap: 2px; }
.asset-flow-list { padding: 2px 0; }
.asset-flow-row { display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-bottom: 1px solid var(--line-soft); }
.asset-flow-row:last-child { border-bottom: 0; }
.asset-flow-row > div { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.asset-flow-row strong { font-size: 10px; font-weight: 550; }
.asset-flow-row small { font-size: 8px; color: var(--faint); }
.asset-flow-row .tx-amount { font-size: 11px; }
.asset-register-card .accounts-note { margin: 9px 18px 13px; padding-top: 9px; }
@media (max-width: 1100px) {
  .asset-layout { grid-template-columns: 1fr; }
  .asset-structure-body { justify-content: flex-start; }
  .asset-legend { max-width: 420px; }
  .overview-bottom-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .ledger-grid { grid-template-columns: 1fr; }
  .overview-category-body { gap: 12px; }
  .overview-category-donut .donut-wrap { transform: scale(.88); transform-origin: left center; margin-right: -15px; }
  .wechat-auto-grid { grid-template-columns: 1fr; }
  .wechat-folder-field, .wechat-auto-actions { grid-column: auto; }
  .webhook-grid { grid-template-columns: 1fr; }
  .webhook-token-row, .webhook-actions { grid-column: auto; }
}
@media (max-width: 600px) {
  .asset-kpis { grid-template-columns: 1fr; gap: 8px; }
  .asset-kpi { min-height: 96px; padding: 16px 17px; }
  .asset-kpi > div { gap: 12px; }
  .asset-kpi strong { font-size: 25px; }
  .asset-register-head { flex-wrap: wrap; padding: 8px 12px; gap: 7px; }
  .asset-register-tabs { min-height: 38px; }
  .asset-register-actions { width: 100%; justify-content: flex-end; }
  .asset-account-row { gap: 7px; padding: 10px 12px; }
  .asset-account-badge { display: none; }
  .asset-account-balance { min-width: 70px; font-size: 13px; }
  .asset-account-actions .row-action { width: 24px; }
  .asset-account-icon { width: 29px; height: 29px; }
  .asset-flow-row { padding: 10px 12px; }
  .asset-structure-body { gap: 10px; }
  .asset-structure-body .donut-wrap { transform: scale(.86); transform-origin: left center; margin-right: -20px; }
}
.budget-head-right { display: flex; align-items: center; gap: 9px; }
.budget-row-actions { display: flex; align-items: center; gap: 5px; }
.finance-accounts-page { margin-bottom: 18px; }
.finance-import-note { margin: -2px 0 16px; max-width: 760px; font-size: 10px; line-height: 1.7; color: var(--muted); }
.finance-import-form { display: flex; flex-direction: column; gap: 13px; }
.finance-import-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.finance-import-form textarea { font-family: var(--font-number); font-size: 10px; line-height: 1.7; }
.finance-import-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.finance-import-actions > span { display: flex; align-items: center; gap: 5px; font-size: 8.5px; color: var(--faint); }
.finance-scope-tabs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: -6px 0 16px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); width: fit-content; max-width: 100%; }
.finance-scope-tabs button { height: 30px; padding: 0 12px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); font-size: 9.5px; }
.finance-scope-tabs button.active { color: var(--ink); background: var(--surface); border-color: var(--line); }
.finance-scope-tabs > span { margin-left: 8px; padding: 0 6px; font-size: 8px; color: var(--faint); }
.check-line { display: flex; align-items: center; gap: 7px; font-size: 9.5px; color: var(--muted); }
.account-owner-hint { padding: 8px 10px; border-radius: 7px; background: var(--surface-2); font-size: 8.5px; line-height: 1.65; color: var(--faint); }
.check-line input { accent-color: var(--forest-3); }
@media (max-width: 600px) {
  .finance-scope-tabs { width: 100%; }
  .finance-scope-tabs button { flex: 1; padding: 0 6px; }
  .finance-scope-tabs > span { width: 100%; margin-left: 0; padding: 3px 6px; }
  .finance-tabs { display: grid; grid-template-columns: 1fr 1fr; }
  .finance-tabs button { justify-content: center; padding: 0 8px; }
  .finance-tabs button:last-child { grid-column: 1 / -1; }
  body[data-view="finance"] .view-head .view-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  body[data-view="finance"] .view-head .view-actions .select-inline { grid-column: 1 / -1; width: 100%; }
  body[data-view="finance"] .view-head .view-actions .btn { justify-content: center; }
  .finance-import-fields { grid-template-columns: 1fr; }
  .finance-import-actions { align-items: flex-start; flex-direction: column; }
}
.view-head h1 { margin-top: 9px; font-family: var(--font-serif); font-size: clamp(30px, 3.1vw, 40px); font-weight: 500; line-height: 1.16; letter-spacing: -0.025em; }
.view-lede { margin-top: 8px; color: var(--muted); font-size: 12.5px; max-width: 620px; }
.view-actions { display: flex; align-items: center; gap: 9px; flex: none; padding-bottom: 3px; }
.select-inline { height: 41px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 11px; padding: 0 30px 0 12px; font-size: 11px; color: var(--ink-2); appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 13px) 17px, calc(100% - 9px) 17px; background-size: 4px 4px, 4px 4px; background-repeat: no-repeat; }
.inline-search { display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--faint); min-width: 180px; }
.inline-search:focus-within { border-color: var(--line-strong); background: #fff; }
.inline-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 10.5px; }
.inline-search input::placeholder { color: var(--faint); }
.chart-legend { display: flex; align-items: center; gap: 12px; font-size: 9.5px; color: var(--muted); }
.chart-legend i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; }
.chart-legend span { display: flex; align-items: center; }
.hidden { display: none !important; }
.confirm-message { color: var(--muted); font-size: 13px; line-height: 1.8; padding: 4px 0; }

/* Switch */
.switch { width: 39px; height: 22px; flex: none; border: 0; padding: 2px; border-radius: 20px; background: #d8d5cc; position: relative; transition: background 0.22s; }
.switch i { display: block; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15); transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1); }
.switch.on { background: var(--forest-3); }
.switch.on i { transform: translateX(17px); }

/* =========================================================
   Modal / toast
   ========================================================= */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 28px;
  background: rgba(18, 34, 25, 0.42); backdrop-filter: blur(8px); opacity: 0; transition: opacity 0.22s;
  overflow-y: auto;
}
.modal-backdrop.is-open { opacity: 1; }
.modal {
  width: min(100%, 540px); max-height: min(88vh, 880px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(0.985); opacity: 0; transition: 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  border: 1px solid rgba(255, 255, 255, 0.5); margin: auto;
}
.modal-backdrop.is-open .modal { transform: none; opacity: 1; }
.modal-sm { width: min(100%, 400px); }
.modal-lg { width: min(100%, 760px); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 23px 25px 17px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-family: var(--font-serif); font-size: 25px; font-weight: 500; line-height: 1.2; }
.modal-head p { margin-top: 4px; font-size: 10.5px; color: var(--muted); }
.modal-close { width: 31px; height: 31px; color: var(--faint); }
.modal-body { padding: 22px 25px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 25px 20px; border-top: 1px solid var(--line); }
.modal-foot-right { display: flex; gap: 8px; margin-left: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 10px; font-weight: 600; color: var(--ink-2); letter-spacing: 0.02em; }
.field-label i { color: var(--clay); font-style: normal; margin-left: 3px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line-strong); background: #fff; border-radius: 9px; padding: 9px 11px;
  font-size: 11.5px; outline: 0; transition: border-color 0.18s, box-shadow 0.18s; color: var(--ink);
}
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 14px) 15px, calc(100% - 10px) 15px; background-size: 4px 4px, 4px 4px; background-repeat: no-repeat; padding-right: 28px; }
.field textarea { resize: vertical; min-height: 60px; line-height: 1.65; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--forest-3); box-shadow: 0 0 0 3px rgba(46, 89, 69, 0.07); }
.field input[type=color] { padding: 3px; height: 36px; cursor: pointer; }
.field input[type=range] { padding: 0; accent-color: var(--forest-3); border: 0; background: none; }
.field-hint { font-size: 9px; color: var(--faint); }
.confirm-message { color: var(--muted); font-size: 12.5px; line-height: 1.8; }
.settings-section { margin-bottom: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.settings-section:last-child { margin-bottom: 0; }
.settings-data-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settings-data-row > div { display: flex; flex-direction: column; gap: 2px; }
.settings-data-row strong { font-size: 11px; font-weight: 600; }
.settings-data-row small { font-size: 9px; color: var(--muted); }
.member-manage-section { padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.member-manage-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 9px; color: var(--faint); letter-spacing: 0.06em; }
.member-manage-head em { font-style: normal; }
.member-manage-list { display: flex; flex-direction: column; gap: 2px; }
.member-manage-item { display: flex; align-items: center; gap: 9px; padding: 6px 5px; border-radius: 8px; }
.member-manage-item:hover { background: rgba(255, 255, 255, 0.35); }
.member-manage-item > div { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.member-manage-item strong { font-size: 11.5px; font-weight: 600; }
.member-manage-item span { font-size: 9.5px; color: var(--faint); }
.member-manage-role { font-style: normal; font-size: 8.5px; color: var(--success); background: var(--sage-light); border-radius: 4px; padding: 3px 6px; }
.member-manage-actions { display: flex; align-items: center; gap: 2px; margin-left: 3px; }
.member-manage-role.muted { color: var(--faint); background: var(--surface-3); }
.member-account-hint { grid-column: 1 / -1; padding: 8px 10px; border-radius: 7px; background: var(--surface-2); font-size: 8.5px; line-height: 1.65; color: var(--faint); }
.member-account-actions { display: flex; justify-content: flex-end; }
.member-manage-divider { display: flex; align-items: center; gap: 11px; margin: 18px 0 13px; font-size: 9px; letter-spacing: 0.08em; color: var(--faint); }
.member-manage-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.toast-root { position: fixed; z-index: 400; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 9px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 9px; min-width: 210px; max-width: 340px; padding: 11px 14px;
  background: #1e382b; color: #f4efe3; border-radius: 11px; box-shadow: 0 12px 35px rgba(15, 30, 21, 0.28);
  font-size: 11.5px; opacity: 0; transform: translateY(10px); transition: 0.26s cubic-bezier(0.22, 1, 0.36, 1);
  border: 1px solid rgba(255, 255, 255, 0.09);
}
.toast.is-visible { opacity: 1; transform: none; }
.toast-icon { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.1); color: #b8d6c1; flex: none; }
.toast-error { background: #46281f; }
.toast-error .toast-icon { color: #f0b8a4; }
.toast-info { background: #263b46; }
.toast-info .toast-icon { color: #b9d4e1; }

/* =========================================================
   Dashboard
   ========================================================= */
.dashboard-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; }
.hero-card {
  grid-column: span 8; min-height: 326px; position: relative; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr); gap: 10px;
  padding: 30px 30px 25px; border-radius: var(--radius-xl); color: #f4efe3;
  background:
    radial-gradient(640px 440px at 84% 12%, rgba(210, 160, 93, 0.26), transparent 58%),
    radial-gradient(600px 500px at 8% 110%, rgba(100, 148, 122, 0.22), transparent 58%),
    linear-gradient(145deg, #1c3c2d 0%, #153025 55%, #122a20 100%);
  box-shadow: 0 22px 50px rgba(23, 43, 32, 0.16);
}
.hero-card::before {
  content: ""; position: absolute; inset: 0; opacity: 0.25; pointer-events: none;
  background-image: radial-gradient(rgba(245, 240, 229, 0.26) 0.4px, transparent 0.4px); background-size: 18px 18px;
  mask-image: radial-gradient(circle at 78% 30%, #000, transparent 65%);
}
.hero-card::after {
  content: ""; position: absolute; width: 420px; height: 420px; right: -160px; bottom: -260px;
  border: 1px solid rgba(231, 200, 144, 0.13); border-radius: 50%; box-shadow: 0 0 0 58px rgba(231, 200, 144, 0.025), 0 0 0 116px rgba(231, 200, 144, 0.02);
}
.hero-main { position: relative; z-index: 2; display: flex; flex-direction: column; }
.hero-eyebrow { display: flex; align-items: center; gap: 8px; font-size: 9.5px; letter-spacing: 0.1em; color: rgba(244, 239, 227, 0.53); }
.hero-eyebrow .live-dot { background: #a8c9b3; }
.hero-main h1 { margin-top: 18px; font-family: var(--font-serif); font-size: clamp(29px, 2.7vw, 37px); font-weight: 500; line-height: 1.3; letter-spacing: -0.02em; color: #f7f2e8; }
.hero-main h1 span { color: #e7c890; }
.hero-lede { margin-top: 13px; max-width: 350px; font-size: 11.5px; line-height: 1.8; color: rgba(244, 239, 227, 0.5); }
.hero-bottom { margin-top: auto; padding-top: 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero-family { display: flex; align-items: center; gap: 9px; font-size: 9px; color: rgba(244, 239, 227, 0.5); }
.hero-family .avatar { --avatar-size: 26px; box-shadow: 0 0 0 2px #1a3629; margin-left: -7px; }
.hero-family .avatar:first-child { margin-left: 0; }
.hero-link { display: flex; align-items: center; gap: 5px; border: 0; background: none; color: #e7c890; font-size: 9.5px; padding: 0; }
.hero-link:hover { color: #f6e5c6; }
.hero-main h1 { font-size: clamp(28px, 2.4vw, 34px); }
.hero-lede { color: rgba(244, 239, 227, .68); font-size: 11.5px; }
.hero-family { font-size: 10px; color: rgba(244, 239, 227, .66); }
.hero-forecast { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 9px; color: rgba(244, 239, 227, .58); }
.hero-forecast span { display: inline-flex; align-items: center; gap: 4px; }
.hero-forecast strong { font-family: var(--font-number); font-size: 10px; font-weight: 500; color: rgba(244, 239, 227, .86); }
.hero-forecast svg { color: #e6c58e; }
.hero-forecast .is-warning { color: #f0c28e; }
.hero-weather { position: relative; z-index: 2; align-self: center; padding: 4px 0 4px 27px; border-left: 1px solid rgba(255, 255, 255, .13); }
.hero-weather-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 9px; color: rgba(244, 239, 227, .7); }
.hero-weather-head span { display: flex; align-items: center; gap: 5px; }
.hero-weather-head-actions { display: flex; align-items: center; gap: 8px; }
.hero-weather-head em { font-style: normal; font-size: 8.5px; color: rgba(244, 239, 227, .5); }
.weather-locate { display: inline-flex; align-items: center; gap: 3px; padding: 0; border: 0; background: transparent; color: #e6c58e; font-size: 8.5px; }
.weather-locate:hover { color: #f6e5c6; }
.weather-locate:disabled { opacity: .55; cursor: wait; }
.hero-weather-main { display: flex; align-items: center; gap: 11px; margin-top: 15px; }
.hero-weather-icon { width: 50px; height: 50px; display: grid; place-items: center; flex: none; color: #f0d09e; }
.hero-weather-main > strong { font-family: var(--font-number); font-size: 52px; line-height: 1; font-weight: 500; letter-spacing: -.055em; color: #fbf4e7; }
.hero-weather-main > strong em { margin-left: 2px; font-family: var(--font-sans); font-size: 13px; font-style: normal; color: rgba(244, 239, 227, .66); }
.hero-weather-main > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hero-weather-main b { font-size: 15px; font-weight: 500; color: #f7eddc; }
.hero-weather-main small { font-size: 9px; color: rgba(244, 239, 227, .64); white-space: nowrap; }
.hero-weather-facts { display: flex; flex-wrap: wrap; gap: 3px 14px; margin-top: 13px; }
.hero-weather-facts span { font-size: 9px; color: rgba(244, 239, 227, .7); }
.hero-live-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 13px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .09); }
.hero-live-facts > div { display: flex; align-items: baseline; gap: 6px; padding: 4px 0; }
.hero-live-facts strong { font-family: var(--font-number); font-size: 19px; font-weight: 500; color: #f5eddf; }
.hero-live-facts span { font-size: 9px; color: rgba(244, 239, 227, .55); }
.hero-weather-empty { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 105px; font-size: 10px; color: rgba(244, 239, 227, .62); }
.hero-weather-empty svg { color: rgba(231, 200, 144, .7); }
.hero-radar { position: relative; z-index: 2; align-self: center; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.radar-chart { width: 100%; max-width: 310px; height: auto; }
.radar-score { position: absolute; left: 50%; top: 41%; transform: translate(-50%, -50%); z-index: 2; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.radar-score strong { font-family: var(--font-number); font-size: 43px; line-height: 1; font-weight: 500; letter-spacing: -0.05em; color: #f7f2e8; }
.radar-score span { margin-top: 4px; font-size: 8.5px; letter-spacing: 0.16em; color: rgba(244, 239, 227, 0.46); }
.radar-score em { margin-top: 3px; font-style: normal; font-size: 8px; color: #cbb183; }
.hero-dims { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px 10px; margin-top: -3px; }
.hero-dim { display: flex; align-items: center; gap: 4px; font-size: 8.5px; color: rgba(244, 239, 227, 0.46); }
.hero-dim-dot { width: 4px; height: 4px; border-radius: 50%; }
.hero-dim strong { font-weight: 600; color: rgba(244, 239, 227, 0.75); font-size: 8.5px; }
.insight-card {
  grid-column: span 4; position: relative; overflow: hidden; display: flex; flex-direction: column;
  padding: 25px 24px 21px; border-radius: var(--radius-xl); border: 1px solid #e9dcc3;
  background: linear-gradient(145deg, #f5ebd9 0%, #f0e3cd 60%, #ecdec6 100%);
  box-shadow: var(--shadow-sm);
}
.insight-head { display: flex; align-items: center; gap: 8px; font-size: 10px; font-weight: 600; color: #66553a; letter-spacing: 0.02em; position: relative; z-index: 2; }
.insight-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: rgba(255, 255, 255, 0.55); color: #9b713d; }
.insight-time { margin-left: auto; font-size: 8px; font-weight: 400; color: #a28f72; }
.insight-card blockquote { position: relative; z-index: 2; margin: 24px 0 18px; font-family: var(--font-serif); font-size: 18px; line-height: 1.72; color: #3b352a; letter-spacing: -0.01em; }
.insight-context { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 7px 13px; margin-top: auto; font-size: 8.5px; color: #8b785b; }
.insight-context span { display: flex; align-items: center; gap: 4px; }
.insight-action { position: relative; z-index: 2; margin-top: 17px; width: 100%; height: 38px; display: flex; align-items: center; justify-content: space-between; padding: 0 13px; border-radius: 10px; border: 1px solid rgba(87, 69, 43, 0.13); background: rgba(255, 255, 255, 0.36); color: #4b3e2b; font-size: 10px; font-weight: 550; transition: background 0.2s; }
.insight-action:hover { background: rgba(255, 255, 255, 0.6); }
.insight-orbit { position: absolute; border: 1px solid rgba(120, 95, 55, 0.08); border-radius: 50%; pointer-events: none; }
.orbit-1 { width: 240px; height: 240px; right: -110px; bottom: -120px; }
.orbit-2 { width: 160px; height: 160px; right: -68px; bottom: -80px; }
.smart-insights { grid-column: span 12; display: flex; flex-direction: column; gap: 12px; }
.smart-insights-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; padding: 3px 2px 0; }
.smart-insights-head h2 { font-family: var(--font-serif); font-size: clamp(20px, 1.7vw, 25px); font-weight: 500; letter-spacing: -0.02em; color: var(--ink); }
.smart-insights-head .panel-kicker { color: var(--gold); }
.smart-insights-more { display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: var(--muted); font-size: 9px; }
.smart-insights-more:hover { color: var(--ink); }
.smart-insights-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.smart-insight { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; min-height: 142px; padding: 15px 16px; overflow: hidden; text-align: left; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); transition: border-color .22s ease, box-shadow .22s ease, transform .22s ease; }
.smart-insight::after { content: ""; position: absolute; inset: auto 0 0 0; height: 2px; background: var(--insight-tone, var(--sage)); opacity: .7; }
.smart-insight:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.smart-insight-icon { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 9px; color: var(--insight-tone, var(--sage)); background: color-mix(in srgb, var(--insight-tone, var(--sage)) 11%, transparent); }
.smart-insight-copy { display: flex; flex-direction: column; gap: 4px; }
.smart-insight-copy strong { font-size: 11px; font-weight: 600; color: var(--ink); line-height: 1.45; }
.smart-insight-copy p { font-size: 9px; line-height: 1.65; color: var(--muted); }
.smart-insight-action { display: inline-flex; align-items: center; gap: 4px; margin-top: auto; font-size: 8.5px; color: var(--insight-tone, var(--sage)); }
.smart-insight.tone-danger { --insight-tone: var(--danger); }
.smart-insight.tone-warning { --insight-tone: var(--gold); }
.smart-insight.tone-info { --insight-tone: var(--blue); }
.smart-insight.tone-good { --insight-tone: var(--success); }
.metric-grid { grid-column: span 12; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.metric-card {
  position: relative; overflow: hidden; display: flex; flex-direction: column; min-height: 132px;
  padding: 17px 17px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
  box-shadow: var(--shadow-sm); transition: transform 0.24s, box-shadow 0.24s, border-color 0.24s;
}
.metric-card::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 2px; border-radius: 2px; background: var(--metric-accent); opacity: 0.65; }
.metric-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.metric-top { display: flex; align-items: center; gap: 7px; }
.metric-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: var(--metric-accent); background: color-mix(in srgb, var(--metric-accent) 12%, transparent); }
.metric-label { font-size: 9.5px; color: var(--muted); }
.metric-delta { margin-left: auto; font-size: 8px; color: var(--muted); background: var(--surface-2); border-radius: 4px; padding: 2px 5px; }
.metric-delta.up { color: var(--clay); background: var(--clay-light); }
.metric-delta.down { color: var(--success); background: var(--sage-light); }
.metric-delta.warn { color: #9e7331; background: #f6ecd7; }
.metric-value { margin-top: 9px; font-family: var(--font-number); font-size: 29px; line-height: 1.15; font-weight: 500; letter-spacing: -0.035em; color: var(--ink); }
.metric-value small { margin-left: 4px; font-family: var(--font-sans); font-size: 9px; font-weight: 400; letter-spacing: 0; color: var(--faint); }
.metric-foot { margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 8.5px; color: var(--faint); }
.metric-foot .progress { max-width: 72px; }
.metric-mini { display: flex; align-items: center; gap: 3px; color: var(--success); }
.metric-card .sparkline { opacity: 0.75; }
.home-panel { grid-column: span 7; }
.upcoming-panel { grid-column: span 5; display: flex; flex-direction: column; }
.finance-panel { grid-column: span 7; }
.health-panel { grid-column: span 5; }
.notes-panel { grid-column: span 12; }
.quick-devices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick-device { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); text-align: left; transition: background 0.2s, border-color 0.2s; }
.quick-device:hover { background: #fff; border-color: var(--line-strong); }
.quick-device.is-on { background: color-mix(in srgb, var(--device-tone) 7%, var(--surface)); border-color: color-mix(in srgb, var(--device-tone) 22%, var(--line)); }
.quick-device-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: #fff; color: var(--device-tone); box-shadow: 0 1px 4px rgba(24, 40, 31, 0.07); flex: none; }
.quick-device.is-on .quick-device-icon { background: var(--device-tone); color: #fff; }
.quick-device-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.quick-device-info strong { font-size: 10.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-device-info small { font-size: 8.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-device .switch { width: 31px; height: 18px; }
.quick-device .switch i { width: 14px; height: 14px; }
.quick-device .switch.on i { transform: translateX(13px); }
.quick-scenes { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 13px; padding-top: 13px; border-top: 1px dashed var(--line); }
.quick-scenes > span { font-size: 8.5px; color: var(--faint); margin-right: 3px; }
.scene-chip { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; background: transparent; font-size: 9px; color: var(--muted); transition: 0.18s; }
.scene-chip:hover { border-color: var(--gold); color: #946e38; background: #faf3e5; }
.scene-more { margin-left: auto; border-color: transparent; }
.upcoming-list { display: flex; flex-direction: column; gap: 4px; }
.upcoming-item { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border: 0; background: none; border-radius: 9px; text-align: left; transition: background 0.18s; }
.upcoming-item:hover { background: var(--surface-2); }
.upcoming-icon { width: 31px; height: 31px; flex: none; display: grid; place-items: center; border-radius: 9px; }
.tone-warn { color: #a87a35; background: #f7eedb; }
.tone-danger { color: var(--danger); background: #f8e9e3; }
.tone-info { color: var(--blue); background: var(--blue-light); }
.tone-good { color: var(--success); background: var(--sage-light); }
.upcoming-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.upcoming-copy strong { font-size: 10.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upcoming-copy small { font-size: 8.5px; color: var(--faint); }
.upcoming-date { font-size: 8.5px; color: var(--faint); }
.weather-strip { margin-top: auto; padding-top: 15px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 9px; }
.weather-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: #f8edd7; color: #c6944d; flex: none; }
.weather-strip > div { display: flex; flex-direction: column; gap: 1px; }
.weather-strip strong { font-size: 9.5px; font-weight: 600; }
.weather-strip small { font-size: 8px; color: var(--faint); }
.weather-sep { width: 1px; height: 24px; background: var(--line); margin: 0 2px; }
.finance-split { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 23px; }
.finance-chart-block { min-width: 0; }
.finance-budget-line { margin-top: 9px; display: flex; align-items: center; gap: 14px; font-size: 8.5px; color: var(--muted); }
.finance-budget-line > span { white-space: nowrap; }
.finance-budget-line strong { color: var(--ink); }
.finance-budget-line .progress { flex: 1; }
.tx-mini-list { display: flex; flex-direction: column; gap: 2px; }
.mini-tx { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.mini-tx:last-child { border-bottom: 0; }
.mini-tx-icon { width: 25px; height: 25px; flex: none; display: grid; place-items: center; border-radius: 7px; }
.mini-tx-icon.expense { background: #f3e9e2; color: #b76848; }
.mini-tx-icon.income { background: #e7f0ea; color: #3f6b57; }
.mini-tx-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mini-tx-copy strong { font-size: 9.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-tx-copy small { font-size: 8px; color: var(--faint); }
.mini-tx-amount { font-family: var(--font-number); font-size: 10px; font-weight: 600; white-space: nowrap; }
.mini-tx-amount.expense { color: var(--ink); }
.mini-tx-amount.income { color: var(--success); }
.health-chart-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.health-chart-head > div:first-child { display: flex; flex-direction: column; }
.health-chart-head strong { font-family: var(--font-number); font-size: 25px; font-weight: 500; letter-spacing: -0.03em; }
.health-chart-head span { font-size: 8.5px; color: var(--faint); }
.health-mini-stats { display: flex; gap: 10px; font-size: 8.5px; color: var(--muted); }
.health-mini-stats span { display: flex; align-items: center; gap: 4px; }
.health-panel .area-chart { width: 100%; height: 150px; margin-top: 4px; }
.health-members { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 5px; padding-top: 10px; border-top: 1px solid var(--line); }
.health-member { display: flex; align-items: center; gap: 7px; padding: 5px; border-radius: 8px; }
.health-member:hover { background: var(--surface-2); }
.health-member .avatar { --avatar-size: 27px; }
.health-member > span:not(.avatar) { flex: 1; display: flex; flex-direction: column; gap: 0; }
.health-member strong { font-size: 9.5px; font-weight: 600; }
.health-member small { font-size: 8px; color: var(--faint); }
.health-member em { font-style: normal; font-size: 8px; color: var(--faint); }
.health-member em.goal-met { color: var(--success); font-weight: 600; }
.recent-notes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.recent-note { display: flex; align-items: center; gap: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); transition: background 0.2s, border-color 0.2s; }
.recent-note:hover { background: #fff; border-color: var(--line-strong); }
.note-color { width: 3px; height: 28px; border-radius: 3px; flex: none; }
.recent-note-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.recent-note-copy strong { font-size: 10px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-note-copy small { font-size: 8px; color: var(--faint); }
.pin-mark { color: var(--gold); }
.notes-footer { display: flex; align-items: center; gap: 17px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 8.5px; color: var(--faint); }
.notes-footer span { display: flex; align-items: center; gap: 5px; }
.mini-action { margin-left: auto; display: flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--muted); font-size: 9px; }
.mini-action:hover { color: var(--ink); }

/* =========================================================
   Smart home
   ========================================================= */
body:not([data-view="home"]) .smart-tabs { display: none !important; }
.smart-tabs {
  display: flex; align-items: center; gap: 3px; width: fit-content; max-width: 100%;
  margin: 0 0 18px; padding: 4px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); overflow-x: auto;
}
.smart-tab {
  display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border: 1px solid transparent; border-radius: 7px; background: transparent;
  color: var(--muted); font-size: 12px; font-weight: 550; white-space: nowrap; transition: background 0.16s, color 0.16s;
}
.smart-tab:hover { color: var(--ink-2); background: color-mix(in srgb, var(--surface) 55%, transparent); }
.smart-tab.active { color: var(--ink); background: var(--surface); border-color: var(--line); box-shadow: 0 1px 2px rgba(30, 42, 35, 0.05); }
.smart-tab em { font-style: normal; font-size: 9px; color: var(--faint); background: var(--surface-2); border-radius: 10px; padding: 2px 5px; }
.smart-tab.active em { color: var(--forest); background: var(--sage-light); }
.home-overview { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; margin-bottom: 6px; align-items: start; }
.home-room-overview { margin-top: 22px; }
.home-room-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin-top: 13px; }
.home-room-card { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.home-room-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 11px; }
.home-room-name { display: flex; align-items: center; gap: 7px; min-width: 0; color: var(--muted); }
.home-room-name h3 { font-family: var(--font-serif); font-size: 18px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-room-head .text-link { font-size: 9.5px; color: var(--faint); }
.home-room-count { font-size: 9.5px; color: var(--faint); }
.home-room-device-list { display: flex; flex-wrap: wrap; gap: 8px; }
.home-device-tile {
  display: flex; align-items: center; gap: 9px; min-width: 0; width: calc(50% - 4px);
  min-height: 64px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface-2); text-align: left; cursor: pointer; transition: border-color 0.16s, background 0.16s;
}
.home-device-tile:hover, .home-device-tile:focus-visible { border-color: var(--line-strong); background: var(--surface); outline: none; }
.home-device-tile.is-on { border-color: color-mix(in srgb, var(--forest-3) 32%, var(--line)); }
.home-device-icon { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--surface); color: var(--faint); }
.home-device-tile.is-on .home-device-icon { color: var(--forest); background: var(--sage-light); }
.home-device-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.home-device-copy strong { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-device-copy small { font-size: 9.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-tile-switch { width: 33px !important; height: 19px !important; }
.home-tile-switch i { width: 15px !important; height: 15px !important; }
.home-tile-switch.on i { transform: translateX(14px) !important; }
.home-tile-readonly { flex: none; color: var(--faint); }
.home-device-more { width: 100%; padding: 6px 2px; font-size: 9.5px; color: var(--faint); background: transparent; border: 0; text-align: left; }
.home-device-more:hover { color: var(--ink-2); }
.home-room-empty { padding: 8px 0 3px; font-size: 10px; color: var(--faint); }
.home-room-overview .home-empty-state { margin-top: 12px; }
.home-status-card { position: relative; overflow: hidden; padding: 25px 27px 20px; border-radius: var(--radius-lg); color: #f4efe3; background: radial-gradient(620px 380px at 90% -20%, rgba(210, 160, 93, 0.2), transparent 60%), linear-gradient(140deg, #204434, #173225); box-shadow: 0 18px 40px rgba(24, 43, 33, 0.13); }
.home-status-card::after { content: ""; position: absolute; width: 330px; height: 330px; right: -140px; bottom: -200px; border: 1px solid rgba(231, 200, 144, 0.14); border-radius: 50%; box-shadow: 0 0 0 45px rgba(231, 200, 144, 0.025), 0 0 0 90px rgba(231, 200, 144, 0.02); }
.home-status-head { display: flex; align-items: center; gap: 12px; position: relative; z-index: 2; }
.status-orb { width: 39px; height: 39px; border-radius: 50%; display: flex; align-items: center; justify-content: center; gap: 2.5px; border: 1px solid rgba(231, 200, 144, 0.25); background: rgba(231, 200, 144, 0.08); }
.status-orb span { width: 3px; border-radius: 3px; background: #e0bb7d; animation: orb-bars 1.9s ease-in-out infinite; }
.status-orb span:nth-child(1) { height: 8px; animation-delay: -0.1s; }
.status-orb span:nth-child(2) { height: 15px; animation-delay: -0.6s; }
.status-orb span:nth-child(3) { height: 10px; animation-delay: -1s; }
@keyframes orb-bars { 0%, 100% { transform: scaleY(0.65); opacity: 0.55; } 50% { transform: scaleY(1); opacity: 1; } }
.home-status-head .panel-kicker { color: rgba(231, 200, 144, 0.55); }
.home-status-head h2 { font-family: var(--font-serif); font-size: 23px; font-weight: 500; color: #f7f2e8; margin-top: 1px; }
.home-online { margin-left: auto; font-size: 9.5px; color: rgba(244, 239, 227, 0.6); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 20px; padding: 4px 10px; }
.home-stat-row { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 24px; }
.home-stat { padding: 14px 15px; border-radius: 11px; background: rgba(255, 255, 255, 0.055); border: 1px solid rgba(255, 255, 255, 0.07); display: flex; flex-direction: column; gap: 3px; }
.home-stat > span { font-size: 10px; color: rgba(244, 239, 227, 0.7); }
.home-stat strong { font-family: var(--font-number); font-size: 27px; font-weight: 500; letter-spacing: -0.03em; color: #f8f2e6; font-variant-numeric: tabular-nums; }
.home-stat strong em { font-style: normal; font-family: var(--font-sans); font-size: 10px; color: rgba(244, 239, 227, 0.62); margin-left: 3px; }
.home-stat small { font-size: 9.5px; color: rgba(183, 211, 192, 0.82); }
.home-energy-tip { position: relative; z-index: 2; display: flex; align-items: center; gap: 7px; margin-top: 13px; padding-top: 11px; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 10px; color: rgba(244, 239, 227, 0.62); }
.home-energy-tip svg { color: #a8c6b1; }
.home-room-map { position: relative; z-index: 2; margin-top: 11px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.home-room-map-head { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 7.5px; color: rgba(244, 239, 227, 0.3); letter-spacing: 0.04em; }
.home-room-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.home-room-chip { display: flex; align-items: center; gap: 4px; min-width: 0; height: 27px; padding: 0 6px; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 6px; background: rgba(255, 255, 255, 0.035); color: rgba(244, 239, 227, 0.55); font-size: 7.5px; }
.home-room-chip:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(231, 200, 144, 0.25); }
.room-dot { width: 4px; height: 4px; border-radius: 50%; background: rgba(244, 239, 227, 0.22); flex: none; }
.room-dot.on { background: #b8d6c1; box-shadow: 0 0 0 2px rgba(184, 214, 193, 0.1); }
.home-room-chip > span:nth-child(2) { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-room-chip em { font-style: normal; font-size: 6.5px; color: rgba(244, 239, 227, 0.27); }
.scene-head-actions { display: flex; align-items: center; gap: 8px; }
.scene-head-actions .text-link { font-size: 8.5px; color: var(--gold); }
.scene-device-picker { max-height: 280px; overflow-y: auto; border: 1px solid var(--line); border-radius: 9px; padding: 5px 9px; }
.scene-device-picker-head { padding: 6px 2px; font-size: 8.5px; color: var(--faint); border-bottom: 1px solid var(--line); margin-bottom: 3px; }
.scene-device-row { display: flex; align-items: center; gap: 8px; padding: 6px 2px; border-bottom: 1px dashed var(--line); font-size: 9.5px; color: var(--muted); }
.scene-device-row:last-child { border-bottom: 0; }
.scene-device-row input { accent-color: var(--forest-3); }
.scene-device-row > span { flex: 1; display: flex; align-items: center; gap: 5px; min-width: 0; }
.scene-device-row select { width: 70px; height: 27px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink-2); font-size: 8.5px; }
.scene-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 128px; padding: 16px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; color: var(--faint); }
.scene-empty strong { font-family: var(--font-serif); font-size: 15px; font-weight: 500; color: var(--ink-2); }
.scene-empty p { max-width: 210px; font-size: 9.5px; line-height: 1.65; color: var(--muted); }
.home-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 44px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: rgba(251, 250, 247, 0.45); text-align: center; }
.home-empty-state .empty-icon { background: var(--surface-3); color: var(--muted); }
.home-empty-state h3 { font-family: var(--font-serif); font-size: 22px; font-weight: 500; }
.home-empty-state p { max-width: 390px; margin-bottom: 5px; font-size: 11px; line-height: 1.75; color: var(--muted); }
.chart-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 190px; color: var(--faint); font-size: 10px; }
.chart-empty small { font-size: 8.5px; }
.power-empty { padding: 24px 0; }
.budget-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; flex: 1; min-height: 150px; padding: 18px; text-align: center; color: var(--faint); }
.budget-empty strong { font-family: var(--font-serif); font-size: 17px; font-weight: 500; color: var(--ink-2); }
.budget-empty p { max-width: 260px; font-size: 10px; line-height: 1.7; color: var(--muted); }
.health-chart-empty { min-height: 240px; }
.health-chart-empty strong { font-family: var(--font-serif); font-size: 16px; font-weight: 500; color: var(--ink-2); }
.workout-empty { padding: 22px 0; text-align: center; }
.scene-panel { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.scene-list { display: flex; flex-direction: column; gap: 7px; }
.scene-card { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); text-align: left; transition: 0.18s; }
.scene-card:hover { background: #fff; border-color: var(--line-strong); transform: translateX(2px); }
.scene-icon { width: 35px; height: 35px; flex: none; display: grid; place-items: center; border-radius: 10px; color: var(--scene-tone); background: color-mix(in srgb, var(--scene-tone) 12%, transparent); }
.scene-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.scene-copy strong { font-size: 10.5px; font-weight: 600; }
.scene-copy small { font-size: 8px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scene-play { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--faint); background: var(--surface); }
.scene-card:hover .scene-play { color: var(--forest); }
.room-section { margin-top: 25px; }
.manage-head { align-items: flex-start; }
.manage-head.actions-only { justify-content: flex-end; }
.room-manage-list { display: flex; flex-direction: column; gap: 7px; }
.room-manage-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 6px; }
.room-manage-row input { min-width: 0; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); font-size: 10px; }
.room-manage-row > span { font-size: 9px; color: var(--muted); white-space: nowrap; }
.room-manage-row .btn { height: 30px; }
.manage-actions { display: flex; align-items: center; gap: 7px; flex: none; }
.room-pills-row { display: flex; align-items: center; margin-top: 13px; overflow-x: auto; padding-bottom: 2px; }
.room-pills-row .room-pills { flex-wrap: nowrap; }
@media (max-width: 600px) {
  .manage-head { flex-direction: column; gap: 10px; }
  .manage-actions { width: 100%; }
  .manage-actions .btn { flex: 1; justify-content: center; }
}
.room-pills { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.room-pill { display: flex; align-items: center; gap: 5px; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 9.5px; }
.room-pill:hover, .room-pill.active { border-color: var(--forest-3); color: var(--forest); background: #f2f6f3; }
.room-pill em { font-style: normal; font-size: 8px; color: var(--faint); background: var(--surface-2); border-radius: 4px; padding: 1px 4px; }
.room-pill.has-active { position: relative; }
.room-pill.has-active::after { content: ""; position: absolute; top: 4px; right: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--gold); }
.room-device-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 14px; }
.room-device-group { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(251, 250, 247, 0.55); }
.room-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.room-title h3 { font-family: var(--font-serif); font-size: 17px; font-weight: 500; }
.room-title span { font-size: 8.5px; color: var(--faint); }
.device-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.device-card { position: relative; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); transition: 0.2s; min-height: 116px; display: flex; flex-direction: column; }
.device-card:hover { border-color: var(--line-strong); box-shadow: 0 6px 16px rgba(24, 40, 31, 0.05); }
.device-card.is-on { background: color-mix(in srgb, var(--device-tone) 4%, var(--surface)); border-color: color-mix(in srgb, var(--device-tone) 20%, var(--line)); }
.device-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.device-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; color: var(--device-tone); background: color-mix(in srgb, var(--device-tone) 10%, transparent); }
.device-card.is-on .device-icon { background: var(--device-tone); color: #fff; box-shadow: 0 4px 10px color-mix(in srgb, var(--device-tone) 25%, transparent); }
.device-card .switch { width: 33px; height: 19px; }
.device-card .switch i { width: 15px; height: 15px; }
.device-card .switch.on i { transform: translateX(14px); }
.device-info { margin-top: 8px; padding-right: 17px; }
.device-info h3 { font-size: 10.5px; font-weight: 600; }
.device-info p { margin-top: 1px; font-size: 8px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-more { position: absolute; right: 8px; bottom: 8px; width: 22px; height: 22px; display: grid; place-items: center; border: 0; background: none; color: var(--faint); border-radius: 5px; opacity: 0; transition: opacity 0.18s; }
.device-card:hover .device-more { opacity: 1; }
.device-more:hover { background: var(--surface-2); color: var(--ink); }
.device-quick-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 9px; }
.device-quick-state { display: flex; align-items: center; gap: 4px; font-size: 9px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-quick-action { display: inline-flex; align-items: center; gap: 4px; flex: none; height: 25px; padding: 0 8px; border: 1px solid color-mix(in srgb, var(--gold) 40%, var(--line)); border-radius: 6px; background: var(--gold-light); color: #7a572c; font-size: 9px; font-weight: 600; }
.device-quick-action:hover { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 18%, var(--surface)); }
[data-theme="dark"] .device-quick-action { color: #f0d29b; background: #332a1e; border-color: #5c4930; }
.device-inline-control { margin-top: 9px; display: flex; align-items: center; gap: 5px; color: var(--faint); }
.device-inline-control input { flex: 1; height: 3px; accent-color: var(--device-tone); min-width: 0; }
.device-inline-control em { font-style: normal; font-size: 7.5px; color: var(--muted); width: 26px; text-align: right; }
.device-temp-control { margin-top: 7px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); height: 26px; padding: 0 3px; }
.device-temp-control button { width: 20px; height: 20px; border: 0; background: none; display: grid; place-items: center; color: var(--muted); border-radius: 4px; }
.device-temp-control button:hover { background: #fff; color: var(--ink); }
.device-temp-control span { font-size: 7.5px; color: var(--faint); }
.device-temp-control strong { font-size: 11px; color: var(--ink); font-weight: 600; }
.home-lower-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; margin-top: 19px; }
.energy-panel .bar-chart { width: 100%; height: 190px; }
.energy-summary { display: flex; align-items: baseline; gap: 3px; }
.energy-summary strong { font-family: var(--font-number); font-size: 23px; font-weight: 500; }
.energy-summary span { font-size: 8px; color: var(--faint); }
.energy-summary em { font-style: normal; font-size: 8px; margin-left: 4px; }
.energy-summary em.good { color: var(--success); }
.energy-summary em.bad { color: var(--clay); }
.energy-foot { display: flex; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--line); font-size: 8.5px; color: var(--faint); }
.energy-foot strong { color: var(--ink); }
.energy-dashboard { display: flex; flex-direction: column; gap: 20px; }
.energy-data-note { display: flex; align-items: flex-start; gap: 6px; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--gold) 36%, var(--line)); border-radius: 9px; background: color-mix(in srgb, var(--gold) 7%, var(--surface-2)); color: var(--muted); font-size: 9.5px; line-height: 1.6; }
.energy-data-note svg { flex: none; margin-top: 1px; color: var(--gold); }
.energy-period-tabs { display: flex; align-items: center; gap: 3px; width: fit-content; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.energy-period-tabs button { height: 34px; padding: 0 15px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 550; }
.energy-period-tabs button.active { color: var(--forest); background: var(--surface); border-color: var(--line); }
[data-theme="dark"] .energy-period-tabs button.active { color: #d8e7bd; background: #2d4132; border-color: #59745d; }
.energy-kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 13px; }
.energy-kpi { padding: 18px; min-height: 120px; display: flex; flex-direction: column; }
.energy-kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 9px; color: var(--muted); }
.energy-kpi-head svg { color: var(--gold); }
.energy-kpi strong { display: flex; align-items: baseline; gap: 5px; margin-top: 9px; font-family: var(--font-number); font-size: 25px; font-weight: 500; color: var(--ink); }
.energy-kpi strong em { font-style: normal; font-family: var(--font-sans); font-size: 9px; font-weight: 500; color: var(--faint); }
.energy-kpi small { margin-top: auto; padding-top: 5px; font-size: 8px; color: var(--faint); }
.energy-tariff-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 16px 0; padding: 18px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 8.5px; color: var(--faint); }
.energy-tariff-title { display: flex; align-items: center; gap: 5px; color: var(--muted); }
.energy-tariff-title svg { color: var(--gold); }
.energy-tariff-title strong { font-family: var(--font-number); font-weight: 500; color: var(--ink); }
.energy-tariff-strip > span:last-child { margin-left: auto; color: var(--faint); }
.energy-lower-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; }
.energy-usage-panel, .energy-breakdown-panel { min-width: 0; }
.energy-stat-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 20px; margin-top: 20px; }
.energy-stat-panel { min-width: 0; min-height: 328px; }
.energy-stat-panel .panel-head p { margin: 5px 0 0; font-size: 9px; color: var(--faint); }
.energy-stat-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 13px; min-height: 235px; color: var(--faint); }
.energy-stat-empty .energy-empty-icon { width: 50px; height: 50px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: var(--surface-2); }
.energy-stat-empty strong { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.energy-trend-chart { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; height: 240px; padding: 22px 8px 0; }
.energy-trend-col { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.energy-trend-col > span { min-height: 13px; font-family: var(--font-number); font-size: 9px; color: var(--muted); }
.energy-trend-track { width: min(32px, 65%); flex: 1; display: flex; align-items: flex-end; border-radius: 5px 5px 2px 2px; background: var(--surface-2); overflow: hidden; }
.energy-trend-track i { display: block; width: 100%; min-height: 0; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, #d6b97d, #8d9d79); }
.energy-trend-col small { font-size: 8.5px; color: var(--faint); white-space: nowrap; }
.energy-ranking { display: flex; flex-direction: column; gap: 2px; margin-top: 13px; }
.energy-rank-row { display: flex; align-items: center; gap: 8px; min-height: 31px; border-bottom: 1px solid var(--line-soft); }
.energy-rank-row:last-child { border-bottom: 0; }
.energy-rank-index { width: 17px; font-family: var(--font-number); font-size: 8px; color: var(--faint); }
.energy-rank-copy { width: 96px; display: flex; flex-direction: column; min-width: 0; }
.energy-rank-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; font-weight: 550; }
.energy-rank-copy small { font-size: 7.5px; color: var(--faint); }
.energy-rank-bar { flex: 1; height: 4px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.energy-rank-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #9db68c, #d3b677); }
.energy-rank-value { width: 59px; text-align: right; font-family: var(--font-number); font-size: 9px; font-weight: 500; }
.energy-rank-value em { margin-left: 2px; font-family: var(--font-sans); font-size: 7px; font-style: normal; color: var(--faint); }
.energy-usage-body { display: flex; align-items: center; gap: 26px; padding-top: 6px; }
.energy-usage-ring {
  width: 152px; height: 152px; flex: none; border-radius: 50%; position: relative; display: grid; place-items: center;
  background: conic-gradient(#B8D47E 0 var(--energy-angle), var(--line) var(--energy-angle) 360deg);
}
.energy-usage-ring::after { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: var(--surface); }
.energy-usage-center { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.energy-usage-center span { font-size: 8px; color: var(--faint); }
.energy-usage-center strong { font-family: var(--font-number); font-size: 24px; font-weight: 500; color: var(--ink); }
.energy-usage-center em { margin-left: 3px; font-style: normal; font-family: var(--font-sans); font-size: 8px; color: var(--faint); }
.energy-usage-stats { flex: 1; min-width: 0; }
.energy-usage-stats > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.energy-usage-stats span { font-size: 9px; color: var(--faint); }
.energy-usage-stats strong { font-family: var(--font-number); font-size: 12px; font-weight: 500; color: var(--ink-2); }
.energy-usage-stats p { margin-top: 10px; font-size: 8px; line-height: 1.6; color: var(--faint); }
.energy-breakdown-body { display: flex; align-items: center; gap: 20px; padding-top: 4px; }
.energy-breakdown-donut { width: 132px; height: 132px; flex: none; border-radius: 50%; position: relative; display: grid; place-items: center; }
.energy-breakdown-donut::after { content: ""; position: absolute; inset: 20px; border-radius: 50%; background: var(--surface); }
.energy-breakdown-center { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
.energy-breakdown-center span { font-size: 8px; color: var(--faint); }
.energy-breakdown-center strong { font-family: var(--font-number); font-size: 21px; font-weight: 500; color: var(--ink); }
.energy-breakdown-center em { font-style: normal; font-family: var(--font-sans); font-size: 7px; color: var(--faint); }
.energy-breakdown-legend { flex: 1; min-width: 0; }
.energy-breakdown-legend > div { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 7px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 8.5px; }
.energy-breakdown-legend > div:last-child { border-bottom: 0; }
.energy-breakdown-legend span { display: flex; align-items: center; gap: 5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.energy-breakdown-legend i { width: 6px; height: 6px; flex: none; border-radius: 2px; }
.energy-breakdown-legend strong { font-family: var(--font-number); font-weight: 500; color: var(--ink-2); }
.energy-breakdown-legend small { font-family: var(--font-number); font-size: 8px; color: var(--faint); }
.energy-breakdown-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 150px; color: var(--faint); text-align: center; }
.energy-breakdown-empty strong { font-family: var(--font-serif); font-size: 16px; font-weight: 500; color: var(--ink-2); }
.energy-breakdown-empty p { font-size: 8.5px; color: var(--faint); }
@media (max-width: 1050px) {
  .energy-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .energy-lower-grid, .energy-stat-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .energy-dashboard { gap: 18px; }
  .energy-period-tabs { width: 100%; justify-content: center; }
  .energy-tariff-strip { margin: 10px 0; padding: 14px; }
  .energy-kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .energy-kpi { padding: 13px; min-height: 108px; }
  .energy-kpi strong { font-size: 21px; }
  .energy-kpi small { font-size: 7.5px; }
  .energy-stat-panel { min-height: 280px; padding: 15px; }
  .energy-trend-chart { height: 205px; gap: 6px; padding-left: 0; padding-right: 0; }
  .energy-rank-copy { width: 78px; }
  .energy-rank-value { width: 52px; }
  .energy-period-tabs { width: 100%; }
  .energy-period-tabs button { flex: 1; padding: 0 5px; }
  .energy-tariff-strip > span:last-child { margin-left: 0; width: 100%; }
  .energy-usage-body, .energy-breakdown-body { gap: 13px; }
  .energy-usage-ring { width: 118px; height: 118px; }
  .energy-breakdown-donut { width: 108px; height: 108px; }
  .energy-breakdown-legend > div { gap: 4px; }
}
.power-list { display: flex; flex-direction: column; gap: 6px; }
.power-item { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.power-item:last-child { border-bottom: 0; }
.power-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); }
.power-copy { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.power-copy strong { font-size: 9.5px; font-weight: 600; }
.power-copy small { font-size: 8px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.power-value { font-family: var(--font-number); font-size: 9.5px; color: var(--muted); }
.power-total { margin-top: 9px; padding-top: 11px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; font-size: 9px; color: var(--muted); }
.power-total strong { color: var(--ink); }
.device-detail-hero { display: flex; align-items: center; gap: 13px; padding: 15px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); }
.device-detail-icon { width: 60px; height: 60px; display: grid; place-items: center; border-radius: 16px; background: var(--device-tone); color: #fff; }
.device-detail-hero > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.device-detail-hero strong { font-size: 13px; }
.device-detail-hero small { font-size: 10px; color: var(--muted); }
.device-panel-block { margin-top: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(180deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 82%, var(--surface))); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035); }
.device-readings { display: grid; grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)); gap: 6px; }
.device-reading { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); display: flex; flex-direction: column; gap: 3px; }
.device-reading span { font-size: 10px; color: var(--muted); }
.device-reading strong { font-family: var(--font-number); font-size: 16px; font-weight: 500; color: var(--ink); }
.device-reading strong em { margin-left: 2px; font-family: var(--font-sans); font-size: 8.5px; font-style: normal; color: var(--muted); }
.pet-feed-actions { margin-top: 12px; }
.pet-feed-button { flex: 1; min-height: 38px; justify-content: center; border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); background: var(--gold-light); color: #7a572c; font-size: 10.5px; font-weight: 600; }
.pet-feed-button:hover { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 18%, var(--surface)); }
[data-theme="dark"] .pet-feed-button { color: #f3d7a5 !important; background: #3a2d1e !important; border-color: #7a5f3a !important; }
[data-theme="dark"] .pet-feed-button:hover { background: #493821 !important; border-color: var(--gold) !important; }
.device-panel-note { display: flex; align-items: center; gap: 6px; margin-top: 11px; font-size: 10.5px; line-height: 1.6; color: var(--muted); }
.device-panel-note svg { flex: none; color: var(--gold); }
.device-panel-label { margin: 15px 0 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); }
.device-panel-label:first-child { margin-top: 0; }
.device-panel-block .detail-range { margin-top: 4px; margin-bottom: 12px; }
.device-panel-block .detail-temp { margin: 8px 0 3px; }
.device-current-reading { margin: 2px 0 12px; text-align: center; font-size: 11px; color: var(--muted); }
.device-current-reading strong { font-family: var(--font-number); font-weight: 500; color: var(--ink-2); }
.control-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.control-chip { min-height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 500; }
.control-chip:hover { border-color: var(--line-strong); color: var(--ink-2); }
.control-chip.active { border-color: var(--forest-3); background: var(--sage-light); color: var(--forest); }
.control-actions { display: flex; gap: 6px; }
.control-action { flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 40px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 500; }
.control-action:hover { border-color: var(--forest-3); color: var(--forest); }
.control-toggle { display: flex; align-items: center; justify-content: center; gap: 5px; width: 100%; min-height: 40px; margin-top: 4px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 500; }
.control-toggle.active { border-color: var(--forest-3); background: var(--sage-light); color: var(--forest); }
.control-select { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink-2); font-size: 11px; }
.device-media-now { padding: 8px 9px; border: 1px dashed var(--line); border-radius: 7px; font-size: 9px; color: var(--muted); }
.detail-range { margin-top: 18px; }
.detail-range-head { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-bottom: 8px; }
.detail-range-head strong { color: var(--ink); }
.detail-range input { width: 100%; accent-color: var(--forest-3); }
.detail-temp { display: flex; align-items: center; justify-content: center; gap: 30px; margin: 14px 0 8px; }
.detail-temp button { width: 45px; height: 45px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-2); color: var(--muted); }
.detail-temp button:hover { border-color: var(--forest-3); color: var(--forest); }
.detail-temp > div { display: flex; flex-direction: column; align-items: center; }
.detail-temp strong { font-family: var(--font-number); font-size: 52px; line-height: 1; font-weight: 500; }
.detail-temp span { font-size: 12px; color: var(--muted); margin-top: -2px; }
.detail-temp small { margin-top: 7px; font-size: 10px; color: var(--muted); }
.detail-more-toggle { width: 100%; min-height: 42px; margin-top: 13px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--ink-2); font-size: 10px; font-weight: 550; text-align: left; }
.detail-more-toggle:hover { border-color: var(--line-strong); background: var(--surface-3); }
.detail-more-toggle > span:first-child { display: flex; align-items: center; gap: 6px; }
.detail-more-toggle svg { color: var(--gold); }
.detail-more-hint { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 9px; font-weight: 400; }
.detail-more-toggle.is-open .detail-more-hint svg { transform: rotate(180deg); }
.detail-meta { margin-top: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: var(--line); }
.detail-meta > div { padding: 9px 11px; background: var(--surface); display: flex; flex-direction: column; gap: 1px; }
.detail-meta span { font-size: 8.5px; color: var(--faint); }
.detail-meta strong { font-size: 10px; font-weight: 600; }
.detail-room-cell { min-width: 0; }
.room-move-select {
  width: 100%; margin-top: 2px; padding: 1px 18px 1px 5px; border: 1px solid transparent; border-radius: 5px;
  background: transparent; color: var(--ink-2); font-size: 10px; font-weight: 600; cursor: pointer;
}
.room-move-select:hover, .room-move-select:focus { border-color: var(--line-strong); background: var(--surface-2); outline: none; }
.room-move-select option { background: var(--surface); color: var(--ink); }
.detail-entities { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.detail-entities-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 11px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 8.5px; color: var(--muted); }
.detail-entities-head em { font-style: normal; color: var(--faint); }
.detail-entity-row { display: flex; align-items: center; gap: 7px; padding: 7px 10px; border-bottom: 1px solid var(--line); }
.detail-entity-row:last-child { border-bottom: 0; }
.detail-entity-icon { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.detail-entity-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0; }
.detail-entity-copy strong { font-size: 9px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-entity-copy small { font-family: var(--font-number); font-size: 7px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-entity-state { font-size: 8px; color: var(--muted); white-space: nowrap; }
.entity-toggle { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--muted); }
.entity-toggle:hover { border-color: var(--forest-3); color: var(--forest); }
[data-theme="dark"] .entity-toggle:hover { border-color: var(--gold); color: var(--gold); }
[data-theme="dark"] .control-chip.active, [data-theme="dark"] .control-toggle.active { background: #22362a; color: #a9c99a; }

/* =========================================================
   Health
   ========================================================= */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 19px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 17px; box-shadow: var(--shadow-sm); }
.stat-card-top { display: flex; align-items: center; gap: 8px; }
.stat-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; }
.tone-green { color: var(--success); background: var(--sage-light); }
.tone-blue { color: var(--blue); background: var(--blue-light); }
.tone-clay { color: var(--clay); background: var(--clay-light); }
.tone-gold { color: #a87935; background: var(--gold-light); }
.stat-label { font-size: 9.5px; color: var(--muted); }
.stat-value { margin-top: 8px; font-family: var(--font-number); font-size: 28px; font-weight: 500; letter-spacing: -0.03em; }
.stat-value small { font-family: var(--font-sans); font-size: 9px; color: var(--faint); margin-left: 3px; letter-spacing: 0; }
.stat-foot { display: flex; align-items: center; gap: 7px; margin-top: 7px; font-size: 8.5px; color: var(--faint); }
.delta { font-weight: 600; }
.delta.good { color: var(--success); }
.delta.bad { color: var(--clay); }
.delta.neutral { color: #a87935; }
.health-main-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; }
.health-trend-panel .area-chart { width: 100%; height: 240px; }
.chart-tabs { display: flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; }
.chart-tabs button { height: 29px; padding: 0 12px; border: 0; background: none; border-radius: 6px; font-size: 11px; font-weight: 550; color: var(--muted); }
.chart-tabs button.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 5px rgba(24, 40, 31, 0.08); }
.chart-topline { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 6px; }
.chart-topline > div:first-child { display: flex; flex-direction: column; }
.chart-topline strong { font-family: var(--font-number); font-size: 25px; font-weight: 500; letter-spacing: -0.03em; }
.chart-topline strong small { font-family: var(--font-sans); font-size: 9px; color: var(--faint); margin-left: 3px; }
.chart-topline span { font-size: 8.5px; color: var(--faint); }
.sleep-chart { width: 100%; height: 240px; }
.trend-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 8.5px; color: var(--faint); }
.trend-foot span { display: flex; align-items: center; gap: 4px; }
.wellness-aside { display: flex; flex-direction: column; background: linear-gradient(150deg, #f7f4eb, #f2f0e6); }
.ai-chip { display: flex; align-items: center; gap: 3px; font-size: 8px; color: #946e38; background: #fbf3e3; border: 1px solid #ecdfc5; border-radius: 20px; padding: 3px 7px; }
.wellness-score { position: relative; width: 120px; height: 120px; margin: 4px auto 14px; display: grid; place-items: center; }
.wellness-score .ring-chart { position: absolute; inset: 0; }
.wellness-score > div { display: flex; flex-direction: column; align-items: center; }
.wellness-score strong { font-family: var(--font-number); font-size: 31px; font-weight: 500; line-height: 1; }
.wellness-score span { margin-top: 3px; font-size: 8px; color: var(--faint); }
.wellness-advice { text-align: center; font-family: var(--font-serif); font-size: 14px; line-height: 1.75; color: var(--ink-2); padding: 0 6px 14px; }
.wellness-list { border-top: 1px dashed var(--line); padding-top: 4px; margin-bottom: 14px; }
.wellness-list > div { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; font-size: 9px; color: var(--muted); }
.wellness-list span { display: flex; align-items: center; gap: 5px; }
.wellness-list strong { font-size: 9px; font-weight: 600; color: var(--ink-2); }
.member-section-head { margin-top: 26px; }
.member-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.member-card { padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); cursor: pointer; transition: transform 0.22s, box-shadow 0.22s; position: relative; overflow: hidden; }
.member-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.member-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--member-color); opacity: 0.7; }
.member-card-head { display: flex; align-items: center; gap: 9px; }
.member-card-head > div { flex: 1; min-width: 0; }
.member-card-head h3 { font-family: var(--font-serif); font-size: 18px; font-weight: 500; }
.member-card-head p { font-size: 8px; color: var(--faint); }
.member-more { color: var(--faint); }
.member-body { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.member-ring { position: relative; width: 88px; height: 88px; flex: none; }
.member-ring .ring-chart { position: absolute; inset: 0; }
.member-ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.member-ring-center strong { font-family: var(--font-number); font-size: 21px; font-weight: 500; line-height: 1; }
.member-ring-center strong em { font-style: normal; font-size: 8px; }
.member-ring-center span { font-size: 7.5px; color: var(--faint); margin-top: 2px; }
.member-metrics { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.member-metrics > div { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.member-metrics span { display: flex; align-items: center; gap: 3px; font-size: 7.5px; color: var(--faint); white-space: nowrap; }
.member-metrics strong { font-family: var(--font-number); font-size: 10px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.member-foot { display: flex; justify-content: space-between; gap: 5px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); font-size: 7.5px; color: var(--faint); }
.member-foot span { display: flex; align-items: center; gap: 3px; }
.member-foot .goal-met { color: var(--success); font-weight: 600; }
.member-water { height: 2px; margin-top: 8px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.member-water span { display: block; height: 100%; background: var(--blue); border-radius: 2px; opacity: 0.55; }
.health-bottom-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; margin-top: 19px; }
.workout-list { display: flex; flex-direction: column; }
.workout-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.workout-item:last-child { border-bottom: 0; }
.workout-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; flex: none; }
.workout-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.workout-copy strong { font-size: 10px; font-weight: 600; }
.workout-copy small { font-size: 8px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workout-stats { text-align: right; display: flex; flex-direction: column; gap: 1px; }
.workout-stats span { font-size: 8px; color: var(--faint); }
.workout-stats strong { font-family: var(--font-number); font-size: 9.5px; font-weight: 600; }
.habit-list { display: flex; flex-direction: column; gap: 8px; }
.habit-item { display: flex; align-items: flex-start; gap: 9px; padding: 9px 10px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); }
.habit-item > span { width: 18px; height: 18px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-strong); color: #fff; }
.habit-item.done > span { background: var(--success); border-color: var(--success); }
.habit-item div { display: flex; flex-direction: column; gap: 1px; }
.habit-item strong { font-size: 9.5px; font-weight: 600; }
.habit-item small { font-size: 8px; color: var(--faint); }

/* =========================================================
   Finance
   ========================================================= */
.finance-overview { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; }
.networth-card { position: relative; overflow: hidden; padding: 24px 26px 19px; border-radius: var(--radius-lg); color: #f4efe3; background: radial-gradient(620px 400px at 100% 0%, rgba(210, 160, 93, 0.23), transparent 60%), linear-gradient(140deg, #1c3d2e, #152f23); box-shadow: 0 18px 42px rgba(24, 43, 33, 0.14); }
.networth-card::after { content: ""; position: absolute; width: 300px; height: 300px; right: -100px; bottom: -180px; border-radius: 50%; border: 1px solid rgba(231, 200, 144, 0.12); box-shadow: 0 0 0 42px rgba(231, 200, 144, 0.02), 0 0 0 84px rgba(231, 200, 144, 0.016); }
.networth-top { display: flex; justify-content: space-between; align-items: flex-start; position: relative; z-index: 2; }
.networth-top h2 { margin-top: 2px; font-family: var(--font-serif); font-size: 19px; font-weight: 500; color: #f7f2e8; }
.networth-top .panel-kicker { color: rgba(231, 200, 144, 0.52); }
.networth-chip { display: flex; align-items: center; gap: 4px; font-size: 8px; color: rgba(244, 239, 227, 0.5); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 20px; padding: 4px 8px; }
.networth-value { position: relative; z-index: 2; margin: 6px 0 17px; font-family: var(--font-number); font-size: clamp(34px, 3.5vw, 46px); font-weight: 500; letter-spacing: -0.045em; line-height: 1.1; color: #f8f3e7; }
.networth-breakdown { position: relative; z-index: 2; display: flex; gap: 14px; margin: -8px 0 14px; font-size: 9px; color: rgba(244, 239, 227, 0.5); }
.networth-breakdown span { padding: 3px 7px; border-radius: 5px; background: rgba(255, 255, 255, 0.05); }
.networth-split { position: relative; z-index: 2; display: flex; gap: 28px; padding-bottom: 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.networth-split > div { display: flex; flex-direction: column; gap: 2px; }
.networth-split span { font-size: 8px; color: rgba(244, 239, 227, 0.4); }
.networth-split strong { font-family: var(--font-number); font-size: 14px; font-weight: 500; color: #f3eddf; }
.networth-split strong.income { color: #a9cdb6; }
.networth-split strong.expense { color: #e5b194; }
.account-strip { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.account-strip .account-card { padding: 0; background: transparent; border: 0; display: flex; flex-direction: column; gap: 2px; box-shadow: none; }
.account-strip .account-icon { width: 22px; height: 22px; margin-bottom: 3px; background: rgba(255, 255, 255, 0.09); color: var(--account-color); border-radius: 6px; }
.account-strip .account-card > div { display: flex; flex-direction: column; gap: 0; }
.account-strip .account-card span { font-size: 7.5px; color: rgba(244, 239, 227, 0.4); }
.account-strip .account-card small { display: none; }
.account-strip .account-card strong { font-size: 9.5px; color: rgba(244, 239, 227, 0.85); font-weight: 500; }
.budget-health-card { padding: 22px 23px; border: 1px solid #e9dcc3; border-radius: var(--radius-lg); background: linear-gradient(145deg, #f6eddd, #f1e6d1); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.budget-pill { font-size: 8px; color: var(--success); background: rgba(255, 255, 255, 0.5); border: 1px solid rgba(79, 124, 97, 0.15); border-radius: 20px; padding: 3px 7px; }
.budget-pill.warn { color: var(--danger); }
.budget-main { display: flex; align-items: center; gap: 17px; margin-top: 4px; }
.budget-circle { width: 94px; height: 94px; flex: none; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--forest-3) calc(var(--pct) * 1%), rgba(62, 83, 66, 0.1) 0); position: relative; }
.budget-circle::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: #f4ead8; }
.budget-circle > div { position: relative; display: flex; flex-direction: column; align-items: center; }
.budget-circle strong { font-family: var(--font-number); font-size: 24px; font-weight: 500; line-height: 1; }
.budget-circle strong em { font-style: normal; font-size: 8px; }
.budget-circle span { margin-top: 3px; font-size: 7.5px; color: var(--faint); }
.budget-copy { display: flex; flex-direction: column; gap: 1px; }
.budget-copy strong { font-family: var(--font-number); font-size: 20px; font-weight: 500; }
.budget-copy span { font-size: 8.5px; color: #8d7b5e; }
.budget-copy small { margin-top: 3px; font-size: 8px; color: #a08b6b; }
.budget-topline { margin-top: 15px; display: flex; flex-direction: column; gap: 5px; }
.budget-topline > div { display: flex; align-items: center; gap: 7px; }
.budget-topline span { width: 26px; font-size: 7.5px; color: #8d7b5e; }
.budget-topline i { display: block; height: 3px; border-radius: 3px; opacity: 0.8; }
.budget-link { margin-top: auto; padding-top: 10px; color: #75603f; font-size: 9px; }
.finance-charts-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; margin-top: 19px; }
.cashflow-panel .bar-chart { width: 100%; height: 240px; }
.cashflow-foot { display: flex; justify-content: space-between; padding-top: 9px; border-top: 1px solid var(--line); font-size: 8.5px; color: var(--faint); }
.cashflow-foot strong { color: var(--ink); font-weight: 600; }
.category-panel { display: flex; flex-direction: column; }
.donut-area { display: flex; justify-content: center; padding: 2px 0 8px; }
.donut-wrap { position: relative; display: grid; place-items: center; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-label { font-size: 7.5px; color: var(--faint); margin-bottom: 2px; }
.donut-center strong { font-family: var(--font-number); font-size: 16px; font-weight: 500; }
.donut-legend { display: flex; flex-direction: column; gap: 2px; margin-top: auto; }
.donut-legend-row { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: 8.5px; }
.donut-legend-row:last-child { border: 0; }
.donut-legend-row > span { flex: 1; display: flex; align-items: center; gap: 5px; color: var(--muted); }
.donut-legend-row i { width: 5px; height: 5px; border-radius: 50%; }
.donut-legend-row strong { font-weight: 500; color: var(--ink-2); font-family: var(--font-number); font-size: 9px; }
.donut-legend-row em { font-style: normal; font-size: 7.5px; color: var(--faint); width: 26px; text-align: right; }
.finance-mid-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; margin-top: 19px; }
.budget-list { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
.budget-row { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.budget-row-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.budget-row-head span { display: flex; align-items: center; gap: 5px; font-size: 9.5px; font-weight: 550; }
.budget-row-head span i { width: 5px; height: 5px; border-radius: 50%; }
.budget-row-head strong { font-family: var(--font-number); font-size: 9px; font-weight: 500; color: var(--ink); }
.budget-row-head strong em { font-style: normal; font-size: 8px; color: var(--faint); }
.budget-row-foot { display: flex; justify-content: space-between; margin-top: 4px; font-size: 7.5px; color: var(--faint); }
.budget-row.over .budget-row-foot { color: var(--danger); }
.accounts-list { display: flex; flex-direction: column; gap: 6px; }
.account-card { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.account-icon { width: 31px; height: 31px; flex: none; display: grid; place-items: center; border-radius: 8px; background: color-mix(in srgb, var(--account-color) 12%, #fff); color: var(--account-color); }
.account-card > div { flex: 1; display: flex; flex-direction: column; gap: 0; }
.account-card > div span { font-size: 9px; font-weight: 550; }
.account-card > div small { font-size: 7.5px; color: var(--faint); }
.account-card > strong { font-family: var(--font-number); font-size: 11px; font-weight: 500; }
.accounts-note { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 5px; font-size: 7.5px; color: var(--faint); }
.tx-panel { margin-top: 19px; }
.tx-panel-head { align-items: flex-end; }
.tx-tools { display: flex; align-items: center; gap: 8px; }
.tx-filter { display: flex; gap: 1px; padding: 3px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); }
.tx-filter button { height: 29px; padding: 0 10px; border: 0; background: none; border-radius: 5px; font-size: 10.5px; font-weight: 550; color: var(--muted); }
.tx-filter button.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 4px rgba(24, 40, 31, 0.08); }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 8px 10px; font-size: 8px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1px solid var(--line); }
.data-table td { padding: 9px 10px; border-bottom: 1px solid rgba(228, 224, 214, 0.6); font-size: 10px; vertical-align: middle; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.tx-date { font-family: var(--font-number); font-size: 9px; color: var(--faint); }
.tx-main { display: flex; align-items: center; gap: 9px; }
.tx-icon { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 8px; }
.tx-main > div { display: flex; flex-direction: column; gap: 0; }
.tx-main strong { font-size: 10px; font-weight: 600; }
.tx-main small { font-size: 8px; color: var(--faint); }
.tx-member { display: flex; align-items: center; gap: 5px; font-size: 9px; color: var(--muted); }
.tx-member .avatar { --avatar-size: 22px; }
.tx-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.wechat-auto-panel { margin-top: 13px; }
.wechat-auto-panel .panel-head { margin-bottom: 14px; }
.wechat-auto-panel .panel-head p { margin: 4px 0 0; font-size: 9.5px; color: var(--muted); }
.wechat-auto-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 16px; align-items: end; }
.wechat-auto-grid > .check-line { align-self: center; }
.wechat-folder-field { grid-column: 1 / -1; }
.wechat-folder-row { display: flex; gap: 6px; }
.wechat-folder-row input { flex: 1; min-width: 0; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: 9.5px; }
.wechat-auto-actions { display: flex; align-items: center; gap: 7px; grid-column: 1 / -1; flex-wrap: wrap; }
.wechat-auto-actions > span { font-size: 9px; color: var(--muted); }
.wechat-auto-hint { display: flex; align-items: flex-start; gap: 5px; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 9px; line-height: 1.6; color: var(--muted); }
.wechat-auto-hint svg { flex: none; color: var(--gold); margin-top: 1px; }
.webhook-panel { margin-top: 13px; }
.webhook-panel .panel-head { margin-bottom: 14px; }
.webhook-panel .panel-head p { margin: 4px 0 0; font-size: 9.5px; color: var(--muted); }
.webhook-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 11px 16px; align-items: end; }
.webhook-endpoint-field { min-width: 0; }
.webhook-token-row { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 5px; }
.webhook-token-row > span { font-size: 9px; color: var(--muted); }
.webhook-token-row > div { display: flex; gap: 6px; }
.webhook-token-row input { flex: 1; min-width: 0; height: 36px; padding: 0 9px; border: 1px dashed var(--gold); border-radius: 7px; background: var(--surface-2); color: var(--ink-2); font-family: ui-monospace, Consolas, monospace; font-size: 9px; }
.webhook-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.webhook-actions > span { font-size: 9px; color: var(--muted); }
.webhook-example { margin-top: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.webhook-example strong { font-size: 10px; }
.webhook-example pre { margin: 7px 0 6px; overflow-x: auto; padding: 9px; border-radius: 6px; background: var(--bg-deep); color: var(--ink-2); font-family: ui-monospace, Consolas, monospace; font-size: 8.5px; line-height: 1.55; }
.webhook-example small { font-size: 9px; line-height: 1.6; color: var(--muted); }
.recurring-list { display: flex; flex-direction: column; gap: 5px; }
.recurring-item { display: flex; align-items: center; gap: 6px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.recurring-item.is-paused { opacity: .58; }
.recurring-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.recurring-copy strong { font-size: 10.5px; font-weight: 600; }
.recurring-copy small { font-size: 8.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recurring-item .btn { height: 29px; }
.split-rows { display: flex; flex-direction: column; gap: 7px; }
.split-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px minmax(0, 1.2fr) 24px; gap: 6px; align-items: center; }
.split-row select, .split-row input { width: 100%; height: 34px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink-2); padding: 0 8px; font-size: 9.5px; }
.split-add { margin-top: 10px; }
.split-total { display: flex; justify-content: flex-end; margin-top: 12px; font-size: 10px; color: var(--muted); }
.split-total strong { margin-left: 6px; font-family: var(--font-number); color: var(--ink); }
.tx-status { display: inline-flex; align-items: center; padding: 3px 6px; border-radius: 5px; font-size: 8px; white-space: nowrap; }
.tx-status.cleared { color: var(--success); background: var(--sage-light); }
.tx-status.pending { color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); }
.tx-amount { font-family: var(--font-number); font-size: 11px; font-weight: 500; }
.tx-amount.income { color: var(--success); }
.tx-amount.expense { color: var(--ink); }
.table-foot { display: flex; justify-content: space-between; padding-top: 11px; margin-top: 4px; border-top: 1px solid var(--line); font-size: 8.5px; color: var(--faint); }
.table-empty { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 30px; color: var(--faint); font-size: 10px; }

/* =========================================================
   Storage
   ========================================================= */
.storage-top-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; }
.storage-hero { position: relative; overflow: hidden; display: flex; align-items: center; padding: 28px 30px; min-height: 230px; border-radius: var(--radius-lg); color: #f5efe3; background: radial-gradient(560px 360px at 88% 10%, rgba(210, 160, 93, 0.18), transparent 58%), linear-gradient(145deg, #3a5245, #2a4034 62%, #24382d); box-shadow: 0 16px 36px rgba(31, 51, 39, 0.13); }
.storage-hero-copy { position: relative; z-index: 2; flex: 1; }
.storage-hero-copy .panel-kicker { color: rgba(231, 200, 144, 0.52); }
.storage-hero-copy h2 { margin-top: 5px; font-family: var(--font-serif); font-size: clamp(24px, 2.3vw, 31px); font-weight: 500; line-height: 1.38; color: #f7f2e8; }
.storage-hero-copy h2 em { font-style: normal; font-family: var(--font-number); color: #e7c890; font-size: 1.2em; }
.storage-hero-copy > p { margin-top: 8px; font-size: 9.5px; color: rgba(244, 239, 227, 0.48); letter-spacing: 0.01em; }
.storage-hero-stats { display: flex; gap: 26px; margin-top: 22px; }
.storage-hero-stats > div { display: flex; flex-direction: column; gap: 0; }
.storage-hero-stats strong { font-family: var(--font-number); font-size: 23px; font-weight: 500; color: #f4eddf; }
.storage-hero-stats span { font-size: 8px; color: rgba(244, 239, 227, 0.38); }
.storage-illustration { position: relative; width: 200px; height: 190px; flex: none; }
.shelf { position: absolute; display: flex; align-items: flex-end; gap: 5px; padding: 0 8px 6px; border-bottom: 2px solid rgba(231, 211, 167, 0.18); }
.shelf span { display: block; border-radius: 3px 3px 2px 2px; background: linear-gradient(180deg, rgba(231, 211, 167, 0.36), rgba(231, 211, 167, 0.12)); border: 1px solid rgba(231, 211, 167, 0.2); }
.shelf-1 { right: 4px; bottom: 18px; width: 176px; height: 53px; }
.shelf-1 span:nth-child(1) { width: 30px; height: 42px; }
.shelf-1 span:nth-child(2) { width: 22px; height: 31px; }
.shelf-1 span:nth-child(3) { width: 42px; height: 37px; border-radius: 20px 20px 3px 3px; }
.shelf-2 { right: 18px; bottom: 75px; width: 148px; height: 48px; }
.shelf-2 span:nth-child(1) { width: 33px; height: 35px; }
.shelf-2 span:nth-child(2) { width: 54px; height: 28px; border-radius: 5px; }
.shelf-3 { right: 0; bottom: 128px; width: 153px; height: 34px; }
.shelf-3 span:nth-child(1) { width: 20px; height: 24px; }
.shelf-3 span:nth-child(2) { width: 32px; height: 17px; }
.shelf-3 span:nth-child(3) { width: 16px; height: 28px; }
.storage-glow { position: absolute; inset: 20% 10%; border-radius: 50%; background: radial-gradient(circle, rgba(210, 160, 93, 0.16), transparent 68%); filter: blur(18px); }
.urgent-panel { display: flex; flex-direction: column; }
.urgent-list { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.urgent-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.urgent-row:last-child { border: 0; }
.urgent-row > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 0; min-width: 0; }
.urgent-row strong { font-size: 9.5px; font-weight: 600; }
.urgent-row small { font-size: 8px; color: var(--faint); }
.urgent-row em { font-style: normal; font-size: 8px; color: var(--faint); background: var(--surface-2); border-radius: 4px; padding: 2px 5px; }
.urgent-icon { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 7px; background: var(--surface-2); }
.location-section { margin-top: 25px; }
.location-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.location-card { position: relative; display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); text-align: left; box-shadow: var(--shadow-sm); transition: 0.2s; }
.location-card:hover { border-color: var(--loc-color); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.location-icon { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 10px; color: var(--loc-color); background: color-mix(in srgb, var(--loc-color) 11%, transparent); }
.location-copy { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.location-copy strong { font-size: 10.5px; font-weight: 600; }
.location-copy small { font-size: 8px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.location-count { display: flex; align-items: baseline; gap: 1px; color: var(--muted); }
.location-count strong { font-family: var(--font-number); font-size: 17px; font-weight: 500; }
.location-count small { font-size: 7.5px; }
.location-alert { position: absolute; right: 9px; top: 8px; font-size: 7px; color: #a87935; background: #fbf1dd; border-radius: 4px; padding: 1px 4px; }
.items-section { margin-top: 25px; }
.items-head { align-items: flex-end; }
.items-tools { display: flex; align-items: center; gap: 8px; }
.active-filter-bar { display: flex; align-items: center; justify-content: space-between; padding: 6px 11px; margin-bottom: 10px; border: 1px dashed var(--line-strong); border-radius: 8px; font-size: 8.5px; color: var(--muted); }
.active-filter-bar button { display: flex; align-items: center; gap: 3px; border: 0; background: none; font-size: 8px; color: var(--faint); }
.storage-items-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.storage-item { padding: 12px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); transition: 0.2s; }
.storage-item:hover { border-color: var(--line-strong); box-shadow: 0 5px 15px rgba(24, 40, 31, 0.045); }
.storage-item-main { display: flex; align-items: flex-start; gap: 9px; }
.item-icon { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 9px; }
.item-copy { flex: 1; min-width: 0; }
.item-copy h3 { font-size: 11px; font-weight: 600; }
.item-copy p { font-size: 8px; color: var(--faint); margin-top: 1px; }
.item-actions { display: flex; gap: 0; opacity: 0; transition: opacity 0.18s; }
.storage-item:hover .item-actions { opacity: 1; }
.storage-item-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 9px; }
.qty-control { display: flex; align-items: center; gap: 3px; border: 1px solid var(--line); border-radius: 6px; height: 24px; padding: 0 2px; background: var(--surface-2); }
.qty-control button { width: 19px; height: 19px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); border-radius: 4px; }
.qty-control button:hover { background: #fff; color: var(--ink); }
.qty-control span { font-size: 7.5px; color: var(--faint); min-width: 40px; text-align: center; }
.qty-control strong { font-size: 10px; color: var(--ink); font-weight: 600; }
.expiry-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 7.5px; border-radius: 5px; padding: 3px 6px; white-space: nowrap; }
.expiry-badge.ok { color: var(--muted); background: var(--surface-2); }
.expiry-badge.warn { color: #a87935; background: #fbf1dd; }
.expiry-badge.danger { color: var(--danger); background: #faeae4; }
.expiry-badge.neutral { color: var(--faint); background: var(--surface-2); }
.storage-item-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 7px; padding-top: 7px; border-top: 1px dashed var(--line); }
.stock-line { display: flex; align-items: center; gap: 3px; font-size: 7.5px; color: var(--faint); }
.stock-line.low { color: #a87935; }
.item-note { font-size: 7.5px; color: var(--faint); max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.storage-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 50px; color: var(--faint); font-size: 10px; }

/* =========================================================
   Media
   ========================================================= */
.media-hero { position: relative; overflow: hidden; display: flex; align-items: center; padding: 30px 33px; min-height: 268px; border-radius: var(--radius-xl); color: #f5efe3; background: radial-gradient(600px 380px at 88% 0%, rgba(210, 160, 93, 0.2), transparent 58%), linear-gradient(145deg, #213d31, #182f26 60%, #14291f); box-shadow: 0 18px 40px rgba(24, 43, 33, 0.15); }
.media-hero-copy { position: relative; z-index: 3; flex: 1; }
.media-hero-copy .panel-kicker { color: rgba(231, 200, 144, 0.52); }
.media-hero-copy h2 { margin-top: 5px; font-family: var(--font-serif); font-size: clamp(25px, 2.6vw, 34px); font-weight: 500; line-height: 1.35; color: #f7f2e8; }
.media-hero-copy h2 span { color: #e7c890; }
.media-hero-copy > p { max-width: 440px; margin-top: 10px; font-size: 9.5px; line-height: 1.75; color: rgba(244, 239, 227, 0.48); }
.media-hero-meta { display: flex; align-items: center; gap: 12px; margin-top: 13px; font-size: 8.5px; color: rgba(244, 239, 227, 0.55); }
.media-hero-meta span { display: flex; align-items: center; gap: 4px; }
.media-hero-meta .stars { color: #d9b475; }
.media-hero .btn-cream { margin-top: 16px; height: 36px; font-size: 10px; padding: 0 14px; }
.media-hero-stats { display: flex; gap: 24px; margin-top: 21px; }
.media-hero-stats > div { display: flex; flex-direction: column; gap: 0; }
.media-hero-stats strong { font-family: var(--font-number); font-size: 21px; font-weight: 500; color: #f5eddf; }
.media-hero-stats span { font-size: 7.5px; color: rgba(244, 239, 227, 0.37); }
.media-poster-stack { position: relative; width: 320px; height: 235px; flex: none; margin-right: 8px; }
.poster { position: absolute; width: 155px; height: 215px; border-radius: 10px; box-shadow: 0 22px 44px rgba(0, 0, 0, 0.32); transition: transform 0.4s; }
.poster .media-cover { width: 100%; height: 100%; }
.poster-1 { right: 103px; top: 16px; transform: rotate(-8deg); z-index: 1; opacity: 0.72; }
.poster-2 { right: 47px; top: 4px; transform: rotate(4deg); z-index: 2; opacity: 0.9; }
.poster-3 { right: -5px; top: 18px; transform: rotate(12deg); z-index: 3; }
.media-hero:hover .poster-1 { transform: rotate(-11deg) translateY(-4px); }
.media-hero:hover .poster-2 { transform: rotate(2deg) translateY(-2px); }
.media-hero:hover .poster-3 { transform: rotate(9deg) translateY(-5px); }
.poster-glow { position: absolute; inset: 20% 15% 10%; background: radial-gradient(circle, rgba(210, 160, 93, 0.2), transparent 65%); filter: blur(24px); z-index: 0; }
.media-cover-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.media-cover .cover-type, .media-cover .cover-text { z-index: 2; }
.media-cover:has(.media-cover-image)::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(0,0,0,.02) 30%, rgba(0,0,0,.72) 100%); }
.media-cover { position: relative; overflow: hidden; border-radius: 10px; background: linear-gradient(150deg, color-mix(in srgb, var(--cover) 85%, #fff) 0%, var(--cover) 45%, color-mix(in srgb, var(--cover) 70%, #000) 100%); display: flex; flex-direction: column; justify-content: flex-end; padding: 12px; aspect-ratio: 3 / 4.2; }
.media-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0.02) 20%, rgba(0, 0, 0, 0.58) 100%); }
.cover-art { position: absolute; inset: 0; }
.cover-type { position: absolute; left: 10px; top: 10px; z-index: 2; display: flex; align-items: center; gap: 3px; font-size: 6.5px; letter-spacing: 0.06em; color: rgba(255, 255, 255, 0.84); background: rgba(0, 0, 0, 0.22); backdrop-filter: blur(6px); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 4px; padding: 3px 5px; }
.cover-text { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 3px; }
.cover-text strong { font-family: var(--font-serif); font-size: 17px; line-height: 1.2; font-weight: 500; color: #fff; letter-spacing: -0.01em; }
.cover-text span { font-size: 7px; color: rgba(255, 255, 255, 0.55); }
.cover-orbit { position: absolute; border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 50%; }
.cover-orbit.o1 { width: 150px; height: 150px; right: -35px; top: 22px; }
.cover-orbit.o2 { width: 90px; height: 90px; right: 5px; top: 52px; }
.cover-line { position: absolute; left: -20px; top: 42%; width: 150%; height: 1px; background: rgba(255, 255, 255, 0.2); transform: rotate(-22deg); }
.cover-book-line { position: absolute; left: 15px; height: 1px; background: rgba(255, 255, 255, 0.24); }
.cover-book-line.l1 { top: 24px; width: 55%; }
.cover-book-line.l2 { top: 30px; width: 38%; }
.cover-book-line.l3 { top: 36px; width: 46%; }
.cover-dot { position: absolute; right: 17px; bottom: 40%; width: 38px; height: 38px; border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 50%; }
.cover-dot::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); }
.wave { position: absolute; top: 35%; width: 2px; background: rgba(255, 255, 255, 0.3); border-radius: 3px; }
.wave.w1 { left: 22%; height: 60px; }
.wave.w2 { left: 38%; height: 95px; }
.wave.w3 { left: 54%; height: 48px; }
.wave.w4 { left: 70%; height: 78px; }
.wave.w5 { left: 86%; height: 40px; }
.pod-ring { position: absolute; border: 1px solid rgba(255, 255, 255, 0.24); border-radius: 50%; left: 50%; top: 38%; transform: translate(-50%, -50%); }
.pod-ring.r1 { width: 104px; height: 104px; }
.pod-ring.r2 { width: 148px; height: 148px; opacity: 0.6; }
.pod-ring.r3 { width: 195px; height: 195px; opacity: 0.3; }
.cover-large { height: 100%; border-radius: 10px; }
.media-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 23px 0 14px; }
.media-segmented button { padding: 0 13px; }
.media-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.media-card { min-width: 0; cursor: pointer; }
.media-cover-wrap { position: relative; border-radius: 12px; overflow: visible; }
.media-card .media-cover { transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s; box-shadow: 0 10px 24px rgba(24, 40, 31, 0.11); }
.media-card:hover .media-cover { transform: translateY(-5px); box-shadow: 0 18px 36px rgba(24, 40, 31, 0.17); }
.media-status { position: absolute; right: 9px; top: 9px; z-index: 3; font-size: 7px; border-radius: 4px; padding: 3px 6px; border: 1px solid rgba(255, 255, 255, 0.2); backdrop-filter: blur(6px); }
.status-green { color: #d9efdf; background: rgba(44, 91, 65, 0.72); }
.status-warm { color: #f4e4c9; background: rgba(133, 92, 45, 0.7); }
.status-blue { color: #dbeaf1; background: rgba(48, 83, 104, 0.72); }
.status-muted { color: rgba(255, 255, 255, 0.7); background: rgba(40, 48, 43, 0.6); }
.media-fav { position: absolute; left: 9px; bottom: 9px; z-index: 3; width: 25px; height: 25px; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 50%; background: rgba(0, 0, 0, 0.25); color: rgba(255, 255, 255, 0.45); backdrop-filter: blur(5px); }
.media-fav.active { color: #f4d18e; border-color: rgba(244, 209, 142, 0.38); }
.media-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 0 0 12px 12px; background: rgba(0, 0, 0, 0.25); overflow: hidden; z-index: 3; }
.media-progress span { display: block; height: 100%; background: #e6c58e; }
.media-card-copy { padding: 10px 3px 0; }
.media-title-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.media-title-row h3 { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-card-copy > p { margin-top: 2px; font-size: 8px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-card-foot { display: flex; justify-content: space-between; margin-top: 6px; font-size: 7.5px; color: var(--faint); }
.media-card-foot span { display: flex; align-items: center; gap: 3px; }
.stars { display: inline-flex; gap: 0.5px; color: #ddd7ca; }
.stars .filled { color: #d6a85e; }
.media-empty { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 60px; color: var(--faint); font-size: 10px; }
.media-empty-initial { flex-direction: column; min-height: 310px; gap: 8px; padding: 42px 20px; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: rgba(251, 250, 247, 0.45); }
.media-empty-initial h3, .archive-empty-initial h3, .storage-empty h3 { font-family: var(--font-serif); font-size: 22px; font-weight: 500; color: var(--ink-2); }
.media-empty-initial p, .archive-empty-initial p, .storage-empty p { max-width: 400px; font-size: 11px; line-height: 1.7; color: var(--muted); }
.media-empty-initial .btn, .archive-empty-initial .btn, .storage-empty .btn { margin-top: 8px; }
.media-footnote { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 22px; padding: 16px 20px; border: 1px dashed var(--line-strong); border-radius: 14px; background: rgba(251, 250, 247, 0.5); }
.media-footnote > div { display: flex; align-items: center; gap: 10px; color: var(--gold); }
.media-footnote p { display: flex; flex-direction: column; gap: 1px; }
.media-footnote strong { font-size: 9px; color: var(--muted); }
.media-footnote span { font-family: var(--font-serif); font-size: 12px; color: var(--ink-2); }
.media-title-field { position: relative; }
.media-title-input-row { display: flex; align-items: center; gap: 8px; }
.media-title-input-row input { flex: 1; }
.media-lookup-status { flex: none; font-size: 8.5px; color: var(--muted); white-space: nowrap; }
.media-suggestions { position: absolute; z-index: 8; left: 0; right: 0; top: calc(100% + 5px); max-height: 230px; overflow-y: auto; padding: 5px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-md); }
.media-suggestion { width: 100%; display: flex; align-items: center; gap: 8px; padding: 7px; border: 0; border-radius: 7px; background: transparent; text-align: left; }
.media-suggestion:hover { background: var(--surface-2); }
.media-suggestion img, .media-suggestion-placeholder { width: 35px; height: 43px; flex: none; object-fit: cover; border-radius: 5px; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); }
.media-suggestion > span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.media-suggestion strong { font-size: 10px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-suggestion small { font-size: 8.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-suggestion em { font-size: 8px; font-style: normal; color: var(--faint); }
.media-lookup-preview { display: flex; align-items: flex-start; gap: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.media-lookup-preview img { width: 48px; height: 62px; object-fit: cover; border-radius: 6px; flex: none; }
.media-lookup-preview > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.media-lookup-preview strong { font-size: 10px; }
.media-lookup-preview p { max-height: 58px; overflow: hidden; font-size: 9px; line-height: 1.55; color: var(--muted); }
.media-detail-description { max-height: 120px; overflow-y: auto; margin-bottom: 12px; padding: 9px 10px; border-radius: 8px; background: var(--surface-2); font-size: 9.5px; line-height: 1.65; color: var(--muted); }
.media-type-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.media-type-picker label input { position: absolute; opacity: 0; pointer-events: none; }
.media-type-picker label span { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; font-size: 9px; color: var(--muted); background: var(--surface); cursor: pointer; }
.media-type-picker label input:checked + span { border-color: var(--forest-3); background: #eef4ef; color: var(--forest); }
.media-detail { display: grid; grid-template-columns: 210px 1fr; gap: 20px; }
.media-detail .media-cover { height: 294px; aspect-ratio: auto; }
.media-detail-form .form-grid { grid-template-columns: 1fr 1fr; }
.media-detail .detail-range { margin-top: 4px; }

/* =========================================================
   Notes
   ========================================================= */
.notes-head { margin-bottom: 18px; }
.notes-layout { display: grid; grid-template-columns: 205px 278px minmax(0, 1fr); height: calc(100vh - 240px); min-height: 560px; max-height: 780px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.notebook-rail { background: var(--surface-2); border-right: 1px solid var(--line); padding: 17px 11px; display: flex; flex-direction: column; overflow-y: auto; }
.rail-head { display: flex; align-items: center; justify-content: space-between; padding: 0 7px 9px; font-size: 8px; letter-spacing: 0.16em; font-weight: 700; color: var(--faint); text-transform: uppercase; }
.rail-head .icon-btn { width: 24px; height: 24px; }
.notebook-item { width: 100%; display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 8px; margin-bottom: 2px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-size: 10px; text-align: left; }
.notebook-item:hover { background: rgba(255, 255, 255, 0.7); color: var(--ink); }
.notebook-item.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 5px rgba(24, 40, 31, 0.06); }
.notebook-icon { color: var(--nb-color); display: grid; place-items: center; }
.notebook-item span:nth-child(2) { flex: 1; }
.notebook-item em { font-style: normal; font-size: 8px; color: var(--faint); }
.rail-divider { height: 1px; background: var(--line); margin: 13px 7px; }
.rail-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 0 7px; }
.rail-stats > div { display: flex; flex-direction: column; }
.rail-stats strong { font-family: var(--font-number); font-size: 19px; font-weight: 500; }
.rail-stats span { font-size: 7.5px; color: var(--faint); }
.rail-quote { margin-top: auto; padding: 16px 8px 4px; font-family: var(--font-serif); font-size: 11px; line-height: 1.8; color: var(--faint); }
.note-list-panel { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.rail-head-actions { display: flex; align-items: center; gap: 2px; }
.notebook-manage-list { display: flex; flex-direction: column; gap: 7px; }
.notebook-manage-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 6px; }
.notebook-manage-row input { min-width: 0; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); font-size: 10px; }
.notebook-manage-row > span { font-size: 9px; color: var(--muted); }
.notebook-manage-row .btn { height: 30px; }
.notebook-add-btn { margin-top: 10px; }
.notebook-new-row { display: flex; gap: 6px; margin-top: 10px; }
.notebook-new-row input { flex: 1; min-width: 0; height: 32px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); font-size: 10px; }
.note-list-head { display: flex; align-items: center; gap: 7px; padding: 12px 12px 9px; border-bottom: 1px solid var(--line); }
.note-search { flex: 1; min-width: 0; height: 32px; }
.note-list-count { font-size: 8px; color: var(--faint); white-space: nowrap; }
.note-list { flex: 1; overflow-y: auto; padding: 7px; }
.note-list-item { width: 100%; display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 1px solid transparent; border-radius: 9px; background: none; text-align: left; margin-bottom: 2px; }
.note-list-item:hover { background: var(--surface-2); }
.note-list-item.active { background: #f4f0e5; border-color: #ebe3d2; }
.note-item-head { display: flex; align-items: center; gap: 6px; }
.note-dot { width: 5px; height: 5px; border-radius: 50%; flex: none; }
.note-item-head strong { flex: 1; font-size: 10px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-pin { color: var(--gold); }
.note-list-item p { font-size: 8px; color: var(--faint); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note-item-foot { display: flex; justify-content: space-between; margin-top: 1px; font-size: 7.5px; color: #a9b0a9; }
.note-list-empty { padding: 30px 10px; text-align: center; font-size: 9px; color: var(--faint); }
.note-editor-panel { min-width: 0; display: flex; flex-direction: column; overflow: hidden; background: #fdfcf9; }
.note-form { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.note-editor-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 20px; border-bottom: 1px solid var(--line); }
.note-breadcrumb { display: flex; align-items: center; gap: 7px; font-size: 8px; color: var(--faint); min-width: 0; }
.note-breadcrumb > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-notebook-select { border: 0; background: none; font-size: 8px; color: var(--muted); padding: 0; max-width: 100px; outline: 0; }
.bc-sep { color: #d3d5ce; }
.note-editor-actions { display: flex; gap: 1px; }
.note-editor-actions .icon-btn { width: 29px; height: 29px; }
.note-title-input { border: 0; outline: 0; background: none; padding: 19px 22px 8px; font-family: var(--font-serif); font-size: 28px; font-weight: 500; letter-spacing: -0.02em; color: var(--ink); line-height: 1.25; }
.note-title-input::placeholder { color: #c5c8c1; }
.note-mode-bar { display: flex; align-items: center; justify-content: space-between; padding: 0 22px 9px; }
.note-tabs { display: flex; gap: 2px; }
.note-tabs button { border: 0; background: none; font-size: 8.5px; color: var(--faint); padding: 4px 8px; border-radius: 5px; }
.note-tabs button.active { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.note-word-count { font-size: 7.5px; color: var(--faint); }
.note-content-input { flex: 1; min-height: 0; width: 100%; border: 0; outline: 0; resize: none; background: transparent; padding: 2px 22px 18px; font-size: 11.5px; line-height: 1.9; color: var(--ink-2); }
.note-preview { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 24px 20px; }
.note-editor-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 20px; border-top: 1px solid var(--line); background: var(--surface); }
.note-tags { display: flex; align-items: center; gap: 6px; color: var(--faint); flex: 1; min-width: 0; }
.note-tags input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 8.5px; }
.note-tags input::placeholder { color: #b3b9b2; }
.note-save-wrap { display: flex; align-items: center; gap: 9px; }
.save-hint { font-size: 7px; color: #b3b9b2; }
.note-editor-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.note-editor-empty h3 { font-family: var(--font-serif); font-size: 21px; font-weight: 500; }
.note-editor-empty p { font-size: 9px; color: var(--faint); margin-bottom: 7px; }
.markdown-body { font-size: 11.5px; line-height: 1.9; color: var(--ink-2); }
.markdown-body h2, .markdown-body h3, .markdown-body h4 { font-family: var(--font-serif); font-weight: 500; color: var(--ink); margin: 18px 0 7px; }
.markdown-body h2 { font-size: 21px; }
.markdown-body h3 { font-size: 17px; }
.markdown-body h4 { font-size: 14px; }
.markdown-body p { margin: 7px 0; }
.markdown-body strong { color: var(--ink); font-weight: 650; }
.markdown-body ul, .markdown-body ol { margin: 6px 0; padding-left: 20px; }
.markdown-body li { margin: 3px 0; }
.markdown-body blockquote { margin: 11px 0; padding: 8px 13px; border-left: 2px solid var(--gold); background: var(--surface-2); border-radius: 0 7px 7px 0; color: var(--muted); font-family: var(--font-serif); }
.markdown-body code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 0.9em; background: var(--surface-3); border-radius: 3px; padding: 1px 4px; }
.markdown-body .checklist { list-style: none; padding-left: 0; }
.markdown-body .checklist li { display: flex; gap: 7px; align-items: flex-start; }
.markdown-body .check-box { width: 14px; height: 14px; flex: none; margin-top: 5px; border: 1px solid var(--line-strong); border-radius: 3px; display: grid; place-items: center; font-size: 8px; color: #fff; }
.markdown-body .checklist li.checked .check-box { background: var(--success); border-color: var(--success); }
.markdown-body .checklist li.checked { color: var(--faint); text-decoration: line-through; }

/* =========================================================
   Archives
   ========================================================= */
.archive-hero { position: relative; overflow: hidden; display: flex; align-items: center; padding: 29px 33px; min-height: 236px; border-radius: var(--radius-lg); color: #f5efe3; background: radial-gradient(560px 380px at 90% 0%, rgba(210, 160, 93, 0.2), transparent 58%), linear-gradient(145deg, #3b4e43, #2b3e33 60%, #25382e); box-shadow: 0 16px 36px rgba(31, 51, 39, 0.13); }
.archive-hero-copy { position: relative; z-index: 3; flex: 1; }
.archive-hero-copy .panel-kicker { color: rgba(231, 200, 144, 0.52); }
.archive-hero-copy h2 { margin-top: 5px; font-family: var(--font-serif); font-size: clamp(25px, 2.5vw, 33px); font-weight: 500; line-height: 1.38; color: #f7f2e8; }
.archive-hero-copy h2 span { color: #e7c890; }
.archive-hero-copy > p { margin-top: 9px; font-size: 9.5px; color: rgba(244, 239, 227, 0.46); }
.archive-hero-stats { display: flex; gap: 26px; margin-top: 21px; }
.archive-hero-stats > div { display: flex; flex-direction: column; }
.archive-hero-stats strong { font-family: var(--font-number); font-size: 22px; font-weight: 500; color: #f4eddf; }
.archive-hero-stats strong.warn { color: #e6b37c; }
.archive-hero-stats span { font-size: 7.5px; color: rgba(244, 239, 227, 0.37); }
.archive-illustration { position: relative; width: 255px; height: 190px; flex: none; }
.folder { position: absolute; border-radius: 5px 8px 8px 8px; }
.folder::before { content: ""; position: absolute; left: 0; top: -11px; width: 74px; height: 16px; border-radius: 6px 6px 0 0; background: inherit; }
.folder-back { width: 180px; height: 128px; right: 20px; bottom: 18px; background: rgba(231, 211, 167, 0.14); transform: rotate(-4deg); border: 1px solid rgba(231, 211, 167, 0.16); }
.folder-mid { width: 190px; height: 130px; right: 12px; bottom: 11px; background: rgba(231, 211, 167, 0.2); transform: rotate(3deg); border: 1px solid rgba(231, 211, 167, 0.2); }
.folder-front { width: 198px; height: 136px; right: 4px; bottom: 5px; background: linear-gradient(160deg, #d7c19a, #c0a77d); box-shadow: 0 17px 35px rgba(0, 0, 0, 0.2); padding: 24px 20px; }
.folder-label { font-family: var(--font-number); font-size: 16px; font-weight: 700; line-height: 0.95; letter-spacing: 0.08em; color: #5b4c34; }
.folder-line { display: block; width: 82px; height: 3px; border-radius: 3px; background: rgba(91, 76, 52, 0.25); margin-top: 12px; }
.folder-line.short { width: 54px; margin-top: 5px; }
.seal { position: absolute; right: 28px; top: 11px; width: 53px; height: 53px; border-radius: 50%; display: grid; place-items: center; color: #6e5734; background: #e3cda5; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15); border: 1px dashed rgba(91, 76, 52, 0.28); transform: rotate(8deg); }
.archive-alert { display: flex; align-items: center; gap: 11px; margin-top: 16px; padding: 11px 15px; border: 1px solid #eedfc7; border-radius: 11px; background: #faf3e6; }
.archive-alert-icon { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 8px; background: #f6e8d0; color: #a87935; }
.archive-alert > div { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.archive-alert strong { font-size: 9.5px; font-weight: 600; color: #66523a; }
.archive-alert span:not(.archive-alert-icon) { font-size: 8px; color: #9b8463; }
.archive-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 21px 0 13px; }
.archive-segmented { max-width: 100%; overflow-x: auto; }
.archive-segmented button { padding: 0 10px; }
.archive-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.archive-card { padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; transition: transform 0.22s, box-shadow 0.22s, border-color 0.22s; }
.archive-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.archive-card-top { display: flex; align-items: center; gap: 7px; }
.archive-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; flex: none; }
.archive-icon.large { width: 57px; height: 57px; border-radius: 14px; }
.archive-category { font-size: 7.5px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; }
.archive-card-top .row-action { margin-left: auto; opacity: 0; }
.archive-card:hover .archive-card-top .row-action { opacity: 1; }
.archive-card h3 { margin-top: 11px; font-family: var(--font-serif); font-size: 17px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.archive-identifier { margin-top: 2px; font-family: var(--font-number); font-size: 8px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.archive-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 7.5px; color: var(--faint); }
.archive-meta > span:first-child { display: flex; align-items: center; gap: 3px; }
.archive-expiry { display: inline-flex; align-items: center; gap: 3px; border-radius: 4px; padding: 2px 5px; }
.archive-expiry.ok { color: var(--muted); background: var(--surface-2); }
.archive-expiry.warn { color: #a87935; background: #fbf1dd; }
.archive-expiry.danger { color: var(--danger); background: #faeae4; }
.archive-expiry.neutral { color: var(--faint); background: var(--surface-2); }
.archive-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 11px; padding-top: 9px; border-top: 1px solid var(--line); }
.archive-file { display: flex; align-items: center; gap: 4px; font-size: 7.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.archive-download { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); background: var(--surface-2); }
.archive-download:hover { background: var(--forest); color: #fff; }
.archive-empty { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 50px; color: var(--faint); font-size: 10px; }
.archive-empty-initial { flex-direction: column; min-height: 290px; gap: 8px; padding: 42px 20px; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: rgba(251, 250, 247, 0.45); }
.archive-tip { display: flex; align-items: center; gap: 11px; margin-top: 20px; padding: 13px 17px; border: 1px dashed var(--line-strong); border-radius: 12px; background: rgba(251, 250, 247, 0.5); }
.archive-tip-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: var(--gold-light); color: #a87935; flex: none; }
.archive-tip p { flex: 1; display: flex; flex-direction: column; gap: 0; }
.archive-tip strong { font-size: 8.5px; color: var(--muted); }
.archive-tip span { font-family: var(--font-serif); font-size: 11.5px; color: var(--ink-2); }
.archive-detail-head { display: flex; align-items: center; gap: 12px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.archive-detail-head > div { flex: 1; min-width: 0; }
.archive-detail-head h3 { font-family: var(--font-serif); font-size: 20px; font-weight: 500; }
.archive-detail-head p { font-size: 8.5px; color: var(--faint); }
.archive-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-top: 14px; }
.archive-detail-grid > div { background: var(--surface); padding: 9px 12px; display: flex; flex-direction: column; gap: 1px; }
.archive-detail-grid span { font-size: 8px; color: var(--faint); }
.archive-detail-grid strong { font-size: 9.5px; font-weight: 600; }
.archive-note { margin-top: 12px; padding: 11px 13px; background: var(--surface-2); border-radius: 9px; }
.archive-note span { font-size: 8px; color: var(--faint); }
.archive-note p { margin-top: 3px; font-size: 10px; color: var(--ink-2); }
.archive-attachment { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; }
.archive-attachment > span { color: var(--muted); }
.archive-attachment > div { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.archive-attachment strong { font-size: 9.5px; }
.archive-attachment small { font-size: 8px; color: var(--faint); }
.file-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 22px; border: 1.5px dashed var(--line-strong); border-radius: 13px; background: var(--surface-2); text-align: center; cursor: pointer; transition: 0.2s; }
.file-drop:hover, .file-drop.dragging { border-color: var(--gold); background: #fbf5e9; }
.file-drop.has-file { border-style: solid; border-color: var(--sage); background: #f1f6f2; }
.file-drop-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--surface); color: var(--gold); box-shadow: 0 2px 7px rgba(24, 40, 31, 0.06); margin-bottom: 2px; }
.file-drop strong { font-size: 10px; font-weight: 600; }
.file-drop small { font-size: 8px; color: var(--faint); }

/* =========================================================
   Assistant
   ========================================================= */
.assistant-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.assistant-head h1 { margin-top: 8px; font-family: var(--font-serif); font-size: clamp(28px, 2.8vw, 37px); font-weight: 500; line-height: 1.16; letter-spacing: -0.025em; }
.assistant-head .view-lede { margin-top: 6px; }
.assistant-live { display: flex; align-items: center; gap: 5px; font-size: 8.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 5px 10px; flex: none; margin-bottom: 4px; }
.assistant-layout { display: grid; grid-template-columns: minmax(0, 1fr) 292px; gap: 18px; height: calc(100vh - 240px); min-height: 600px; max-height: 820px; }
.chat-shell { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: rgba(251, 250, 247, 0.92); }
.chat-head-identity { display: flex; align-items: center; gap: 9px; }
.ai-orb { position: relative; width: 35px; height: 35px; display: grid; place-items: center; border-radius: 11px; background: var(--forest); color: #e7d3a7; box-shadow: 0 5px 14px rgba(24, 54, 42, 0.18); }
.ai-orb i { position: absolute; right: -1px; bottom: -1px; width: 8px; height: 8px; border-radius: 50%; background: #8fbfa0; border: 2px solid var(--surface); }
.chat-head-identity > div { display: flex; flex-direction: column; gap: 0; }
.chat-head-identity strong { font-size: 11.5px; font-weight: 600; }
.chat-head-identity span { display: flex; align-items: center; gap: 5px; font-size: 8px; color: var(--faint); }
.chat-head-identity .live-dot { width: 4px; height: 4px; box-shadow: 0 0 0 2px rgba(159, 195, 169, 0.12); }
.chat-head-badges { display: flex; gap: 4px; }
.chat-head-badges span { display: flex; align-items: center; gap: 3px; font-size: 7.5px; color: #8d7858; background: #f7efe0; border: 1px solid #ecdfc8; border-radius: 4px; padding: 3px 6px; }
.chat-thread { flex: 1; overflow-y: auto; padding: 19px 22px 12px; background: linear-gradient(180deg, #fbfaf7, #f9f7f1); }
.chat-day { text-align: center; font-size: 7.5px; color: var(--faint); margin-bottom: 16px; }
.chat-message { display: flex; gap: 9px; margin-bottom: 17px; }
.chat-message.from-user { flex-direction: row-reverse; }
.chat-avatar { width: 31px; height: 31px; flex: none; border-radius: 9px; display: grid; place-items: center; margin-top: 1px; }
.chat-avatar.ai { background: var(--forest); color: #e7d3a7; }
.chat-avatar.user { background: transparent; }
.chat-avatar.user .avatar { --avatar-size: 31px; }
.chat-content { max-width: min(82%, 620px); display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.from-user .chat-content { align-items: flex-end; }
.chat-meta { display: flex; align-items: center; gap: 6px; font-size: 7.5px; color: var(--faint); }
.chat-meta span { opacity: 0.72; }
.from-user .chat-meta { flex-direction: row-reverse; }
.chat-bubble { padding: 11px 14px; border-radius: 3px 13px 13px 13px; background: #f1eee5; color: var(--ink-2); border: 1px solid #e9e4d8; }
.from-user .chat-bubble { border-radius: 13px 3px 13px 13px; background: var(--forest); border-color: var(--forest); color: #f4efe3; }
.chat-bubble.markdown-body { font-size: 11px; line-height: 1.8; }
.chat-bubble.markdown-body p { margin: 4px 0; }
.chat-bubble.markdown-body p:first-child { margin-top: 0; }
.chat-bubble.markdown-body p:last-child { margin-bottom: 0; }
.chat-bubble.markdown-body h2, .chat-bubble.markdown-body h3, .chat-bubble.markdown-body h4 { font-size: 13px; margin: 10px 0 3px; }
.chat-bubble.markdown-body ul, .chat-bubble.markdown-body ol { margin: 4px 0; padding-left: 17px; }
.chat-bubble.markdown-body li { margin: 2px 0; }
.chat-bubble.markdown-body code { background: rgba(44, 59, 50, 0.07); color: #8a543c; }
.from-user .chat-bubble.markdown-body code { background: rgba(255, 255, 255, 0.12); color: #f3dfb9; }
.chat-bubble.markdown-body strong { color: var(--ink); }
.from-user .chat-bubble.markdown-body strong { color: #f8f0df; }
.chat-bubble.markdown-body blockquote { background: rgba(255, 255, 255, 0.4); border-left-color: var(--gold); }
.chat-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.chat-action { display: flex; align-items: center; gap: 4px; height: 25px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 8px; }
.chat-action:hover { border-color: var(--forest-3); color: var(--forest); }
.chat-typing .chat-bubble { display: flex; align-items: center; gap: 4px; height: 37px; padding: 0 14px; }
.typing-dots i { width: 4px; height: 4px; border-radius: 50%; background: #a8b0a8; animation: typing-bounce 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-3px); opacity: 1; } }
.chat-compose-wrap { padding: 8px 16px 11px; border-top: 1px solid var(--line); background: var(--surface); }
.chat-suggestions { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.chat-suggestions::-webkit-scrollbar { display: none; }
.suggestion-chip { flex: none; display: flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); color: var(--muted); font-size: 8px; white-space: nowrap; }
.suggestion-chip:hover { border-color: var(--gold); color: #8d6b39; background: #fbf4e6; }
.chat-compose { display: flex; align-items: flex-end; gap: 8px; padding: 7px 7px 7px 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; transition: 0.18s; }
.chat-compose:focus-within { border-color: var(--forest-3); box-shadow: 0 0 0 3px rgba(46, 89, 69, 0.06); }
.chat-compose textarea { flex: 1; border: 0; outline: 0; resize: none; font-size: 11px; line-height: 1.6; padding: 5px 0; max-height: 150px; background: none; }
.chat-compose textarea::placeholder { color: #adb3ac; }
.chat-send { width: 33px; height: 33px; flex: none; display: grid; place-items: center; border: 0; border-radius: 8px; background: var(--forest); color: #f4efe3; }
.chat-send:hover { background: var(--forest-2); }
.chat-send:disabled { opacity: 0.5; }
.chat-compose-foot { display: flex; justify-content: space-between; gap: 8px; padding-top: 6px; font-size: 7px; color: #b0b6af; }
.chat-compose-foot span { display: flex; align-items: center; gap: 3px; }
.assistant-context { display: flex; flex-direction: column; padding: 15px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); overflow-y: auto; }
.ai-context-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 3px 10px; font-size: 8px; font-weight: 650; letter-spacing: 0.16em; color: var(--faint); text-transform: uppercase; }
.ai-context-head em { font-style: normal; font-size: 7px; color: var(--success); background: var(--sage-light); border-radius: 20px; padding: 2px 6px; }
.ai-module-list { display: flex; flex-direction: column; gap: 1px; }
.ai-module { display: flex; align-items: center; gap: 8px; padding: 7px 6px; border-radius: 8px; }
.ai-module:hover { background: var(--surface-2); }
.ai-module-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 7px; flex: none; }
.ai-module > span:nth-child(2) { flex: 1; font-size: 9px; color: var(--muted); }
.ai-module strong { font-size: 8px; font-weight: 550; color: var(--ink-2); white-space: nowrap; }
.ai-context-insight { margin-top: 13px; padding: 12px; border-radius: 10px; background: linear-gradient(145deg, #f6eddd, #f0e4ce); border: 1px solid #ebdec6; }
.ai-context-insight .panel-kicker { color: #a28b68; font-size: 6.5px; }
.ai-context-insight p { font-family: var(--font-serif); font-size: 11.5px; line-height: 1.7; color: #4e4636; margin: 5px 0 8px; }
.ai-context-insight .text-link { font-size: 8px; color: #7d6642; }
.ai-context-privacy { display: flex; gap: 8px; margin-top: auto; padding-top: 14px; border-top: 1px dashed var(--line); color: var(--faint); }
.ai-context-privacy p { display: flex; flex-direction: column; gap: 2px; }
.ai-context-privacy strong { font-size: 8px; color: var(--muted); }
.ai-context-privacy span { font-size: 7px; line-height: 1.55; }

/* =========================================================
   Notification drawer / search
   ========================================================= */
.drawer-scrim { position: fixed; inset: 0; z-index: 90; background: rgba(18, 34, 25, 0.3); backdrop-filter: blur(4px); opacity: 0; visibility: hidden; transition: 0.25s; }
.drawer-scrim.is-open { opacity: 1; visibility: visible; }
.notification-drawer { position: fixed; right: 0; top: 0; bottom: 0; z-index: 100; width: min(390px, 92vw); display: flex; flex-direction: column; background: var(--surface); box-shadow: -20px 0 60px rgba(18, 34, 25, 0.16); transform: translateX(100%); transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1); }
.notification-drawer.is-open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 24px 22px 16px; border-bottom: 1px solid var(--line); }
.drawer-eyebrow { font-size: 7.5px; letter-spacing: 0.18em; font-weight: 700; color: var(--gold); }
.drawer-head h2 { margin-top: 5px; font-family: var(--font-serif); font-size: 25px; font-weight: 500; }
.drawer-list { flex: 1; overflow-y: auto; padding: 12px; }
.notification-item { width: 100%; display: flex; gap: 10px; padding: 11px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; border-radius: 8px; }
.notification-item:hover { background: var(--surface-2); }
.notification-item.read { opacity: 0.58; }
.notification-icon { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 9px; }
.notification-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notification-copy strong { font-size: 10px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.unread-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--clay); flex: none; }
.notification-copy p { font-size: 8.5px; color: var(--muted); line-height: 1.6; }
.notification-copy small { font-size: 7.5px; color: var(--faint); margin-top: 2px; }
.drawer-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 60px 20px; color: var(--faint); font-size: 10px; }
.drawer-loading { display: flex; justify-content: center; gap: 4px; padding: 40px; }
.drawer-loading span, .search-loading span { width: 5px; height: 5px; border-radius: 50%; background: var(--faint); animation: typing-bounce 1.2s infinite; }
.drawer-loading span:nth-child(2), .search-loading span:nth-child(2) { animation-delay: 0.15s; }
.drawer-loading span:nth-child(3), .search-loading span:nth-child(3) { animation-delay: 0.3s; }
.drawer-foot { display: flex; align-items: center; justify-content: space-between; padding: 13px 22px 18px; border-top: 1px solid var(--line); font-size: 7.5px; color: var(--faint); }
.search-overlay { position: fixed; inset: 0; z-index: 150; background: rgba(18, 34, 25, 0.38); backdrop-filter: blur(10px); display: flex; justify-content: center; align-items: flex-start; padding-top: 11vh; opacity: 0; visibility: hidden; transition: 0.22s; }
.search-overlay.is-open { opacity: 1; visibility: visible; }
.search-panel { width: min(720px, calc(100vw - 36px)); max-height: 70vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); overflow: hidden; transform: translateY(-10px) scale(0.99); transition: 0.25s cubic-bezier(0.22, 1, 0.36, 1); border: 1px solid rgba(255, 255, 255, 0.45); }
.search-overlay.is-open .search-panel { transform: none; }
.search-input-row { display: flex; align-items: center; gap: 11px; padding: 15px 18px; border-bottom: 1px solid var(--line); color: var(--muted); }
.search-input-row input { flex: 1; border: 0; outline: 0; background: none; font-size: 14px; color: var(--ink); }
.search-input-row input::placeholder { color: #a9b0a9; }
.esc-key { border: 1px solid var(--line); background: var(--surface-2); border-radius: 5px; font-family: ui-monospace, monospace; font-size: 8px; color: var(--faint); padding: 3px 5px; }
.search-results { flex: 1; overflow-y: auto; padding: 14px 17px 18px; }
.search-default { display: flex; flex-direction: column; gap: 10px; }
.search-section-label { display: flex; align-items: center; gap: 4px; font-size: 7.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); margin: 2px 0 5px; }
.search-section-label span { margin-left: auto; font-weight: 500; }
.search-quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.search-quick { display: flex; align-items: center; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--ink-2); font-size: 9px; text-align: left; }
.search-quick:hover { background: #fff; border-color: var(--line-strong); }
.search-quick svg:last-child { margin-left: auto; color: var(--faint); }
.search-hint { display: flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 8px; color: var(--faint); }
.search-group { margin-bottom: 13px; }
.search-result { width: 100%; display: flex; align-items: center; gap: 9px; padding: 9px 8px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; border-radius: 6px; }
.search-result:hover { background: var(--surface-2); }
.search-result.is-active { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--gold); }
.search-result-title { font-size: 10px; font-weight: 600; width: 38%; flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-snippet { flex: 1; font-size: 8.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result svg { color: var(--faint); }
.search-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 50px 20px; text-align: center; color: var(--faint); }
.search-empty h3 { font-family: var(--font-serif); font-size: 18px; font-weight: 500; color: var(--ink-2); }
.search-empty p { font-size: 9px; }
.search-loading { display: flex; justify-content: center; gap: 4px; padding: 48px; }
.search-foot { display: flex; align-items: center; gap: 15px; padding: 9px 17px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 7.5px; color: var(--faint); }
.search-foot span { display: flex; align-items: center; gap: 4px; }
.search-foot span:last-child { margin-left: auto; }
.sidebar-scrim { display: none; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1360px) {
  :root { --sidebar-w: 230px; }
  .view-root { padding: 24px 26px 42px; }
  .topbar { padding: 14px 26px; }
  .dashboard-grid { gap: 15px; }
  .hero-card { grid-column: span 8; padding: 26px 25px 22px; }
  .hero-main h1 { font-size: 32px; }
  .media-poster-stack { width: 275px; }
  .poster { width: 140px; height: 198px; }
  .poster-1 { right: 84px; }
  .poster-2 { right: 36px; }
  .archive-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1180px) {
  .hero-card { grid-column: span 12; }
  .insight-card { grid-column: span 12; min-height: 190px; }
  .insight-card blockquote { margin: 17px 0 14px; max-width: 720px; }
  .insight-context { margin-top: 0; }
  .insight-action { margin-top: 13px; max-width: 310px; }
  .home-panel, .upcoming-panel, .finance-panel, .health-panel { grid-column: span 12; }
  .recent-notes { grid-template-columns: repeat(3, 1fr); }
  .home-overview { grid-template-columns: 1.4fr 1fr; }
  .member-grid { grid-template-columns: repeat(2, 1fr); }
  .media-poster-stack { width: 250px; }
  .poster { width: 128px; height: 184px; }
  .poster-1 { right: 78px; }
  .poster-2 { right: 30px; }
  .assistant-layout { grid-template-columns: minmax(0, 1fr) 265px; }
  .storage-top-grid { grid-template-columns: 1.45fr 1fr; }
}
@media (max-width: 1060px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); width: 260px; }
  .app-shell.sidebar-open .sidebar { transform: none; }
  .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(18, 34, 25, 0.34); backdrop-filter: blur(4px); opacity: 0; visibility: hidden; transition: 0.25s; }
  .sidebar-scrim.is-open { opacity: 1; visibility: visible; }
  .menu-btn { display: inline-grid; width: 38px; height: 38px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.6); margin-right: 3px; }
  .view-root { padding: 24px 28px 45px; }
  .home-overview, .health-main-grid, .finance-overview, .finance-charts-grid, .finance-mid-grid, .storage-top-grid, .health-bottom-grid, .home-lower-grid { grid-template-columns: 1fr; }
  .storage-hero { min-height: 220px; }
  .urgent-panel { min-height: 190px; }
  .media-grid { grid-template-columns: repeat(3, 1fr); }
  .archive-grid { grid-template-columns: repeat(2, 1fr); }
  .assistant-layout { grid-template-columns: 1fr; height: auto; }
  .chat-shell { height: calc(100vh - 230px); min-height: 560px; }
  .assistant-context { display: none; }
  .notes-layout { grid-template-columns: 190px 260px minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; padding: 32px 24px; background: radial-gradient(500px 300px at 80% 0%, rgba(210, 160, 93, 0.1), transparent 65%), var(--surface); }
  .login-panel::before { display: none; }
  .login-mobile-brand { display: flex; }
  .login-panel-inner { width: min(100%, 390px); }
  .login-foot { margin-top: 34px; }
  .topbar { padding: 12px 18px; min-height: 72px; }
  .topbar-date { display: none; }
  .search-trigger { min-width: 0; width: 38px; height: 38px; padding: 0; justify-content: center; border-radius: 10px; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .profile-btn > svg { display: none; }
  .view-root { padding: 19px 18px 40px; }
  .view-head { flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
  .view-head h1 { font-size: 31px; }
  .view-actions { width: 100%; }
  .view-actions .btn-primary { margin-left: auto; }
  .crumb-line strong { font-size: 14px; }
  .page-heading p { display: none; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .hero-card { display: block; min-height: auto; }
  .hero-main { min-height: 260px; }
  .hero-weather { margin-top: 20px; padding: 18px 0 0; border-left: 0; border-top: 1px solid rgba(255, 255, 255, .12); }
  .hero-radar { display: none; }
  .home-room-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .home-room-chip { height: 31px; font-size: 8.5px; }
  .home-room-chip em { font-size: 7.5px; }
  .radar-score { top: 43%; }
  .radar-score strong { font-size: 34px; }
  .hero-dims { display: none; }
  .hero-main h1 { font-size: 30px; }
  .hero-main .hero-lede { max-width: 320px; }
  .hero-bottom { margin-top: 30px; }
  .hero-card::after { display: none; }
  .home-panel, .upcoming-panel, .finance-panel, .health-panel, .notes-panel { grid-column: span 12; }
  .quick-devices { grid-template-columns: 1fr 1fr; }
  .finance-split { grid-template-columns: 1fr; gap: 16px; }
  .recent-notes { grid-template-columns: 1fr 1fr; }
  .notes-footer { flex-wrap: wrap; }
  .mini-action { margin-left: 0; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .member-grid { grid-template-columns: 1fr 1fr; }
  .room-device-groups { grid-template-columns: 1fr; }
  .home-stat-row { grid-template-columns: 1fr 1fr; }
  .home-status-head h2 { font-size: 19px; }
  .scene-panel { padding: 17px; }
  .finance-overview { gap: 14px; }
  .account-strip { grid-template-columns: 1fr 1fr; gap: 10px; }
  .budget-list { grid-template-columns: 1fr; }
  .storage-items-grid { grid-template-columns: 1fr; }
  .location-grid { grid-template-columns: 1fr 1fr; }
  .storage-hero { padding: 22px; min-height: 205px; }
  .storage-illustration { width: 155px; height: 160px; opacity: 0.8; }
  .shelf-1 { width: 140px; }
  .shelf-2 { width: 120px; }
  .shelf-3 { width: 125px; }
  .storage-hero-stats { gap: 18px; }
  .media-hero { padding: 24px; min-height: 230px; }
  .media-poster-stack { width: 190px; height: 200px; opacity: 0.6; }
  .poster { width: 105px; height: 160px; }
  .poster-1 { right: 55px; }
  .poster-2 { right: 18px; }
  .poster-3 { right: -8px; }
  .media-hero-stats { gap: 15px; }
  .archive-hero { padding: 23px; }
  .archive-illustration { width: 180px; opacity: 0.7; transform: scale(0.85); transform-origin: right center; }
  .archive-toolbar { flex-direction: column; align-items: stretch; }
  .archive-segmented { overflow-x: auto; }
  .archive-grid { grid-template-columns: 1fr 1fr; }
  .notes-layout { grid-template-columns: 1fr; height: auto; max-height: none; }
  .notebook-rail { display: none; }
  .note-list-panel { border-right: 0; border-bottom: 1px solid var(--line); max-height: 235px; }
  .note-list { max-height: 180px; }
  .note-editor-panel { min-height: 570px; }
  .notes-layout { overflow: visible; }
  .tx-panel-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .tx-tools { width: 100%; flex-wrap: wrap; }
  .tx-tools .inline-search { flex: 1; }
  .data-table th, .data-table td { padding: 8px 7px; }
  .items-head { flex-direction: column; align-items: flex-start; }
  .items-tools { width: 100%; }
  .items-tools .inline-search { flex: 1; }
  .assistant-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .chat-shell { height: calc(100vh - 210px); }
  .chat-thread { padding: 16px 14px 10px; }
  .chat-content { max-width: 86%; }
  .search-quick-grid { grid-template-columns: 1fr 1fr; }
  .toast-root { left: 16px; right: 16px; bottom: 16px; align-items: stretch; }
  .toast { max-width: none; }
}
@media (max-width: 560px) {
  .metric-value { font-size: 25px; }
  .metric-card .sparkline { display: none; }
  .metric-card .metric-foot { font-size: 8px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .member-grid { grid-template-columns: 1fr; }
  .quick-devices { grid-template-columns: 1fr; }
  .recent-notes { grid-template-columns: 1fr; }
  .device-grid { grid-template-columns: 1fr; }
  .home-stat-row { grid-template-columns: 1fr 1fr; }
  .location-grid { grid-template-columns: 1fr; }
  .media-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .media-hero { min-height: 255px; }
  .media-poster-stack { position: absolute; right: -20px; bottom: 0; width: 140px; height: 190px; opacity: 0.28; }
  .poster { width: 100px; height: 148px; }
  .poster-1 { right: 40px; }
  .poster-2 { right: 10px; }
  .poster-3 { right: -20px; }
  .media-hero-copy h2 { font-size: 25px; }
  .media-hero-stats { margin-top: 18px; }
  .media-toolbar { flex-direction: column; align-items: stretch; }
  .media-toolbar .inline-search { width: 100%; }
  .media-segmented { overflow-x: auto; }
  .archive-grid { grid-template-columns: 1fr; }
  .archive-illustration { display: none; }
  .archive-hero-copy h2 { font-size: 24px; }
  .archive-tip { flex-wrap: wrap; }
  .archive-tip .text-link { margin-left: 43px; }
  .storage-hero-stats { margin-top: 18px; }
  .storage-illustration { position: absolute; right: -30px; bottom: -25px; opacity: 0.28; }
  .storage-top-grid { gap: 14px; }
  .media-detail { grid-template-columns: 1fr; }
  .media-detail .media-cover { height: 180px; max-width: 135px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-span-2 { grid-column: span 1; }
  .finance-overview { grid-template-columns: 1fr; }
  .networth-split { gap: 16px; flex-wrap: wrap; }
  .account-strip { grid-template-columns: 1fr 1fr; }
  .tx-table th:nth-child(3), .tx-table td:nth-child(3) { display: none; }
  .search-panel { max-height: 80vh; }
  .search-result-title { width: 45%; }
  .drawer-head { padding: 20px 18px 13px; }
  .notification-drawer { width: 100vw; }
  .chat-suggestions { padding-bottom: 6px; }
  .chat-compose-foot span:last-child { display: none; }
  .hero-main h1 { font-size: 27px; }
  .hero-radar { width: 180px; right: -8px; bottom: 46px; }
  .insight-card blockquote { font-size: 16px; }
  .upcoming-date { display: none; }
  .health-chart-head { align-items: flex-start; flex-direction: column; gap: 5px; }
  .finance-charts-grid { gap: 14px; }
  .panel { padding: 18px; border-radius: 18px; }
  .networth-card, .home-status-card, .storage-hero, .media-hero, .archive-hero { border-radius: 20px; }
  .notes-head { margin-bottom: 13px; }
  .note-title-input { font-size: 24px; }
  .modal-backdrop { padding: 12px; align-items: flex-end; }
  .modal { max-height: 92vh; border-radius: 20px; }
  .modal-head { padding: 19px 19px 14px; }
  .modal-body { padding: 18px 19px; }
  .modal-foot { padding: 12px 19px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* =========================================================
   Readability pass — card copy and supporting metadata
   ========================================================= */
.eyebrow { font-size: 9.5px; }
.view-lede { font-size: 13.5px; line-height: 1.7; }
.panel-kicker { font-size: 9px; letter-spacing: 0.18em; }
.panel-count { font-size: 10.5px; }
.panel-subhead { font-size: 11px; }
.text-link { font-size: 11.5px; }
.inline-search input { font-size: 11.5px; }
.segmented button { font-size: 12px; }
.segmented button span { font-size: 9.5px; }
.section-head p { font-size: 11.5px; }
.section-note { font-size: 10.5px; }
.field-label { font-size: 11px; }
.field input, .field select, .field textarea { font-size: 12.5px; }
.field-hint { font-size: 10px; }

/* Dashboard cards */
.metric-label { font-size: 10.5px; }
.metric-delta { font-size: 9.5px; }
.metric-value small { font-size: 10px; }
.metric-foot { font-size: 9.5px; }
.quick-device-info strong { font-size: 12px; }
.quick-device-info small { font-size: 9.5px; }
.quick-scenes > span { font-size: 9.5px; }
.scene-chip { font-size: 10.5px; height: 30px; padding: 0 10px; }
.upcoming-copy strong { font-size: 11.5px; }
.upcoming-copy small { font-size: 9.5px; }
.upcoming-date { font-size: 9.5px; }
.weather-strip strong { font-size: 10.5px; }
.weather-strip small { font-size: 9px; }
.mini-tx-copy strong { font-size: 11px; }
.mini-tx-copy small { font-size: 9px; }
.mini-tx-amount { font-size: 11px; }
.health-member strong { font-size: 10.5px; }
.health-member small { font-size: 9px; }
.health-member em { font-size: 9px; }
.recent-note-copy strong { font-size: 11.5px; }
.recent-note-copy small { font-size: 9.5px; }
.notes-footer { font-size: 9.5px; }
.insight-head { font-size: 11px; }
.insight-time { font-size: 9px; }
.insight-context { font-size: 9.5px; }
.hero-family { font-size: 9.5px; }
.hero-link { font-size: 10.5px; }
.hero-dim { font-size: 9px; }
.hero-dim strong { font-size: 9px; }
.health-mini-stats { font-size: 9.5px; }

/* Smart home cards */
.home-online { font-size: 9.5px; }
.home-stat > span { font-size: 10px; }
.home-stat small { font-size: 9.5px; }
.home-energy-tip { font-size: 9.5px; }
.home-room-map-head { font-size: 8.5px; }
.home-room-chip { font-size: 9px; }
.home-room-chip em { font-size: 8px; }
.room-title span { font-size: 9.5px; }
.scene-copy strong { font-size: 11.5px; }
.scene-copy small { font-size: 9px; }
.device-info h3 { font-size: 12px; }
.device-info p { font-size: 9.5px; }
.device-inline-control em { font-size: 9px; }
.device-temp-control span { font-size: 9px; }
.device-temp-control strong { font-size: 12px; }
.energy-foot { font-size: 9.5px; }
.energy-summary span { font-size: 9px; }
.energy-summary em { font-size: 9px; }
.power-copy strong { font-size: 11px; }
.power-copy small { font-size: 9px; }
.power-value { font-size: 10.5px; }
.power-total { font-size: 10px; }
.room-pill { font-size: 10.5px; }
.room-pill em { font-size: 9px; }

/* Health cards */
.stat-label { font-size: 10.5px; }
.stat-foot { font-size: 9.5px; }
.chart-topline span { font-size: 9.5px; }
.chart-legend { font-size: 10px; }
.trend-foot { font-size: 9.5px; }
.wellness-advice { font-size: 15px; }
.wellness-list > div, .wellness-list strong { font-size: 10px; }
.member-card-head p { font-size: 9.5px; }
.member-metrics span { font-size: 9px; }
.member-metrics strong { font-size: 11px; }
.member-foot { font-size: 9px; }
.workout-copy strong { font-size: 11px; }
.workout-copy small { font-size: 9.5px; }
.workout-stats span { font-size: 9px; }
.workout-stats strong { font-size: 10.5px; }
.habit-item strong { font-size: 11px; }
.habit-item small { font-size: 9.5px; }

/* Finance cards */
.networth-chip { font-size: 9px; }
.networth-split span { font-size: 9px; }
.account-strip .account-card span { font-size: 9px; }
.account-strip .account-card strong { font-size: 10.5px; }
.budget-pill { font-size: 9px; }
.budget-circle span { font-size: 8.5px; }
.budget-copy span, .budget-copy small { font-size: 9.5px; }
.budget-topline span { font-size: 9px; }
.budget-link { font-size: 10px; }
.cashflow-foot { font-size: 9.5px; }
.donut-legend-row { font-size: 9.5px; }
.donut-legend-row strong { font-size: 10px; }
.donut-legend-row em { font-size: 8.5px; }
.budget-row-head span { font-size: 10.5px; }
.budget-row-head strong { font-size: 10px; }
.budget-row-head strong em { font-size: 9px; }
.budget-row-foot { font-size: 8.5px; }
.account-card > div span { font-size: 10.5px; }
.account-card > div small { font-size: 9px; }
.accounts-note { font-size: 8.5px; }
.tx-filter button { font-size: 10.5px; }
.data-table th { font-size: 9.5px; }
.data-table td { font-size: 11px; }
.tx-date { font-size: 10px; }
.tx-main strong { font-size: 11.5px; }
.tx-main small { font-size: 9.5px; }
.tx-member { font-size: 10px; }
.tx-amount { font-size: 12px; }
.table-foot { font-size: 9.5px; }

/* Storage cards */
.storage-hero-copy > p { font-size: 10.5px; }
.storage-hero-stats span { font-size: 9px; }
.urgent-row strong { font-size: 10.5px; }
.urgent-row small { font-size: 9px; }
.urgent-row em { font-size: 9px; }
.location-copy strong { font-size: 11.5px; }
.location-copy small { font-size: 9px; }
.location-count small { font-size: 8.5px; }
.location-alert { font-size: 8px; }
.active-filter-bar, .active-filter-bar button { font-size: 9.5px; }
.item-copy h3 { font-size: 12px; }
.item-copy p { font-size: 9.5px; }
.qty-control span { font-size: 9px; }
.qty-control strong { font-size: 11px; }
.expiry-badge { font-size: 9px; padding: 3px 7px; }
.stock-line { font-size: 9px; }
.item-note { font-size: 9px; }
.storage-empty { font-size: 11px; }

/* Media cards */
.cover-type { font-size: 8px; padding: 3px 6px; }
.cover-text strong { font-size: 18px; }
.cover-text span { font-size: 8.5px; }
.media-status { font-size: 8px; }
.media-hero-copy > p { font-size: 10.5px; }
.media-hero-meta { font-size: 9.5px; }
.media-hero-stats span { font-size: 9px; }
.media-card-copy > p { font-size: 9.5px; }
.media-card-foot { font-size: 9px; }
.media-footnote strong { font-size: 10px; }
.media-footnote span { font-size: 12.5px; }
.media-type-picker label span { font-size: 10px; }
.media-empty { font-size: 11px; }

/* Notes */
.notebook-item { font-size: 11px; }
.notebook-item em { font-size: 9px; }
.rail-stats span { font-size: 9px; }
.note-list-count { font-size: 9px; }
.note-item-head strong { font-size: 11.5px; }
.note-list-item p { font-size: 9.5px; }
.note-item-foot { font-size: 9px; }
.note-breadcrumb, .note-notebook-select { font-size: 9.5px; }
.note-tabs button { font-size: 10px; }
.note-word-count { font-size: 9px; }
.note-content-input, .markdown-body { font-size: 12.5px; }
.note-tags input { font-size: 10px; }
.save-hint { font-size: 8.5px; }
.note-editor-empty p { font-size: 10.5px; }
.note-list-empty { font-size: 10.5px; }

/* Archives */
.archive-category { font-size: 8.5px; }
.archive-identifier { font-size: 9.5px; }
.archive-meta { font-size: 9px; }
.archive-file { font-size: 9px; }
.archive-alert strong { font-size: 10.5px; }
.archive-alert span:not(.archive-alert-icon) { font-size: 9px; }
.archive-hero-stats span { font-size: 9px; }
.archive-detail-head p { font-size: 9.5px; }
.archive-detail-grid span { font-size: 9px; }
.archive-detail-grid strong { font-size: 10.5px; }
.archive-note span { font-size: 9px; }
.archive-note p { font-size: 11px; }
.archive-attachment strong { font-size: 10.5px; }
.archive-attachment small { font-size: 9px; }
.file-drop strong { font-size: 11px; }
.file-drop small { font-size: 9px; }
.archive-tip strong { font-size: 9.5px; }
.archive-tip span { font-size: 12.5px; }
.archive-empty { font-size: 11px; }

/* Assistant cards */
.chat-head-identity span { font-size: 9px; }
.chat-head-badges span { font-size: 8.5px; }
.chat-day { font-size: 8.5px; }
.chat-meta { font-size: 9px; }
.chat-bubble.markdown-body { font-size: 12px; }
.chat-action { font-size: 9px; }
.suggestion-chip { font-size: 9.5px; height: 29px; padding: 0 9px; }
.chat-compose textarea { font-size: 12px; }
.chat-compose-foot { font-size: 8.5px; }
.ai-context-head { font-size: 9px; }
.ai-module > span:nth-child(2) { font-size: 10.5px; }
.ai-module strong { font-size: 9.5px; }
.ai-context-insight p { font-size: 12.5px; }
.ai-context-privacy strong { font-size: 9px; }
.ai-context-privacy span { font-size: 8px; }

/* Search / drawer cards */
.notification-copy strong { font-size: 11px; }
.notification-copy p { font-size: 9.5px; }
.notification-copy small { font-size: 8.5px; }
.search-result-title { font-size: 11px; }
.search-result-snippet { font-size: 9.5px; }
.search-section-label { font-size: 9px; }
.search-hint { font-size: 9.5px; }
.search-quick { font-size: 10px; }

@media (max-width: 600px) {
  .smart-tabs { width: 100%; }
  .smart-tab { flex: 1; justify-content: center; padding: 0 7px; }
  .home-device-tile { width: 100%; }
}
@media (max-width: 560px) {
  .metric-delta { display: none; }
  .metric-top { gap: 6px; }
  .metric-label { font-size: 10.5px; }
  .home-room-chip { font-size: 9.5px; }
  .home-room-chip em { font-size: 8.5px; }
}

/* =========================================================
   Home Assistant integration
   ========================================================= */
.device-readonly { width: 28px; height: 28px; display: grid; place-items: center; color: var(--faint); }
.integration-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; }
.ha-config-panel { min-width: 0; }
.ha-readonly-banner { display: flex; align-items: flex-start; gap: 7px; margin-bottom: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); font-size: 9.5px; line-height: 1.65; color: var(--muted); }
.ha-readonly-banner svg { flex: none; color: var(--gold); margin-top: 1px; }
.integration-page.is-readonly #ha-config-form,
.integration-page.is-readonly .builtin-ha,
.integration-page.is-readonly .entity-panel,
.integration-page.is-readonly [data-ha-sync],
.integration-page.is-readonly [data-ha-clear] { display: none !important; }
.ha-status {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 9px; white-space: nowrap;
}
.ha-status i { width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }
.ha-status.is-on { color: var(--success); border-color: color-mix(in srgb, var(--success) 28%, var(--line)); background: var(--sage-light); }
.ha-status.is-on i { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 14%, transparent); }
.ha-config-lede { margin: -3px 0 18px; max-width: 650px; font-size: 11.5px; line-height: 1.75; color: var(--muted); }
.ha-config-form { display: flex; flex-direction: column; gap: 14px; }
.ha-form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 3px; }
.ha-test-result {
  display: flex; align-items: flex-start; gap: 7px; padding: 9px 11px; border-radius: 8px;
  font-size: 10px; line-height: 1.6;
}
.ha-test-result.ok { color: var(--success); background: var(--sage-light); border: 1px solid color-mix(in srgb, var(--success) 18%, transparent); }
.ha-test-result.error { color: var(--danger); background: var(--clay-light); border: 1px solid color-mix(in srgb, var(--danger) 18%, transparent); }
.builtin-ha {
  display: flex; align-items: center; gap: 10px; margin-top: 15px; padding: 11px 12px;
  border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--surface-2);
}
.builtin-ha-icon { width: 31px; height: 31px; flex: none; display: grid; place-items: center; border-radius: 8px; color: var(--gold); background: var(--surface); }
.builtin-ha > div:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.builtin-ha strong { font-size: 10px; font-weight: 600; color: var(--ink-2); }
.builtin-ha p { font-size: 9px; line-height: 1.6; color: var(--muted); }
.builtin-ha .btn { flex: none; }
.ha-meta { display: flex; flex-wrap: wrap; gap: 13px; margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 9px; color: var(--faint); }
.ha-meta span { display: flex; align-items: center; gap: 4px; }
@media (max-width: 600px) {
  .builtin-ha { flex-wrap: wrap; }
  .builtin-ha > div:nth-child(2) { flex-basis: calc(100% - 45px); }
  .builtin-ha .btn { width: 100%; margin-left: 41px; }
}
.ha-guide-panel { display: flex; flex-direction: column; background: linear-gradient(150deg, #f7f4eb, #f1eee4); }
.ha-steps { display: flex; flex-direction: column; gap: 12px; list-style: none; padding: 0; margin: 4px 0 18px; }
.ha-steps li { display: flex; align-items: flex-start; gap: 9px; }
.ha-steps li > span { width: 25px; height: 23px; flex: none; display: grid; place-items: center; border-radius: 6px; background: var(--surface); color: var(--gold); font-family: var(--font-number); font-size: 8px; }
.ha-steps li > div { display: flex; flex-direction: column; gap: 2px; }
.ha-steps strong { font-size: 10.5px; font-weight: 600; color: var(--ink-2); }
.ha-steps p { font-size: 9.5px; line-height: 1.65; color: var(--muted); }
.ha-guide-note { display: flex; align-items: flex-start; gap: 7px; margin-top: auto; padding: 10px; border-radius: 9px; border: 1px dashed var(--line-strong); color: var(--faint); font-size: 9px; line-height: 1.65; }
.ha-guide-note svg { flex: none; color: var(--gold); margin-top: 1px; }
.entity-panel { margin-top: 18px; }
.entity-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.entity-domains { display: flex; gap: 3px; overflow-x: auto; }
.entity-domains button { height: 29px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: 10.5px; font-weight: 550; white-space: nowrap; }
.entity-domains button.active { color: var(--ink); border-color: var(--forest-3); background: #f2f6f3; }
.entity-import-bar { display: flex; align-items: center; gap: 12px; padding: 9px 11px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.check-label { display: flex; align-items: center; gap: 6px; font-size: 9.5px; color: var(--muted); white-space: nowrap; }
.check-label input { accent-color: var(--forest-3); }
.entity-selection { font-size: 9px; color: var(--faint); }
.entity-import-actions { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.entity-list { max-height: 430px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.entity-row {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-bottom: 1px solid var(--line);
  cursor: pointer; transition: background 0.16s;
}
.entity-row:last-child { border-bottom: 0; }
.entity-row:hover { background: var(--surface-2); }
.entity-row.is-imported { opacity: 0.62; cursor: default; }
.entity-row input[type="checkbox"] { accent-color: var(--forest-3); flex: none; }
.entity-type-icon { width: 29px; height: 29px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.entity-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.entity-main strong { font-size: 10.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entity-main small { font-family: var(--font-number); font-size: 8.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entity-domain { flex: none; font-size: 8px; color: var(--muted); background: var(--surface-2); border-radius: 4px; padding: 3px 6px; }
.entity-state { min-width: 46px; text-align: right; font-size: 8.5px; color: var(--faint); white-space: nowrap; }
.entity-readonly { flex: none; font-size: 7.5px; color: var(--faint); border: 1px solid var(--line); border-radius: 4px; padding: 2px 5px; }
.entity-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 175px; padding: 24px; text-align: center; color: var(--faint); }
.entity-placeholder.compact { min-height: 130px; }
.entity-placeholder strong { font-family: var(--font-serif); font-size: 17px; font-weight: 500; color: var(--ink-2); }
.entity-placeholder p { max-width: 400px; font-size: 9.5px; line-height: 1.7; color: var(--muted); }
.entity-loading { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 170px; color: var(--faint); font-size: 9px; font-style: normal; }
.entity-loading span { width: 5px; height: 5px; border-radius: 50%; background: var(--faint); animation: typing-bounce 1.2s infinite; }
.entity-loading span:nth-child(2) { animation-delay: 0.15s; }
.entity-loading span:nth-child(3) { animation-delay: 0.3s; }
.entity-loading em { margin-left: 7px; font-style: normal; }
.linked-panel { margin-top: 18px; }
.linked-head-right { display: flex; align-items: center; gap: 9px; }
.linked-device-list { display: flex; flex-direction: column; }
.linked-device-row { display: flex; align-items: center; gap: 9px; padding: 9px 2px; border-bottom: 1px dashed var(--line); }
.linked-device-row:last-child { border-bottom: 0; }
.linked-device-icon { width: 31px; height: 31px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.linked-device-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.linked-device-copy strong { font-size: 10.5px; font-weight: 600; }
.linked-device-copy small { font-size: 8.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.linked-device-state { font-size: 9px; color: var(--muted); }
.linked-device-state.offline { color: var(--danger); }
.ha-mini-badge { font-size: 7.5px; color: #5b7aa3; background: var(--blue-light); border-radius: 4px; padding: 2px 5px; }
.linked-panel-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 8.5px; color: var(--faint); }
.linked-panel-foot > span { display: flex; align-items: center; gap: 4px; }
[data-theme="dark"] .ha-guide-panel { background: linear-gradient(150deg, #1c261f, #171f19); }
[data-theme="dark"] .entity-domains button.active { background: #213228; }
[data-theme="dark"] .entity-row:hover { background: var(--surface-2); }
[data-theme="dark"] .ha-test-result.ok { background: #22362a; }
[data-theme="dark"] .ha-test-result.error { background: #39241e; }
[data-theme="dark"] .ha-steps li > span { background: var(--surface-2); }
[data-theme="dark"] .ha-mini-badge { background: #20313e; color: #9ec1d8; }

@media (max-width: 900px) {
  .integration-grid { grid-template-columns: 1fr; }
  .home-room-cards { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .smart-insights-head { align-items: flex-start; flex-direction: column; gap: 7px; }
  .smart-insights-grid { grid-template-columns: 1fr; }
  .smart-insight { min-height: 126px; }
}
@media (max-width: 600px) {
  .ha-form-actions { justify-content: stretch; }
  .ha-form-actions .btn { flex: 1; }
  .entity-toolbar { flex-direction: column; align-items: stretch; }
  .entity-domains { padding-bottom: 2px; }
  .entity-import-bar { flex-wrap: wrap; }
  .entity-import-actions { width: 100%; margin-left: 0; }
  .entity-import-actions .select-inline { flex: 1; }
  .entity-row { gap: 7px; }
  .entity-domain { display: none; }
  .entity-state { min-width: 38px; }
  .linked-device-state { display: none; }
}


/* =========================================================
   New-family onboarding
   ========================================================= */
.hero-start {
  position: relative; z-index: 2; align-self: center; width: 100%; max-width: 315px;
  justify-self: end; padding: 18px; border-radius: 18px;
  border: 1px solid rgba(231, 211, 167, 0.16); background: rgba(255, 255, 255, 0.035);
}
.hero-start p { margin: 0 0 10px; font-size: 9.5px; letter-spacing: 0.12em; color: rgba(244, 239, 227, 0.46); }
.hero-start button {
  width: 100%; display: flex; align-items: center; gap: 9px; padding: 10px 2px; border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07); background: none; color: #f2eadb;
  font-size: 11.5px; text-align: left;
}
.hero-start button:first-of-type { border-top: 0; }
.hero-start button span { font-family: var(--font-number); font-size: 8.5px; color: #d8b77f; }
.hero-start button svg { margin-left: auto; color: rgba(244, 239, 227, 0.35); }
.hero-start button:hover { color: #e7c890; }
.hero-start button:hover svg { color: #e7c890; transform: translateX(2px); }
.setup-grid { grid-column: span 12; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.setup-card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  min-height: 190px; padding: 19px 17px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); text-align: left; box-shadow: var(--shadow-sm); transition: transform 0.22s, box-shadow 0.22s, border-color 0.22s;
}
.setup-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.setup-index { font-family: var(--font-number); font-size: 8.5px; letter-spacing: 0.12em; color: var(--faint); }
.setup-icon {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px;
  color: var(--setup-tone); background: color-mix(in srgb, var(--setup-tone) 12%, transparent);
}
.setup-card strong { margin-top: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.setup-card p { margin: 0; font-size: 10.5px; line-height: 1.65; color: var(--muted); }
.setup-arrow { margin-top: auto; color: var(--setup-tone); }
.dashboard-grid.is-new .metric-grid,
.dashboard-grid.is-new .home-panel,
.dashboard-grid.is-new .upcoming-panel,
.dashboard-grid.is-new .finance-panel,
.dashboard-grid.is-new .health-panel,
.dashboard-grid.is-new .notes-panel { display: none; }

@media (max-width: 820px) {
  .hero-start { display: none; }
  .setup-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .setup-card { min-height: 175px; }
  .dashboard-grid.is-new .insight-card { margin-top: 0; }
}
@media (max-width: 560px) {
  .setup-grid { grid-template-columns: 1fr; }
  .setup-card { min-height: 0; }
}

/* =========================================================
   Theme controls
   ========================================================= */
.theme-icon { display: none; place-items: center; }
.theme-icon--moon { display: grid; }
[data-theme="dark"] .theme-icon--moon { display: none; }
[data-theme="dark"] .theme-icon--sun { display: grid; }
.theme-toggle { position: relative; }
.login-theme-btn {
  position: absolute; top: 26px; right: 28px; z-index: 4; width: 38px; height: 38px;
  display: grid; place-items: center; border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface-2); color: var(--muted); transition: 0.2s;
}
.login-theme-btn:hover { color: var(--ink); border-color: var(--line-strong); background: var(--surface-3); }
.profile-menu-item.theme-menu-item { color: var(--ink-2); }
.profile-menu-item.theme-menu-item:hover { background: var(--surface-2); }
.profile-theme-icon { display: grid; place-items: center; width: 18px; color: var(--gold); }
.theme-menu-label { flex: 1; text-align: left; }
.theme-menu-switch {
  width: 30px; height: 17px; padding: 2px; border-radius: 20px; background: var(--line-strong);
  transition: background 0.2s;
}
.theme-menu-switch i {
  display: block; width: 13px; height: 13px; border-radius: 50%; background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.2s;
}
.theme-menu-switch.is-on { background: var(--forest-3); }
.theme-menu-switch.is-on i { transform: translateX(13px); }

/* =========================================================
   Dark theme
   ========================================================= */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1511;
  --bg-deep: #0a100d;
  --surface: #161f19;
  --surface-2: #1c2720;
  --surface-3: #253229;
  --ink: #efeae0;
  --ink-2: #dbe3db;
  --muted: #bcc7bf;
  --faint: #9aa89e;
  --line: #29362d;
  --line-strong: #3a4a3f;
  --forest: #203b2d;
  --forest-2: #2c503e;
  --forest-3: #4e7d65;
  --sage: #91b09a;
  --sage-light: #23372b;
  --gold: #dfb477;
  --gold-light: #3a3021;
  --cream: #2b2419;
  --clay: #db9574;
  --clay-light: #3c2921;
  --blue: #89aec6;
  --blue-light: #1f303a;
  --plum: #a99abb;
  --danger: #df8d77;
  --success: #86b795;
  --chart-ink: #d6ddd6;
  --donut-track: rgba(255, 255, 255, 0.08);
  --ring-track: rgba(255, 255, 255, 0.11);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.24), 0 8px 22px rgba(0, 0, 0, 0.16);
  --shadow-md: 0 16px 42px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] html, html[data-theme="dark"] { background: var(--bg); }
[data-theme="dark"] body {
  background: var(--bg);
  color: var(--ink);
}
[data-theme="dark"] body::before {
  background:
    radial-gradient(1000px 520px at 82% -12%, rgba(223, 180, 119, 0.075), transparent 65%),
    radial-gradient(800px 520px at 8% 105%, rgba(126, 158, 136, 0.065), transparent 70%);
}
[data-theme="dark"] ::selection { background: rgba(223, 180, 119, 0.25); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(210, 221, 211, 0.16); border: 3px solid transparent; background-clip: content-box; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(210, 221, 211, 0.28); border: 3px solid transparent; background-clip: content-box; }

/* Dark shell */
[data-theme="dark"] .topbar {
  background: rgba(14, 21, 17, 0.86);
  border-bottom-color: rgba(41, 54, 45, 0.9);
}
[data-theme="dark"] .topbar-date:hover { background: rgba(255, 255, 255, 0.045); }
[data-theme="dark"] .search-trigger,
[data-theme="dark"] .topbar-icon,
[data-theme="dark"] .menu-btn {
  background: rgba(255, 255, 255, 0.035);
  border-color: var(--line);
  color: var(--muted);
}
[data-theme="dark"] .search-trigger:hover,
[data-theme="dark"] .topbar-icon:hover,
[data-theme="dark"] .menu-btn:hover { background: var(--surface-2); color: var(--ink-2); }
[data-theme="dark"] kbd { background: var(--surface-3); border-color: var(--line-strong); color: var(--faint); }
[data-theme="dark"] .profile-menu { background: var(--surface); border-color: var(--line-strong); }
[data-theme="dark"] .profile-menu-meta { background: var(--surface-2); }
[data-theme="dark"] .profile-menu-item:hover { background: var(--surface-2); }
[data-theme="dark"] .notification-badge { border-color: var(--bg); }
[data-theme="dark"] .skeleton { background: linear-gradient(90deg, #18231c 20%, #213026 45%, #18231c 70%); background-size: 240% 100%; }

/* Dark login */
[data-theme="dark"] .login-screen { background: var(--surface); }
[data-theme="dark"] .login-panel {
  background: radial-gradient(500px 300px at 80% 0%, rgba(223, 180, 119, 0.07), transparent 65%), var(--surface);
}
[data-theme="dark"] .login-panel::before { background: linear-gradient(transparent, var(--line-strong), transparent); }
[data-theme="dark"] .login-input-wrap {
  background: #0f1712;
  border-color: var(--line-strong);
  color: var(--faint);
}
[data-theme="dark"] .login-input-wrap:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(223, 180, 119, 0.09); color: var(--gold); }
[data-theme="dark"] .login-input-wrap input { color: var(--ink); }
[data-theme="dark"] .login-error { background: #3a241e; border-color: #56362b; color: #efb29e; }
[data-theme="dark"] .login-foot { border-top-color: var(--line); }
[data-theme="dark"] .login-submit { background: var(--gold); color: #17241c; box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3); }
[data-theme="dark"] .login-submit:hover { background: #edc88e; color: #17241c; }
[data-theme="dark"] .login-theme-btn { background: var(--surface-2); border-color: var(--line); color: var(--muted); }
[data-theme="dark"] .login-theme-btn:hover { color: var(--ink); background: var(--surface-3); border-color: var(--line-strong); }
[data-theme="dark"] .brand-mark-dark { background: #1d3026; border-color: rgba(223, 180, 119, 0.24); color: var(--gold); }

/* Dark buttons */
[data-theme="dark"] .btn-primary { background: var(--gold); color: #17241c; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24); }
[data-theme="dark"] .btn-primary:hover { background: #edc88e; color: #17241c; }
[data-theme="dark"] .btn-cream { background: #ead6b2; color: #1b2b21; }
[data-theme="dark"] .btn-cream:hover { background: #f3e3c7; color: #1b2b21; }
[data-theme="dark"] .btn-ghost-danger:hover,
[data-theme="dark"] .icon-btn.danger:hover,
[data-theme="dark"] .row-action.danger:hover { background: #3a241e; color: #efad99; }
[data-theme="dark"] .icon-btn.is-pinned { background: #362c1c; color: var(--gold); }
[data-theme="dark"] .profile-menu-item#logout-btn:hover { background: #3a241e; }

/* Dark surfaces and controls */
[data-theme="dark"] .progress { background: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .segmented button span { background: rgba(255, 255, 255, 0.06); color: var(--muted); }
[data-theme="dark"] .switch { background: #435249; }
[data-theme="dark"] .switch.on { background: var(--forest-3); }
[data-theme="dark"] .switch i { background: #f4efe6; }
[data-theme="dark"] .inline-search:focus-within { background: var(--surface-2); }
[data-theme="dark"] .field input,
[data-theme="dark"] .field select,
[data-theme="dark"] .field textarea {
  background: #0f1712;
  border-color: var(--line-strong);
  color: var(--ink);
}
[data-theme="dark"] .field select { background-color: #0f1712; }
[data-theme="dark"] .modal { background: var(--surface); border-color: rgba(255, 255, 255, 0.055); }
[data-theme="dark"] .modal-backdrop { background: rgba(3, 7, 5, 0.68); }
[data-theme="dark"] .toast { border-color: rgba(255, 255, 255, 0.09); }
[data-theme="dark"] .btn-soft { background: var(--surface); border-color: var(--line-strong); color: var(--ink-2); }
[data-theme="dark"] .btn-soft:hover { background: var(--surface-2); border-color: var(--forest-3); color: var(--ink); }

/* Dark special cards */
[data-theme="dark"] .insight-card {
  background: linear-gradient(145deg, #2c2519 0%, #241f16 60%, #1f1b13 100%);
  border-color: #3c3322;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18);
}
[data-theme="dark"] .insight-head { color: #d9c6a4; }
[data-theme="dark"] .insight-icon { background: rgba(255, 255, 255, 0.06); color: #dfb477; }
[data-theme="dark"] .insight-time { color: #9c896a; }
[data-theme="dark"] .insight-card blockquote { color: #efe5d3; }
[data-theme="dark"] .insight-context { color: #b8a683; }
[data-theme="dark"] .insight-action {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(223, 180, 119, 0.18);
  color: #ead8b8;
}
[data-theme="dark"] .insight-action:hover { background: rgba(255, 255, 255, 0.1); }
[data-theme="dark"] .insight-orbit { border-color: rgba(255, 255, 255, 0.06); }
[data-theme="dark"] .quick-device:hover { background: var(--surface-2); border-color: var(--line-strong); }
[data-theme="dark"] .member-manage-item:hover { background: rgba(255, 255, 255, 0.055); }
[data-theme="dark"] .home-empty-state,
[data-theme="dark"] .media-empty-initial,
[data-theme="dark"] .archive-empty-initial { background: rgba(255, 255, 255, 0.018); }
[data-theme="dark"] .quick-device-icon { background: var(--surface-3); }
[data-theme="dark"] .quick-device.is-on .quick-device-icon { background: var(--device-tone); }
[data-theme="dark"] .scene-chip:hover { background: #2a251a; border-color: #7d633b; color: #e8c88f; }
[data-theme="dark"] .metric-delta.warn { background: #352c1d; color: #dfb477; }
[data-theme="dark"] .tone-warn { color: #dfb477; background: #352c1d; }
[data-theme="dark"] .tone-danger { color: #e4a08a; background: #39241e; }
[data-theme="dark"] .tone-info { color: #9fc3d9; background: #203039; }
[data-theme="dark"] .tone-good { color: #a8ceb5; background: #22362a; }
[data-theme="dark"] .weather-icon { background: #3a2e1d; color: #e0b477; }
[data-theme="dark"] .recent-note:hover { background: var(--surface-2); border-color: var(--line-strong); }
[data-theme="dark"] .recent-note { background: var(--surface-2); border-color: var(--line); }
[data-theme="dark"] .mini-tx-icon.expense { background: #3a2822; color: #e4a08a; }
[data-theme="dark"] .mini-tx-icon.income { background: #22362a; color: #a8ceb5; }
[data-theme="dark"] .room-device-group { background: rgba(255, 255, 255, 0.018); border-color: var(--line); }
[data-theme="dark"] .room-pill:hover,
[data-theme="dark"] .room-pill.active { background: #213129; border-color: var(--forest-3); color: var(--ink); }
[data-theme="dark"] .room-pill em { background: var(--surface-3); color: var(--muted); }
[data-theme="dark"] .scene-card:hover { background: var(--surface-2); border-color: var(--line-strong); }
[data-theme="dark"] .device-temp-control button:hover { background: var(--surface-3); color: var(--ink); }
[data-theme="dark"] .device-more:hover { background: var(--surface-3); }
[data-theme="dark"] .qty-control button:hover { background: var(--surface-3); color: var(--ink); }
[data-theme="dark"] .wellness-aside { background: linear-gradient(150deg, #1b261e, #171f19); }
[data-theme="dark"] .wellness-advice { color: var(--ink-2); }
[data-theme="dark"] .ai-chip { color: #dfb477; background: #342b1c; border-color: #4b3c25; }
[data-theme="dark"] .budget-health-card {
  background: linear-gradient(145deg, #292317, #211d15);
  border-color: #3d3423;
}
[data-theme="dark"] .budget-pill { background: rgba(255, 255, 255, 0.06); border-color: rgba(134, 183, 149, 0.2); color: #a8ceb5; }
[data-theme="dark"] .budget-pill.warn { color: #e4a08a; }
[data-theme="dark"] .budget-copy span { color: #b3a184; }
[data-theme="dark"] .budget-copy small { color: #9d8a6c; }
[data-theme="dark"] .budget-circle::before { background: #241f17; }
[data-theme="dark"] .budget-circle { background: conic-gradient(var(--forest-3) calc(var(--pct) * 1%), rgba(255, 255, 255, 0.09) 0); }
[data-theme="dark"] .budget-topline span { color: #a89676; }
[data-theme="dark"] .budget-link { color: #d8c095; }
[data-theme="dark"] .budget-row.over .budget-row-foot { color: #e4a08a; }
[data-theme="dark"] .account-card { background: var(--surface-2); border-color: var(--line); }
[data-theme="dark"] .account-strip .account-card { background: transparent; border: 0; }
[data-theme="dark"] .location-card { background: var(--surface); border-color: var(--line); }
[data-theme="dark"] .location-alert { background: #352c1d; color: #dfb477; }
[data-theme="dark"] .expiry-badge.ok,
[data-theme="dark"] .archive-expiry.ok { background: var(--surface-2); color: var(--muted); }
[data-theme="dark"] .expiry-badge.warn,
[data-theme="dark"] .archive-expiry.warn { background: #352c1d; color: #dfb477; }
[data-theme="dark"] .expiry-badge.danger,
[data-theme="dark"] .archive-expiry.danger { background: #39241e; color: #e4a08a; }
[data-theme="dark"] .expiry-badge.neutral,
[data-theme="dark"] .archive-expiry.neutral { background: var(--surface-2); color: var(--faint); }
[data-theme="dark"] .stock-line.low { color: #dfb477; }
[data-theme="dark"] .urgent-row em { background: var(--surface-2); }
[data-theme="dark"] .media-footnote { background: rgba(255, 255, 255, 0.018); border-color: var(--line-strong); }
[data-theme="dark"] .media-type-picker label span { background: var(--surface-2); border-color: var(--line); }
[data-theme="dark"] .media-type-picker label input:checked + span { background: #213228; border-color: var(--forest-3); color: var(--ink); }
[data-theme="dark"] .notebook-item:hover { background: rgba(255, 255, 255, 0.045); }
[data-theme="dark"] .note-list-item:hover { background: var(--surface-2); }
[data-theme="dark"] .note-list-item.active { background: #263128; border-color: #344237; }
[data-theme="dark"] .note-editor-panel { background: var(--surface); }
[data-theme="dark"] .note-title-input { color: var(--ink); }
[data-theme="dark"] .note-content-input { color: var(--ink-2); }
[data-theme="dark"] .note-tabs button.active { background: var(--surface-3); color: var(--ink); }
[data-theme="dark"] .markdown-body code { background: var(--surface-3); color: #e2ad8e; }
[data-theme="dark"] .markdown-body blockquote { background: var(--surface-2); color: var(--muted); }
[data-theme="dark"] .note-editor-foot { background: var(--surface); }
[data-theme="dark"] .note-tags input { color: var(--ink-2); }
[data-theme="dark"] .note-tags input::placeholder { color: var(--faint); }
[data-theme="dark"] .archive-alert { background: #2b2519; border-color: #3d3423; }
[data-theme="dark"] .archive-alert-icon { background: #3a2f1e; color: #dfb477; }
[data-theme="dark"] .archive-alert strong { color: #e6d4b5; }
[data-theme="dark"] .archive-alert span:not(.archive-alert-icon) { color: #b6a281; }
[data-theme="dark"] .archive-tip { background: rgba(255, 255, 255, 0.015); border-color: var(--line-strong); }
[data-theme="dark"] .archive-tip strong { color: var(--muted); }
[data-theme="dark"] .archive-tip span { color: var(--ink-2); }
[data-theme="dark"] .archive-note { background: var(--surface-2); }
[data-theme="dark"] .archive-attachment { border-color: var(--line); }
[data-theme="dark"] .archive-download { background: var(--surface-2); color: var(--muted); }
[data-theme="dark"] .archive-download:hover { background: var(--gold); color: #17241c; }
[data-theme="dark"] .file-drop { background: var(--surface-2); border-color: var(--line-strong); }
[data-theme="dark"] .file-drop:hover,
[data-theme="dark"] .file-drop.dragging { background: #2a2519; border-color: var(--gold); }
[data-theme="dark"] .file-drop.has-file { background: #1f3026; border-color: var(--forest-3); }
[data-theme="dark"] .file-drop-icon { background: var(--surface); color: var(--gold); }
[data-theme="dark"] .chat-head { background: rgba(22, 31, 25, 0.92); }
[data-theme="dark"] .chat-thread { background: linear-gradient(180deg, #151e18, #121a15); }
[data-theme="dark"] .chat-bubble { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }
[data-theme="dark"] .from-user .chat-bubble { background: #2c503e; border-color: #3a6450; color: #f3eee3; }
[data-theme="dark"] .chat-bubble.markdown-body code { background: rgba(255, 255, 255, 0.08); color: #e2ad8e; }
[data-theme="dark"] .chat-bubble.markdown-body blockquote { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .chat-bubble.markdown-body strong { color: var(--ink); }
[data-theme="dark"] .chat-head-badges span { background: #342b1c; border-color: #4b3c25; color: #d9bd90; }
[data-theme="dark"] .chat-compose { background: #0f1712; border-color: var(--line-strong); }
[data-theme="dark"] .chat-compose textarea { color: var(--ink); }
[data-theme="dark"] .chat-send { background: var(--gold); color: #17241c; }
[data-theme="dark"] .chat-send:hover { background: #edc88e; }
[data-theme="dark"] .suggestion-chip:hover { background: #2a2519; border-color: #7d633b; color: #e8c88f; }
[data-theme="dark"] .typing-dots i { background: #98a49a; }
[data-theme="dark"] .ai-orb { background: #2c503e; }
[data-theme="dark"] .ai-context-insight { background: linear-gradient(145deg, #2c2519, #241f15); border-color: #3c3322; }
[data-theme="dark"] .ai-context-insight .panel-kicker { color: #a28b68; }
[data-theme="dark"] .ai-context-insight p { color: #eadfcb; }
[data-theme="dark"] .ai-context-insight .text-link { color: #d5bd92; }
[data-theme="dark"] .ai-context-privacy { border-top-color: var(--line); }
[data-theme="dark"] .ai-context-privacy strong { color: var(--muted); }
[data-theme="dark"] .assistant-live { background: var(--surface); border-color: var(--line); color: var(--muted); }
[data-theme="dark"] .search-panel { background: var(--surface); border-color: rgba(255, 255, 255, 0.055); }
[data-theme="dark"] .search-quick { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }
[data-theme="dark"] .search-quick:hover { background: var(--surface-3); border-color: var(--line-strong); }
[data-theme="dark"] .search-result:hover,
[data-theme="dark"] .search-result.is-active { background: var(--surface-2); }
[data-theme="dark"] .search-foot { background: var(--surface-2); }
[data-theme="dark"] .esc-key { background: var(--surface-3); border-color: var(--line-strong); }
[data-theme="dark"] .notification-drawer { background: var(--surface); box-shadow: -20px 0 60px rgba(0, 0, 0, 0.4); }
[data-theme="dark"] .notification-item:hover { background: var(--surface-2); }
[data-theme="dark"] .drawer-scrim { background: rgba(3, 7, 5, 0.55); }
[data-theme="dark"] .search-overlay { background: rgba(3, 7, 5, 0.68); }
[data-theme="dark"] .sidebar-scrim { background: rgba(3, 7, 5, 0.58); }
[data-theme="dark"] .profile-menu { box-shadow: 0 24px 50px rgba(0, 0, 0, 0.4); }
[data-theme="dark"] .empty-icon { background: var(--surface-3); color: var(--muted); }
[data-theme="dark"] .table-empty { color: var(--faint); }
[data-theme="dark"] .data-table td { border-bottom-color: rgba(58, 74, 63, 0.55); }
[data-theme="dark"] .data-table tbody tr:hover { background: var(--surface-2); }
[data-theme="dark"] .budget-row { border-bottom-color: var(--line); }
[data-theme="dark"] .tx-filter { background: var(--surface-2); border-color: var(--line); }
[data-theme="dark"] .tx-filter button.active { background: var(--surface-3); }
[data-theme="dark"] .select-inline { background-color: var(--surface); border-color: var(--line-strong); color: var(--ink-2); }
[data-theme="dark"] .topbar-date small,
[data-theme="dark"] .topbar-date strong { color: var(--muted); }
[data-theme="dark"] .topbar-date strong { color: var(--ink-2); }

@media (max-width: 820px) {
  .topbar .theme-toggle { display: none; }
  .login-theme-btn { top: 20px; right: 20px; }
}

/* Readability & card polish */
.panel {
  background: linear-gradient(180deg, var(--surface) 0%, color-mix(in srgb, var(--surface) 94%, var(--surface-2)) 100%);
}
.metric-card {
  background: linear-gradient(165deg, var(--surface) 0%, color-mix(in srgb, var(--surface) 93%, var(--surface-2)) 100%);
}
.panel-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9.5px !important;
  color: var(--gold) !important;
  letter-spacing: 0.18em;
}
.panel-kicker::before { content: ""; width: 13px; height: 1px; flex: none; background: currentColor; opacity: .65; }
.eyebrow { font-size: 9.5px !important; color: var(--gold) !important; }
.panel-count {
  padding: 5px 10px;
  font-size: 10px !important;
  font-weight: 550;
  color: var(--ink-2) !important;
  background: var(--surface-2) !important;
  border-color: var(--line-strong) !important;
}
.section-note, .accounts-note, .asset-subtitle { font-size: 9.5px !important; color: var(--muted) !important; }
.metric-label { font-size: 10.5px !important; color: var(--ink-2) !important; font-weight: 600; }
.metric-foot { font-size: 9.5px !important; color: var(--muted) !important; }
.metric-delta { font-size: 9px !important; font-weight: 600; }
.quick-device-info strong, .upcoming-copy strong { font-size: 11.5px !important; color: var(--ink) !important; }
.mini-tx-copy strong { font-size: 10.5px !important; color: var(--ink) !important; }
.quick-device-info small, .upcoming-copy small, .mini-tx-copy small,
.device-info p, .tx-main small, .recent-note-copy small {
  font-size: 9.5px !important;
  line-height: 1.5;
  color: var(--muted) !important;
}
.device-info h3 { font-size: 12px !important; }
.tx-main strong { font-size: 11.5px !important; }
.tx-date, .tx-member { font-size: 10px !important; color: var(--muted) !important; }
.tx-status { padding: 4px 7px; font-size: 9px !important; font-weight: 600; }
.account-card > div span { font-size: 11px !important; }
.account-card > div small { font-size: 9.5px !important; color: var(--muted) !important; }
.account-card > strong { font-size: 12px !important; }
.asset-account-main strong { font-size: 11.5px !important; }
.asset-account-main small { font-size: 9.5px !important; color: var(--muted) !important; }
.asset-account-balance { font-size: 16px !important; }
.asset-account-badge { padding: 4px 7px; font-size: 9px !important; font-weight: 600; }
.asset-legend-row { font-size: 10px; }
.asset-legend-row strong { font-size: 10.5px; }
.asset-legend-row em { font-size: 9px; color: var(--muted); }
.asset-flow-row strong { font-size: 11px !important; }
.asset-flow-row small { font-size: 9px !important; color: var(--muted) !important; }
.budget-pill, .ai-chip { font-size: 9px !important; padding: 4px 8px; font-weight: 600; }
[data-theme="dark"] .ai-chip { color: #e8c38b; background: #2c261d; border-color: #493d2b; }
[data-theme="dark"] .budget-pill { color: #a9d0b5; background: #22362b; border-color: #365442; }
[data-theme="dark"] .tx-status.cleared { color: #a9d0b5; background: #22362b; }
[data-theme="dark"] .tx-status.pending { color: #e8c38b; background: #332a1e; }
.panel-head h2 { font-size: 22px; }
small { font-size: 9.5px !important; line-height: 1.55; }
.storage-item-meta, .archive-meta, .media-hero-meta, .linked-device-copy small,
.entity-main small, .workout-copy small, .habit-item small, .location-copy small,
.chat-meta, .detail-meta, .home-device-copy small, .scene-copy small {
  font-size: 9.5px !important;
  color: var(--muted) !important;
}
.storage-hero-copy > p, .media-hero-copy > p, .archive-hero-copy > p { font-size: 11px !important; color: rgba(244, 239, 227, .7) !important; }
.storage-hero-stats span, .media-hero-stats span, .archive-hero-stats span { font-size: 9.5px !important; color: rgba(244, 239, 227, .65) !important; }
.media-hero-meta { font-size: 9.5px !important; color: rgba(244, 239, 227, .72) !important; }
.media-card-copy > p, .media-card-foot { font-size: 9.5px !important; color: var(--muted) !important; }
.media-status { font-size: 8.5px !important; }
.media-footnote strong { font-size: 9.5px !important; color: var(--muted) !important; }
.storage-item-foot, .storage-item-meta { font-size: 9.5px !important; color: var(--muted) !important; }
.storage-item-foot strong, .storage-item-meta strong { font-size: 10px !important; }
.node-list-count, .note-list-count { font-size: 9.5px !important; color: var(--muted) !important; }
.note-item-head strong { font-size: 11px !important; }
.note-list-item p { font-size: 9.5px !important; color: var(--muted) !important; }
.note-item-foot { font-size: 9px !important; color: var(--muted) !important; }
.archive-category { font-size: 9px !important; font-weight: 550; }
.archive-identifier { font-size: 9px !important; color: var(--muted) !important; }
.archive-meta { font-size: 9.5px !important; }
.archive-file, .archive-expiry { font-size: 9px !important; }
.member-card-head p { font-size: 9.5px !important; color: var(--muted) !important; }
.member-metrics span { font-size: 9px !important; color: var(--muted) !important; }
.member-metrics strong { font-size: 11px !important; }
.member-foot { font-size: 9px !important; color: var(--muted) !important; }
.member-ring-center span { font-size: 9px !important; color: var(--muted) !important; }
.member-ring-center strong em { font-size: 9px !important; }
.member-manage-head, .member-manage-divider { font-size: 10px !important; color: var(--muted) !important; }
.member-manage-item span { font-size: 9.5px !important; color: var(--muted) !important; }
.member-manage-role { font-size: 9px !important; }
.member-account-hint { font-size: 9.5px !important; color: var(--muted) !important; }
.workout-copy strong { font-size: 11px !important; }
.media-title-row h3 { font-size: 13px; }
.archive-card h3 { font-size: 18px; }
.expiry-badge { font-size: 9px !important; padding: 3px 7px; font-weight: 550; }
.room-pill em { font-size: 9px !important; color: var(--muted) !important; }
.nav-badge { font-size: 8.5px !important; }
.note-tags { color: var(--muted) !important; }
.note-tags input { font-size: 9.5px !important; }
.note-tags input::placeholder { color: var(--muted); }
@media (max-width: 600px) {
  body[data-view="health"] .view-head .view-actions { width: 100%; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  body[data-view="health"] .view-head .view-actions .btn { flex: 1 1 0; min-width: 0; justify-content: center; padding: 0 9px; white-space: nowrap; }
  .device-info h3 { font-size: 12px !important; }
  .device-info p { font-size: 9px !important; }
  .quick-device-info small, .upcoming-copy small, .mini-tx-copy small { font-size: 9px !important; }
}

