/* Assistent web app – design system v3 (2026-11-03) */
@font-face { font-family: "InterVar"; src: url("/fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "InterVar"; src: url("/fonts/inter-ext.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --accent: #4f46e5;
  --accent-2: #2563eb;
  --accent-soft: rgba(79, 70, 229, .1);
  --grad: linear-gradient(135deg, #5b50f0 0%, #3b6cf6 100%);
  --bg: #f5f6fb;
  --chat-bg: #eef0f8;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --glass: rgba(255, 255, 255, .82);
  --text: #0f172a;
  --muted: #667085;
  --faint: #98a2b3;
  --border: #e4e7f0;
  --me: var(--grad);
  --me-text: #ffffff;
  --bot: #ffffff;
  --bot-text: #0f172a;
  --quote-bg: rgba(15, 23, 42, .06);
  --danger: #e11d48;
  --success: #10b981;
  --warn: #f59e0b;
  --chip: #ffffff;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 8px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .14);
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #8b85ff;
    --accent-2: #5b8cff;
    --accent-soft: rgba(139, 133, 255, .14);
    --grad: linear-gradient(135deg, #5b50f0 0%, #3a63e0 100%);
    --bg: #0b0d16;
    --chat-bg: #0b0d16;
    --surface: #131624;
    --surface-2: #1a1e30;
    --glass: rgba(19, 22, 36, .82);
    --text: #e9ebf5;
    --muted: #9097b1;
    --faint: #687089;
    --border: #252a40;
    --bot: #1a1e30;
    --bot-text: #e9ebf5;
    --quote-bg: rgba(255, 255, 255, .08);
    --danger: #fb7185;
    --success: #34d399;
    --chip: #1a1e30;
    --shadow-sm: none;
    --shadow: 0 1px 0 rgba(255, 255, 255, .02);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 "InterVar", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv11", "ss01"; letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
#app { height: 100dvh; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; cursor: pointer; letter-spacing: inherit; }
button:focus-visible, a:focus-visible, .field:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
.center { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- forms (login, invite) --- */
.center.auth {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(91, 80, 240, .28), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, rgba(59, 108, 246, .25), transparent 60%),
    var(--bg);
}
.card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 32px 26px 26px; box-shadow: var(--shadow-lg); }
.card h1 { margin: 0 0 6px; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.card p { color: var(--muted); margin: 0 0 20px; font-size: 15px; }
.logo { width: 60px; height: 60px; border-radius: 18px; margin-bottom: 18px; display: block; box-shadow: 0 8px 24px rgba(79, 70, 229, .35); }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 16px 0 7px; }
.field { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s; }
.field:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); outline: none; }
.code { letter-spacing: .35em; font-variant-numeric: tabular-nums; text-align: center; font-size: 22px; font-weight: 600; }
.primary { width: 100%; margin-top: 22px; padding: 14px; border: 0; border-radius: 12px; background: var(--grad); color: #fff; font-weight: 600; font-size: 16px; box-shadow: 0 6px 18px rgba(79, 70, 229, .3); transition: transform .1s, filter .15s; }
.primary:hover { filter: brightness(1.06); }
.primary:active { transform: scale(.985); }
.primary:disabled { opacity: .55; box-shadow: none; }
.secondary { display: inline-block; padding: 10px 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--accent); font-weight: 600; font-size: 15px; text-decoration: none; transition: background .15s; }
.secondary:hover { background: var(--surface-2); }
.error { color: var(--danger); font-size: 14px; margin-top: 12px; min-height: 1em; }
.qr { background: #fff; padding: 12px; border-radius: 16px; width: 210px; margin: 8px auto 12px; border: 1px solid var(--border); }
.qr svg { display: block; width: 100%; height: auto; }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: 13px; word-break: break-all; text-align: center; color: var(--muted); user-select: all; }
.steps { padding-left: 20px; color: var(--text); font-size: 15px; margin: 0 0 6px; }
.steps li { margin: 7px 0; }
.steps li::marker { color: var(--accent); font-weight: 700; }

/* --- header --- */
header {
  flex: none; display: flex; align-items: center; gap: 12px; position: relative; z-index: 5;
  padding: calc(10px + var(--safe-top)) 10px 10px 16px; background: var(--glass); color: var(--text);
  -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--border);
}
header img { width: 38px; height: 38px; border-radius: 12px; box-shadow: 0 4px 12px rgba(79, 70, 229, .3); }
header .tavatar { width: 38px; height: 38px; font-size: 14px; }
header .title { flex: 1; min-width: 0; }
header .name { font-weight: 700; font-size: 17px; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header .status { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
header .status:not(:empty)::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(16, 185, 129, .18); flex: none; }
header .status.working { color: var(--accent); }
header .status.working::before { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); animation: pulse 1.2s infinite; }
header .status.working::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.4s steps(4) infinite; overflow: hidden; vertical-align: bottom; margin-left: -6px; }
@keyframes dots { 0% { width: 0 } 100% { width: 1.2em } }
.iconbtn { border: 0; background: transparent; padding: 9px; border-radius: 12px; display: flex; color: var(--muted); transition: background .15s, color .15s; }
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn svg { width: 22px; height: 22px; }
.iconbtn.back { margin-left: -8px; color: var(--accent); }
.banner { flex: none; background: var(--accent-soft); border-bottom: 1px solid var(--border); padding: 10px 14px; font-size: 14px; display: flex; gap: 10px; align-items: center; }
.banner span { flex: 1; }
.banner button { border: 0; background: var(--grad); color: #fff; border-radius: 10px; padding: 7px 13px; font-weight: 600; font-size: 14px; }
.banner .x { background: transparent; color: var(--muted); padding: 4px 6px; }

/* --- chat --- */
#list {
  flex: 1; overflow-y: auto; padding: 12px 12px 16px; -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(800px 400px at 100% 0%, rgba(91, 80, 240, .07), transparent 70%),
    radial-gradient(700px 400px at 0% 100%, rgba(59, 108, 246, .06), transparent 70%),
    var(--chat-bg);
}
.day { text-align: center; margin: 16px 0 10px; position: sticky; top: 4px; z-index: 2; }
.day span { background: var(--glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: var(--muted); font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border); }
.row { display: flex; margin: 4px 0; animation: pop .2s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
.row.me { justify-content: flex-end; }
.bubble {
  position: relative; max-width: min(80%, 600px); padding: 9px 13px 7px; border-radius: 20px;
  background: var(--bot); color: var(--bot-text); box-shadow: var(--shadow); word-wrap: break-word; overflow-wrap: anywhere;
  user-select: text; -webkit-user-select: text; -webkit-touch-callout: none; font-size: 15.5px; line-height: 1.45;
}
.row.bot .bubble { border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.row.me .bubble { background: var(--me); color: var(--me-text); border-bottom-right-radius: 6px; box-shadow: 0 4px 14px rgba(79, 70, 229, .22); }
.row.me .bubble .quote { --quote-bg: rgba(255, 255, 255, .18); }
.row.pending .bubble { opacity: .6; }
.row.flash .bubble { animation: flash 1.2s; }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 3px var(--accent); } }
.text { white-space: pre-wrap; }
.text b, .text strong { font-weight: 650; }
.text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.row.bot .text a { color: var(--accent); }
.text code { font-family: ui-monospace, Menlo, monospace; font-size: .88em; background: var(--quote-bg); padding: 1px 5px; border-radius: 5px; }
.text pre { margin: 6px 0; padding: 10px; background: var(--quote-bg); border-radius: 10px; overflow-x: auto; white-space: pre; }
.text pre code { background: none; padding: 0; }
.meta { font-size: 11px; opacity: .6; text-align: right; margin-top: 3px; white-space: nowrap; user-select: none; font-variant-numeric: tabular-nums; }
.row.me .meta { opacity: .8; }
.meta .ticks { margin-left: 4px; letter-spacing: -2px; }
.quote { border-left: 3px solid currentColor; background: var(--quote-bg); border-radius: 8px; padding: 5px 9px; margin: 2px 0 6px; font-size: 13px; opacity: .92; cursor: pointer; }
.row.bot .quote { border-left-color: var(--accent); }
.quote b { display: block; font-size: 12px; }
.quote div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo { display: block; max-width: 100%; max-height: 340px; border-radius: 14px; margin: 2px 0 4px; cursor: zoom-in; }
.filecard { display: flex; align-items: center; gap: 11px; padding: 6px 2px; color: inherit; text-decoration: none; }
.filecard .ic { flex: none; width: 42px; height: 42px; border-radius: 12px; background: var(--quote-bg); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.filecard .fn { font-weight: 600; font-size: 14px; word-break: break-all; }
.filecard .fs { font-size: 12px; opacity: .7; }
audio { width: 250px; max-width: 100%; height: 40px; margin: 2px 0; display: block; }
video { max-width: 100%; max-height: 340px; border-radius: 14px; display: block; }
.reactions { display: flex; gap: 4px; margin-top: -8px; margin-bottom: 4px; padding: 0 10px; }
.row.me + .reactions, .reactions.me { justify-content: flex-end; }
.reactions span { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1px 7px; font-size: 14px; box-shadow: var(--shadow-sm); position: relative; z-index: 1; }
.buttons { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 8px; max-width: min(80%, 600px); }
.buttons .brow { display: flex; gap: 6px; }
.buttons button { flex: 1; border: 1px solid var(--border); background: var(--surface); color: var(--accent); font-weight: 600; font-size: 14.5px; padding: 10px 12px; border-radius: 14px; box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s; }
.buttons button:hover { border-color: var(--accent); background: var(--accent-soft); }
.buttons button:active { transform: scale(.98); }
.buttons button:disabled { opacity: .5; }
.choice { font-size: 13px; opacity: .8; margin-top: 4px; font-style: italic; }
.loadmore { text-align: center; padding: 8px; color: var(--muted); font-size: 13px; }
.empty { text-align: center; color: var(--muted); margin-top: 28vh; padding: 0 32px; font-size: 15px; }

/* composer */
footer { flex: none; background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px); border-top: 1px solid var(--border); padding: 8px 10px calc(8px + var(--safe-bottom)); }
.replybar { display: flex; align-items: center; gap: 8px; padding: 4px 6px 8px; font-size: 13px; }
.replybar .q { flex: 1; min-width: 0; border-left: 3px solid var(--accent); padding-left: 9px; }
.replybar .q b { color: var(--accent); display: block; font-size: 12px; }
.replybar .q div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.composer { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea {
  flex: 1; resize: none; max-height: 160px; min-height: 42px; padding: 10px 16px; border: 1px solid var(--border);
  border-radius: 22px; background: var(--surface); outline: none; font-size: 16px; line-height: 1.35; transition: border-color .15s, box-shadow .15s;
}
.composer textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.round { flex: none; width: 42px; height: 42px; border: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: transparent; color: var(--muted); transition: background .15s, transform .1s; }
.round:hover { background: var(--surface-2); }
.round:active { transform: scale(.94); }
.round.send { background: var(--grad); color: #fff; box-shadow: 0 4px 12px rgba(79, 70, 229, .35); }
.round.rec { background: var(--danger); color: #fff; }
.round svg { width: 22px; height: 22px; }
.recording { display: flex; align-items: center; gap: 10px; flex: 1; padding: 0 8px; height: 42px; font-variant-numeric: tabular-nums; }
.recording .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.progress { height: 3px; background: var(--grad); width: 0; transition: width .2s; border-radius: 2px; }

/* action sheet (long press) */
.sheet-bg { position: fixed; inset: 0; background: rgba(8, 10, 20, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .18s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 520px; background: var(--surface); border-radius: 24px 24px 0 0; padding: 10px 18px calc(18px + var(--safe-bottom)); animation: up .24s cubic-bezier(.2, .9, .3, 1.1); box-shadow: var(--shadow-lg); }
.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--border); margin: 0 auto 12px; }
@media (min-width: 820px) { .sheet-bg { align-items: center; } .sheet { border-radius: 24px; } .sheet::before { display: none; } }
@keyframes up { from { transform: translateY(60px); opacity: .4; } }
.emojis { display: flex; justify-content: space-between; margin-bottom: 10px; }
.emojis button { font-size: 26px; border: 0; background: var(--surface-2); border-radius: 50%; width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; transition: transform .12s; }
.emojis button:active { transform: scale(1.15); }
.emojis button.on { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.sheet .act { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 14px 8px; font-size: 16px; border-top: 1px solid var(--border); border-radius: 0; }
.sheet .act:hover { background: var(--surface-2); }
.viewer { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .94); display: flex; align-items: center; justify-content: center; animation: fade .15s; }
.viewer img { max-width: 100%; max-height: 100%; }
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translateX(-50%); background: rgba(15, 18, 32, .92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: #fff; padding: 10px 18px; border-radius: 14px; font-size: 14px; font-weight: 500; z-index: 70; max-width: 90%; text-align: center; box-shadow: var(--shadow-lg); animation: pop .2s ease-out; }
.offline { flex: none; background: var(--warn); color: #111; text-align: center; font-size: 13px; font-weight: 600; padding: 5px; }

/* --- layout: side (lists) + main (one chat) --- */
.layout { flex: 1; min-height: 0; display: flex; }
.side, .main { min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.side { flex: 1; background: var(--bg); }
.main { flex: 1; display: none; }
#app.in-thread .side { display: none; }
#app.in-thread .main { display: flex; }
@media (min-width: 820px) {
  .side { flex: 0 0 360px; display: flex !important; border-right: 1px solid var(--border); }
  .main { display: flex; }
  .main .back { display: none; }
}
.placeholder { flex: 1; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; color: var(--muted); background: var(--chat-bg); font-size: 15px; }
.placeholder::before { content: ""; width: 72px; height: 72px; border-radius: 22px; background: url(/icon.svg) center/cover; box-shadow: 0 10px 30px rgba(79, 70, 229, .3); opacity: .9; }
.sidebody { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* tab bar */
.tabbar { flex: none; display: flex; gap: 4px; border-top: 1px solid var(--border); background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px); padding: 6px 8px calc(6px + var(--safe-bottom)); }
.tabbar button { flex: 1; border: 0; background: transparent; padding: 4px 0 3px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 500; color: var(--muted); position: relative; }
.tabbar button .ti { display: flex; align-items: center; justify-content: center; width: 56px; height: 30px; border-radius: 15px; transition: background .2s, color .2s; }
.tabbar button .ti svg { width: 22px; height: 22px; }
.tabbar button.on { color: var(--accent); font-weight: 650; }
.tabbar button.on .ti { background: var(--accent-soft); }
.tabbar .badge { position: absolute; top: 0; left: calc(50% + 6px); box-shadow: 0 0 0 2px var(--surface); }
.badge { background: var(--danger); color: #fff; border-radius: 10px; font-size: 11px; font-weight: 700; padding: 1px 6px; min-width: 19px; text-align: center; font-variant-numeric: tabular-nums; line-height: 17px; }
.thread .badge { background: var(--grad); }

/* thread list */
.threads, .tasks { padding: 8px 8px 20px; }
.thread { display: flex; gap: 12px; align-items: center; width: 100%; border: 0; background: transparent; padding: 10px 10px; text-align: left; border-radius: 16px; transition: background .15s; }
.thread:hover { background: var(--surface); }
.thread.on { background: var(--surface); box-shadow: var(--shadow); }
.thread:active { background: var(--surface-2); }
.tavatar { flex: none; width: 48px; height: 48px; border-radius: 16px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; letter-spacing: 0; box-shadow: inset 0 -10px 20px rgba(0, 0, 0, .08); }
.tbody { flex: 1; min-width: 0; }
.trow { display: flex; align-items: center; gap: 8px; }
.trow + .trow { margin-top: 2px; }
.ttitle { flex: 1; font-weight: 650; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.ttime { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.thread.unread .ttime { color: var(--accent); font-weight: 650; }
.thread.unread .tlast { color: var(--text); }
.tlast { flex: 1; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.newthread { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 10px 2px 6px; width: calc(100% - 4px); padding: 12px; border: 1.5px dashed var(--border); border-radius: 16px; background: transparent; color: var(--accent); font-weight: 600; font-size: 15px; transition: background .15s, border-color .15s; }
.newthread:hover { border-color: var(--accent); background: var(--accent-soft); }
.linkbtn { display: block; margin: 10px auto; border: 0; background: transparent; color: var(--muted); font-size: 14px; font-weight: 500; padding: 6px 10px; border-radius: 10px; }
.linkbtn:hover { background: var(--surface); color: var(--text); }

/* tasks */
.tgroup { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 18px 8px 8px; }
.tgroup::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.tgroup.late { color: var(--danger); }
.task { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; margin: 0 0 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s; }
.task:hover { box-shadow: var(--shadow); }
.tgroup.late + .task, .tgroup.late ~ .task.late { border-left: 3px solid var(--danger); }
.task .check { flex: none; width: 24px; height: 24px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--faint); background: transparent; color: #fff; font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0; transition: background .15s, border-color .15s, transform .1s; }
.task .check:hover { border-color: var(--success); background: rgba(16, 185, 129, .1); }
.task .check:active { transform: scale(.9); }
.task.done { opacity: .7; }
.task.done .check { background: var(--success); border-color: var(--success); }
.task .tmain { flex: 1; min-width: 0; border: 0; background: transparent; text-align: left; padding: 0; }
.task.done .ttl { text-decoration: line-through; color: var(--muted); }
.ttl { font-size: 15px; font-weight: 550; }
.tsub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.tnote { font-size: 13px; color: var(--muted); margin-top: 3px; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty.small { margin-top: 12vh; font-size: 15px; line-height: 1.5; }

/* sheets with forms */
.sheet { max-height: 90dvh; overflow-y: auto; }
.sheet h3 { margin: 4px 0 12px; font-size: 19px; font-weight: 700; letter-spacing: -.015em; }
.sheet .hint { color: var(--muted); font-size: 14px; margin: -4px 0 12px; }
.sheet .field + .field { margin-top: 8px; }
.sheet textarea.field { resize: vertical; }
.sheettitle { font-weight: 650; padding: 2px 8px 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 20px; padding: 7px 13px; font-size: 14px; font-weight: 500; transition: background .15s, border-color .15s; }
.chip:hover { border-color: var(--accent); }
.sheetbtns { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.sheetbtns .primary { flex: 1; margin-top: 14px; }
.sheetbtns .secondary { margin-top: 14px; }
.secondary.danger { color: var(--danger); }
select.field { appearance: auto; }

/* approvals */
.tgroup.appr { color: #d97706; }
.appr-card { margin: 0 0 8px; padding: 14px; border: 1px solid rgba(245, 158, 11, .45); background: linear-gradient(180deg, rgba(245, 158, 11, .1), rgba(245, 158, 11, .04)), var(--surface); border-radius: 16px; box-shadow: var(--shadow-sm); }
.appr-card .ttl { font-weight: 650; }
.appr-card .brow { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.chip.ok { background: var(--success); border-color: var(--success); color: #fff; font-weight: 650; }
.chip.no { color: var(--danger); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.mailprev { font-size: 14px; display: grid; gap: 4px; }
.mailprev pre { white-space: pre-wrap; font: inherit; background: var(--surface-2); border-radius: 12px; padding: 12px; margin: 8px 0 0; max-height: 45dvh; overflow-y: auto; }

/* calendar */
.event { display: flex; gap: 14px; width: 100%; border: 1px solid var(--border); background: var(--surface); text-align: left; padding: 12px 14px; margin: 0 0 6px; border-radius: 16px; box-shadow: var(--shadow-sm); transition: box-shadow .15s; }
.event:hover { box-shadow: var(--shadow); }
.etime { flex: none; width: 50px; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; display: flex; flex-direction: column; color: var(--accent); }
.etime small { color: var(--faint); font-weight: 500; font-size: 12.5px; margin-top: 2px; }
.ebody { flex: 1; min-width: 0; border-left: 3px solid var(--accent); border-image: var(--grad) 1; padding-left: 12px; }
label.inline { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; font-weight: 400; }

/* files, search */
.pad { padding: 8px 8px 4px; }
.chips.pad { margin: 0; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 8px; }
.thumb { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; cursor: zoom-in; }
.fileitem { display: flex; align-items: center; gap: 8px; padding: 6px 12px; margin: 0 8px 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.fileitem .filecard { flex: 1; min-width: 0; }
.searchbar { padding: 10px 8px 4px; }
.sres { display: block; width: calc(100% - 16px); margin: 0 8px 6px; border: 1px solid var(--border); background: var(--surface); text-align: left; padding: 10px 14px; border-radius: 14px; }
mark { background: #fde68a; color: inherit; border-radius: 3px; padding: 0 1px; }
@media (prefers-color-scheme: dark) { mark { background: #78350f; } }

/* mail wizard */
.helpbox { background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 0 0 12px; }
.acct { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.tsub.err { color: var(--danger); }
.hint.small { font-size: 12px; margin-top: 12px; }
.devcode { display: inline-block; font-family: ui-monospace, Menlo, monospace; font-size: 22px; font-weight: 700; letter-spacing: .12em; background: var(--surface-2); padding: 5px 12px; border-radius: 10px; margin: 4px 6px 4px 0; user-select: all; }
.secondary.wide { display: block; width: 100%; margin-top: 10px; text-align: center; }
.tabbar button span:not(.ti) { white-space: nowrap; }
.hint.err { color: var(--danger); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
header .status.off::before { background: var(--faint); box-shadow: none; }
