/* Life Hub, the signed-in page: a sidebar on wide screens, a top bar on phones; each area has its own color.
   connect.html keeps the narrow style.css. */
:root {
  --bg: #f7f5f0; --card: #fff; --raised: #fbfaf7; --ink: #1f1d1a; --muted: #6f695f; --line: #e8e3da;
  --brand: #2f6f5e; --brand-ink: #fff; --danger: #b13a2c;
  --a-family: #c24470; --a-home: #c8692a; --a-money: #2f8a57; --a-health: #d2453c; --a-car: #2f6fc0;
  --a-projects: #7151d1; --a-work: #4f6582; --a-learning: #a87d10; --a-other: #7a746b; --a-cooking: #b5562b;
  --shadow: 0 1px 2px rgb(40 30 10 / 4%), 0 4px 16px rgb(40 30 10 / 5%);
  --serif: 'Fraunces', Georgia, serif; --sans: 'Inter', system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121110; --card: #1b1a18; --raised: #201e1b; --ink: #efebe4; --muted: #a39d93; --line: #2e2b27;
    --brand: #74c7ad; --brand-ink: #0f1a16; --danger: #ec8a7c;
    --a-family: #f07fa5; --a-home: #f0a066; --a-money: #6fcf98; --a-health: #f28079; --a-car: #7fb2f2;
    --a-projects: #a990f5; --a-work: #9fb2cc; --a-learning: #e3bd55; --a-other: #a8a198; --a-cooking: #ee9a6c;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #121110; --card: #1b1a18; --raised: #201e1b; --ink: #efebe4; --muted: #a39d93; --line: #2e2b27;
  --brand: #74c7ad; --brand-ink: #0f1a16; --danger: #ec8a7c;
  --a-family: #f07fa5; --a-home: #f0a066; --a-money: #6fcf98; --a-health: #f28079; --a-car: #7fb2f2;
  --a-projects: #a990f5; --a-work: #9fb2cc; --a-learning: #e3bd55; --a-other: #a8a198; --a-cooking: #ee9a6c;
  --shadow: none;
}
[data-area="family"] { --c: var(--a-family); } [data-area="home"] { --c: var(--a-home); } [data-area="money"] { --c: var(--a-money); }
[data-area="health"] { --c: var(--a-health); } [data-area="car"] { --c: var(--a-car); } [data-area="projects"] { --c: var(--a-projects); }
[data-area="work"] { --c: var(--a-work); } [data-area="learning"] { --c: var(--a-learning); } [data-area="other"] { --c: var(--a-other); }
[data-area="cooking"] { --c: var(--a-cooking); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15.5px/1.5 var(--sans); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; }
h1 { font: 600 2rem/1.15 var(--serif); letter-spacing: -.01em; }
h2 { font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: .86rem; } .error { color: var(--danger); }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shell ---------- */
.shell { min-height: 100vh; }
/* Saved to an iPhone home screen it runs full screen: keep clear of the notch, rounded corners and home indicator. */
.side { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 4px;
  padding: calc(10px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) 10px calc(16px + env(safe-area-inset-left)); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); overflow-x: auto; }
.brand { display: flex; align-items: center; gap: 10px; font: 600 1.15rem var(--serif); color: var(--ink); margin-right: auto; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.mark { width: 28px; height: 28px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; color: var(--brand-ink); }
.mark svg { width: 16px; height: 16px; stroke-width: 2.2; }
.nav { display: flex; align-items: center; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.nav a:hover { background: var(--raised); color: var(--ink); text-decoration: none; }
.nav a.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.nav .label { display: none; }
.side .areas-nav, .side .who { display: none; }
main { padding: 20px calc(16px + env(safe-area-inset-right)) calc(64px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left)); max-width: 1180px; width: 100%; margin: 0 auto; }

@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); }
  .side { position: sticky; top: 0; height: 100vh; flex-direction: column; align-items: stretch; gap: 18px; padding: calc(22px + env(safe-area-inset-top)) 16px 22px calc(16px + env(safe-area-inset-left)); border-bottom: 0;
    border-right: 1px solid var(--line); background: var(--bg); backdrop-filter: none; overflow-y: auto; }
  .brand { margin: 0 0 4px 6px; }
  .nav { flex-direction: column; align-items: stretch; }
  .nav .label { display: inline; }
  .side .areas-nav { display: block; }
  .areas-nav h2 { margin: 0 0 6px 10px; }
  .areas-nav a { justify-content: space-between; }
  .areas-nav .count { font-size: .8rem; color: var(--muted); }
  .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
  .side .who { display: block; margin-top: auto; padding: 0 10px; font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
  main { padding: calc(40px + env(safe-area-inset-top)) 44px 80px; }
}

