:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f4f4f3;
  --text: #18181b;
  --muted: #6b6b73;
  --faint: #a1a1aa;
  --line: #e7e7e4;
  --ink: #18181b;
  --ink-text: #ffffff;
  --live: #16a34a;
  --live-soft: #dcfce7;
  --ship: #d97706;
  --ship-soft: #fef3c7;
  --done: #2563eb;
  --done-soft: #dbeafe;
  --danger: #dc2626;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  --shadow-lift: 0 2px 4px rgba(0,0,0,.04), 0 12px 32px rgba(0,0,0,.08);
  --radius: 14px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2,.8,.2,1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0c0d;
    --surface: #161618;
    --surface-2: #1e1e21;
    --text: #ececee;
    --muted: #9b9ba3;
    --faint: #63636b;
    --line: #26262a;
    --ink: #ececee;
    --ink-text: #111113;
    --live: #22c55e;
    --live-soft: rgba(34,197,94,.14);
    --ship: #f59e0b;
    --ship-soft: rgba(245,158,11,.14);
    --done: #60a5fa;
    --done-soft: rgba(96,165,250,.14);
    --shadow: 0 1px 2px rgba(0,0,0,.3);
    --shadow-lift: 0 12px 32px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--live); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.container { max-width: 1080px; margin: 0 auto; padding: 24px 16px 96px; outline: none; }
@media (min-width: 720px) { .container { padding: 40px 24px 80px; } }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner { max-width: 1080px; margin: 0 auto; height: 56px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
@media (min-width: 720px) { .topbar-inner { padding: 0 24px; } }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.01em; }
.brand-mark { width: 22px; height: 22px; border-radius: 7px; background: var(--ink); position: relative; }
.brand-mark::after { content: ""; position: absolute; right: 4px; bottom: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 2px var(--ink); }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a, .nav button.link { padding: 6px 12px; border-radius: 999px; color: var(--muted); border: 0; background: none; transition: background .15s, color .15s; }
.nav a:hover, .nav button.link:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--text); background: var(--surface-2); }
.nav .avatar { width: 30px; height: 30px; font-size: 13px; }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-weight: 550; white-space: nowrap; user-select: none;
  transition: transform .12s var(--ease), background .15s, border-color .15s, box-shadow .15s, opacity .15s;
}
.btn:hover { border-color: color-mix(in srgb, var(--text) 25%, var(--line)); }
.btn:active { transform: scale(.96); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--ink); color: var(--ink-text); border-color: var(--ink); }
.btn.primary:hover { opacity: .9; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.on { background: var(--live-soft); color: var(--live); border-color: transparent; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn .spinner { width: 16px; height: 16px; }
.btn.busy { pointer-events: none; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.field .hint { font-size: 12px; color: var(--faint); }
.input, .textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
  font-size: 16px; /* prevents iOS zoom */
}
@media (min-width: 720px) { .input, .textarea { font-size: 15px; } }
.input:focus, .textarea:focus { border-color: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 10%, transparent); }
.textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
.form-error { color: var(--danger); font-size: 13px; min-height: 20px; margin: -4px 0 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin: 4px 0 16px; cursor: pointer; }
.check input { accent-color: var(--ink); width: 16px; height: 16px; }

.segmented { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); position: relative; }
.segmented button { position: relative; z-index: 1; border: 0; background: none; padding: 6px 14px; border-radius: 999px; color: var(--muted); font-size: 14px; transition: color .2s; }
.segmented button[aria-pressed="true"] { color: var(--text); }
.segmented .thumb { position: absolute; z-index: 0; top: 3px; bottom: 3px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); transition: left .25s var(--ease), width .25s var(--ease); }

