:root {
  --accent: #1f5fbf;
  --on-accent: #ffffff;
  --accent-text: #1f5fbf;
  --ink: #1c2026;
  --quiet: #5b6470;
  --line: #dfe3e8;
  --surface: #f4f6f8;
  --paper: #ffffff;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--paper); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
[hidden] { display: none !important; }

.app { display: flex; flex-direction: column; height: 100%; }
.standalone { background: var(--surface); }
.standalone .app { max-width: 720px; margin: 0 auto; background: var(--paper); box-shadow: 0 0 24px rgba(0, 0, 0, .08); }
.top { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--accent); color: var(--on-accent); }
.identity { display: flex; align-items: center; gap: 10px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 18px; background: var(--avatar-bg, rgba(255, 255, 255, .22)); }
.avatar svg { fill: currentColor; }
.top h1 { margin: 0; font-size: 16px; }
.top p { margin: 0; font-size: 12px; opacity: .9; }
.actions { display: flex; align-items: center; gap: 6px; }
.langs { display: inline-flex; padding: 2px; border-radius: 999px; background: var(--avatar-bg, rgba(255, 255, 255, .22)); }
.langs button { min-width: 36px; min-height: 30px; padding: 0 8px; border: 0; border-radius: 999px; background: none; color: inherit; font: inherit; font-size: 12px; font-weight: 600; letter-spacing: .03em; cursor: pointer; opacity: .75; }
.langs button[aria-pressed="true"] { background: var(--paper); color: var(--ink); opacity: 1; }
.langs button:disabled { cursor: default; }
.icon { width: 44px; height: 44px; margin-right: -10px; border: 0; background: none; color: inherit; font-size: 24px; cursor: pointer; }
.notice { margin: 0; padding: 6px 16px; background: var(--surface); color: var(--quiet); font-size: 12px; }

.log { flex: 1; min-height: 80px; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 88%; padding: 9px 12px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.user { align-self: flex-end; background: var(--accent); color: var(--on-accent); }
.bubble.assistant { align-self: flex-start; background: var(--surface); }
.bubble.system { align-self: center; color: var(--quiet); font-size: 13px; }
.bubble.pending::after { content: attr(data-typing); color: var(--quiet); }

.card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.card h3 { margin: 0 0 4px; font-size: 15px; }
.card p { margin: 0 0 8px; }
.card dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0 0 8px; font-size: 14px; }
.card dt { color: var(--quiet); }
.card dd { margin: 0; font-weight: 600; }
.card .date { color: var(--quiet); font-size: 12px; }
.card .stale { color: #8a4b00; }
.card a { color: var(--accent-text); }

.handoff { max-height: 55%; overflow-y: auto; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.handoff-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.handoff h2 { margin: 0; font-size: 14px; }
.handoff label { display: block; margin-bottom: 8px; font-size: 13px; }
.handoff input:not([type="checkbox"]) { display: block; width: 100%; min-height: 40px; margin-top: 2px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 16px; }
.summary { margin: 0 0 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); font-size: 13px; white-space: pre-line; }
.channels { display: flex; flex-wrap: wrap; gap: 8px; }
.bubble a { color: inherit; text-decoration: underline; }
.consent { display: flex !important; gap: 8px; align-items: flex-start; }
.alt { margin: 12px 0 8px; font-size: 13px; color: var(--quiet); }
.status { margin: 8px 0 0; font-size: 13px; }
.handoff #privacy { display: block; margin-bottom: 8px; font-size: 13px; color: var(--accent-text); }

.bottom { padding: 8px 16px 12px; border-top: 1px solid var(--line); }
.link { min-height: 32px; padding: 0; border: 0; background: none; color: var(--accent-text); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; }
.composer { display: flex; gap: 8px; align-items: flex-end; margin-top: 4px; }
textarea { flex: 1; min-height: 44px; max-height: 110px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 16px; resize: none; }
.primary, .secondary { display: inline-block; min-height: 44px; padding: 10px 14px; border: 0; border-radius: 10px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.primary { background: var(--accent); color: var(--on-accent); }
.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.primary:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