/* ---------- building blocks ---------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.panel > h2 { margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel > h2 a { font-size: .78rem; letter-spacing: 0; text-transform: none; font-weight: 500; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 500; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.chip.area { border-color: transparent; background: color-mix(in srgb, var(--c) 13%, transparent); color: var(--c); }
.chips { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-left: 4px; }
.empty { color: var(--muted); font-size: .92rem; margin: 0; }
.empty-art { display: flex; gap: 12px; align-items: flex-start; }
.empty-art .ic { background: var(--raised); color: var(--muted); }
.ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--c, var(--brand)) 15%, transparent); color: var(--c, var(--brand)); }
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { padding: 11px 0; border-top: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; }
.rows > li:first-child { border-top: 0; padding-top: 0; }
.rows > li:last-child { padding-bottom: 0; }
.rows a.title { color: var(--ink); font-weight: 600; }
.sub { color: var(--muted); font-size: .85rem; margin-top: 1px; }
.bar { border-left: 3px solid var(--c, var(--line)); padding-left: 12px; }
button { font: inherit; border-radius: 12px; padding: 10px 16px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
button:hover { background: var(--raised); }
button.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
button.danger { color: var(--danger); }
button.link { border: 0; padding: 0; background: none; color: var(--brand); }
button.small { padding: 6px 12px; font-size: .86rem; }
button:disabled { opacity: .55; }
.search { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; box-shadow: var(--shadow); color: var(--muted); }
.search:focus-within { border-color: var(--brand); }
.search input { font: inherit; flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); padding: 12px 0; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9rem; margin-bottom: 18px; }
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: .85rem; font-weight: 500; }
.lede { margin: 10px 0 0; color: var(--muted); font-size: 1.02rem; max-width: 62ch; }

/* ---------- layout grids ---------- */
.hero { display: grid; gap: 18px; margin-bottom: 24px; }
.cols { display: grid; gap: 24px; }
.cols > * { min-width: 0; }
.stack > * + * { margin-top: 28px; }
.sec-title { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 12px; }
@media (min-width: 1100px) {
  .hero { grid-template-columns: 1fr 340px; align-items: end; }
  .cols { grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; }
}

/* ---------- home ---------- */
.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 14px; }
.area-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 18px; color: var(--ink); min-width: 0;
  background: color-mix(in srgb, var(--c) 7%, var(--card)); border: 1px solid color-mix(in srgb, var(--c) 20%, var(--line)); transition: transform .12s, box-shadow .12s; }
.area-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 22px color-mix(in srgb, var(--c) 16%, transparent); }
@media (max-width: 599px) { .area-grid { grid-template-columns: 1fr 1fr; gap: 10px; } .area-card { padding: 13px; } }
.area-card .top { display: flex; justify-content: space-between; align-items: flex-start; }
.area-card .n { font: 600 1.6rem/1 var(--serif); color: var(--c); }
.area-card .name { font: 600 1.12rem var(--serif); }
.area-card ul { list-style: none; margin: 0; padding: 0; font-size: .88rem; color: var(--muted); }
.area-card li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.area-card .foot { margin-top: auto; font-size: .78rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.area-card .foot .chip.area { background: color-mix(in srgb, var(--c) 16%, transparent); }
.area-card.ext { border-style: dashed; background: var(--card); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); min-width: 0; }
.timeline li:first-child { border-top: 0; padding-top: 0; }
.date { width: 46px; flex: none; text-align: center; border-radius: 11px; padding: 4px 0 5px; background: color-mix(in srgb, var(--c, var(--brand)) 12%, transparent); color: var(--c, var(--brand)); }
.date small { display: block; font-size: .64rem; font-weight: 700; letter-spacing: .08em; }
.date b { display: block; font: 600 1.2rem/1 var(--serif); }
.av { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: #fff; background: #8a8378; }
.av[data-app="ChatGPT"] { background: #10a37f; } .av[data-app="Claude"] { background: #d97757; } .av[data-app="you"] { background: var(--brand); color: var(--brand-ink); }

/* ---------- area page ---------- */
.area-hero { display: flex; gap: 18px; align-items: center; padding: 24px; border-radius: 22px; margin-bottom: 28px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 16%, var(--card)), color-mix(in srgb, var(--c) 5%, var(--card)));
  border: 1px solid color-mix(in srgb, var(--c) 22%, var(--line)); }