/* ---------- Generic ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: .92em; }
.row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }
.avatar {
  --h: 200;
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center; font-weight: 600; font-size: 14px;
  background: hsl(var(--h) 70% 92%); color: hsl(var(--h) 45% 32%);
}
@media (prefers-color-scheme: dark) { .avatar { background: hsl(var(--h) 35% 22%); color: hsl(var(--h) 70% 80%); } }
.avatar.lg { width: 52px; height: 52px; font-size: 20px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .02em; margin: 0 0 12px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; position: relative; }
.dot.live { background: var(--live); }
.dot.live::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--live); opacity: 0; animation: ping 1.8s var(--ease) infinite; }
@keyframes ping { 0% { transform: scale(.5); opacity: .7; } 100% { transform: scale(1.6); opacity: 0; } }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; background: var(--surface-2); color: var(--muted); max-width: 100%; }
.chip.live { background: var(--live-soft); color: var(--live); }
.chip span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2) 40%, var(--surface)) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.empty { text-align: center; padding: 56px 16px; color: var(--muted); }
.empty h3 { color: var(--text); margin: 12px 0 6px; font-size: 17px; }
.empty .glyph { width: 48px; height: 48px; margin: 0 auto; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; color: var(--faint); }
.empty .glyph svg { width: 22px; height: 22px; }

.code {
  display: flex; align-items: center; gap: 8px; max-width: 100%;
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 8px 8px 14px;
  font-family: var(--mono); font-size: 13px; text-align: left;
}
.code code { flex: 1; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.code code::-webkit-scrollbar { display: none; }

.fade-in { animation: fadeUp .4s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Home ---------- */
.home-hero { padding: 24px; }
@media (min-width: 720px) { .home-hero { padding: 28px; } }
.who { display: flex; align-items: center; gap: 14px; }
.who h1 { margin: 0 0 2px; font-size: clamp(22px, 4vw, 28px); letter-spacing: -.02em; line-height: 1.2; }
.home-hero > .work.none { margin-top: 18px; }
.live-list { display: grid; gap: 20px; margin-top: 20px; }
.live-item + .live-item { border-top: 1px solid var(--line); padding-top: 20px; }
.live-item .work { margin: 0 0 8px; }
.live-item .clock { margin-top: 10px; }
@media (min-width: 720px) {
  .live-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 24px; }
  .live-item .clock { margin: 0; line-height: 1; }
}
.ptag { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 500; margin-left: 8px; white-space: nowrap; transition: color .15s, background .15s; }
.ptag:hover { color: var(--text); background: color-mix(in srgb, var(--text) 8%, var(--surface-2)); }
.live-item .ptag { margin-left: 0; height: 26px; font-size: 13px; }

.overview { display: grid; gap: 12px; margin-top: 16px; grid-template-columns: minmax(0, 1fr); }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; order: -1; }
.tiles .stat { padding: 12px 14px; }
.tiles .stat .n { font-size: 22px; }
.stat .n small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
@media (min-width: 960px) {
  .overview { grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; }
  .tiles { grid-template-columns: 1fr; order: 0; gap: 12px; }
  .tiles .stat { padding: 14px 18px; display: flex; align-items: baseline; justify-content: space-between; flex-direction: row-reverse; }
  .tiles .stat .n { font-size: 24px; }
}
.chart-card { padding: 18px 18px 14px; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.chart { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); height: 132px; margin-top: 26px; border-bottom: 1px solid var(--line); }
.col { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; outline: none; cursor: default; }
.col i { display: block; width: min(24px, 62%); background: var(--live); border-radius: 4px 4px 0 0; transform-origin: bottom; animation: rise .7s var(--ease) both; transition: opacity .15s; }
@keyframes rise { from { transform: scaleY(0); } }
.chart:hover .col i { opacity: .45; }
.chart .col:hover i, .chart .col:focus-visible i { opacity: 1; }
.col .v { font-size: 11px; color: var(--muted); margin-bottom: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.col .tip {
  position: absolute; z-index: 5; top: -6px; left: 50%; transform: translate(-50%, -100%);
  display: grid; gap: 1px; padding: 7px 10px; border-radius: 10px; white-space: nowrap;
  background: var(--ink); color: var(--ink-text); font-size: 12px; box-shadow: var(--shadow-lift);
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.col .tip span { opacity: .7; }
.col.left .tip { left: 0; transform: translate(0, -100%); }
.col.right .tip { left: auto; right: 0; transform: translate(0, -100%); }
.col:hover .tip, .col:focus .tip { opacity: 1; }
.xaxis { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); margin-top: 6px; font-size: 11px; color: var(--faint); text-align: center; font-variant-numeric: tabular-nums; }
.xaxis .today { color: var(--text); font-weight: 600; }

.home-grid { display: grid; gap: 28px; margin-top: 28px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "projects" "feed"; }
.home-grid .feed { grid-area: feed; min-width: 0; }
.home-grid .projects { grid-area: projects; min-width: 0; }
.home-grid .day:first-of-type { margin-top: 0; }
@media (min-width: 960px) {
  .home-grid { grid-template-columns: minmax(0, 1fr) 320px; grid-template-areas: "feed projects"; align-items: start; }
  .home-grid .projects { position: sticky; top: 80px; }
}

/* ---------- Project page ---------- */
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; margin-bottom: 16px; transition: color .15s, gap .2s var(--ease); }
.back:hover { color: var(--text); gap: 8px; }
.back svg { width: 16px; height: 16px; }
.phead { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 24px; }
.phead h1 { margin: 0; font-size: clamp(22px, 4vw, 30px); letter-spacing: -.02em; line-height: 1.2; word-break: break-word; }
.phead .meta { color: var(--muted); font-size: 14px; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.phead .meta a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

.layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "presence" "aside" "feed"; }
.layout > .presence { grid-area: presence; }
.layout > .aside { grid-area: aside; }
.layout > .feed { grid-area: feed; min-width: 0; }
@media (min-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: auto 1fr; grid-template-areas: "presence aside" "feed aside"; gap: 0 28px; align-items: start; }
  .aside { position: sticky; top: 80px; }
}

