:root {
  --bg: #f4f5f7;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, #e8f1ff 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, #fdeef3 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f1f2f5;
  --glass: rgba(255, 255, 255, 0.72);
  --border: #e4e6eb;
  --text: #15171c;
  --muted: #6a6f7b;
  --accent: #4f46e5;
  --accent-soft: #eceafd;
  --accent-text: #ffffff;
  --warn: #b45309;
  --warn-soft: #fdf1dc;
  --bad: #c2334d;
  --bad-soft: #fde4e8;
  --good: #047857;
  --good-soft: #dcf5ea;
  --track: #e6e8ed;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, 0.14);
  --radius: 18px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f13;
    --bg-grad: radial-gradient(1200px 600px at 10% -10%, #1a2140 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, #2a1622 0%, transparent 55%);
    --surface: #17191f;
    --surface-2: #20232b;
    --glass: rgba(23, 25, 31, 0.72);
    --border: #2a2d36;
    --text: #eef0f4;
    --muted: #9399a6;
    --accent: #a5b4fc;
    --accent-soft: #252a4a;
    --accent-text: #11131a;
    --warn: #f4b860;
    --warn-soft: #3a2c15;
    --bad: #fb8a9c;
    --bad-soft: #3d1d25;
    --good: #5fd3a4;
    --good-soft: #15342a;
    --track: #2a2d36;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

/* Per-app accent colors: each app tints its own buttons and highlights */
body[data-app='goals'] { --accent: #047857; --accent-soft: #dcf5ea; }
body[data-app='calendar'] { --accent: #d6324f; --accent-soft: #fde4e8; }
body[data-app='reminders'] { --accent: #c2410c; --accent-soft: #feeadc; }
@media (prefers-color-scheme: dark) {
  body[data-app='goals'] { --accent: #5fd3a4; --accent-soft: #15342a; }
  body[data-app='calendar'] { --accent: #fb8a9c; --accent-soft: #3d1d25; }
  body[data-app='reminders'] { --accent: #fdba74; --accent-soft: #3a2415; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.9rem; font-weight: 750; letter-spacing: -0.025em; }
h2 { font-size: 1.05rem; font-weight: 650; letter-spacing: -0.01em; }
h3 { font-size: 0.98rem; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ---- App icons ---- */
.app-icon {
  --g1: #6366f1; --g2: #4338ca;
  display: inline-grid; place-items: center; flex: none; color: #fff;
  background: linear-gradient(145deg, var(--g1), var(--g2));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 4px 12px -4px var(--g2);
}
.app-icon.lg { width: 68px; height: 68px; border-radius: 20px; }
.app-icon.md { width: 44px; height: 44px; border-radius: 13px; }
.app-icon.sm { width: 30px; height: 30px; border-radius: 9px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.25); }
.app-goals { --g1: #34d399; --g2: #047857; }
.app-calendar { --g1: #fb7185; --g2: #be123c; }
.app-reminders { --g1: #fbbf24; --g2: #ea580c; }
.app-budget { --g1: #60a5fa; --g2: #1d4ed8; }
.app-chores { --g1: #a78bfa; --g2: #6d28d9; }
.app-meeting { --g1: #38bdf8; --g2: #0369a1; }
.app-docs { --g1: #94a3b8; --g2: #334155; }
.app-inventory { --g1: #fb923c; --g2: #9a3412; }
.app-home { --g1: #4b5563; --g2: #111827; }

/* ---- App chrome: top bar + dock ---- */
.shell { min-height: 100vh; }
.appbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--glass); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.appbar-inner { max-width: 1160px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 12px; height: 60px; }
.appbar-home {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--text);
  background: var(--surface-2); transition: background 0.15s, transform 0.15s;
}
.appbar-home:hover { background: var(--border); text-decoration: none; transform: scale(1.04); }
.appbar-title { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; color: var(--text); }
.appbar-title:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-size: 1.15rem; font-weight: 800; line-height: 1; color: #fff;
  background: linear-gradient(145deg, #6366f1, #db2777); box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}
.account { position: relative; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer; font: inherit; font-weight: 700; color: #fff;
  background: linear-gradient(145deg, #6366f1, #db2777);
}
.account-menu {
  position: absolute; right: 0; top: 46px; min-width: 200px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 30;
}
.account-name { padding: 8px 10px; font-weight: 600; }
.account-name small { display: block; color: var(--muted); font-weight: 400; }
.menu-item { display: block; width: 100%; text-align: left; border: 0; background: none; font: inherit; padding: 8px 10px; border-radius: 9px; cursor: pointer; color: var(--text); }
.menu-item:hover { background: var(--surface-2); }

.main { max-width: 1160px; margin: 0 auto; padding: 28px 24px 120px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin: 6px 0 0; }

.dock {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 25;
  display: flex; gap: 4px; padding: 6px; border-radius: 22px;
  background: var(--glass); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent); box-shadow: var(--shadow-lg);
}
.dock-item { display: flex; align-items: center; gap: 8px; white-space: nowrap; padding: 6px 12px 6px 6px; border-radius: 16px; color: var(--muted); font-size: 0.85rem; font-weight: 600; transition: background 0.15s, color 0.15s; }
.dock-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.dock-item.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
@media (max-width: 720px) {
  .appbar-inner { padding: 8px 16px; height: 56px; }
  .main { padding: 20px 16px 120px; }
  h1 { font-size: 1.55rem; }
  .dock { left: 12px; right: 12px; transform: none; justify-content: space-around; padding: 6px 4px; }
  .dock-item { flex-direction: column; gap: 3px; padding: 5px 6px; font-size: 0.68rem; flex: 1; min-width: 0; white-space: nowrap; padding-left: 2px; padding-right: 2px; letter-spacing: -0.01em; }
  .dock-item.active { background: transparent; box-shadow: none; color: var(--text); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Cards and grids */
.card { background: var(--surface); border: 1px solid color-mix(in srgb, var(--border) 70%, transparent); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.two-col { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1000px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat .label { font-size: 0.8rem; color: var(--muted); }
.stat .value { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 0.8rem; color: var(--muted); }

/* Progress */
.bar { height: 8px; background: var(--track); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.3s; }
.bar.at_risk > i { background: var(--warn); }
.bar.off_track > i { background: var(--bad); }
.pct { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.9rem; min-width: 3.2em; text-align: right; }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 0.75rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.on_track { background: var(--good-soft); color: var(--good); }
.pill.at_risk { background: var(--warn-soft); color: var(--warn); }
.pill.off_track { background: var(--bad-soft); color: var(--bad); }
.pill.stale { background: var(--surface-2); color: var(--muted); }
.pill.done { background: var(--good-soft); color: var(--good); }
.pill.dropped { background: var(--surface-2); color: var(--muted); }
.chip { font-size: 0.75rem; color: var(--muted); background: var(--surface-2); border-radius: 6px; padding: 1px 8px; white-space: nowrap; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-top: 1px solid var(--border); }
.list > li:first-child { border-top: 0; padding-top: 2px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }

/* Module cards */
.modules { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.module { border: 1px dashed var(--border); border-radius: 10px; padding: 12px 14px; }
.module h3 { font-size: 0.9rem; }
.module p { margin: 2px 0 0; font-size: 0.8rem; color: var(--muted); }

/* Buttons and forms */
.btn {
  appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: 0.88rem; padding: 7px 14px; border-radius: 11px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); padding: 5px 8px; }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--bad); }
.btn.sm { font-size: 0.8rem; padding: 4px 10px; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 4px; }
input, select, textarea {
  width: 100%; font: inherit; font-size: 0.92rem; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}
textarea { resize: vertical; min-height: 70px; }
.field { margin-bottom: 14px; }
.fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 520px) { .fields, .fields.two { grid-template-columns: 1fr; } }
.hint { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar select { width: auto; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented button { border: 0; background: var(--surface); font: inherit; font-size: 0.85rem; padding: 6px 12px; cursor: pointer; color: var(--muted); }
.segmented button[aria-pressed='true'] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* Dialog */
dialog {
  border: 1px solid var(--border); border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
dialog::backdrop { background: rgba(15, 20, 17, 0.45); }
dialog form { padding: 22px 24px 20px; }
dialog h2 { margin-bottom: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.error-text { color: var(--bad); font-size: 0.85rem; min-height: 1.2em; }

/* Goals page */
.goal { padding: 0; overflow: hidden; }
.goal-head { padding: 16px 20px; display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; }
.goal-head .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.goal-why { color: var(--muted); font-size: 0.88rem; margin: 2px 0 0; }
.goal-progress { display: flex; align-items: center; gap: 10px; grid-column: 1 / -1; }
.goal-progress .bar { flex: 1; }
.krs { border-top: 1px solid var(--border); background: var(--surface-2); padding: 6px 20px 12px; }
.kr { display: grid; grid-template-columns: minmax(0, 1fr) 160px auto; gap: 6px 16px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.kr:first-child { border-top: 0; }
.kr .kr-title { font-weight: 550; }
.kr .kr-meta { font-size: 0.8rem; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.kr .kr-bar { display: flex; flex-direction: column; gap: 4px; }
.kr .kr-num { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.kr-actions { display: flex; gap: 2px; justify-content: flex-end; }
@media (max-width: 640px) { .kr { grid-template-columns: 1fr; } .kr-actions { justify-content: flex-start; } }
.history { list-style: none; padding: 0; margin: 10px 0 0; max-height: 220px; overflow-y: auto; }
.history li { font-size: 0.83rem; padding: 6px 0; border-top: 1px solid var(--border); }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-size: 0.88rem; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.toast.show { opacity: 1; }

/* ---- Category colors (calendar) ---- */
:root {
  --c1: #2f6b4f; --c1-soft: #e3efe8;
  --c2: #2f5d8a; --c2-soft: #e1eaf4;
  --c3: #a33b5c; --c3-soft: #f6e1e8;
  --c4: #5b5f66; --c4-soft: #e9eaec;
  --c5: #8a6417; --c5-soft: #f6ecd6;
  --c6: #6a4c93; --c6-soft: #ece5f5;
  --c7: #b4532a; --c7-soft: #f8e5db;
}
@media (prefers-color-scheme: dark) {
  :root {
    --c1: #6fbf95; --c1-soft: #20332a;
    --c2: #7fb0e0; --c2-soft: #1d2a38;
    --c3: #e58aa8; --c3-soft: #3a2029;
    --c4: #b3b8bf; --c4-soft: #2a2d31;
    --c5: #e0b45c; --c5-soft: #352b17;
    --c6: #b59be0; --c6-soft: #2b2338;
    --c7: #ee9a72; --c7-soft: #3a261c;
  }
}
.c1 { --cat: var(--c1); --cat-soft: var(--c1-soft); }
.c2 { --cat: var(--c2); --cat-soft: var(--c2-soft); }
.c3 { --cat: var(--c3); --cat-soft: var(--c3-soft); }
.c4 { --cat: var(--c4); --cat-soft: var(--c4-soft); }
.c5 { --cat: var(--c5); --cat-soft: var(--c5-soft); }
.c6 { --cat: var(--c6); --cat-soft: var(--c6-soft); }
.c7 { --cat: var(--c7); --cat-soft: var(--c7-soft); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cat, var(--accent)); flex: none; }

/* ---- Calendar month grid ---- */
.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-head h2 { font-size: 1.2rem; min-width: 10em; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--border); gap: 1px; }
.month .dow { background: var(--surface-2); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 6px 8px; font-weight: 600; }
.day { background: var(--surface); min-height: 108px; padding: 6px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; }
.day:hover { background: var(--surface-2); }
.day.other { background: var(--bg); }
.day.other .num { color: var(--muted); opacity: 0.6; }
.day .num { font-size: 0.8rem; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.day.today .num { background: var(--accent); color: var(--accent-text); }
.ev {
  display: flex; align-items: center; gap: 4px; font-size: 0.74rem; line-height: 1.3; padding: 2px 6px; border-radius: 5px;
  background: var(--cat-soft); color: var(--text); border: 0; text-align: left; font-family: inherit; cursor: pointer; min-width: 0; width: 100%;
}
.ev .t { color: var(--cat); font-weight: 600; flex: none; }
.ev .ttl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev.allday { background: var(--cat); color: #fff; font-weight: 600; }
@media (prefers-color-scheme: dark) { .ev.allday { color: #111; } }
.more { font-size: 0.72rem; color: var(--muted); padding-left: 6px; }
@media (max-width: 820px) {
  .day { min-height: 64px; padding: 4px; }
  .ev .t, .ev .ttl { display: none; }
  .ev { width: 8px; height: 8px; padding: 0; border-radius: 50%; background: var(--cat); display: inline-block; }
  .day .evs { display: flex; flex-wrap: wrap; gap: 3px; }
  .more { display: none; }
}

/* ---- Agenda (calendar list + dashboard) ---- */
.agenda { list-style: none; margin: 0; padding: 0; }
.agenda .date-h { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 12px 0 4px; }
.agenda .date-h:first-child { padding-top: 0; }
.agenda .date-h.is-today { color: var(--accent); }
.agenda .item { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; cursor: pointer; border-radius: 6px; }
.agenda .item:hover .ttl { text-decoration: underline; }
.agenda .when { width: 64px; flex: none; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.agenda .dot { align-self: center; }
.agenda .ttl { font-weight: 550; }
.agenda .sub { font-size: 0.8rem; color: var(--muted); }

/* ---- Reminders ---- */
.rem-group h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 8px; display: flex; gap: 8px; align-items: center; }
.rem-group h2 .count { font-size: 0.72rem; background: var(--surface-2); border-radius: 999px; padding: 0 8px; letter-spacing: 0; }
.rem-group.overdue h2 { color: var(--bad); }
.rem { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 10px 0; border-top: 1px solid var(--border); }
.rem:first-of-type { border-top: 0; }
.check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); cursor: pointer; margin-top: 1px;
  display: grid; place-items: center; padding: 0; color: transparent; font-size: 13px; line-height: 1;
}
.check:hover { border-color: var(--accent); color: var(--accent); }
.check.done { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.rem .ttl { font-weight: 550; }
.rem.is-done .ttl { text-decoration: line-through; color: var(--muted); }
.rem .meta { font-size: 0.8rem; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.rem .meta .late { color: var(--bad); font-weight: 600; }
.rem .meta .high { color: var(--warn); font-weight: 600; }
.rem .acts { display: flex; gap: 2px; }
.week-list .rem { grid-template-columns: auto minmax(0, 1fr); }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(380px, 100%); padding: 28px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 750; font-size: 1.1rem; color: var(--text); padding: 0 0 22px; }
.brand small { display: block; color: var(--muted); font-weight: 400; font-size: 0.82rem; }
.brand .brand-mark { width: 44px; height: 44px; border-radius: 14px; font-size: 1.45rem; }

/* ---- Home screen ---- */
.hero { margin: 8px 0 26px; }
.hero .eyebrow { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.hero h1 { font-size: 2.3rem; margin-top: 4px; }
.hero .summary { margin-top: 8px; color: var(--muted); font-size: 1rem; }
.hero .summary b { color: var(--text); font-weight: 650; }
@media (max-width: 720px) { .hero h1 { font-size: 1.8rem; } }

.launcher { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 260px)); gap: 14px; margin-bottom: 30px; }
.tile { flex-direction: row; align-items: center; }
.tile {
  position: relative; display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: 22px; color: var(--text);
  background: var(--surface); border: 1px solid color-mix(in srgb, var(--border) 70%, transparent); box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
a.tile:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-lg); }
a.tile:active { transform: scale(0.98); }
.tile .name { font-weight: 700; letter-spacing: -0.01em; }
.tile .stat { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.tile .badge {
  position: absolute; top: 12px; right: 12px; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--bad); color: #fff; font-size: 0.75rem; font-weight: 700; display: grid; place-items: center;
}
.tile.soon { box-shadow: none; background: color-mix(in srgb, var(--surface) 55%, transparent); border-style: dashed; }
.tile.soon .app-icon { filter: grayscale(0.85); opacity: 0.55; box-shadow: none; }
.tile.soon .name { color: var(--muted); }
.tile .soon-tag { font-size: 0.7rem; font-weight: 600; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 8px; align-self: flex-start; }
@media (max-width: 720px) {
  /* phone home screen: icon + label grid */
  .launcher { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 8px; }
  .tile { background: none; border: 0; box-shadow: none; padding: 0; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
  .tile.soon { background: none; }
  .tile .app-icon.lg { width: 60px; height: 60px; border-radius: 17px; }
  .tile .name { font-size: 0.74rem; font-weight: 600; }
  .tile .stat, .tile .soon-tag { display: none; }
  .tile .badge { top: -4px; right: calc(50% - 38px); }
  a.tile:hover { transform: none; box-shadow: none; }
}

.section-title { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.widgets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 820px) { .widgets { grid-template-columns: minmax(0, 1fr); } }
.widget-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.widget-head h2 { flex: 1; }
.ring { --p: 0; width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--g2, #047857) calc(var(--p) * 1%), var(--track) 0); }
.ring::before { content: ''; grid-area: 1 / 1; width: 94px; height: 94px; border-radius: 50%; background: var(--surface); }
.ring span { grid-area: 1 / 1; font-size: 1.5rem; font-weight: 750; letter-spacing: -0.02em; z-index: 1; }
.goal-mini { display: flex; gap: 18px; align-items: center; }
.goal-mini ul { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; font-size: 0.85rem; }
.goal-mini li { padding: 4px 0; display: flex; gap: 8px; align-items: center; }
@media (max-width: 720px) {
  /* the app bar already names the app on phones */
  body:not([data-app='home']) .page-head h1 { display: none; }
  .page-head { margin-bottom: 16px; }
}

/* ---- Calendar suggestions inbox ---- */
.inbox { margin-bottom: 16px; border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.count-pill { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: 0.75rem; margin-left: 6px; vertical-align: 2px; }
.suggestions { list-style: none; margin: 0; padding: 0; }
.suggestion { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.suggestion:first-child { border-top: 0; }
.suggestion .who { font-size: 0.72rem; font-weight: 700; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.suggestion .ttl { font-weight: 600; }
@media (max-width: 720px) { .suggestion > .row { width: 100%; justify-content: flex-end; } }

/* ---- "New on your Google Calendar" pop-up ---- */
dialog.notify { width: min(440px, calc(100vw - 32px)); }
.notify-body { padding: 18px 20px 16px; }
.notify-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.notify-head b { display: block; font-size: 0.9rem; }
.notify-head small { color: var(--muted); font-size: 0.78rem; }
.notify-ttl { font-size: 1.2rem; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.notify-meta { color: var(--muted); margin-top: 4px; font-size: 0.92rem; }
.notify-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.notify-actions .btn { flex: 1 1 auto; }
.notify-foot { display: flex; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 0.85rem; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; text-decoration: underline; }

/* ---- Your own Google events on the Calendar (only you see these) ---- */
.mine { --cat: var(--muted); --cat-soft: transparent; }
.ev.mine { border: 1px dashed color-mix(in srgb, var(--muted) 60%, transparent); color: var(--muted); }
.item.mine .ttl { color: var(--muted); }
.item.mine .dot { background: transparent; border: 1.5px dashed var(--muted); }
.mine-tag { font-size: 0.7rem; font-weight: 700; border: 1px dashed var(--muted); color: var(--muted); border-radius: 999px; padding: 1px 7px; margin-left: 6px; white-space: nowrap; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); cursor: pointer; }

/* ---- Notification history ---- */
.log-item { display: flex; gap: 12px; align-items: flex-start; }
.log-item .state { font-size: 0.72rem; font-weight: 700; border-radius: 999px; padding: 2px 9px; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.log-item .state.added { background: var(--accent-soft); color: var(--accent); }
.log-item .state.waiting { background: #fef3c7; color: #92400e; }
@media (prefers-color-scheme: dark) { .log-item .state.waiting { background: #3a2f12; color: #fcd34d; } }
.ev.allday.mine { background: var(--surface-2); color: var(--muted); font-weight: 500; }
@media (max-width: 820px) { .ev.mine, .ev.allday.mine { background: transparent; border: 1.5px solid var(--muted); width: 8px; height: 8px; } }

/* ---- Settings: connect calendars ---- */
.steps { margin: 6px 0 10px; padding-left: 22px; line-height: 1.65; font-size: 0.92rem; }
.steps li { margin-bottom: 4px; }
.steps .muted { display: block; font-size: 0.82rem; }
.steps code { font-size: 0.82rem; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.feed-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; padding: 0; }
.feed-row input { flex: 1 1 auto; min-width: 0; }
.toggle { white-space: nowrap; }
.toggle input { width: auto; margin: 0; accent-color: var(--accent); }
.toggle[hidden] { display: none; }

/* ---- Notification bell (app bar) ---- */
.bell { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: var(--text); margin-right: 6px; }
.bell:hover { background: var(--surface-2); }
.bell-count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 0.68rem; font-weight: 700; display: grid; place-items: center; }
.bell-count[hidden] { display: none; }

/* ---- Notifications: swipeable cards ---- */
.notif-section { margin-bottom: 18px; }
.notif-head { display: flex; align-items: baseline; gap: 10px; margin: 0 2px 8px; flex-wrap: wrap; }
.notif-head .notif-hint { flex: 1; }
.notif-stack { display: grid; gap: 8px; }
.notif { position: relative; border-radius: 14px; overflow: hidden; transition: max-height .2s ease, opacity .2s ease, margin .2s ease; max-height: 200px; }
.notif-bg { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 18px; font-weight: 700; font-size: 0.85rem; color: #fff; opacity: 0; }
.notif-bg.add { background: #16a34a; justify-content: flex-start; }
.notif-bg.skip { background: #64748b; justify-content: flex-end; }
.notif[data-dir='add'] .notif-bg.add, .notif[data-dir='skip'] .notif-bg.skip { opacity: 1; }
.notif-card { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; touch-action: pan-y; user-select: none; transition: transform .15s ease; cursor: grab; }
.notif-card .ttl { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-card .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-actions { display: flex; gap: 4px; flex: none; }
.notif.out-right .notif-card { transform: translateX(110%); }
.notif.out-left .notif-card { transform: translateX(-110%); }
.notif.out-right, .notif.out-left { opacity: 0; max-height: 0; }
@media (max-width: 720px) { .notif-actions [data-add] { display: none; } .notif-head .notif-hint { flex-basis: 100%; order: 3; } }
@media (hover: none) { .notif-actions [data-add] { display: none; } }
.connect-hint { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border: 1px dashed var(--border); border-radius: 14px; color: var(--muted); font-size: 0.9rem; }
.type-tag { font-size: 0.7rem; font-weight: 600; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 1px 7px; margin-left: 6px; white-space: nowrap; }
.type-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; } .type-form input[name=name] { flex: 1 1 180px; width: auto; } .type-form select { width: auto; }

/* ---- Home: weather, your week ---- */
.home-top { display: grid; gap: 14px; margin-bottom: 8px; }
.home-left { display: grid; gap: 14px; }
.home-left .notif-section { margin-bottom: 0; }
.weather { min-height: 52px; min-width: 0; }
.weather-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: stretch; }
.clocks { display: flex; gap: 6px; }
.clock { display: flex; flex-direction: column; justify-content: center; align-items: center; min-width: 76px; padding: 6px 10px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); line-height: 1.15; }
.clock b { font-size: 1.05rem; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; }
.clock small { color: var(--muted); font-size: 0.7rem; white-space: nowrap; }
@media (max-width: 520px) { .weather-row { grid-template-columns: 1fr; } .clocks .clock { flex: 1; flex-direction: row; gap: 8px; padding: 8px 12px; } }
.weather-chip { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
button.weather-chip:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.w-icon { font-size: 1.9rem; line-height: 1; }
.w-temp { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; }
.w-text { display: flex; flex-direction: column; min-width: 0; }
.w-text small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.weather-set { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 14px; border: 1px dashed var(--border); border-radius: 16px; }
.weather-set input { width: auto; flex: 1 1 140px; }
dialog.weather-dialog { width: min(520px, calc(100vw - 24px)); }
.w-body { padding: 18px 20px; }
.w-big { font-size: 2.6rem; font-weight: 800; letter-spacing: -0.02em; }
.w-facts { margin: 8px 0 4px; line-height: 1.6; }
.w-h { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 14px 0 8px; }
.w-hours { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; }
.w-hour { flex: none; width: 52px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; border-radius: 12px; background: var(--surface-2); }
.w-hour small { color: var(--muted); font-size: 0.72rem; }
.w-hour .w-rain { color: #2563eb; }
.w-days { list-style: none; margin: 0; padding: 0; }
.w-days li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--border); }
.w-days li:first-child { border-top: 0; }
.w-day { width: 52px; font-weight: 600; }
.w-lo { color: var(--muted); width: 36px; text-align: right; }
.w-hi { font-weight: 700; width: 36px; text-align: right; }
.heads-ups { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.heads-up { font-size: 0.82rem; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--text); text-decoration: none; }
.heads-up span { color: var(--muted); }
@media (min-width: 900px) {
  .home-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .home-left { display: grid; gap: 14px; align-content: start; }
}
.notif-card .wrap { white-space: normal; overflow: visible; }
.notif.intro, .notif.ios { max-height: 320px; }
.notif.intro .notif-card, .notif.ios .notif-card { align-items: flex-start; border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
@media (max-width: 720px), (hover: none) { .notif.ios .notif-card { flex-wrap: wrap; } .notif.ios .notif-actions { width: 100%; justify-content: flex-end; } .notif.ios .notif-actions [data-add] { display: inline-flex; } }
@media (max-width: 720px) { .notif.intro .notif-card { flex-wrap: wrap; } .notif.intro .notif-actions { width: 100%; justify-content: flex-end; } .notif.intro .notif-actions [data-howto] { display: inline-flex; } }

/* ---- Health & Wellness ---- */
.app-wellness { --g1: #34d399; --g2: #0f766e; }
.app-onthisday { --g1: #a78bfa; --g2: #6d28d9; }
body[data-app='wellness'] { --accent: #0f766e; --accent-soft: #d5f5ec; }
@media (prefers-color-scheme: dark) { body[data-app='wellness'] { --accent: #5eead4; --accent-soft: #123a33; } }
.notif.hw .notif-card { border-color: color-mix(in srgb, #0f766e 40%, var(--border)); }
.notif.hw .notif-bg.add { background: #0f766e; }
.hw-summary { display: flex; gap: 18px; align-items: center; margin-bottom: 16px; }
.hw-ring { flex: none; color: var(--text); }
.hw-stats { margin-top: 2px; }
.hw-bars { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; margin-top: 12px; height: 64px; }
.hw-bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 3px; border: 0; background: none; padding: 0; cursor: pointer; font: inherit; min-width: 0; }
.hw-bar span { display: block; border-radius: 5px; background: var(--surface-2); min-height: 6px; }
.hw-bar small { font-size: 0.65rem; color: var(--muted); text-align: center; }
.hw-bar.full span { background: var(--accent); }
.hw-bar.part span { background: color-mix(in srgb, var(--accent) 50%, var(--surface-2)); }
.hw-bar.miss span { background: color-mix(in srgb, var(--bad) 35%, var(--surface-2)); height: 6px !important; }
.hw-bar.sel small { color: var(--text); font-weight: 800; }
.hw-bar.sel span { outline: 2px solid var(--text); outline-offset: 1px; }
.hw-slots { display: grid; gap: 14px; margin-bottom: 16px; }
@media (min-width: 900px) { .hw-slots { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; } }
.hw-slot.locked { opacity: 0.7; }
.hw-slot.complete { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.hw-items { list-style: none; margin: 0 0 10px; padding: 0; }
.hw-item { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-top: 1px solid var(--border); cursor: pointer; font-size: 1rem; }
.hw-items li:first-child .hw-item { border-top: 0; }
.hw-item input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.hw-check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); flex: none; display: grid; place-items: center; transition: background .15s; }
.hw-item input:checked + .hw-check { background: var(--accent); border-color: var(--accent); }
.hw-item input:checked + .hw-check::after { content: '✓'; color: #fff; font-weight: 800; font-size: 0.9rem; }
.hw-item input:focus-visible + .hw-check { outline: 2px solid var(--accent); outline-offset: 2px; }
.hw-item input:disabled + .hw-check { border-style: dashed; }
.hw-item.done .grow { color: var(--muted); text-decoration: line-through; }
.hw-slot.locked .hw-item { cursor: default; }
.hw-manage summary { cursor: pointer; list-style: none; }
.hw-manage summary::-webkit-details-marker { display: none; }
.day-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 0.8rem; padding: 3px 8px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; }
.chip input { width: auto; margin: 0; accent-color: var(--accent); }
.slot-times { display: grid; gap: 8px; }
.slot-time { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.slot-time b { width: 84px; }
.slot-time label { display: inline-flex; gap: 6px; align-items: center; font-size: 0.85rem; color: var(--muted); }
.slot-time input { width: auto; }

/* ---- Color themes (Settings → Color theme). Classic = no data-theme, keeps each app's own color. ---- */
:root[data-theme='ocean'] body, :root[data-theme='ocean'] body[data-app] { --accent: #0369a1; --accent-soft: #e0f2fe; --bg: #eef4f8; --bg-grad: radial-gradient(1200px 600px at 10% -10%, #cfe8fb 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, #c9f3ea 0%, transparent 55%); }
:root[data-theme='forest'] body, :root[data-theme='forest'] body[data-app] { --accent: #15803d; --accent-soft: #dcfce7; --bg: #f0f5f0; --bg-grad: radial-gradient(1200px 600px at 10% -10%, #d3f0d9 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, #ecf3c4 0%, transparent 55%); }
:root[data-theme='sunset'] body, :root[data-theme='sunset'] body[data-app] { --accent: #c2410c; --accent-soft: #ffedd5; --bg: #f8f2ec; --bg-grad: radial-gradient(1200px 600px at 10% -10%, #ffdcbf 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, #fbd3e0 0%, transparent 55%); }
:root[data-theme='rose'] body, :root[data-theme='rose'] body[data-app] { --accent: #be185d; --accent-soft: #fce7f3; --bg: #f8eff3; --bg-grad: radial-gradient(1200px 600px at 10% -10%, #fbd2e5 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, #e6d6fb 0%, transparent 55%); }
:root[data-theme='grape'] body, :root[data-theme='grape'] body[data-app] { --accent: #6d28d9; --accent-soft: #ede9fe; --bg: #f2f0f9; --bg-grad: radial-gradient(1200px 600px at 10% -10%, #ddd3fd 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, #cfe6fb 0%, transparent 55%); }
:root[data-theme='graphite'] body, :root[data-theme='graphite'] body[data-app] { --accent: #374151; --accent-soft: #e5e7eb; --bg: #f1f2f4; --bg-grad: radial-gradient(1200px 600px at 10% -10%, #e2e4e8 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, #ececec 0%, transparent 55%); }
@media (prefers-color-scheme: dark) {
  :root[data-theme='ocean'] body, :root[data-theme='ocean'] body[data-app] { --accent: #7dd3fc; --accent-soft: #0c2a3d; --bg: #0c1217; --bg-grad: radial-gradient(1200px 600px at 10% -10%, #0c2235 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, #0b2a2a 0%, transparent 55%); }
  :root[data-theme='forest'] body, :root[data-theme='forest'] body[data-app] { --accent: #86efac; --accent-soft: #12301d; --bg: #0d130f; --bg-grad: radial-gradient(1200px 600px at 10% -10%, #10261a 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, #1f2a12 0%, transparent 55%); }
  :root[data-theme='sunset'] body, :root[data-theme='sunset'] body[data-app] { --accent: #fdba74; --accent-soft: #3a2415; --bg: #15100d; --bg-grad: radial-gradient(1200px 600px at 10% -10%, #33200f 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, #2e1520 0%, transparent 55%); }
  :root[data-theme='rose'] body, :root[data-theme='rose'] body[data-app] { --accent: #f9a8d4; --accent-soft: #3b1630; --bg: #150e12; --bg-grad: radial-gradient(1200px 600px at 10% -10%, #2e1426 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, #241536 0%, transparent 55%); }
  :root[data-theme='grape'] body, :root[data-theme='grape'] body[data-app] { --accent: #c4b5fd; --accent-soft: #2a1f4a; --bg: #100e17; --bg-grad: radial-gradient(1200px 600px at 10% -10%, #1f1840 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, #0f2236 0%, transparent 55%); }
  :root[data-theme='graphite'] body, :root[data-theme='graphite'] body[data-app] { --accent: #d1d5db; --accent-soft: #2a2d36; --bg: #0f1012; --bg-grad: radial-gradient(1200px 600px at 10% -10%, #181a20 0%, transparent 60%), radial-gradient(900px 500px at 100% 0%, #1c1d22 0%, transparent 55%); }
}
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.theme-opt { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 2px solid var(--border); border-radius: 14px; background: var(--surface); cursor: pointer; font-weight: 600; font-size: 0.88rem; margin: 0; }
.theme-opt input { position: absolute; opacity: 0; pointer-events: none; }
.theme-opt:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-swatch { display: flex; height: 34px; border-radius: 9px; overflow: hidden; border: 1px solid var(--border); }
.theme-swatch span { flex: 1; }
.theme-opt .check { position: absolute; top: 6px; right: 8px; font-size: 0.8rem; color: var(--accent); display: none; }
.theme-opt:has(input:checked) .check { display: block; }
.share-glyph { display: inline-flex; vertical-align: -3px; color: var(--accent); }
dialog.steps-dialog { width: min(460px, calc(100vw - 24px)); }
dialog.steps-dialog ol.steps li { margin-bottom: 8px; }
.fit-card { margin-bottom: 16px; }
.fit-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.fit-tile { background: var(--surface-2); border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; min-width: 0; }
.fit-tile small { color: var(--muted); font-size: 0.72rem; }
.fit-tile b { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fit-steps { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; height: 40px; margin-top: 12px; align-items: end; }
.fit-bar { height: 100%; display: flex; align-items: flex-end; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.fit-bar i { display: block; width: 100%; background: color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 5px; }
.fit-bar.goal i { background: var(--accent); }
.fit-bar.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 560px) { .fit-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---- On this day ---- */
body[data-app='onthisday'] { --accent: #6d28d9; --accent-soft: #ede9fe; }
@media (prefers-color-scheme: dark) { body[data-app='onthisday'] { --accent: #c4b5fd; --accent-soft: #2a1f4a; } }
.otd-card .otd-line { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; min-width: 0; cursor: pointer; list-style: none; }
.otd-card .otd-line::-webkit-details-marker { display: none; }
.otd-item { border-top: 1px solid var(--border); }
.otd-items .otd-item:first-child { border-top: 0; }
.otd-chev { margin-left: auto; flex: none; color: var(--muted); transition: transform 0.15s; }
.otd-item[open] .otd-chev { transform: rotate(90deg); }
.otd-item[open] .otd-text { -webkit-line-clamp: unset; display: block; }
.otd-body { padding: 0 0 10px 54px; display: grid; gap: 4px; justify-items: start; }
.otd-thumb { width: 100%; max-width: 220px; max-height: 160px; object-fit: cover; border-radius: 10px; }
.otd-hols { margin: -4px 0 6px; }
.otd-hols span { font-size: 0.78rem; }
.otd-year { flex: none; font-weight: 800; color: var(--accent); min-width: 44px; font-variant-numeric: tabular-nums; }
.otd-text { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.otd-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .otd-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; } }
.otd-list { list-style: none; margin: 0; padding: 0; }
.otd-list > li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); align-items: flex-start; }
.otd-list > li:first-child { border-top: 0; }
.otd-list .thumb { flex: none; width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.otd-ago { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-bottom: 2px; }
.memory-photo { display: block; width: 100%; max-height: 360px; object-fit: cover; border-radius: 12px; margin-top: 8px; background: var(--surface-2); }
.holiday-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.holiday-chips a, .holiday-chips span { font-size: 0.84rem; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text); }
.otd-empty { padding: 6px 0; }
.photo-preview { max-width: 160px; max-height: 120px; border-radius: 10px; display: block; margin-top: 8px; }

/* ---- Trips ---- */
.app-trips { --g1: #38bdf8; --g2: #0369a1; }
body[data-app='trips'] { --accent: #0369a1; --accent-soft: #e0f2fe; }
@media (prefers-color-scheme: dark) { body[data-app='trips'] { --accent: #7dd3fc; --accent-soft: #0c2a3d; } }
.look-sky { --t1: #38bdf8; --t2: #0369a1; } .look-sea { --t1: #2dd4bf; --t2: #0e7490; } .look-sun { --t1: #fbbf24; --t2: #ea580c; }
.look-rose { --t1: #fb7185; --t2: #be185d; } .look-grape { --t1: #a78bfa; --t2: #6d28d9; } .look-leaf { --t1: #4ade80; --t2: #15803d; } .look-slate { --t1: #94a3b8; --t2: #334155; }
.trip-timeline { position: relative; display: grid; gap: 14px; padding-left: 4px; }
.trip-timeline::before { content: ''; position: absolute; left: 31px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.trip { position: relative; display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; align-items: start; }
.trip-date { position: relative; z-index: 1; width: 56px; height: 56px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; background: linear-gradient(145deg, var(--t1), var(--t2)); box-shadow: var(--shadow); line-height: 1.05; }
.trip-date b { font-size: 1.25rem; } .trip-date small { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.trip.past .trip-date { filter: saturate(0.35); opacity: 0.8; }
.trip-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.trip-card > summary { list-style: none; display: flex; gap: 12px; align-items: center; padding: 14px 16px; cursor: pointer; position: relative; border-left: 5px solid var(--t2); }
.trip-card > summary::-webkit-details-marker { display: none; }
.trip-card[open] > summary { background: linear-gradient(90deg, color-mix(in srgb, var(--t1) 14%, transparent), transparent 70%); }
.trip-card[open] > summary .otd-chev { transform: rotate(90deg); }
.trip-emoji { font-size: 1.7rem; line-height: 1; flex: none; }
.trip-name { display: block; font-weight: 800; font-size: 1.08rem; letter-spacing: -0.01em; }
.trip-sub { display: block; color: var(--muted); font-size: 0.86rem; }
.trip-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.trip-status { font-size: 0.74rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.trip.soon .trip-status { background: color-mix(in srgb, var(--t1) 22%, transparent); color: var(--t2); }
.trip.now .trip-status { background: var(--t2); color: #fff; }
@media (prefers-color-scheme: dark) { .trip.soon .trip-status { color: var(--t1); } }
.chip-sm { font-size: 0.74rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); }
.trip-body { padding: 4px 16px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.trip-note { white-space: pre-wrap; font-size: 0.88rem; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.trip-day { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin-top: 6px; min-width: 0; }
.trip-day-head { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; padding-top: 6px; border-top: 1px solid var(--border); }
.trip-day-head .muted { text-transform: none; letter-spacing: 0; margin-left: 4px; }
.trip-item { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.trip-item > summary, .trip-item .ti-static { list-style: none; display: flex; gap: 10px; align-items: center; padding: 8px 10px; }
.trip-item > summary { cursor: pointer; }
.trip-item > summary::-webkit-details-marker { display: none; }
.trip-item[open] > summary .otd-chev { transform: rotate(90deg); }
.trip-item b { display: block; font-size: 0.92rem; } .trip-item small { display: block; color: var(--muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ti-icon { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); font-size: 1rem; }
.trip-event { border-style: dashed; background: transparent; }
.ti-body { padding: 0 12px 10px 52px; display: grid; gap: 4px; font-size: 0.88rem; justify-items: start; }
.ti-body .muted { font-size: 0.78rem; margin-right: 4px; }
.conf { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.04em; cursor: copy; }
.past-trips { margin-top: 22px; }
.past-trips > summary { cursor: pointer; margin-bottom: 12px; }
.empty-trips { text-align: center; display: grid; gap: 4px; justify-items: center; padding: 28px; }
.trip-unfiled { margin-bottom: 16px; display: grid; gap: 6px; }
.trip-looks { display: grid; gap: 8px; }
.look-row { display: flex; flex-wrap: wrap; gap: 6px; }
.look-swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; background: linear-gradient(145deg, var(--t1), var(--t2)); cursor: pointer; }
.look-swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface) inset; }
.look-emoji { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-size: 1.1rem; cursor: pointer; }
.look-emoji.on { border-color: var(--accent); background: var(--accent-soft); }
.kind-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.kind-opt { display: inline-flex; gap: 5px; align-items: center; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 0.85rem; cursor: pointer; }
.kind-opt.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
#item-dialog, #trip-dialog { width: min(560px, calc(100vw - 24px)); }
@media (max-width: 520px) { .trip { grid-template-columns: 44px minmax(0, 1fr); gap: 8px; } .trip-date { width: 44px; height: 48px; border-radius: 13px; } .trip-timeline::before { left: 25px; } .trip-card > summary { padding: 12px; } .trip-body { padding: 2px 12px 14px; } .ti-body { padding-left: 12px; } }
.trip-mail { margin: 22px 0 0; padding: 0; }
.trip-mail > summary { list-style: none; display: flex; gap: 10px; align-items: center; padding: 12px 16px; cursor: pointer; }
.trip-mail > summary::-webkit-details-marker { display: none; }
.trip-mail > summary b { display: block; } .trip-mail > summary small { display: block; color: var(--muted); font-size: 0.82rem; }
.trip-mail[open] > summary .otd-chev { transform: rotate(90deg); }
.trip-mail-body { padding: 0 16px 14px; display: grid; gap: 10px; }
.mail-log li { display: flex; gap: 10px; align-items: flex-start; }