.area-hero .ic { width: 56px; height: 56px; border-radius: 16px; background: var(--c); color: var(--card); }
.area-hero .ic svg { width: 28px; height: 28px; }
.ents { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 14px; }
.ent { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); min-width: 0; overflow-wrap: anywhere; }
.ent > a { color: var(--ink); font: 600 1.05rem var(--serif); }
.kv { display: grid; grid-template-columns: minmax(90px, auto) 1fr; gap: 4px 14px; font-size: .88rem; margin-top: 10px; }
.kv > span:nth-child(odd) { color: var(--muted); }

/* ---------- record page ---------- */
.rec-hero { margin-bottom: 24px; }
.rec-hero .meta { margin-top: 10px; color: var(--muted); font-size: .9rem; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.removed-title { text-decoration: line-through; color: var(--muted); }
.change { position: relative; padding: 0 0 18px 26px; }
.change::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 0; width: 2px; background: var(--line); }
.change:last-child::before { display: none; }
.change::after { content: ''; position: absolute; left: 1px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 2px solid var(--brand); }
.change[data-what="removed"]::after { border-color: var(--danger); }
.change .head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.diff { list-style: none; padding: 0; margin: 6px 0; font-size: .9rem; overflow-wrap: anywhere; }
.diff s { color: var(--muted); }
blockquote { margin: 8px 0; padding: 8px 12px; border-radius: 10px; background: var(--raised); border-left: 3px solid var(--line); font-style: italic; font-size: .92rem; }
.change .undo { margin-top: 8px; }

/* ---------- records & settings ---------- */
.rec-list a { display: flex; gap: 12px; align-items: center; color: var(--ink); min-width: 0; }
.rec-list a:hover { text-decoration: none; }
.rec-list a:hover .t { text-decoration: underline; }
.rec-list .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--line)); flex: none; display: block; }
.rec-list .t { font-weight: 600; }
.settings-grid { display: grid; gap: 16px; }
@media (min-width: 1000px) { .settings-grid { grid-template-columns: 1fr 1fr; align-items: start; } .settings-grid .panel + .panel { margin-top: 0; } }
.app-row { padding: 12px 0; border-top: 1px solid var(--line); } .app-row:first-of-type { border-top: 0; padding-top: 0; }
label.opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin: 10px 0; }
label.opt input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.alert { border-color: var(--danger); margin-bottom: 20px; }
code { font-size: .85rem; overflow-wrap: anywhere; }
.signin { max-width: 420px; margin: 12vh auto; text-align: center; }
.signin .mark { width: 52px; height: 52px; border-radius: 16px; margin: 0 auto 18px; }
.signin .mark svg { width: 28px; height: 28px; }
.loading { color: var(--muted); padding: 40px 0; }
.rows > li.bar { padding-left: 12px; }

/* ---------- home: one calm column ---------- */
.calm { max-width: 720px; }
.calm > * + * { margin-top: 28px; }
.calm .hero { margin-bottom: 0; }
.calm .area-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px; }
.calm .area-card { flex-direction: row; align-items: center; gap: 10px; padding: 12px 14px; }
.calm .area-card .name { flex: 1; min-width: 0; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calm .area-card .n { font-size: 1rem; }
.quiet { margin: 0; color: var(--muted); }
.more { margin: 14px 0 0; font-size: .9rem; color: var(--muted); }
.latest { display: flex; align-items: center; gap: 10px; margin: 28px 0 0; font-size: .9rem; color: var(--muted); }
.latest > span:nth-child(2) { flex: 1; min-width: 0; }
.latest .av { width: 24px; height: 24px; font-size: .7rem; }

/* Per-hub choice in Settings (decision 0017): None · Read · Read + change. */
.hub { padding: 8px 0; }
.hub-head { display: flex; justify-content: space-between; gap: 8px; font-size: .92rem; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg label { position: relative; text-align: center; padding: 8px 4px; font-size: .88rem; cursor: pointer; border-left: 1px solid var(--line); }
.seg label:first-child { border-left: 0; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg label:has(input:checked) { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: -2px; }
