:root { --bg:#fff; --fg:#111; --muted:#777; --line:#e5e5e5; --me:#e8f0fe; --ai:#f4f4f4; --err:#fde8e8; color-scheme: light; }
@media (prefers-color-scheme: dark) { :root { --bg:#111; --fg:#eee; --muted:#999; --line:#333; --me:#1e2a44; --ai:#1d1d1d; --err:#3a1d1d; color-scheme: dark; } }
* { box-sizing: border-box; }
body { margin:0; font: 16px/1.45 system-ui, -apple-system, sans-serif; background:var(--bg); color:var(--fg); }
a { color: inherit; }
header.top { display:flex; justify-content:space-between; align-items:center; padding:.6rem 1rem; border-bottom:1px solid var(--line); position:sticky; top:0; background:var(--bg); }
header .brand { display:flex; align-items:center; text-decoration:none; }
header .brand-logo { height:40px; width:40px; display:block; }
header nav { display:flex; gap:1rem; align-items:center; }
header.top .nav-toggle { display:none; }
.nav-item { display:inline-flex; align-items:center; gap:.35rem; }
.nav-item .new-conversation-link {
  display:inline-flex; align-items:center; justify-content:center;
  width:1.4rem; height:1.4rem; line-height:1; font-weight:700;
  border:1px solid var(--line); border-radius:6px; text-decoration:none;
}
.nav-item .new-conversation-link:hover { background:var(--ai); }
main { max-width: 820px; margin: 0 auto; padding: 1rem; }
h1 { font-size: 1.5rem; margin: .5rem 0 1rem; }
h2 { font-size: 1.2rem; margin: .5rem 0 1rem; }
.btn, button.link { font: inherit; cursor:pointer; }
.btn { background:var(--fg); color:var(--bg); border:0; border-radius:8px; padding:.5rem 1rem; text-decoration:none; display:inline-block; }
.btn.small { padding:.25rem .6rem; }
button.link { background:none; border:0; text-decoration:underline; color:inherit; padding:0; }
input[type=text], input[type=email], input[type=password], textarea, select { width:100%; font:inherit; padding:.5rem; border:1px solid var(--line); border-radius:8px; background:var(--bg); color:var(--fg); }
input[type=submit] { font: inherit; }
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M1 1l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .6rem center;
  background-size: .7em;
}
select::-ms-expand { display: none; }
form.inline { display:flex; gap:.5rem; align-items:center; }
form.inline input { max-width: 260px; }
.list { list-style:none; padding:0; }
.list-heading { font-size:.85rem; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; margin:1.5rem 0 0; }
.list li { padding:.6rem 0; border-bottom:1px solid var(--line); display:flex; gap:.6rem; flex-wrap:wrap; align-items:baseline; }
.tags { color:var(--muted); font-size:.85rem; }
.breadcrumb { display:flex; justify-content:space-between; align-items:baseline; gap:.5rem; }
.link-muted { background:none; border:0; text-decoration:underline; color:var(--muted); font-size:.85rem; padding:0; cursor:pointer; }
.meta { color:var(--muted); font-size:.75rem; margin-left:auto; }
.title-block { display:flex; flex-direction:column; flex:1; min-width: 200px; gap:.1rem; }
.context-slug { font-size:.7rem; color:var(--muted); }
.title-row { display:flex; align-items:center; gap:.4rem; }
.title-form { flex:1; min-width: 0; }
.status-wrap { display:inline-flex; align-items:center; gap:.3rem; }
.status-icon { display:inline-flex; flex-shrink:0; color:var(--muted); }
.status-icon.status-error { color:#c00; }
.stop-btn { width:1.5rem; height:1.5rem; color:#c00; }
.run-color { width:1.5rem; height:1.5rem; cursor:default; }
@media (prefers-reduced-motion: no-preference) { .status-icon.status-thinking svg { animation: spin 1s linear infinite; } }
@keyframes spin { to { transform: rotate(360deg); } }
.title-form .title-input { font-size: 1.5rem; font-weight: 600; border-color: transparent; background: transparent; padding: .3rem .4rem; max-width: none; }
.title-form .title-input:hover, .title-form .title-input:focus { border-color: var(--line); background: var(--bg); }
.title-form .save-btn { opacity: 0; }
.title-form:hover .save-btn, .title-form .title-input:focus ~ .save-btn { opacity: 1; }
@media (max-width: 600px) {
  .composer-meta { flex-wrap: wrap; }
  .title-block { min-width: 0; flex-basis: 100%; }
  .title-row { gap: .25rem; }
  .title-form .title-input { padding-left: .1rem; }
  header.top .nav-toggle { display:inline-flex; margin-left:auto; }
  header.top nav {
    display:none; position:absolute; top:100%; left:0; right:0; z-index:10;
    flex-direction:column; align-items:stretch; gap:0;
    background:var(--bg); border-bottom:1px solid var(--line); padding:.5rem 1rem;
  }
  header.top nav.open { display:flex; }
  header.top nav a, header.top nav button.link { padding:.6rem 0; }
}
.messages { display:flex; flex-direction:column; gap:.6rem; padding-bottom: calc(var(--composer-h, 9.5rem) + 1rem); }
.msg { max-width: 92%; padding:.6rem .8rem; border-radius:12px; background:var(--ai); }
.msg.user { align-self:flex-end; background:var(--me); }
.msg.error { background:var(--err); }
.msg .body p { margin:0 0 .5rem; } .msg .body p:last-child { margin:0; }
.msg .body ul, .msg .body ol { margin: 0 0 .5rem 1.2rem; padding: 0; }
.msg .body li { margin: 0 0 .2rem; }
.msg .body code { background: rgba(0,0,0,.06); padding: .1em .3em; border-radius: 4px; font-size: .85em; }
.msg .body pre code { background: none; padding: 0; }
.msg .body h1, .msg .body h2, .msg .body h3, .msg .body h4, .msg .body h5, .msg .body h6 { margin: .6rem 0 .3rem; line-height: 1.25; }
.msg .body h1:first-child, .msg .body h2:first-child, .msg .body h3:first-child, .msg .body h4:first-child, .msg .body h5:first-child, .msg .body h6:first-child { margin-top: 0; }
.msg .body table { border-collapse: collapse; margin: 0 0 .5rem; width: 100%; }
.msg .body th, .msg .body td { border: 1px solid var(--line); padding: .25rem .5rem; text-align: left; }
.msg .body th { background: rgba(0,0,0,.04); }
.msg .meta { margin: .25rem 0 0; }
.msg .rate a { text-decoration:none; opacity:.35; filter:grayscale(1); }
.msg .rate a.on, .msg .rate a:hover { opacity:1; filter:none; }
.msg .rating-note { font-style:italic; }
.composer { position:fixed; bottom:0; left:0; right:0; background:var(--bg); border-top:1px solid var(--line); padding:.6rem 1rem calc(.6rem + env(safe-area-inset-bottom)); display:flex; }
.composer-inner { width:100%; max-width: 760px; margin:0 auto; display:flex; flex-direction:column; gap:.4rem; }
.composer-meta { display:flex; align-items:center; gap:.5rem; }
.composer-toolbar { display:flex; flex-wrap:wrap; gap:.4rem; }
.composer-toolbar-right { display:flex; gap:.4rem; margin-left:auto; }
.icon-btn { display:inline-flex; align-items:center; justify-content:center; width:2.2rem; height:2.2rem; padding:0; border:1px solid var(--line); border-radius:8px; background:var(--bg); color:var(--fg); cursor:pointer; }
.icon-btn:hover { background:var(--ai); }
.icon-btn.labeled { width:auto; gap:.4rem; padding:0 .7rem; text-decoration:none; }
.icon-btn.current { background:var(--ai); font-weight:600; }
.index-toolbar { display:flex; flex-wrap:wrap; gap:.4rem; }
.pager { display:flex; align-items:center; justify-content:center; gap:.6rem; margin:1rem 0; }
.pager .disabled { opacity:.4; cursor:default; }
.pager-status { color:var(--muted); font-size:.9rem; }
#previas[busy] { opacity:.5; }
.composer-model-form { display:flex; }
.composer-lock-form { display:flex; }
.archive-toggle { display:flex; }
.postpone-menu { position:relative; display:flex; }
.postpone-menu summary { list-style:none; position:relative; }
.postpone-menu summary::-webkit-details-marker { display:none; }
.postpone-menu summary.postponed { border-color:currentColor; }
.postpone-badge { position:absolute; top:-.35rem; right:-.35rem; min-width:1rem; height:1rem; border-radius:999px; font-size:.65rem; line-height:1rem; text-align:center; background:var(--fg); color:var(--bg); }
.postpone-options { position:absolute; bottom:calc(100% + .3rem); right:0; z-index:20; display:flex; flex-direction:column; min-width:10rem; padding:.3rem; background:var(--bg); border:1px solid var(--line); border-radius:8px; box-shadow:0 4px 12px rgba(0,0,0,.15); }
.postpone-option { display:flex; align-items:center; gap:.5rem; padding:.35rem .5rem; border-radius:6px; color:var(--fg); text-decoration:none; font-size:.85rem; }
.postpone-option:hover, .postpone-option:focus { background:var(--ai); }
.postpone-option.current { font-weight:600; }
.postpone-clear { color:var(--muted); border-top:1px solid var(--line); border-radius:0; margin-top:.2rem; padding-top:.45rem; }
.priority-dot { display:inline-flex; align-items:center; justify-content:center; width:1.2rem; height:1.2rem; border-radius:999px; font-size:.7rem; font-weight:600; color:#FFFFFF; flex-shrink:0; }
.priority-dot.p1 { background:#BF512C; }
.priority-dot.p2 { background:#DA9B2B; }
.priority-dot.p3 { background:#0C2C47; }
.priority-dot.p4 { background:#2E5749; }
.priority-dot.p5 { background:#D6C9C5; color:#0C2C47; }
.composer-model { height:2.2rem; padding:0 .6rem; border:1px solid var(--line); border-radius:8px; background:var(--bg); color:var(--fg); font:inherit; font-size:.8rem; cursor:pointer; }
.composer-model:hover { background:var(--ai); }
.composer-form textarea { transition: height .15s ease; }
.composer-expand-toggle .icon-collapse { display:none; }
.composer-expanded .composer-expand-toggle .icon-expand { display:none; }
.composer-expanded .composer-expand-toggle .icon-collapse { display:inline; }
.composer-expanded .composer-form textarea { height: 40vh; }
.composer-note-toggle .icon-note-on { display:none; }
.composer-note-mode .composer-note-toggle { color:#b8860b; border-color:#b8860b; }
.composer-note-mode .composer-note-toggle .icon-note-off { display:none; }
.composer-note-mode .composer-note-toggle .icon-note-on { display:inline; }
.composer-note-mode .composer-form textarea { border-color:#b8860b; background:rgba(184,134,11,.08); }
.composer-lock-toggle .icon-pin { opacity:.8; }
.composer-open-lock .composer-lock-toggle { color:#2a7f62; border-color:#2a7f62; }
.composer-open-lock .composer-lock-toggle .icon-pin { opacity:1; }
.composer-list { display:none; }
.composer-empty .composer-send { display:none; }
.composer-empty .composer-list { display:inline-flex; }
.composer-filelist { font-size:.75rem; color:var(--muted); min-height:0; }
.composer-filelist:not(:empty) { cursor:pointer; }
.composer-filelist:not(:empty):hover { text-decoration:underline; }
.attachments { display:flex; flex-wrap:wrap; gap:.4rem; margin:.4rem 0; }
.attachment-thumb { max-width:200px; max-height:200px; border-radius:8px; border:1px solid var(--line); display:block; }
.attachment-file { display:inline-block; padding:.3rem .6rem; border:1px solid var(--line); border-radius:8px; font-size:.85rem; }
.files-page { max-width:760px; margin:0 auto; padding:1rem; padding-bottom:6rem; }
.files-page h2 { font-size:1rem; margin:1.5rem 0 .6rem; }
.files-page h2:first-of-type { margin-top:0; }
.files-back { margin-bottom:1rem; }
.files-list { list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:.5rem; }
.files-list li { display:flex; justify-content:space-between; align-items:center; gap:1rem; padding:.5rem .7rem; border:1px solid var(--line); border-radius:8px; }
.files-list .meta { color:var(--muted); font-size:.8rem; white-space:nowrap; }
.file-preview { max-width:760px; margin:0 auto; padding:1rem; }
.file-preview-header { display:flex; align-items:center; gap:1rem; margin-bottom:1rem; }
.file-preview-name { font-weight:600; flex:1; overflow-wrap:anywhere; }
.file-preview-body { max-width:none; }
.msg.note { background:rgba(184,134,11,.12); border:1px dashed #b8860b; }
.error { color:#c00; }
.notice { color:#1a7f37; }
.msg.thinking, .msg.tool, .msg.system, .msg.shell { background: transparent; border: 1px dashed var(--line); font-size: .8rem; color: var(--muted); padding: .3rem .6rem; max-width: 100%; overflow-x: auto; }
.msg.thinking summary, .msg.tool summary, .msg.system summary, .msg.shell summary { cursor: pointer; overflow-wrap: anywhere; }
.msg .role { font-weight: 600; text-transform: uppercase; font-size: .65rem; letter-spacing: .05em; margin-right: .4rem; }
.msg pre { white-space: pre-wrap; word-break: break-word; margin: .3rem 0 0; font-size: .75rem; max-height: 16rem; overflow: auto; }
main.legal { max-width: 720px; } main.legal h2 { font-size: 1rem; margin: 1.4rem 0 .4rem; } main.legal p, main.legal li { line-height: 1.6; }
.deploy-log { white-space: pre-wrap; word-break: break-word; font-size: .8rem; max-height: 32rem; overflow: auto; border: 1px dashed var(--line); padding: .6rem .8rem; border-radius: 8px; }
.auth-form { max-width: 340px; margin: 3rem auto 0; display: flex; flex-direction: column; gap: 1.2rem; }
.auth-form h1 { text-align: center; margin: 0; }
.auth-form form { display: flex; flex-direction: column; gap: 1rem; }
.auth-form .field { display: flex; flex-direction: column; gap: .3rem; }
.auth-form label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.auth-form .btn { width: 100%; text-align: center; border: 0; }
.auth-form .error, .auth-form .notice { text-align: center; margin: 0; }
.auth-form .links { text-align: center; margin: 0; }
.landing { max-width: 960px; margin: 0 auto; padding: 0 1rem 4rem; display: flex; flex-direction: column; gap: 4rem; }
.landing-hero { text-align: center; padding: 3rem 0 1rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.landing-logo { width: 72px; height: 72px; }
.landing-hero h1 { font-size: 2.4rem; margin: 0; letter-spacing: -.02em; }
.landing-tagline { font-size: 1.15rem; font-weight: 600; margin: 0; }
.landing-lead { max-width: 560px; color: var(--muted); margin: 0; line-height: 1.6; }
.landing-hero .btn { margin-top: .5rem; padding: .7rem 1.6rem; font-size: 1rem; }
.landing-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.landing-feature { border: 1px solid var(--line); border-radius: 12px; padding: 1.4rem; }
.landing-feature h2 { font-size: 1rem; margin: 0 0 .5rem; }
.landing-feature p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.landing-ai { max-width: 680px; margin: 0 auto; text-align: center; }
.landing-ai h2 { font-size: 1.3rem; margin: 0 0 .6rem; }
.landing-ai p { color: var(--muted); line-height: 1.6; margin: 0; }
.landing-auth { display: flex; justify-content: center; }
.landing-auth .auth-form { margin: 0; padding: 2rem; border: 1px solid var(--line); border-radius: 16px; background: var(--ai); }
@media (max-width: 700px) {
  .landing-features { grid-template-columns: 1fr; }
}