.presence { padding: 22px; position: relative; overflow: hidden; }
.presence.working { border-color: color-mix(in srgb, var(--live) 35%, var(--line)); }
.presence.working::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(600px 200px at 0% 0%, var(--live-soft), transparent 70%);
}
.presence > * { position: relative; }
.presence .status { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.presence.working .status { color: var(--live); }
.presence .status .muted { font-weight: 400; }
.presence .work { font-size: clamp(18px, 3vw, 22px); font-weight: 600; letter-spacing: -.01em; margin: 12px 0 4px; line-height: 1.35; word-break: break-word; }
.presence .work.none { color: var(--faint); font-weight: 500; }
.presence .clock { font-family: var(--mono); font-size: clamp(30px, 6vw, 40px); font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 14px; }
.presence .sub { color: var(--muted); font-size: 13px; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { padding: 14px 16px; }
.stat .n { font-size: 24px; font-weight: 650; letter-spacing: -.02em; display: inline-block; }
.stat .l { font-size: 12.5px; color: var(--muted); }
.bump { animation: bump .5s var(--ease); }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.25); color: var(--live); } 100% { transform: scale(1); } }

.actions { display: grid; gap: 8px; margin-top: 12px; }
.actions .btn { width: 100%; }
@media (max-width: 959px) {
  .actions {
    position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; margin: 0;
    grid-template-columns: 1fr 1fr 1fr; gap: 8px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--line);
    animation: slideUp .35s var(--ease) both;
  }
  .actions .btn { padding: 0 8px; font-size: 14px; }
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }

.nudge-btn { position: relative; overflow: visible; }
.burst { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; border-radius: 50%; pointer-events: none; background: var(--ship); animation: burst .7s var(--ease) forwards; }
@keyframes burst { from { transform: translate(-50%,-50%) translate(0,0) scale(1); opacity: 1; } to { transform: translate(-50%,-50%) translate(var(--dx), var(--dy)) scale(.3); opacity: 0; } }
.wiggle svg { animation: wiggle .5s var(--ease); }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-18deg); } 40% { transform: rotate(14deg); } 60% { transform: rotate(-8deg); } 80% { transform: rotate(4deg); } }

.conn { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-top: 14px; justify-content: center; }
@media (max-width: 959px) { .conn { justify-content: flex-start; margin: 2px 0 0 2px; } }
.conn .dot { width: 6px; height: 6px; }
.conn.stale .dot { background: var(--ship); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 12px 0 8px; position: relative; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 10px 12px; color: var(--muted); font-weight: 550; position: relative; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); }
.tabs .ink { position: absolute; bottom: -1px; height: 2px; background: var(--text); border-radius: 2px; transition: left .25s var(--ease), width .25s var(--ease); }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; display: inline-grid; place-items: center; font-weight: 600; }

