/* Quiet glass in the spirit of iOS: warm neutrals, ink for actions, one metal accent, serif titles. */
:root {
  color-scheme: light dark;
  --serif: ui-serif, "New York", Georgia, serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --text: #1b1a17;
  --text-2: #5c5850;
  --text-3: #6f6b62;
  --wall: #f6f4ef;
  --wall-a: #fffdf9;
  --wall-b: #efece4;
  --ink: #1c1b18;
  --on-ink: #f8f6f1;
  --bubble: #1c1b18;
  --on-bubble: #f8f6f1;
  --accent: #8f6f3a;
  --accent-text: #7a5c2b;
  --accent-soft: #ebe5d7;
  --warn: #7a5c2b;
  --danger: #9f2f22;
  --danger-soft: rgba(159, 47, 34, .09);
  --badge: #a8372a;
  --ok: #3f7a58;
  --fill: rgba(60, 52, 40, .07);
  --line: rgba(60, 52, 40, .15);
  --plain: rgba(255, 255, 255, .74);
  --seg: #fffdf9;
  --glass: linear-gradient(180deg, rgba(255, 255, 255, .74), rgba(255, 255, 255, .56));
  --glass-strong: linear-gradient(180deg, rgba(255, 254, 251, .96), rgba(252, 250, 246, .9));
  --glass-sheet: linear-gradient(180deg, rgba(251, 249, 245, .99), rgba(246, 244, 239, .985));
  --glass-edge: rgba(60, 52, 40, .1);
  --glass-shine: inset 0 .5px 0 rgba(255, 255, 255, .9);
  --shadow-1: 0 1px 2px rgba(40, 32, 20, .04), 0 8px 24px rgba(40, 32, 20, .06);
  --shadow-2: 0 2px 6px rgba(40, 32, 20, .05), 0 22px 52px rgba(40, 32, 20, .1);
  --scrim: rgba(28, 24, 18, .28);
  --saturate: saturate(130%);
  --app-h: 100dvh;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --text: #f3f0ea;
    --text-2: #bdb8ae;
    --text-3: #9d988e;
    --wall: #0d0c0b;
    --wall-a: #201d18;
    --wall-b: #0d0c0b;
    --ink: #f3f0ea;
    --on-ink: #171613;
    --bubble: #2d2a26;
    --on-bubble: #f3f0ea;
    --accent: #c9a870;
    --accent-text: #d6b884;
    --accent-soft: #29251e;
    --warn: #d6b884;
    --danger: #ec8d7f;
    --danger-soft: rgba(236, 141, 127, .14);
    --badge: #c4513f;
    --ok: #7fbf9a;
    --fill: rgba(255, 250, 240, .08);
    --line: rgba(255, 250, 240, .13);
    --plain: rgba(255, 250, 240, .06);
    --seg: rgba(255, 250, 240, .15);
    --glass: linear-gradient(180deg, rgba(255, 250, 240, .11), rgba(255, 250, 240, .05));
    --glass-strong: linear-gradient(180deg, rgba(44, 41, 37, .96), rgba(32, 30, 27, .94));
    --glass-sheet: linear-gradient(180deg, rgba(30, 28, 25, .99), rgba(20, 19, 17, .985));
    --glass-edge: rgba(255, 250, 240, .12);
    --glass-shine: inset 0 .5px 0 rgba(255, 250, 240, .14);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, .3), 0 24px 56px rgba(0, 0, 0, .5);
    --scrim: rgba(0, 0, 0, .55);
    --saturate: saturate(120%);
  }
}
@media (prefers-reduced-transparency: reduce) {
  :root { --glass: var(--wall); --glass-strong: var(--wall); --glass-sheet: var(--wall); }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  color: var(--text);
  font: 16px/1.42 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: -.006em;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(120vmax 62vmax at 50% -12%, var(--wall-a), transparent 72%),
    radial-gradient(110vmax 60vmax at 50% 112%, var(--wall-b), transparent 72%),
    var(--wall) fixed;
}
button, input, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
a { color: var(--text); text-decoration-color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Glass */
.glass, .sheet, dialog {
  background: var(--glass);
  -webkit-backdrop-filter: blur(26px) var(--saturate);
  backdrop-filter: blur(26px) var(--saturate);
  border: .5px solid var(--glass-edge);
  box-shadow: var(--glass-shine), var(--shadow-1);
}
.glass-strong { background: var(--glass-strong); box-shadow: var(--glass-shine), var(--shadow-2); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .sheet, dialog { background: var(--wall); }
}

/* A small dot means an agent. People get a plain circle with a letter. */
.avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 18px; }
.avatar.s { width: 22px; height: 22px; }
.avatar.m { width: 28px; height: 28px; font-size: 13px; }
.avatar.l { width: 34px; height: 34px; font-size: 15px; }
.person { background: var(--fill); color: var(--text-2); }
.dot::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.item .dot::before { width: 12px; height: 12px; }
.pill .avatar.dot { width: 14px; height: 14px; }
.agent-text .avatar.dot, .status .avatar.dot { width: 10px; height: 22px; }
.bubble-row .avatar.dot { width: 10px; height: 10px; margin-bottom: 16px; }
.link-row .avatar.dot { width: 20px; }
.c0 { --c: var(--accent); }
.c1 { --c: #c0694a; }
.c2 { --c: #5f9278; }
.c3 { --c: #8f6aa3; }
.c4 { --c: #bf6478; }
.c5 { --c: #4f8f9c; }
.c6 { --c: #b8933f; }
.c7 { --c: #6f6fb8; }
.breathing::before { animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.22); opacity: .55; } }

/* Stage */
#app { position: fixed; inset: 0; height: var(--app-h); }
.stage { position: absolute; inset: 0; }
.scroll {
  position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-t) + 78px) 16px calc(var(--safe-b) + var(--composer-h, 96px));
  /* Content fades out under the floating controls, so text never collides with them. */
  --fade: linear-gradient(to bottom,
    transparent calc(var(--safe-t) + 52px), #000 calc(var(--safe-t) + 84px),
    #000 calc(100% - var(--safe-b) - var(--composer-h, 96px) + 4px), transparent calc(100% - var(--safe-b) - var(--composer-h, 96px) + 26px));
  -webkit-mask-image: var(--fade);
  mask-image: var(--fade);
}
.column { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; min-height: 100%; }
.column.bottom > :first-child { margin-top: auto; }
.topbar { position: absolute; z-index: 5; top: calc(var(--safe-t) + 10px); left: 16px; right: 16px; }
.topbar-in { max-width: 720px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.round { position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; }
.pill { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 22px; font-size: 15px; font-weight: 500; min-width: 0; }
.pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill.wide { flex: 1; height: 52px; border-radius: 26px; padding: 0 18px; }
.pill .row-sub { font-weight: 400; font-size: 12.5px; line-height: 16px; }
.badge { position: absolute; top: -2px; right: -2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--badge); color: #fff; font-size: 11px; font-weight: 600; line-height: 17px; text-align: center; letter-spacing: 0; }

/* Messages */
.mine-bubble { align-self: flex-end; max-width: 78%; padding: 10px 15px; border-radius: 20px; background: var(--bubble); color: var(--on-bubble); white-space: pre-wrap; overflow-wrap: anywhere; }
.agent-text { display: flex; gap: 10px; padding-right: 8px; }
.agent-text .avatar { margin-top: 1px; }
.agent-text .text { min-width: 0; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.agent-text.cont { padding-left: 20px; margin-top: -6px; }
.stamp { align-self: center; font-size: 12px; letter-spacing: .01em; color: var(--text-3); margin-top: 10px; }
.note { align-self: center; max-width: 320px; text-align: center; font-size: 13px; line-height: 18px; color: var(--text-3); white-space: pre-wrap; }
.status { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--text-2); }
.fresh { animation: rise .5s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.mine-bubble.fresh, .bubble-row.right.fresh { transform-origin: 100% 100%; animation: sent .44s var(--ease); }
@keyframes sent { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.card.fresh { transform-origin: 50% 100%; animation: card-in .52s var(--ease); }
@keyframes card-in { from { opacity: 0; transform: translateY(12px) scale(.985); } }
.card { transition: height .26s ease, opacity .2s ease, transform .26s ease, padding .26s ease, margin .26s ease; }
.card.leaving { height: 0 !important; padding-block: 0; margin-block: -7px; opacity: 0; transform: scale(.96); overflow: hidden; }
.sending { opacity: .72; }

/* What the agent is doing right now */
.live { position: relative; display: flex; flex-direction: column; gap: 8px; }
.live-head { transition: opacity .2s; }
.live.drafting .live-head { display: none; }
.live-label {
  background: linear-gradient(100deg, var(--text-2) 30%, var(--text) 50%, var(--text-2) 70%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 2.8s linear infinite;
}
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
/* Not shown yet, but laid out at full width: lines are measured here before the first one appears. */
.live:not(.drafting) .draft { position: absolute; left: 0; right: 0; height: 0; overflow: hidden; visibility: hidden; }
.steps { list-style: none; margin: 0 0 0 4px; padding: 0 0 0 12px; border-left: 1px solid var(--line); display: flex; flex-direction: column; justify-content: flex-end; gap: 5px; font-size: 13.5px; line-height: 18px; color: var(--text-2); }
.steps:empty { display: none; }
.live .steps { max-height: 118px; overflow: hidden; }
.live .steps.many { --steps-fade: linear-gradient(to bottom, transparent, #000 26px); -webkit-mask-image: var(--steps-fade); mask-image: var(--steps-fade); }
.step { display: flex; align-items: flex-start; gap: 7px; min-width: 0; flex: none; }
.step .ico { width: 15px; height: 15px; margin-top: 1.5px; stroke-width: 2; opacity: .75; }
.step span, .step code { min-width: 0; overflow-wrap: anywhere; }
.step code { font: 12.5px/18px ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live .step span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.steps.done .step code { white-space: pre-wrap; overflow-wrap: anywhere; }
.live .step:last-child { color: var(--text); }
.step.enter { animation: step-in .4s var(--ease); }
@keyframes step-in { from { opacity: 0; transform: translateY(8px); } }

/* Agent text */
.word-hidden { visibility: hidden; }
.md.revealing { overflow: hidden; }
.md h3, .md h4, .md h5, .md h6 { margin: 0; }
.md strong { font-weight: 600; }
.md h3 { font-family: var(--serif); font-size: 21px; line-height: 27px; font-weight: 500; letter-spacing: -.012em; }
.md h4 { font-size: 17px; line-height: 24px; font-weight: 600; }
.md h5, .md h6 { font-size: 15px; line-height: 22px; font-weight: 600; }
.md code { padding: .08em .34em; border-radius: 6px; background: var(--fill); font: .875em/1 ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0; }
.md pre { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--fill); overflow-x: auto; white-space: pre; font-size: 14px; line-height: 20px; }
.md pre code { display: block; padding: 0; border-radius: 0; background: none; font-size: 13px; line-height: 20px; }
.md ul, .md ol { display: flex; flex-direction: column; gap: .3em; margin: 0; padding: 0; list-style: none; }
.md li { display: flex; gap: 8px; }
.md-mark { flex: none; min-width: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.md-item { flex: 1; min-width: 0; }
.md blockquote { margin: 0; padding: 1px 0 1px 13px; border-left: 1px solid var(--accent); color: var(--text-2); }
.md hr { height: 0; margin: 0; border: 0; border-top: .5px solid var(--line); }
.md-table { overflow-x: auto; }
.md table { border-collapse: collapse; font-size: 14px; line-height: 20px; }
.md th, .md td { padding: 6px 12px 6px 0; border-bottom: .5px solid var(--line); text-align: left; white-space: normal; vertical-align: top; }
.md th { font-weight: 600; }
.md .md-right { text-align: right; }
.md .md-center { text-align: center; }
.md tr > :last-child { padding-right: 0; }
.md-host { color: var(--text-3); font-size: .85em; }
/* After the element rules above, which reset margins. */
.md > :not(:first-child) { margin-top: .7em; }
.md > :not(:first-child):is(h3, h4, h5, h6) { margin-top: 1.1em; }
.md-item > :not(:first-child) { margin-top: .4em; }
.md blockquote > :not(:first-child) { margin-top: .5em; }

/* How the agent worked, folded away afterwards */
.activity { align-self: flex-start; max-width: 100%; }
.activity-toggle { display: flex; align-items: center; gap: 5px; min-height: 32px; padding: 2px 8px 2px 2px; border-radius: 12px; font-size: 13px; color: var(--text-3); text-align: left; }
.activity-chev { width: 13px; height: 13px; stroke-width: 2.6; transition: transform .24s cubic-bezier(.2, .9, .3, 1); }
.activity.open .activity-chev { transform: rotate(90deg); }
.activity-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .28s cubic-bezier(.2, .9, .3, 1); }
.activity.open .activity-body { grid-template-rows: 1fr; }
.activity-body .steps { min-height: 0; overflow: hidden; visibility: hidden; transition: visibility .28s, margin .28s; }
.activity.open .activity-body .steps { visibility: visible; margin-top: 4px; margin-bottom: 4px; }

/* Screens slide when the browser supports it */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .3s; animation-timing-function: cubic-bezier(.2, .9, .25, 1); mix-blend-mode: normal; }
html[data-nav="forward"]::view-transition-new(root) { animation-name: nav-in-right; }
html[data-nav="forward"]::view-transition-old(root) { animation-name: nav-out-left; }
html[data-nav="back"]::view-transition-new(root) { animation-name: nav-in-left; z-index: 0; }
html[data-nav="back"]::view-transition-old(root) { animation-name: nav-out-right; z-index: 1; }
@keyframes nav-in-right { from { transform: translateX(100%); } }
@keyframes nav-out-left { to { transform: translateX(-24%); opacity: .55; } }
@keyframes nav-in-left { from { transform: translateX(-24%); opacity: .55; } }
@keyframes nav-out-right { to { transform: translateX(100%); } }

/* Pictures in the chat */
/* Cached images are reattached on render: an entrance animation here would replay on every click. */
.chat-image { display: block; width: fit-content; max-width: min(100%, 440px); margin: 8px 0; border-radius: 18px; overflow: hidden; cursor: zoom-in; box-shadow: var(--shadow-1); }
.chat-image img { display: block; max-width: 100%; max-height: 60vh; width: auto; height: auto; transition: opacity .28s ease; }
.chat-image.loading { width: min(100%, 320px); height: 220px; background: var(--fill); box-shadow: none; }
.chat-image.loading img { opacity: 0; }
.viewer { position: fixed; z-index: 40; inset: 0; display: grid; place-items: center; padding: calc(var(--safe-t) + 12px) 12px calc(var(--safe-b) + 12px); background: rgba(0, 0, 0, .9); touch-action: pinch-zoom; animation: fade .2s ease; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; animation: viewer-in .28s cubic-bezier(.2, .9, .3, 1); }
.viewer.leaving { animation: fade-out .18s ease forwards; }
@keyframes viewer-in { from { transform: scale(.94); } }
.viewer-bar { position: absolute; top: calc(var(--safe-t) + 12px); right: 16px; display: flex; gap: 10px; color: #fff; }
.viewer-bar a { color: inherit; }

/* Touch feedback */
.btn, .round, .chip, .item, .link-row, .activity-toggle, .text-btn, .big, .icon-btn { transition: transform .2s var(--ease), background-color .2s, opacity .2s; }
.btn:active, .round:active, .chip:active, .link-row:active, .send.ready:active, .big:active, .icon-btn:active { transform: scale(.975); }
.item:active, .activity-toggle:active { transform: scale(.992); }

.link-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 8px 14px 8px 12px; border-radius: 20px; text-align: left; }
.grow { flex: 1; min-width: 0; }
.row-title { font-size: 15px; font-weight: 500; line-height: 20px; }
.row-sub { font-size: 13px; line-height: 17px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { width: 15px; height: 15px; color: var(--text-3); stroke-width: 1.8; }

.card { padding: 20px; border-radius: 24px; }
.card-label { font-size: 11px; font-weight: 600; line-height: 16px; letter-spacing: .09em; text-transform: uppercase; color: var(--warn); }
.card-title { font-family: var(--serif); font-size: 22px; font-weight: 500; line-height: 28px; letter-spacing: -.012em; margin-top: 8px; overflow-wrap: anywhere; }
.card-sub { font-size: 15px; line-height: 21px; color: var(--text-2); margin-top: 4px; overflow-wrap: anywhere; }
.card-quote { font-size: 15px; line-height: 22px; margin-top: 14px; padding: 1px 0 1px 13px; border-left: 1px solid var(--accent); white-space: pre-wrap; overflow-wrap: anywhere; }
.card-why { font-size: 13px; line-height: 18px; color: var(--text-3); margin-top: 12px; }
.card-why::first-letter, .card-sub::first-letter { text-transform: uppercase; }
.actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.btn { flex: 1 1 120px; min-height: 44px; padding: 0 8px; border-radius: 22px; font-size: 15px; font-weight: 500; white-space: nowrap; box-shadow: inset 0 0 0 1px var(--line); }
.btn.primary { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.btn.danger { background: var(--danger-soft); color: var(--danger); box-shadow: none; }
.btn.tiny { flex: 0 0 auto; min-height: 44px; font-size: 15px; padding: 0 16px; }

.bubble-row { display: flex; gap: 8px; align-items: flex-end; }
.bubble-row.right { flex-direction: row-reverse; }
.bubble { max-width: 76%; padding: 10px 15px; border-radius: 20px; background: var(--plain); box-shadow: inset 0 0 0 .5px var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.own-agent { background: var(--accent-soft); box-shadow: none; }
.bubble.me { background: var(--bubble); color: var(--on-bubble); box-shadow: none; }
.meeting { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: .5px solid var(--line); color: var(--text); }
.tile { flex: none; width: 44px; text-align: center; color: var(--text); }
.tile b { display: block; color: var(--accent-text); font-size: 10px; font-weight: 600; letter-spacing: .08em; line-height: 14px; }
.tile span { font-family: var(--serif); font-size: 24px; font-weight: 500; line-height: 28px; }

/* Composer */
.composer { position: absolute; z-index: 5; left: 14px; right: 14px; bottom: calc(var(--safe-b) + 14px); }
.composer-in { max-width: 720px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px; }
.attach { width: 52px; height: 52px; }
.field { flex: 1; min-width: 0; display: flex; align-items: flex-end; min-height: 52px; padding: 6px 6px 6px 18px; border-radius: 26px; }
.field textarea { flex: 1; min-width: 0; height: 40px; max-height: 150px; padding: 8px 8px 8px 0; border: 0; outline: 0; background: none; resize: none; font-size: 16px; line-height: 24px; }
.field textarea::placeholder { color: var(--text-3); }
.send { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--on-ink); }
.send { transition: background-color .2s, color .2s, transform .2s var(--ease); }
.send:not(.ready) { background: var(--fill); color: var(--text-3); transform: scale(.92); }
.send .ico { width: 18px; height: 18px; stroke-width: 2; }
.observer { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 6px 6px 6px 18px; border-radius: 28px; font-size: 14px; line-height: 19px; color: var(--text-2); max-width: 720px; margin: 0 auto; }
.observer .btn { flex: none; }

/* Empty main chat */
.hello { margin: auto 0; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 12px; }
.hello h1 { font-family: var(--serif); font-size: 32px; line-height: 38px; font-weight: 500; letter-spacing: -.018em; }
.hello p { color: var(--text-2); max-width: 320px; }
.hello .dot::before, .welcome .dot::before { width: 14px; height: 14px; }
.hello .avatar, .welcome .avatar { width: 14px; height: 14px; }
.chips { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 340px; margin-top: 6px; }
.chip { min-height: 46px; padding: 8px 18px; border-radius: 23px; font-size: 15px; box-shadow: none; }

/* Sheets */
.scrim { position: absolute; inset: 0; z-index: 10; background: var(--scrim); }
.scrim.enter { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; } }
.scrim.leaving { animation: fade-out .2s ease forwards; }
@keyframes fade-out { to { opacity: 0; } }
.sheet {
  position: absolute; z-index: 11; left: 0; right: 0; bottom: 0; top: calc(var(--safe-t) + 22px);
  display: flex; flex-direction: column; border-radius: 28px 28px 0 0; background: var(--glass-sheet);
  box-shadow: var(--glass-shine), 0 -10px 40px rgba(28, 22, 12, .14);
  -webkit-backdrop-filter: blur(40px) var(--saturate); backdrop-filter: blur(40px) var(--saturate);
}
.sheet.enter { animation: slide-up .46s var(--ease); }
@keyframes slide-up { from { transform: translateY(46px); opacity: 0; } }
.sheet.leaving { animation: slide-down .2s cubic-bezier(.4, 0, .8, .4) forwards; }
@keyframes slide-down { to { transform: translateY(70px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 18px 20px 4px; }
.sheet-head h1 { flex: 1; min-width: 0; font-family: var(--serif); font-size: 30px; line-height: 36px; font-weight: 500; letter-spacing: -.018em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-sub { padding: 0 20px; font-size: 15px; line-height: 21px; color: var(--text-2); overflow-wrap: anywhere; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 20px calc(var(--safe-b) + 24px); }
.icon-btn { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); }
.segments { display: flex; padding: 3px; border-radius: 22px; background: var(--fill); }
.segments button { flex: 1; min-height: 36px; border-radius: 18px; font-size: 14px; color: var(--text-2); padding: 0 4px; }
.segments button[aria-pressed="true"] { background: var(--seg); color: var(--text); font-weight: 500; box-shadow: 0 1px 3px rgba(30, 24, 14, .12); }
.group-title { margin: 24px 2px 8px; font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); }
.group-title.warn { color: var(--warn); }
.group { border-radius: 20px; background: var(--plain); box-shadow: inset 0 0 0 .5px var(--line); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 68px; padding: 10px 14px; text-align: left; position: relative; }
.item + .item::before { content: ""; position: absolute; top: 0; left: 70px; right: 0; height: .5px; background: var(--line); }
.item.small { min-height: 52px; }
a.item { color: inherit; text-decoration: none; }
.item.small + .item.small::before { left: 14px; }
.item-name { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.item-name b { font-weight: 500; white-space: nowrap; }
.item-name span { font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-preview { font-size: 14px; line-height: 19px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-preview.warn { color: var(--warn); }
.count { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--badge); color: #fff; font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; letter-spacing: 0; }
.trail { flex: none; font-size: 13px; color: var(--text-3); }
.trail.live { color: var(--accent-text); font-weight: 500; }
.empty { padding: 44px 16px; text-align: center; color: var(--text-2); }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 520px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.form-grid .wide { grid-column: 1 / -1; }
.input-label { display: block; font-size: 13px; color: var(--text-2); }
.input-label input, .input-label textarea { display: block; width: 100%; margin-top: 6px; min-height: 44px; min-width: 0; padding: 10px 14px; border: 0; border-radius: 14px; background: var(--fill); font-size: 16px; color: var(--text); outline-offset: 0; }
.input-label textarea { min-height: 110px; resize: none; }
.upload { position: relative; overflow: hidden; display: grid; place-items: center; }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.upload:focus-within { outline: 2px solid var(--accent-text); outline-offset: 2px; }

/* Menu */
.menu-layer { position: absolute; inset: 0; z-index: 8; }
.menu { position: absolute; top: calc(var(--safe-t) + 64px); right: 16px; width: 240px; border-radius: 20px; overflow: hidden; background: var(--glass-strong); box-shadow: var(--glass-shine), var(--shadow-2); transform-origin: top right; animation: pop .28s var(--ease); }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }
.menu button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 0 16px; text-align: left; position: relative; }
.menu button + button::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--line); }
.menu .usage { padding: 10px 16px 12px; font-size: 13px; line-height: 18px; color: var(--text-2); border-bottom: .5px solid var(--line); }

/* Welcome */
.welcome { position: absolute; inset: 0; overflow-y: auto; padding: calc(var(--safe-t) + 40px) 20px calc(var(--safe-b) + 24px); display: flex; }
.welcome-in { width: 100%; max-width: 400px; margin: auto; display: flex; flex-direction: column; align-items: center; min-height: 100%; }
.wordmark { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-size: 19px; letter-spacing: -.005em; }
.welcome h1 { margin-top: 40px; font-family: var(--serif); font-size: 38px; line-height: 44px; font-weight: 500; letter-spacing: -.022em; text-align: center; }
.welcome p { margin-top: 12px; max-width: 310px; font-size: 16px; line-height: 23px; color: var(--text-2); text-align: center; }
.welcome form { width: 100%; display: flex; flex-direction: column; flex: 1; margin-top: 32px; }
.fields { border-radius: 20px; overflow: hidden; }
.fields label { display: flex; align-items: center; min-height: 52px; padding: 0 16px; font-size: 16px; position: relative; }
.fields label + label::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--line); }
.fields label > span { flex: none; width: 92px; color: var(--text-2); }
.fields .at { width: auto; }
.fields input { flex: 1; min-width: 0; height: 50px; border: 0; outline: 0; background: none; font-size: 16px; }
.fields input::placeholder { color: var(--text-3); }
.fields label:focus-within { box-shadow: inset 0 0 0 1.5px var(--accent); }
.auth-error { margin: 12px 4px 0; font-size: 14px; color: var(--danger); text-align: center; }
.welcome-actions { margin-top: auto; padding-top: 24px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.big { width: 100%; height: 54px; border-radius: 27px; background: var(--ink); color: var(--on-ink); font-size: 16px; font-weight: 500; box-shadow: var(--shadow-1); }
.text-btn { min-height: 44px; padding: 0 16px; color: var(--text-2); }

/* Dialog */
dialog { width: calc(100% - 32px); max-width: 440px; padding: 22px; border-radius: 24px; color: var(--text); background: var(--glass-strong); box-shadow: var(--glass-shine), var(--shadow-2); }
dialog::backdrop { background: var(--scrim); }
dialog h2 { font-family: var(--serif); font-size: 22px; line-height: 28px; font-weight: 500; letter-spacing: -.012em; margin-bottom: 16px; }
dialog .input-label + .input-label { margin-top: 12px; }

.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(var(--safe-b) + 84px); transform: translateX(-50%); max-width: calc(100% - 40px); padding: 10px 16px; border-radius: 20px; font-size: 14px; background: var(--text); color: var(--wall); animation: rise .25s ease; }

@media (min-width: 760px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: 560px; height: min(760px, calc(100% - 64px)); transform: translate(-50%, -50%); border-radius: 28px; box-shadow: var(--glass-shine), var(--shadow-2); }
  .sheet.enter { animation: sheet-in .28s cubic-bezier(.2, .9, .25, 1); }
  @keyframes sheet-in { from { transform: translate(-50%, -47%); opacity: 0; } }
  .sheet.leaving { animation: sheet-out .18s ease-in forwards; }
  @keyframes sheet-out { to { transform: translate(-50%, -47%); opacity: 0; } }
}
@media (hover: hover) {
  .item:hover, .menu button:hover { background: var(--fill); }
  .btn:hover, .icon-btn:hover, .big:hover { opacity: .86; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; transition: none !important; }
}
