:root {
  --bg: #f5f3ee; --card: #fffdf9; --ink: #1d1f22; --sub: #6b6f76; --line: #e4e0d6;
  --accent: #1f6f5c; --accent-ink: #fff; --warn: #a15c07; --warn-bg: #fdf3e2; --bad: #b3261e;
  --claude: #c2603e; --codex: #2c3440;
  --r: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 17px/1.55 -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif; min-height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 18px 10px; background: rgba(245, 243, 238, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.brand { font-size: 22px; font-weight: 700; letter-spacing: 1px; }
.pc { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 12px; font-size: 14px; color: var(--sub); }
.pc .dot { width: 9px; height: 9px; border-radius: 50%; background: #b9b4a8; }
.pc.on .dot { background: #2f9e6f; box-shadow: 0 0 0 3px rgba(47, 158, 111, .18); }
.pc.on { color: var(--ink); }

main { padding: 6px 16px calc(96px + var(--safe-b)); max-width: 640px; margin: 0 auto; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; background: rgba(255, 253, 249, .96);
  border-top: 1px solid var(--line); padding: 6px 8px calc(6px + var(--safe-b)); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.tabs button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; color: var(--sub); padding: 4px 0; }
.tabs svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.on { color: var(--accent); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 12px 0; }
.card h2 { font-size: 17px; margin: 0 0 10px; }
.muted { color: var(--sub); font-size: 14px; }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

textarea, input[type=text], input[type=password], select {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; padding: 12px 14px; outline: none; }
textarea:focus, input:focus, select:focus { border-color: var(--accent); }
textarea.say { font-size: 20px; line-height: 1.5; min-height: 132px; resize: vertical; }
textarea.edit { font-size: 17px; min-height: 120px; resize: vertical; }

.btn { border: 0; border-radius: 14px; padding: 14px 18px; font-size: 18px; font-weight: 600; background: #ebe7dd; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { background: #f6e3e1; color: var(--bad); }
.btn.block { width: 100%; }
.btn.ghost { background: none; border: 1.5px solid var(--line); font-weight: 500; }
.btn.sm { font-size: 15px; padding: 8px 12px; border-radius: 10px; font-weight: 500; }
.btn:disabled { opacity: .5; }
.stack > * + * { margin-top: 10px; }

.target { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 15px; white-space: nowrap; }
.target .chip { min-width: 0; flex: 0 1 auto; }
.target .chip .ell { min-width: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 12px; font-size: 14px; max-width: 100%; }
.chip.x { padding-right: 6px; }
.chip .close { border: 0; background: #eee9de; border-radius: 50%; width: 22px; height: 22px; font-size: 14px; line-height: 1; }
.agent { display: inline-block; border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 700; color: #fff; letter-spacing: .3px; flex: none; }
.agent.claude { background: var(--claude); }
.agent.codex { background: var(--codex); }

.confirm .field { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.confirm .field:last-of-type { border-bottom: 0; }
.confirm .label { font-size: 13px; color: var(--sub); margin-bottom: 4px; }
.confirm .big { font-size: 19px; font-weight: 600; }
.note { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: 15px; }
.alts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.alts button { border: 1px dashed var(--warn); background: #fff; border-radius: 10px; padding: 6px 10px; font-size: 14px; text-align: left; }
.said { font-size: 14px; color: var(--sub); }
.loading { display: flex; align-items: center; gap: 10px; color: var(--sub); padding: 18px 4px; font-size: 17px; }
.spin { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.sec-title { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 4px 4px; font-size: 15px; color: var(--sub); }
.task { display: block; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 8px 0; }
.task .t1 { display: flex; align-items: center; gap: 8px; }
.task .sum { font-weight: 600; font-size: 17px; }
.task .t2 { margin-top: 4px; font-size: 14px; color: var(--sub); }
.st { flex: none; font-size: 13px; border-radius: 999px; padding: 2px 9px; background: #eee9de; color: var(--sub); }
.st.running, .st.dispatched { background: #e2f1ea; color: var(--accent); }
.st.queued { background: #eef0f7; color: #3d4b86; }
.st.done { background: #e8f3e6; color: #2d6a22; }
.st.failed { background: #f8e4e2; color: var(--bad); }
.pulse { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 5px; animation: pulse 1.2s ease-in-out infinite; vertical-align: 1px; }
@keyframes pulse { 50% { opacity: .25; } }

.seg { display: flex; background: #ebe7dd; border-radius: 12px; padding: 3px; margin: 10px 0; }
.seg button { flex: 1; border: 0; background: none; border-radius: 9px; padding: 8px 0; font-size: 15px; color: var(--sub); }
.seg button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.sess { display: block; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 8px 0; }
.sess .title { font-size: 17px; font-weight: 600; }
.sess .meta { font-size: 13px; color: var(--sub); margin-top: 3px; }
.sess.new { border-style: dashed; color: var(--accent); font-weight: 600; text-align: center; }
.busy { color: var(--accent); font-size: 13px; }

.back { border: 0; background: none; color: var(--accent); font-size: 17px; padding: 8px 0; }
.log { background: #1f2226; color: #d9dde3; border-radius: 12px; padding: 12px; font: 13px/1.6 ui-monospace, Menlo, Consolas, monospace; max-height: 46vh; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.log .ts { color: #7f8792; margin-right: 6px; }
.result { white-space: pre-wrap; word-break: break-word; font-size: 16px; line-height: 1.65; }
.prompt { white-space: pre-wrap; word-break: break-word; font-size: 15px; color: #3a3d42; }
.err { color: var(--bad); }
.code { font: 700 38px/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 6px; text-align: center; padding: 14px 0; user-select: all; -webkit-user-select: all; }
.kv { display: grid; grid-template-columns: 5.5em 1fr; gap: 6px 10px; font-size: 15px; }
.kv div:nth-child(odd) { color: var(--sub); }
.center { text-align: center; }
.login { max-width: 420px; margin: 8vh auto 0; }
.login h1 { font-size: 28px; margin: 0 0 6px; }
.link { border: 0; background: none; color: var(--accent); padding: 6px 0; font-size: 15px; }
.empty { text-align: center; color: var(--sub); padding: 24px 0; font-size: 15px; }

.toast { position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translateX(-50%); z-index: 9; background: rgba(29, 31, 34, .92); color: #fff;
  border-radius: 12px; padding: 10px 16px; font-size: 15px; max-width: 86vw; text-align: center; }
.flex-none { flex: none; }
