:root { --bg:#f6f7f9; --card:#fff; --ink:#1b1f24; --muted:#6b7280; --line:#e3e6ea; --accent:#2563eb; --ok:#16a34a; --warn:#d97706; --bad:#dc2626; }
* { box-sizing: border-box; }
body { margin:0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; background:var(--bg); color:var(--ink); }
header.top { display:flex; align-items:center; justify-content:space-between; padding:10px 20px; background:#fff; border-bottom:1px solid var(--line); }
.brand { font-weight:700; text-decoration:none; color:var(--ink); }
nav a, nav button.link { margin-left:16px; color:var(--accent); background:none; border:0; font:inherit; cursor:pointer; text-decoration:none; }
form.inline { display:inline; }
main { padding:20px; max-width:1400px; margin:0 auto; }
h1 { font-size:22px; margin:0 0 16px; } h2 { font-size:17px; margin:18px 0 8px; } h3 { font-size:13px; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); margin:18px 0 6px; }
.card { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:18px; }
.card.narrow { max-width:380px; margin:60px auto; }
.grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(260px, 1fr)); gap:16px; }
label { display:block; margin:10px 0; font-size:14px; }
input:not([type=checkbox]), textarea, select { width:100%; padding:8px 10px; border:1px solid var(--line); border-radius:6px; font:inherit; margin-top:4px; }
button, .button { padding:8px 14px; border:1px solid var(--line); border-radius:6px; background:#fff; font:inherit; cursor:pointer; color:var(--ink); text-decoration:none; display:inline-block; }
button.primary, .button.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
button:disabled { opacity:.5; cursor:default; }
.button.disabled { opacity:.45; pointer-events:none; }
.muted { color:var(--muted); } .small { font-size:12.5px; } .error { color:var(--bad); }
.dot { display:inline-block; width:10px; height:10px; border-radius:50%; background:#9ca3af; margin-right:6px; vertical-align:middle; }
.dot.running { background:var(--ok); } .dot.starting, .dot.cloning, .dot.stopping { background:var(--warn); } .dot.error { background:var(--bad); }
table { border-collapse:collapse; width:100%; background:#fff; border:1px solid var(--line); border-radius:8px; }
th, td { text-align:left; padding:7px 10px; border-bottom:1px solid var(--line); vertical-align:top; } th { font-size:12.5px; color:var(--muted); }
button.on { background:#dcfce7; border-color:#86efac; } button.off { color:var(--muted); }
details { background:#fff; border:1px solid var(--line); border-radius:8px; padding:10px 14px; margin:8px 0; } summary { cursor:pointer; font-weight:600; }
.form-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(260px, 1fr)); gap:4px 16px; } .form-grid .wide { grid-column:1 / -1; }

/* workspace */
.ws { display:grid; grid-template-columns:300px 1fr; gap:18px; height:calc(100vh - 90px); }
.side { background:#fff; border:1px solid var(--line); border-radius:10px; padding:14px; overflow:auto; }
.side h2 { margin:0 0 10px; }
.status-box { padding:8px 0; border-bottom:1px solid var(--line); }
.actions { display:flex; flex-wrap:wrap; gap:6px; margin:8px 0; } .actions button, .actions .button { font-size:13px; padding:6px 10px; }
#git-box { background:#f3f4f6; padding:8px; border-radius:6px; max-height:220px; overflow:auto; margin:0; }
.gf { font-family:ui-monospace, SFMono-Regular, Menlo, monospace; font-size:12px; padding:2px 0; word-break:break-all; } .gf .dir { color:var(--muted); } .gnote { margin-top:6px; }
a.commit { display:block; font-size:12.5px; color:var(--ink); text-decoration:none; padding:3px 6px; border-radius:4px; } a.commit:hover { background:#e5e7eb; } a.commit code { color:var(--accent); }
.chead { font-family:system-ui, sans-serif; margin-bottom:12px; } .csub { font-weight:600; font-size:15px; } .cbody { white-space:pre-wrap; margin-top:6px; font-size:13px; }
.add { color:var(--ok); font-weight:600; } .del { color:var(--bad); font-weight:600; } .new { color:var(--accent); font-weight:600; font-size:11px; }
.diff { font-family:ui-monospace, SFMono-Regular, Menlo, monospace; font-size:12.5px; max-height:72vh; overflow:auto; }
.dfile { padding:0; margin:0 0 10px; overflow:hidden; } .dfile summary { padding:8px 12px; background:#f3f4f6; font-family:system-ui, sans-serif; }
.dbody { padding:4px 0; } .dl { white-space:pre-wrap; padding:1px 12px 1px 28px; position:relative; line-height:1.45; }
.dl .sign { position:absolute; left:10px; color:var(--muted); } .dl.add { background:#dcfce7; } .dl.add .sign { color:#15803d; }
.dl.del { background:#fee2e2; } .dl.del .sign { color:#b91c1c; } .dl.hunk { color:var(--muted); background:#f8fafc; padding-left:12px; margin:6px 0 2px; border-top:1px dashed var(--line); }
#modal-body:not(.diff) { white-space:pre-wrap; font-family:ui-monospace, SFMono-Regular, Menlo, monospace; font-size:12.5px; max-height:70vh; overflow:auto; }
.sessions { list-style:none; padding:0; margin:8px 0; } .sessions li { padding:4px 6px; border-radius:4px; } .sessions li.active { background:#eef2ff; } .sessions a { color:var(--ink); text-decoration:none; font-size:13.5px; }
.chat { display:flex; flex-direction:column; background:#fff; border:1px solid var(--line); border-radius:10px; min-height:0; }
.messages { flex:1; overflow:auto; padding:16px; }
.hint { color:var(--muted); max-width:560px; margin:40px auto; text-align:center; }
.msg { max-width:820px; margin:0 0 14px; padding:10px 14px; border-radius:10px; white-space:pre-wrap; }
.msg.user { background:#eef2ff; margin-left:auto; } .msg.assistant { background:#f3f4f6; }
.msg .text p { margin:0 0 8px; } .msg .text p:last-child { margin:0; } .live { opacity:.85; }
.msg .text ul { margin:0 0 8px; padding-left:20px; } .msg .text code { background:#e5e7eb; padding:0 4px; border-radius:4px; font-size:13px; }
.msg.assistant, .msg.user { white-space:normal; } .msg.user .text { white-space:pre-wrap; }
.chip { display:inline-block; font-size:11.5px; background:#e5e7eb; border-radius:999px; padding:1px 8px; margin:0 4px 6px 0; color:#374151; white-space:nowrap; max-width:100%; overflow:hidden; text-overflow:ellipsis; }
.chip.denied { background:#fee2e2; color:#991b1b; }
.composer { display:flex; gap:8px; padding:12px; border-top:1px solid var(--line); } .composer textarea { width:100%; resize:vertical; margin:0; }
.composer-main { flex:1; position:relative; } .composer-side { display:flex; flex-direction:column; gap:6px; } .composer-side .button { text-align:center; }
.previews { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:6px; } .previews:empty { display:none; }
.previews .pv { position:relative; } .previews img { height:64px; border:1px solid var(--line); border-radius:6px; }
.previews .rm { position:absolute; top:-6px; right:-6px; width:20px; height:20px; border-radius:50%; background:#111; color:#fff; border:0; font-size:12px; line-height:20px; padding:0; cursor:pointer; }
.cmd-hints { position:absolute; bottom:100%; left:0; right:0; background:#fff; border:1px solid var(--line); border-radius:8px; box-shadow:0 4px 16px rgba(0,0,0,.08); padding:4px; margin-bottom:4px; z-index:5; }
.cmd-hints div { padding:6px 10px; border-radius:6px; cursor:pointer; font-size:13.5px; } .cmd-hints div:hover, .cmd-hints div.sel { background:#eef2ff; } .cmd-hints code { font-weight:600; }
.msg img.thumb { max-height:160px; max-width:100%; border-radius:6px; display:block; margin:0 0 6px; border:1px solid var(--line); }
#chat-status { padding:0 14px 8px; min-height:18px; }
dialog { max-width:92vw; width:1000px; border:1px solid var(--line); border-radius:10px; padding:16px; } dialog form { margin-top:12px; }
@media (max-width: 900px) { .ws { grid-template-columns:1fr; height:auto; } .chat { height:70vh; } }
