/* uponu companion. Light is the default palette; dark comes from the OS or the setting. No gradients. */
:root {
  --bg: #f6f6f7;
  --surface: #ffffff;
  --surface-2: #efeff1;
  --surface-3: #e6e6e9;
  --text: #1c1c1e;
  --muted: #6e6e73;
  --faint: #a1a1a6;
  --line: #e3e3e6;
  --brand: #B4100E;
  --brand-ink: #ffffff;
  --brand-soft: rgba(180, 16, 14, .09);
  --user-bg: #1c1c1e;
  --user-ink: #ffffff;
  --ok: #1f8a4c;
  --warn: #b26a00;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.08);
  --radius: 18px;
  --avatar-color: #B4100E;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e10; --surface: #17171a; --surface-2: #1f1f23; --surface-3: #2a2a2f; --text: #f2f2f4;
    --muted: #9a9aa2; --faint: #6c6c73; --line: #2c2c31; --brand: #e5362f; --brand-soft: rgba(229, 54, 47, .14);
    --user-bg: #f2f2f4; --user-ink: #111113; --avatar-color: #ef3e36;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e10; --surface: #17171a; --surface-2: #1f1f23; --surface-3: #2a2a2f; --text: #f2f2f4;
  --muted: #9a9aa2; --faint: #6c6c73; --line: #2c2c31; --brand: #e5362f; --brand-soft: rgba(229, 54, 47, .14);
  --user-bg: #f2f2f4; --user-ink: #111113; --avatar-color: #ef3e36;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45); color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px;
  line-height: 1.5; -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
a { color: var(--brand); }
[hidden] { display: none !important; }
::selection { background: var(--brand-soft); }

/* styled scrollbars, everywhere */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: padding-box; }

.app { position: fixed; inset: 0; display: flex; flex-direction: column; }
.app.booting .main, .app.booting .dock, .app.booting .topbar { opacity: 0; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(var(--safe-t) + 6px) 10px 6px; flex: 0 0 auto; transition: opacity .3s;
}
.topbar-right { display: flex; gap: 2px; }
.brand { display: flex; align-items: center; gap: 9px; }
.wordmark { height: 22px; width: auto; display: block; }
.wordmark .wm-u { fill: var(--brand); }
.wordmark .wm-ink { fill: var(--text); }
.brand-sub { font-size: 16px; font-weight: 500; color: var(--muted); letter-spacing: -.01em; padding-top: 3px; }
.icon-btn {
  position: relative; width: 42px; height: 42px; border: 0; background: transparent; border-radius: 12px;
  display: inline-grid; place-items: center; cursor: pointer; color: var(--text);
}
.icon-btn svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active { background: var(--surface-2); }
@media (hover: hover) { .icon-btn:hover { background: var(--surface-2); } }
.badge {
  position: absolute; top: 6px; right: 5px; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--brand); color: var(--brand-ink); font-size: 11px; font-weight: 600; line-height: 17px; text-align: center;
}

/* ---------------------------------------------------------------- install banner */
.install {
  display: flex; align-items: center; gap: 10px; margin: 4px 12px 0; padding: 8px 6px 8px 12px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(0,0,0,.04); animation: rise .3s ease-out;
}
.install-u { width: 26px; height: 26px; flex: 0 0 auto; fill: var(--brand-ink); background: var(--brand); border-radius: 7px; padding: 4px; }
.install-text { flex: 1; font-size: 14.5px; font-weight: 500; }
.install .icon-btn { width: 34px; height: 34px; }
.install .icon-btn svg { width: 18px; height: 18px; }
.steps { margin: 6px 0 4px; padding-left: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: 15px; }
.steps li:last-child { border-bottom: 0; }
.steps li::before { content: counter(s); flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--brand); color: var(--brand-ink);
                    display: grid; place-items: center; font-size: 13px; font-weight: 600; }