/* Timeline */
.day { font-size: 12.5px; font-weight: 600; color: var(--faint); margin: 22px 0 6px; letter-spacing: .02em; }
.timeline { list-style: none; margin: 0; padding: 0; }
.tl { display: grid; grid-template-columns: 32px 1fr; gap: 12px; position: relative; padding: 8px 0; }
.tl::before { content: ""; position: absolute; left: 15.5px; top: 40px; bottom: -8px; width: 1px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl .ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.tl .ic svg { width: 15px; height: 15px; }
.tl .body { padding-top: 5px; min-width: 0; }
.tl .txt { word-break: break-word; }
.tl .label { font-size: 13px; color: var(--muted); }
.tl time { font-size: 12.5px; color: var(--faint); margin-left: 6px; white-space: nowrap; }
.tl.lifecycle .body { padding-top: 6px; font-size: 13.5px; color: var(--muted); }
.tl.doing .ic { background: var(--live-soft); color: var(--live); }
.tl.done .ic { background: var(--done-soft); color: var(--done); }
.tl.ship .ic { background: var(--ship-soft); color: var(--ship); }
.tl.ship .body { background: var(--ship-soft); padding: 10px 14px; border-radius: var(--radius-sm); margin-top: -2px; }
.tl.ship .txt { font-weight: 600; }
.tl.fresh { animation: arrive .7s var(--ease) both; }
.tl.fresh .body { animation: flash 2.4s ease-out; border-radius: 8px; }
@keyframes arrive { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes flash { 0% { background-color: var(--live-soft); } 100% { background-color: transparent; } }
.more-row { display: flex; justify-content: center; padding: 16px 0; }

.sessions { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.session { padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.session .when { font-size: 13px; color: var(--muted); }
.session .dur { font-family: var(--mono); font-weight: 600; font-variant-numeric: tabular-nums; grid-row: span 2; text-align: right; }
.session .what { word-break: break-word; }
.session .bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.session .bar i { display: block; height: 100%; background: var(--live); border-radius: 4px; transform-origin: left; animation: grow .8s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }

.msgs { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.msg { padding: 14px 16px; display: grid; grid-template-columns: auto 1fr; gap: 12px; transition: opacity .3s; }
.msg.unread { border-color: color-mix(in srgb, var(--done) 40%, var(--line)); }
.msg.read { opacity: .72; }
.msg .top { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.msg .top strong { color: var(--text); font-weight: 600; }
.msg .txt { margin-top: 2px; word-break: break-word; }
.msg .avatar { width: 32px; height: 32px; font-size: 13px; }

.composer { padding: 16px; margin-top: 12px; }
.composer .row { flex-wrap: wrap; }
.composer .input { flex: 1; min-width: 0; }

/* ---------- Me ---------- */
.me-grid { display: grid; gap: 20px; }
@media (min-width: 960px) { .me-grid { grid-template-columns: 320px minmax(0,1fr); gap: 28px; align-items: start; } }
.account { padding: 20px; }
.account h2 { margin: 12px 0 0; font-size: 19px; }
.list { display: grid; gap: 8px; margin-bottom: 28px; }
.litem { padding: 14px 16px; display: flex; align-items: center; gap: 12px; transition: border-color .15s, transform .15s var(--ease); }
.litem:hover { border-color: color-mix(in srgb, var(--text) 20%, var(--line)); }
.litem:active { transform: scale(.99); }
.litem .grow { flex: 1; min-width: 0; }
.litem .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.litem svg.chev { width: 16px; height: 16px; color: var(--faint); flex: none; transition: transform .2s var(--ease); }
.litem:hover svg.chev { transform: translateX(3px); }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.36); display: grid; place-items: center; padding: 16px; animation: fade .2s ease both; }
.overlay.closing { animation: fade .18s ease reverse both; }
@keyframes fade { from { opacity: 0; } }
.dialog { width: 100%; max-width: 420px; background: var(--surface); border-radius: 20px; padding: 24px; box-shadow: var(--shadow-lift); animation: pop .28s var(--ease) both; max-height: calc(100vh - 32px); overflow-y: auto; }
.overlay.closing .dialog { animation: pop .18s ease reverse both; }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } }
.dialog h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.01em; }
.dialog .lead { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.dialog .head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog .x { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); flex: none; }
.dialog .x svg { width: 16px; height: 16px; }
.dialog .segmented { width: 100%; margin-bottom: 18px; }
.dialog .segmented button { flex: 1; }
.counter { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; text-align: right; }
.counter.warn { color: var(--ship); }
.counter.over { color: var(--danger); }
@media (max-width: 639px) {
  .overlay { place-items: end stretch; padding: 0; }
  .dialog { max-width: none; border-radius: 20px 20px 0 0; padding: 12px 20px calc(20px + env(safe-area-inset-bottom)); animation: sheet .32s var(--ease) both; max-height: 92vh; }
  .overlay.closing .dialog { animation: sheet .2s ease reverse both; }
  .dialog::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 4px; background: var(--line); margin: 0 auto 14px; }
}
@keyframes sheet { from { transform: translateY(100%); } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); top: calc(68px + env(safe-area-inset-top)); display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { background: var(--ink); color: var(--ink-text); padding: 10px 16px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow-lift); display: flex; align-items: center; gap: 8px; animation: toastIn .35s var(--ease) both; pointer-events: auto; }
.toast.out { animation: toastIn .25s ease reverse both; }
.toast svg { width: 16px; height: 16px; flex: none; }
.toast.error svg { color: #f87171; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.96); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.presence .hint { margin-top: 16px; display: grid; gap: 8px; }
.presence .hint p { margin: 0; font-size: 13px; color: var(--muted); }
