/* Tua web — Mac-native feel: system font, sidebar + chat, light/dark tokens. */
:root {
  --bg: #f6f4fa; --side: #efebf6; --panel: #ffffff; --line: #e2dcec; --text: #1d1a24; --muted: #6f6880; --faint: #9a93aa;
  --accent: #7a4fd6; --accent-2: #a888f0; --on-accent: #ffffff; --me: #7a4fd6; --me-text: #ffffff; --tua: #ffffff; --sys: #ece7f4;
  --warn: #c2410c; --ok: #15803d; --danger: #b91c1c; --shadow: 0 1px 2px rgba(30, 20, 50, .08), 0 4px 18px rgba(30, 20, 50, .06);
  --radius: 16px; --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17141e; --side: #1e1a27; --panel: #221e2c; --line: #332c42; --text: #f2eefb; --muted: #b0a7c4; --faint: #7d7494;
    --accent: #9f78f0; --accent-2: #c9a8ff; --on-accent: #15121c; --me: #6f48c9; --me-text: #ffffff; --tua: #2a2536; --sys: #262131;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 22px rgba(0, 0, 0, .25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17141e; --side: #1e1a27; --panel: #221e2c; --line: #332c42; --text: #f2eefb; --muted: #b0a7c4; --faint: #7d7494;
  --accent: #9f78f0; --accent-2: #c9a8ff; --on-accent: #15121c; --me: #6f48c9; --me-text: #ffffff; --tua: #2a2536; --sys: #262131;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 22px rgba(0, 0, 0, .25); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }

body[data-view="pair"] .app, body[data-view="boot"] .app { display: none; }
body[data-view="app"] .pair, body[data-view="boot"] .pair { display: none; }

/* ---------- orb ---------- */
.orb { width: 34px; height: 34px; border-radius: 50%; flex: none; background: radial-gradient(circle at 35% 30%, var(--accent-2), var(--accent) 72%); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.orb.big { width: 68px; height: 68px; margin: 0 auto 18px; }

/* ---------- pairing ---------- */
.pair { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px; overflow: auto; }
.pair-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 32px 28px; text-align: center; box-shadow: var(--shadow); }
.pair-card h1 { font-size: 22px; margin: 0 0 10px; letter-spacing: -.01em; }
.pair-card .lead { color: var(--muted); margin: 0 0 20px; }
#pairForm { display: flex; gap: 8px; }
#pairCode { flex: 1; min-width: 0; text-align: center; font: 600 22px var(--mono); letter-spacing: 3px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); }
#pairCode:focus, #pairPhone:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button.primary, .pair-card button[type=submit] { background: var(--accent); color: var(--on-accent); border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 600; cursor: pointer; }
button.primary:disabled { opacity: .5; cursor: default; }
.err { color: var(--danger); min-height: 1.4em; margin: 10px 0 0; }
.nocode { margin-top: 14px; text-align: left; }
.nocode summary { cursor: pointer; color: var(--accent); text-align: center; }
#phoneForm { display: flex; gap: 8px; margin-top: 12px; }
#pairPhone { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); }
.note { color: var(--muted); font-size: 13px; }
.foot { margin: 22px 0 0; font-size: 13px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 280px 1fr; height: 100vh; height: 100dvh; }
.sidebar { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-head { display: flex; align-items: center; gap: 10px; padding: 16px 12px 10px 16px; }
.who { flex: 1; min-width: 0; }
.tname-big { font-weight: 700; font-size: 15px; }
.tperson { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.conn[data-state="live"] { background: #22c55e; }
.conn[data-state="reconnecting"], .conn[data-state="connecting"] { background: #f59e0b; }
.conn[data-state="offline"] { background: var(--danger); }
button.icon { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 34px; height: 34px; padding: 0 7px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
button.icon:hover { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); }
button.icon:focus-visible, .thread:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.icon.on { color: #fff; background: var(--danger); }
#btnGeo.on { background: #0e7490; }
button.icon.wide { width: 100%; justify-content: flex-start; padding: 0 10px; }
.search { padding: 0 12px 8px; }
.search input { width: 100%; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); }
.side-label { padding: 6px 18px 4px; color: var(--faint); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.threads { list-style: none; margin: 0; padding: 0 8px; overflow: auto; flex: 1; }
.threads.life-nav { flex: none; overflow: visible; padding-bottom: 6px; }
.life-nav .thread { padding: 6px 10px; }
.life-nav .lcount { margin-left: auto; color: var(--muted); font-size: 12px; }
.thread { padding: 9px 10px; border-radius: 10px; cursor: pointer; margin-bottom: 2px; }
.thread:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.thread.cur { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.thread .row1, .thread .row2 { display: flex; align-items: center; gap: 8px; }
.thread .tname { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread .ttime { color: var(--faint); font-size: 11px; }
.thread .tprev { flex: 1; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread.unread .tname { color: var(--text); }
.thread .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }
.side-foot { padding: 8px; border-top: 1px solid var(--line); }

.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.main-head { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); min-height: 56px; }
.main-head h1 { flex: 1; font-size: 15px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.held-pill { font-size: 12px; color: var(--warn); }
.held-pill:has(b:empty) { display: none; }
.narrow-only { display: none !important; }
.offline-bar { background: #fff4e5; color: #7c2d12; padding: 6px 18px; font-size: 13px; }

/* ---------- held ---------- */
.held { display: flex; gap: 10px; padding: 10px 18px; overflow-x: auto; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--warn) 5%, var(--bg)); }
.held-card { flex: 0 0 300px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); }
.htitle { font-weight: 600; }
.hdetail { color: var(--muted); font-size: 12.5px; margin: 2px 0 8px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.hactions { display: flex; gap: 8px; }
.hactions button { flex: 1; padding: 7px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; font-weight: 600; }
.hactions button.primary { border: 0; }
.hactions.info { color: var(--faint); font-size: 12px; }

/* ---------- messages ---------- */
.messages { flex: 1; overflow-y: auto; padding: 18px 18px 8px; display: flex; flex-direction: column; gap: 6px; }
.messages > :first-child { margin-top: auto; }
.older { align-self: center; border: 1px solid var(--line); background: var(--panel); border-radius: 20px; padding: 5px 14px; cursor: pointer; color: var(--muted); margin-bottom: 8px; }
.empty { text-align: center; color: var(--faint); }
.day { align-self: center; color: var(--faint); font-size: 12px; font-weight: 600; margin: 12px 0 4px; }
.msg { display: flex; flex-direction: column; max-width: min(720px, 82%); }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.tua { align-self: flex-start; align-items: flex-start; }
.msg.sys { align-self: center; align-items: center; max-width: min(640px, 90%); }
.bubble { padding: 8px 12px; border-radius: var(--radius); background: var(--tua); box-shadow: var(--shadow); overflow-wrap: anywhere; }
.msg.me .bubble { background: var(--me); color: var(--me-text); border-bottom-right-radius: 6px; box-shadow: none; }
.msg.tua .bubble { border-bottom-left-radius: 6px; border: 1px solid var(--line); box-shadow: none; }
.msg.sys .bubble { background: var(--sys); color: var(--muted); font-size: 13px; box-shadow: none; }
.msg.me a { color: inherit; text-decoration: underline; }
.msg.pending .bubble { opacity: .72; }
.msg.failed .bubble { outline: 2px solid var(--danger); }
.meta { font-size: 11px; color: var(--faint); margin: 2px 6px 4px; }
.meta.failed { color: var(--danger); }
button.link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-weight: 600; }
.text p { margin: 0; }
.text p.gap { height: .55em; }
.text p.h { font-weight: 700; margin-top: 2px; }
.text ul, .text ol { margin: 2px 0; padding-left: 20px; }
.text code { font: 12.5px var(--mono); background: color-mix(in srgb, var(--text) 8%, transparent); padding: 1px 4px; border-radius: 5px; }
.text pre { background: color-mix(in srgb, var(--text) 7%, transparent); padding: 8px 10px; border-radius: 9px; overflow-x: auto; margin: 6px 0; }
.text pre code { background: none; padding: 0; white-space: pre; }
.files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.text:empty + .files, .files:first-child { margin-top: 0; }
.file.image { cursor: zoom-in; }
.file.image img { display: block; max-width: 320px; max-height: 260px; border-radius: 10px; background: color-mix(in srgb, var(--text) 6%, transparent); min-width: 60px; min-height: 40px; object-fit: cover; }
.file.video video { display: block; max-width: 360px; max-height: 260px; border-radius: 10px; background: #000; }
.file.audio audio { display: block; width: 280px; }
.file.video, .file.audio { display: flex; flex-direction: column; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; max-width: 320px; padding: 6px 10px; border-radius: 10px; border: 1px solid color-mix(in srgb, currentColor 22%, transparent); background: color-mix(in srgb, currentColor 6%, transparent); cursor: pointer; text-align: left; }
.chip.static { cursor: default; }
.chip .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .fsize { opacity: .7; font-size: 11px; white-space: nowrap; }
.typing .bubble { display: inline-flex; gap: 4px; padding: 12px 14px; }
.typing .bubble span { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: blink 1.2s infinite; }
.typing .bubble span:nth-child(2) { animation-delay: .2s; } .typing .bubble span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ---------- drop ---------- */
.drop-hint { display: none; position: absolute; inset: 64px 16px 90px; border: 2px dashed var(--accent); border-radius: 18px; background: color-mix(in srgb, var(--accent) 10%, var(--bg)); align-items: center; justify-content: center; font-size: 18px; font-weight: 600; color: var(--accent); pointer-events: none; z-index: 5; }
.main.dragging .drop-hint { display: flex; }

/* ---------- banners (explicit capture indicators) ---------- */
.banners { display: flex; flex-direction: column; gap: 6px; padding: 0 18px 6px; }
.banner { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: color-mix(in srgb, var(--danger) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); font-size: 13px; }
.banner.geo { background: color-mix(in srgb, #0e7490 12%, var(--panel)); border-color: color-mix(in srgb, #0e7490 35%, transparent); }
.banner > span:nth-child(2) { flex: 1; }
.banner .time { font: 12px var(--mono); color: var(--muted); }
.banner button { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 4px 10px; cursor: pointer; }
.banner button.primary { border: 0; background: var(--accent); }
.rec-dot, .geo-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1.4s infinite; flex: none; }
.geo-dot { background: #0e7490; }
@keyframes pulse { 50% { opacity: .35; } }
.meter { width: 80px; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--text) 10%, transparent); overflow: hidden; flex: none !important; }
.meter i { display: block; height: 100%; width: 0; background: var(--danger); transition: width .1s; }

/* ---------- composer ---------- */
.composer { padding: 8px 18px 16px; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.att { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 30px 6px 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 12px; max-width: 280px; }
.att img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.att .ic { width: 44px; text-align: center; font-size: 22px; }
.att .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.att .fsize { color: var(--faint); font-size: 11px; white-space: nowrap; }
.att .x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--text) 10%, transparent); cursor: pointer; line-height: 1; }
.compose-row { display: flex; align-items: flex-end; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 6px; box-shadow: var(--shadow); }
.compose-row:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.tools { display: flex; gap: 0; }
#input { flex: 1; min-width: 0; resize: none; border: 0; background: transparent; padding: 7px 6px; max-height: 260px; outline: none; line-height: 1.4; }
.send { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.send:disabled { opacity: .35; cursor: default; }

/* ---------- menus / dialogs / toast ---------- */
.menu { position: fixed; z-index: 50; min-width: 200px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px; box-shadow: 0 10px 40px rgba(0, 0, 0, .22); }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 7px; cursor: pointer; }
.menu button:hover, .menu button:focus { background: var(--accent); color: var(--on-accent); outline: none; }
dialog { border: 0; padding: 0; background: transparent; color: var(--text); max-width: calc(100vw - 32px); }
dialog::backdrop { background: rgba(10, 6, 20, .42); backdrop-filter: blur(2px); }
.sheet { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px; width: 480px; max-width: 100%; max-height: 82vh; overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.sheet.small { width: 400px; }
.sheet h2 { margin: 0 0 12px; font-size: 18px; }
.sheet h3 { margin: 16px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.sheet .pre { white-space: pre-wrap; margin: 0 0 12px; display: block; }
.sheet input[type=text], .sheet textarea { width: 100%; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); margin-bottom: 12px; }
.sheet select { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); margin-right: 8px; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.sheet-actions button { padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; }
.sheet-actions button.primary { border: 0; background: var(--accent); }
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.devices { list-style: none; margin: 0; padding: 0; }
.devices li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.devices .dname { flex: 1; }
.devices .dseen { color: var(--faint); font-size: 12px; }
.devices button, .links button, .links a { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 5px 10px; cursor: pointer; text-decoration: none; color: var(--text); display: inline-block; margin: 0 6px 6px 0; }
.links { margin-top: 16px; }
button.danger { border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); background: none; border-radius: 10px; padding: 7px 12px; cursor: pointer; margin-top: 12px; }
.ver { color: var(--faint); font-size: 11px; margin: 14px 0 0; }
.keys { width: 100%; border-collapse: collapse; }
.keys td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
kbd { font: 12px var(--mono); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); white-space: nowrap; }
.lightbox { max-width: 96vw; max-height: 96vh; }
.lightbox img { display: block; max-width: 94vw; max-height: 86vh; border-radius: 10px; }
.lbbar { display: flex; gap: 8px; align-items: center; margin-top: 8px; color: #fff; }
.lbbar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbbar button { border: 0; border-radius: 8px; padding: 5px 12px; background: rgba(255, 255, 255, .18); color: #fff; cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(12px); opacity: 0; transition: .2s; background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 12px; z-index: 60; max-width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------- narrow windows ---------- */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 30; transform: translateX(-102%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
  body.drawer .sidebar { transform: none; }
  .narrow-only { display: inline-flex !important; }
  .messages, .composer, .banners { padding-left: 12px; padding-right: 12px; }
  .main-head { padding: 10px 12px; }
  .msg { max-width: 92%; }
  .tools { flex-wrap: wrap; max-width: 104px; }
  .file.image img, .file.video video { max-width: 100%; }
}
.sheet button.small { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 5px 10px; cursor: pointer; }
.hactions button.primary { background: var(--accent); color: var(--on-accent); }
.banner button.primary { color: var(--on-accent); }

/* ---------- live call ---------- */
.call-btn { color: var(--accent) !important; }
.callbar { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.callbar .orb { width: 30px; height: 30px; transition: transform .12s; }
.callbar[data-state="speaking"] .orb { animation: speak 1s ease-in-out infinite; }
.callbar[data-state="thinking"] .orb { animation: think 1.6s linear infinite; }
@keyframes speak { 50% { transform: scale(1.15); } }
@keyframes think { 50% { opacity: .55; } }
.callbar .cstate { font-weight: 600; }
.callbar .cmeta { color: var(--muted); font-size: 12px; flex: 1; }
.callbar button { border: 1px solid var(--line); background: var(--panel); border-radius: 18px; padding: 6px 14px; cursor: pointer; font-weight: 600; }
.callbar button.on { background: var(--warn); color: #fff; border-color: transparent; }
.callbar button.end { background: var(--danger); color: #fff; border-color: transparent; }
.call-btn.on { color: #fff !important; }

.install-card { margin: 8px; padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-size: 12.5px; }
.install-card b { display: block; font-size: 13px; margin-bottom: 2px; }
.install-card .row { display: flex; gap: 6px; margin-top: 8px; }
.install-card button { border: 0; border-radius: 8px; padding: 5px 10px; cursor: pointer; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.install-card button.ghost { background: none; color: var(--muted); }

/* ---------- life sections ---------- */
body.in-life .messages, body.in-life .composer, body.in-life .banners, body.in-life #held { display: none !important; }
.life { flex: 1; overflow-y: auto; padding: 18px 24px 32px; }
.life h3 { margin: 18px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.life-add { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.life-add input, .life-add select { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }
.life-add input[type=text] { flex: 1; min-width: 180px; }
.life-add button, .life-empty button, .gcard button, .mail-read button, button.ghost { padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 600; }
.life-add button.primary, .life-empty button.primary, .mail-read button.primary { border: 0; background: var(--accent); color: var(--on-accent); }
button.ghost { background: none; color: var(--muted); font-weight: 500; }
button.ghost.small { padding: 4px 8px; font-size: 12px; }
.life-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.life-tabs button { border: 1px solid var(--line); background: var(--panel); border-radius: 16px; padding: 5px 12px; cursor: pointer; }
.life-tabs button.on { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.life-tabs button.ghost { border-style: dashed; }
.todo-list, .rem-list, .mail-list, .cal ul { list-style: none; margin: 0; padding: 0; }
.todo-list li, .rem-list li, .cal li { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.todo-list label { display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer; }
.todo-list input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.todo-list li.done .ttext { text-decoration: line-through; color: var(--faint); }
.tdue, .rwhen, .etime { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.rwhen { min-width: 150px; } .etime { min-width: 52px; }
.rtext, .etitle { flex: 1; } .etitle small { color: var(--muted); }
.ecal { color: var(--faint); font-size: 11px; }
.life .x { border: 0; background: none; color: var(--faint); font-size: 18px; cursor: pointer; width: 28px; height: 28px; border-radius: 50%; }
.life .x:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.life-none, .life-loading { color: var(--faint); }
.life-empty { text-align: center; padding: 40px 0; color: var(--muted); }
.note.warn { color: var(--warn); }
.mail-list li { padding: 10px 6px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 8px; }
.mail-list li:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.mail-list li.unread .mfrom, .mail-list li.unread .msubj { font-weight: 700; }
.mrow { display: flex; gap: 8px; } .mfrom { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .mdate { color: var(--faint); font-size: 12px; }
.msnip, .matt { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-read h2 { font-size: 18px; margin: 14px 0 4px; }
.mbody { white-space: pre-wrap; font: 14px/1.5 var(--font); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; max-width: 760px; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.gcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.gcard.wide { margin-bottom: 8px; }
.gcard.muted { opacity: .85; }
.gcard p { margin: 0; color: var(--muted); font-size: 13px; }
.gcard .example { text-align: left; font-weight: 400; font-size: 13px; color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.pill { align-self: flex-start; font-size: 12px; padding: 3px 8px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
@media (max-width: 760px) { .life { padding: 14px 12px 28px; } .rwhen { min-width: 0; } }

.mail-compose { display: flex; flex-direction: column; gap: 8px; max-width: 760px; margin-top: 10px; }
.mail-compose input, .mail-compose textarea { padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font: inherit; }
.mail-compose .row, .mail-read .row { display: flex; gap: 8px; margin-top: 6px; }
.mail-compose button.primary { border: 0; background: var(--accent); color: var(--on-accent); padding: 8px 18px; border-radius: 10px; font-weight: 600; cursor: pointer; }
.text blockquote { margin: 0; padding: 0 0 0 9px; border-left: 3px solid color-mix(in srgb, currentColor 35%, transparent); opacity: .8; }
.text blockquote + p { margin-top: 3px; }