.steps svg { width: 18px; height: 18px; vertical-align: -3px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- stage + thread */
.main { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column;
        transition: opacity .3s; scroll-behavior: smooth; overscroll-behavior: contain; }
.stage {
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 16px 4px;
  flex: 1 0 auto; min-height: 46vh; transition: min-height .45s cubic-bezier(.2,.8,.2,1);
}
.app.has-thread .stage {
  flex: 0 0 auto; min-height: 0; position: sticky; top: -1px; z-index: 3; padding: 3px 16px 6px;
  background: var(--bg); box-shadow: 0 10px 12px -12px rgba(0,0,0,.12);
}
.avatar-wrap {
  position: relative; border: 0; background: transparent; padding: 0; cursor: pointer; border-radius: 50%;
  width: min(74vw, 350px); height: min(74vw, 350px); transition: width .45s cubic-bezier(.2,.8,.2,1), height .45s cubic-bezier(.2,.8,.2,1);
}
.app.has-thread .avatar-wrap { width: 118px; height: 118px; }
.halo {
  --lvl: 0; position: absolute; inset: 14%; border-radius: 50%; background: var(--brand-soft);
  transform: scale(calc(.82 + var(--lvl) * .55)); opacity: calc(.0 + var(--lvl) * 1.4); transition: transform .08s linear, opacity .2s;
}
.avatar { position: absolute; inset: 0; display: block; }
.avatar svg { width: 100%; height: 100%; display: block; overflow: visible; }
.avatar .m { --r: var(--avatar-color); }
.greeting { font-size: 21px; font-weight: 600; letter-spacing: -.015em; margin-top: 2px; text-align: center; }
.app.has-thread .greeting { display: none; }
.status { min-height: 22px; font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.status .spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface-3); border-top-color: var(--brand); animation: spin .8s linear infinite; }
.status .chip { background: var(--surface-2); border-radius: 999px; padding: 1px 9px; font-size: 13px; color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }

.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 6px 16px 14px; }
.app.has-thread .suggestions { display: none; }
.suggestion {
  border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px;
  padding: 8px 14px; font-size: 14.5px; cursor: pointer; box-shadow: 0 1px 1px rgba(0,0,0,.03);
}
.suggestion:active { background: var(--surface-2); }

.thread { padding: 6px 14px 18px; display: flex; flex-direction: column; gap: 14px; max-width: 760px; width: 100%; margin: 0 auto; }
.app:not(.has-thread) .thread { display: none; }
.msg { display: flex; flex-direction: column; gap: 6px; max-width: 100%; animation: rise .25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.user { align-items: flex-end; }
.msg.user .bubble {
  background: var(--user-bg); color: var(--user-ink); padding: 9px 14px; border-radius: 20px 20px 6px 20px;
  max-width: 84%; white-space: pre-wrap; word-wrap: break-word; font-size: 15.5px;
}
.msg.user .bubble .voice-tag { opacity: .6; font-size: 12px; margin-right: 6px; }
.msg.assistant .body { font-size: 15.5px; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.assistant .body > :first-child { margin-top: 0; }
.msg.assistant .body > :last-child { margin-bottom: 0; }
.msg .tools { display: flex; flex-wrap: wrap; gap: 5px; }
.msg .tools span { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 1px 8px; }
.msg .meta { font-size: 12px; color: var(--faint); }
.msg.error .body { color: var(--brand); }
.typing-dots { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: dot 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .15s; } .typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

/* markdown */
.body p { margin: 0 0 10px; }
.body h3, .body h4, .body h5 { margin: 14px 0 6px; line-height: 1.3; letter-spacing: -.01em; }
.body h3 { font-size: 17.5px; } .body h4 { font-size: 16px; } .body h5 { font-size: 15px; }
.body ul, .body ol { margin: 4px 0 10px; padding-left: 22px; }
.body li { margin: 2px 0; }
.body li::marker { color: var(--muted); }
.body code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; }
.body pre { background: var(--surface-2); padding: 10px 12px; border-radius: 12px; overflow-x: auto; margin: 6px 0 10px; }
.body pre code { background: none; padding: 0; font-size: 13px; }
.body blockquote { margin: 6px 0 10px; padding: 2px 0 2px 12px; border-left: 3px solid var(--brand); color: var(--muted); }
.body hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.body a { word-break: break-word; }
.table-wrap { overflow-x: auto; margin: 6px 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.body table { border-collapse: collapse; font-size: 14px; min-width: 100%; }
.body th, .body td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
.body td { white-space: normal; min-width: 90px; }
.body th { background: var(--surface-2); font-weight: 600; font-size: 13px; }
.body tr:last-child td { border-bottom: 0; }
.md-img { display: block; max-width: 100%; border-radius: 14px; margin: 6px 0; cursor: zoom-in; background: var(--surface-2); }

/* attachments + files */
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.thumbs img { width: 76px; height: 76px; object-fit: cover; border-radius: 12px; cursor: zoom-in; background: var(--surface-2); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.gallery figure { margin: 0; position: relative; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; cursor: zoom-in; background: var(--surface-2); display: block; }
.gallery .dl { position: absolute; right: 6px; bottom: 6px; }
.file-card {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); text-decoration: none; color: var(--text); max-width: 420px;
}
.file-card .ficon { width: 38px; height: 44px; border-radius: 8px; display: grid; place-items: center; font-size: 10.5px; font-weight: 700;
                    color: #fff; background: #6e6e73; flex: 0 0 auto; letter-spacing: .02em; }
.file-card .ficon.pdf { background: #c8322b; } .file-card .ficon.doc { background: #2b5bb5; }
.file-card .ficon.xls { background: #1f7a45; } .file-card .ficon.ppt { background: #c1581f; }
.file-card .ficon.img { background: #7a4fc0; } .file-card .ficon.txt { background: #55555b; }
.file-card .fname { font-size: 14.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card .fmeta { font-size: 12.5px; color: var(--muted); }
.file-card .ftext { min-width: 0; flex: 1; }
.file-card .fdl { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); flex: 0 0 auto; }
.file-card .fdl svg, .dl svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dl { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(0,0,0,.55); color: #fff; }
.files { display: flex; flex-direction: column; gap: 8px; }

/* ---------------------------------------------------------------- dock */
.dock { flex: 0 0 auto; padding: 6px 10px calc(var(--safe-b) + 10px); background: var(--bg); transition: opacity .3s; }
.attachments { display: flex; gap: 8px; overflow-x: auto; padding: 2px 4px 8px; }
.attachments:empty { display: none; }
.att { position: relative; flex: 0 0 auto; width: 64px; height: 64px; border-radius: 12px; background: var(--surface-2);
       display: grid; place-items: center; overflow: hidden; font-size: 11px; color: var(--muted); text-align: center; }
.att img { width: 100%; height: 100%; object-fit: cover; }
.att .x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6);
          color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.att .x svg { width: 12px; height: 12px; stroke: #fff; stroke-width: 2.4; fill: none; }
.att.busy::after { content: ""; position: absolute; inset: 0; background: rgba(255,255,255,.55); }
.att .fx { padding: 4px; word-break: break-all; line-height: 1.15; }
.composer {
  display: flex; align-items: flex-end; gap: 4px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 26px; padding: 5px 5px 5px 4px; box-shadow: var(--shadow); max-width: 760px; margin: 0 auto;
}
.field { flex: 1; min-width: 0; position: relative; align-self: center; }
.field textarea {
  width: 100%; resize: none; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit;
  font-size: 16px; line-height: 22px; max-height: 132px; padding: 9px 6px; display: block;
}
.field textarea::placeholder { color: var(--faint); }
.rec-meter { position: absolute; inset: 0; display: flex; align-items: center; gap: 9px; padding: 0 6px; color: var(--text); font-variant-numeric: tabular-nums; background: var(--surface); }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.rec-bars { display: flex; align-items: center; gap: 2px; height: 24px; flex: 1; overflow: hidden; }
.rec-bars i { width: 3px; border-radius: 2px; background: var(--brand); opacity: .75; }
.round {
  width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; flex: 0 0 auto;
  background: var(--brand); color: var(--brand-ink); transition: transform .15s, background .2s;
}
.round svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.round:active { transform: scale(.93); }
.mic .i-stop, .mic .i-send { display: none; }
.mic.recording { animation: recpulse 1.4s infinite; }
.mic.recording .i-mic { display: none; } .mic.recording .i-send { display: block; }
.mic.busy { background: var(--text); color: var(--bg); }
.mic.busy .i-mic { display: none; } .mic.busy .i-stop { display: block; }
.mic.busy .i-stop rect { fill: currentColor; stroke: none; }
@keyframes recpulse { 0% { box-shadow: 0 0 0 0 var(--brand-soft); } 70% { box-shadow: 0 0 0 12px rgba(0,0,0,0); } 100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); } }
.composer.recording #btn-camera, .composer.recording #btn-attach { display: none; }

/* ---------------------------------------------------------------- sheets */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.36); z-index: 20; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; background: var(--surface); border-radius: 22px 22px 0 0;
  max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 -10px 40px rgba(0,0,0,.2);
  padding-bottom: var(--safe-b); animation: slideup .28s cubic-bezier(.2,.8,.2,1); max-width: 640px; margin: 0 auto;
}
@keyframes slideup { from { transform: translateY(100%); } }
.sheet-grip { width: 38px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 8px auto 0; }
.sheet-head { display: flex; align-items: center; gap: 4px; padding: 4px 8px 6px 16px; }
.sheet-head h2 { flex: 1; margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.sheet-head #sheet-back:not([hidden]) + h2 { margin-left: -4px; }
.sheet-body { overflow-y: auto; padding: 4px 16px 22px; overscroll-behavior: contain; }
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); min-height: 52px;
  background: transparent; border-left: 0; border-right: 0; border-top: 0; text-align: left; width: 100%; cursor: pointer; color: var(--text);
}
.row:last-child { border-bottom: 0; }
.row .ricon { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; flex: 0 0 auto; }
.row .ricon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.row .rtext { flex: 1; min-width: 0; }
.row .rtitle { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .rsub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.row .chev { color: var(--faint); }
.row.danger .rtitle { color: var(--brand); }
.row.static { cursor: default; }
.who { padding: 6px 4px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.who .n { font-weight: 600; font-size: 16px; } .who .e { color: var(--muted); font-size: 13.5px; }
.who .acc { display: inline-block; margin-top: 6px; font-size: 12px; border-radius: 999px; padding: 1px 9px; background: var(--surface-2); color: var(--muted); }
.section-label { font-size: 12.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 18px 4px 4px; }
.empty { color: var(--muted); padding: 18px 4px; font-size: 14.5px; }
.hint { color: var(--muted); font-size: 13px; padding: 2px 4px 8px; }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 7px 6px; font-size: 14px; cursor: pointer; color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }
.switch { position: relative; width: 50px; height: 30px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 15px; background: var(--surface-3); transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.voice { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.voice:last-child { border-bottom: 0; }
.voice .vplay { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: 0 0 auto; }
.voice .vplay svg { width: 15px; height: 15px; fill: currentColor; }
.voice .vplay.playing { border-color: var(--brand); color: var(--brand); }
.voice label { flex: 1; display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-size: 15.5px; }
.voice input { accent-color: var(--brand); width: 20px; height: 20px; }
.voice .vtag { font-size: 12px; color: var(--muted); margin-left: 6px; }
.task { padding: 12px 4px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; }
.task:last-child { border-bottom: 0; }
.task .tbody { flex: 1; min-width: 0; }
.task .btn { align-self: flex-start; }
.task .ttitle { font-weight: 600; font-size: 15px; }
.task .tsub { font-size: 13px; color: var(--muted); }
.task .tres { font-size: 13.5px; margin-top: 4px; }
.pill { display: inline-block; font-size: 11.5px; border-radius: 999px; padding: 0 8px; margin-left: 6px; vertical-align: 2px; background: var(--surface-2); color: var(--muted); font-weight: 500; }
.pill.active { background: rgba(31,138,76,.13); color: var(--ok); }
.pill.done { background: var(--brand-soft); color: var(--brand); }
.note { padding: 12px 4px; border-bottom: 1px solid var(--line); }
.note.unread .ntitle::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-right: 7px; vertical-align: 1px; }
.note .ntitle { font-weight: 600; font-size: 15px; }
.note .nbody { font-size: 14px; margin-top: 2px; }
.note .ntime { font-size: 12px; color: var(--faint); margin-top: 3px; }
.mem { display: flex; gap: 10px; align-items: flex-start; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.mem .mn { color: var(--faint); font-variant-numeric: tabular-nums; min-width: 20px; }
.mem .mt { flex: 1; font-size: 14.5px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); border-radius: 12px; padding: 10px 16px; font-size: 15px; font-weight: 500; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--brand); }
.btn.small { padding: 5px 11px; font-size: 13.5px; border-radius: 10px; }
.btn.wide { width: 100%; padding: 13px 16px; font-size: 16px; }
.btn:active { transform: scale(.98); }
.btn-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.btn-row.top { margin-top: 0; margin-bottom: 4px; }
.btn-row.tight { margin: 4px 0 0; }
.hint.foot { margin-top: 22px; }
.file-card.flat { flex: 1; border: 0; padding: 0; background: transparent; }

/* ---------------------------------------------------------------- viewer, login, toast */
.viewer { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.92); display: flex; flex-direction: column;
          align-items: center; justify-content: center; padding: calc(var(--safe-t) + 12px) 12px calc(var(--safe-b) + 12px); animation: fade .2s; }
.viewer img { max-width: 100%; max-height: calc(100% - 70px); object-fit: contain; border-radius: 8px; }
.viewer-bar { display: flex; gap: 10px; margin-top: 14px; }
.viewer .btn { background: rgba(255,255,255,.12); border-color: transparent; color: #fff; }
.login { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.login-avatar { position: relative; width: 190px; height: 190px; }
.login h1 { font-size: 24px; letter-spacing: -.02em; margin: 0; font-weight: 600; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 92px); transform: translateX(-50%); z-index: 50; background: var(--text);
  color: var(--bg); padding: 10px 16px; border-radius: 14px; font-size: 14.5px; box-shadow: var(--shadow); max-width: 88vw; animation: fade .2s;
}
body.plain { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.plain-msg { max-width: 420px; text-align: center; }
.plain-msg h1 { font-size: 22px; font-weight: 600; }

@media (min-width: 900px) {
  .avatar-wrap { width: 320px; height: 320px; }
  .app.has-thread .avatar-wrap { width: 132px; height: 132px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
