:root {
  --ink: #14231c;
  --muted: #69776f;
  --surface: rgba(255, 255, 255, .78);
  --surface-solid: #f9fbf9;
  --line: rgba(28, 58, 43, .11);
  --green: #176b49;
  --green-soft: #dff2e8;
  --amber: #b56b12;
  --red: #b5443f;
  --shadow: 0 22px 70px rgba(36, 68, 51, .12);
  --radius: 24px;
}

* { box-sizing: border-box; }
.launch-screen {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  color: #d8dee9;
  background: #090c10;
  opacity: 1;
  transition: opacity .32s ease, visibility .32s ease;
}
.launch-screen.ready { visibility: hidden; opacity: 0; pointer-events: none; }
.launch-mark { display: grid; width: 52px; height: 52px; place-items: center; margin-bottom: 18px; border: 1px solid #285d43; border-radius: 14px; color: #54d67d; background: #0c1712; font: 700 23px/1 "Microsoft YaHei UI", sans-serif; box-shadow: 0 0 32px rgba(63,185,80,.12); }
.launch-title { color: #f0f6fc; font: 700 20px/1.4 "Microsoft YaHei UI", sans-serif; letter-spacing: .05em; }
.launch-subtitle { margin-top: 9px; color: #7d8590; font: 11px/1.5 "Microsoft YaHei UI", sans-serif; }
.launch-progress { width: 128px; height: 2px; margin-top: 24px; overflow: hidden; border-radius: 999px; background: #1b222b; }
.launch-progress span { display: block; width: 42%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, transparent, #58a6ff, #3fb950, transparent); animation: launch-progress 1.05s ease-in-out infinite; }
@keyframes launch-progress { from { transform: translateX(-110%); } to { transform: translateX(340%); } }
html { min-height: 100%; background: #eef3ef; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(255,255,255,.9), transparent 30%),
    linear-gradient(145deg, #e9f0eb 0%, #f5f2e9 100%);
  overflow-x: hidden;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.ambient { position: fixed; border-radius: 999px; filter: blur(80px); opacity: .38; pointer-events: none; }
.ambient-a { width: 360px; height: 360px; background: #9bd1b5; top: -120px; right: -80px; }
.ambient-b { width: 280px; height: 280px; background: #ead49b; bottom: -100px; left: -70px; }

.app-shell { position: relative; width: 100%; max-width: 1440px; min-width: 0; min-height: 100vh; margin: 0 auto; padding: 30px 34px 40px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; }
.eyebrow, .kicker { margin: 0 0 6px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(30px, 4vw, 48px); letter-spacing: -.035em; }
h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.connection-pill { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.64); font-size: 13px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.security-button { padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: rgba(255,255,255,.64); font-size: 12px; font-weight: 700; }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: #d69535; box-shadow: 0 0 0 5px rgba(214,149,53,.12); }
.connection-pill.online .pulse-dot { background: #28a66a; box-shadow: 0 0 0 5px rgba(40,166,106,.12); animation: breathe 2.2s infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 8px rgba(40,166,106,.03); } }

.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.summary-card { display: flex; flex-direction: column; padding: 17px 19px; border: 1px solid var(--line); border-radius: 19px; background: rgba(255,255,255,.58); backdrop-filter: blur(18px); }
.summary-card strong { font-family: Georgia, serif; font-size: 27px; line-height: 1; }
.summary-card span { margin-top: 7px; color: var(--muted); font-size: 12px; }

.node-tabs { display: flex; width: 100%; max-width: 100%; gap: 9px; overflow-x: auto; padding: 3px 2px 14px; scrollbar-width: none; }
.node-tab { min-width: 112px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: rgba(255,255,255,.55); text-align: left; transition: .2s ease; }
.node-tab.active { color: white; background: var(--ink); transform: translateY(-1px); box-shadow: 0 12px 25px rgba(20,35,28,.16); }
.node-tab span { display: block; font-weight: 800; }
.node-tab small { display: block; margin-top: 4px; color: inherit; opacity: .65; }
.node-tab.offline { opacity: .48; }

.workspace-grid { display: grid; width: 100%; min-width: 0; grid-template-columns: 370px minmax(0, 1fr); gap: 16px; min-height: 630px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); backdrop-filter: blur(22px); box-shadow: var(--shadow); overflow: hidden; }
.session-panel { min-width: 0; max-width: 100%; }
.panel-heading, .conversation-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 22px; border-bottom: 1px solid var(--line); }
.heading-actions { display: flex; gap: 8px; align-items: center; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 13px; color: var(--green); background: white; font-size: 23px; }
.session-list { max-height: 680px; overflow-y: auto; padding: 10px; }
.session-item { width: 100%; display: grid; grid-template-columns: 12px 1fr auto; gap: 12px; align-items: start; padding: 15px 13px; border: 0; border-radius: 16px; color: inherit; background: transparent; text-align: left; }
.session-item > span:nth-child(2) { min-width: 0; }
.session-item:hover, .session-item.active { background: rgba(222,238,228,.78); }
.state-dot { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: #a7b0aa; }
.state-dot.active { background: #21a367; box-shadow: 0 0 0 5px rgba(33,163,103,.1); }
.state-dot.open { background: #438d74; box-shadow: 0 0 0 4px rgba(67,141,116,.09); }
.state-dot.systemError { background: var(--red); }
.session-name { display: block; overflow: hidden; font-weight: 800; white-space: nowrap; text-overflow: ellipsis; }
.session-preview { display: -webkit-box; margin-top: 5px; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.5; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.session-time { color: var(--muted); font-size: 10px; white-space: nowrap; }
.list-empty { padding: 50px 20px; color: var(--muted); text-align: center; }

.conversation-panel { position: relative; display: flex; flex-direction: column; min-width: 0; }
.empty-state { margin: auto; padding: 60px 20px; color: var(--muted); text-align: center; }
.empty-state h2 { margin: 18px 0 8px; color: var(--ink); }
.empty-orbit { position: relative; width: 70px; height: 70px; margin: auto; border: 1px solid rgba(23,107,73,.2); border-radius: 50%; }
.empty-orbit:after { content: ""; position: absolute; inset: 13px; border: 1px solid rgba(23,107,73,.35); border-radius: 50%; }
.empty-orbit span { position: absolute; width: 12px; height: 12px; top: 7px; left: 29px; border-radius: 50%; background: var(--green); box-shadow: 0 0 22px rgba(23,107,73,.5); }
.conversation { display: flex; flex: 1; min-height: 0; flex-direction: column; }
.session-breadcrumb { margin-bottom: 5px; color: var(--green); font-size: 12px; font-weight: 800; }
.status-chip { padding: 7px 11px; border-radius: 999px; background: #edf1ee; font-size: 12px; font-weight: 800; white-space: nowrap; }
.status-chip.active { color: #11603e; background: var(--green-soft); }
.status-chip.open { color: #176b49; background: #e6f1eb; }
.metadata { display: flex; flex-wrap: wrap; gap: 8px; padding: 13px 22px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.metadata span { padding: 5px 8px; border-radius: 8px; background: rgba(238,242,239,.8); }
.timeline { flex: 1; min-height: 300px; max-height: 470px; overflow-y: auto; padding: 22px; scroll-behavior: smooth; }
.event { margin-bottom: 14px; padding: 13px 15px; border-left: 3px solid #c8d3cc; border-radius: 4px 14px 14px 4px; background: rgba(247,249,247,.86); }
.event.agent { border-color: var(--green); background: rgba(230,243,235,.82); }
.event.command { border-color: #b88635; font-family: Consolas, monospace; }
.event.error { border-color: var(--red); }
.event-label { margin-bottom: 6px; color: var(--muted); font: 700 10px/1 system-ui; letter-spacing: .08em; text-transform: uppercase; }
.event-body { white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.65; }
.history-more { display: block; margin: 0 auto 18px; color: var(--green); background: rgba(255,255,255,.8); }

.approval-box { margin: 0 18px 14px; padding: 16px; border: 1px solid rgba(181,107,18,.24); border-radius: 17px; background: #fff8e9; }
.button-row, .composer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.composer { padding: 15px 18px 18px; border-top: 1px solid var(--line); background: rgba(250,252,250,.82); }
.composer textarea, .auth-card input { width: 100%; resize: none; outline: none; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: white; padding: 13px 14px; transition: .2s; }
.composer textarea:focus, .auth-card input:focus { border-color: rgba(23,107,73,.55); box-shadow: 0 0 0 4px rgba(23,107,73,.07); }
.composer-actions { justify-content: flex-end; }
.button { border: 1px solid var(--line); border-radius: 12px; padding: 10px 13px; color: var(--ink); background: white; font-weight: 750; font-size: 12px; }
.button.primary { border-color: var(--green); color: white; background: var(--green); }
.button.danger { color: var(--red); }
.button.subtle { background: transparent; }
.button:disabled { cursor: not-allowed; opacity: .45; }

.auth-layer { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(230,237,232,.82); backdrop-filter: blur(18px); }
.auth-card { width: min(400px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 28px; background: white; box-shadow: var(--shadow); }
.brand-mark { display: grid; width: 48px; height: 48px; margin-bottom: 20px; place-items: center; border-radius: 15px; color: white; background: var(--green); font-family: Georgia, serif; font-size: 24px; }
.auth-card p { color: var(--muted); line-height: 1.6; }
.auth-card .button { width: 100%; margin-top: 12px; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0 3px; color: var(--muted); font-size: 11px; text-align: center; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.token-login input { margin-top: 10px; }
.security-actions { margin-top: 10px; }
.form-error { min-height: 20px; margin-top: 10px; color: var(--red); font-size: 12px; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: 25px; max-width: calc(100vw - 32px); padding: 11px 15px; border-radius: 12px; color: white; background: rgba(20,35,28,.92); opacity: 0; pointer-events: none; transform: translate(-50%, 16px); transition: .22s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 820px) {
  .app-shell { padding: max(18px, env(safe-area-inset-top)) 14px calc(22px + env(safe-area-inset-bottom)); }
  .topbar { margin-bottom: 17px; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-grid { display: block; min-height: 0; }
  .session-panel { min-height: 520px; }
  .conversation-panel { position: fixed; z-index: 10; inset: 0; border: 0; border-radius: 0; background: #f7faf7; transform: translateX(105%); transition: transform .25s ease; }
  .conversation-panel.mobile-open { transform: translateX(0); }
  .conversation-head { padding-top: max(18px, env(safe-area-inset-top)); }
  .conversation-head:before { content: "‹"; margin-right: 2px; font-size: 32px; cursor: pointer; }
  .timeline { max-height: none; }
  .composer { padding-bottom: calc(15px + env(safe-area-inset-bottom)); }
  .composer-actions .button { flex: 1 1 calc(50% - 8px); }
}

/* Pure terminal theme. Keep this block last so it deliberately replaces the
   original dashboard styling without changing any realtime behavior. */
:root {
  --term-bg: #090c10;
  --term-panel: #0d1117;
  --term-panel-2: #11161d;
  --term-hover: #161b22;
  --term-border: #30363d;
  --term-text: #d8dee9;
  --term-bright: #f0f6fc;
  --term-muted: #7d8590;
  --term-green: #3fb950;
  --term-blue: #58a6ff;
  --term-amber: #d29922;
  --term-red: #f85149;
}

html, body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  color: var(--term-text);
  background: var(--term-bg);
  font-family: "Cascadia Code", "JetBrains Mono", Consolas, "Microsoft YaHei UI", monospace;
}

button, input, textarea { font-family: inherit; }
.ambient, .summary { display: none !important; }

.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: none;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  padding: 0;
  background: var(--term-bg);
}

.topbar {
  flex: 0 0 42px;
  min-height: 42px;
  margin: 0;
  padding: 0 12px;
  border-bottom: 1px solid var(--term-border);
  color: var(--term-bright);
  background: var(--term-panel);
}

.topbar > div:first-child { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.eyebrow { margin: 0; color: var(--term-muted); font-size: 11px; font-weight: 400; letter-spacing: 0; text-transform: none; }
h1 { margin: 0; overflow: hidden; color: var(--term-bright); font-family: inherit; font-size: 13px; font-weight: 600; letter-spacing: 0; white-space: nowrap; text-overflow: ellipsis; }
h1::before { content: "$ "; color: var(--term-green); }
h2 { color: var(--term-bright); font-size: 13px; font-weight: 600; letter-spacing: 0; }

.connection-pill {
  gap: 7px;
  padding: 3px 7px;
  border: 1px solid var(--term-border);
  border-radius: 2px;
  color: var(--term-muted);
  background: transparent;
  font-size: 10px;
  font-weight: 400;
}
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--term-amber); box-shadow: none; }
.connection-pill.online .pulse-dot { background: var(--term-green); box-shadow: none; animation: none; }

.node-tabs {
  flex: 0 0 38px;
  width: 100%;
  height: 38px;
  gap: 0;
  overflow-x: auto;
  padding: 0 8px;
  border-bottom: 1px solid var(--term-border);
  background: var(--term-panel);
}
.node-tab {
  min-width: auto;
  height: 37px;
  padding: 6px 14px;
  border: 0;
  border-right: 1px solid #21262d;
  border-radius: 0;
  color: var(--term-muted);
  background: transparent;
  text-align: left;
  transition: none;
}
.node-tab:first-child { border-left: 1px solid #21262d; }
.node-tab:hover { color: var(--term-text); background: var(--term-hover); }
.node-tab.active { border-bottom: 2px solid var(--term-blue); color: var(--term-bright); background: var(--term-hover); box-shadow: none; transform: none; }
.node-tab span { font-size: 11px; font-weight: 600; }
.node-tab small { margin-top: 1px; font-size: 9px; opacity: .7; }

.workspace-grid {
  display: grid;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 0;
}
.panel { min-height: 0; border: 0; border-radius: 0; background: var(--term-bg); box-shadow: none; backdrop-filter: none; }
.session-panel { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--term-border); background: var(--term-panel); }
.panel-heading, .conversation-head {
  flex: 0 0 48px;
  min-height: 48px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--term-border);
  background: var(--term-panel);
}
.kicker { margin: 0 0 2px; color: var(--term-muted); font-size: 9px; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; }
.heading-actions { gap: 4px; }
.icon-button {
  width: 27px;
  height: 27px;
  padding: 0;
  border: 1px solid var(--term-border);
  border-radius: 2px;
  color: var(--term-text);
  background: transparent;
  font-size: 16px;
}
.icon-button:hover { color: var(--term-bright); background: var(--term-hover); }
.session-list { flex: 1; min-height: 0; max-height: none; overflow-y: auto; padding: 3px; }
.session-select-wrap { width: 100%; padding: 9px; }
.session-select {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 34px 0 11px;
  border: 1px solid var(--term-border);
  border-radius: 6px;
  color: var(--term-bright);
  background: #0e131a;
  font: inherit;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}
.session-select:hover { border-color: #3b4654; background: #121923; }
.session-select:focus { border-color: var(--term-blue); box-shadow: 0 0 0 2px rgba(47,129,247,.16); }
.session-select option { color: var(--term-text); background: #0e131a; }
.session-item {
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 8px;
  padding: 9px 7px;
  border: 0;
  border-radius: 0;
  color: var(--term-text);
  background: transparent;
}
.session-item:hover, .session-item.active { background: var(--term-hover); }
.session-item.active { box-shadow: inset 2px 0 var(--term-blue); }
.state-dot { width: 6px; height: 6px; margin-top: 5px; box-shadow: none !important; }
.state-dot.active { background: var(--term-green); }
.state-dot.open { background: var(--term-blue); }
.state-dot.systemError { background: var(--term-red); }
.session-name { color: var(--term-bright); font-size: 11px; font-weight: 500; }
.session-preview { margin-top: 3px; color: var(--term-muted); font-size: 10px; line-height: 1.4; }
.session-time { color: #545d68; font-size: 9px; }
.list-empty { padding: 32px 12px; color: var(--term-muted); font-size: 11px; text-align: center; }

.conversation-panel { display: flex; min-width: 0; min-height: 0; flex-direction: column; background: var(--term-bg); }
.empty-state { margin: auto; padding: 30px 18px; color: var(--term-muted); font-size: 11px; }
.empty-state h2 { margin: 0 0 8px; color: var(--term-text); }
.empty-state p { margin: 0; }
.empty-orbit { display: none; }
.conversation { flex: 1; min-height: 0; }
.conversation-head { color: var(--term-text); }
.session-breadcrumb { margin-bottom: 2px; color: var(--term-blue); font-size: 9px; font-weight: 400; }
.status-chip { padding: 3px 6px; border: 1px solid var(--term-border); border-radius: 2px; color: var(--term-muted); background: transparent; font-size: 9px; font-weight: 400; }
.status-chip.active, .status-chip.open { border-color: #238636; color: var(--term-green); background: transparent; }
.metadata {
  flex: 0 0 auto;
  gap: 12px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--term-border);
  color: var(--term-muted);
  background: var(--term-panel);
  font-size: 9px;
}
.metadata span { padding: 0; border-radius: 0; background: transparent; }
.metadata span::before { content: "· "; color: #545d68; }
.metadata .sync-warning { color: var(--term-amber); }
.working-bar { display: flex; flex: 0 0 34px; align-items: center; gap: 7px; padding: 6px 12px; border-bottom: 1px solid #1e2935; color: #a9c7df; background: #0b1219; font-size: 10px; }
.working-spinner { width: 10px; height: 10px; border: 2px solid #25445d; border-top-color: var(--term-blue); border-radius: 50%; animation: working-spin .8s linear infinite; }
.working-label {
  color: transparent;
  background-image: linear-gradient(
    100deg,
    #58a6ff 0%,
    #58a6ff 34%,
    #d9efff 46%,
    #ffffff 50%,
    #8fd3ff 56%,
    #58a6ff 68%,
    #58a6ff 100%
  );
  background-size: 260% 100%;
  background-position: 120% 0;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
  animation: working-text-shimmer 2.15s linear infinite;
}
.working-time { color: var(--term-muted); font-variant-numeric: tabular-nums; }
.working-detail { min-width: 0; overflow: hidden; color: #8ea4b6; white-space: nowrap; text-overflow: ellipsis; }
.working-stop { margin-left: auto; padding: 4px 9px; border: 1px solid #743431; border-radius: 4px; color: #ff8b84; background: #1b0e0e; font: 600 10px/1.2 inherit; }
.working-stop:hover { border-color: var(--term-red); background: #271212; }
@keyframes working-spin { to { transform: rotate(360deg); } }
@keyframes working-text-shimmer {
  from { background-position: 120% 0; }
  to { background-position: -140% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .working-label { animation-duration: 5s; }
}
.timeline-shell { position: relative; display: flex; flex: 1; min-height: 0; }
.timeline {
  flex: 1;
  width: 100%;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding: 8px 14px 14px;
  background: var(--term-bg);
  scroll-behavior: auto;
  overscroll-behavior-y: contain;
  overflow-anchor: none;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}
.latest-button { position: absolute; z-index: 3; right: 12px; bottom: 10px; padding: 6px 10px; border: 1px solid #28557a; border-radius: 999px; color: #c7e1f8; background: rgba(13,28,42,.96); box-shadow: 0 5px 18px rgba(0,0,0,.35); font: 600 10px/1.2 inherit; }
.latest-button:hover { border-color: var(--term-blue); color: #fff; }
.event {
  margin: 0;
  padding: 9px 4px 10px 10px;
  border: 0;
  border-bottom: 1px solid #161b22;
  border-left: 2px solid #30363d;
  border-radius: 0;
  color: var(--term-text);
  background: transparent;
}
.event.agent { border-left-color: var(--term-green); background: transparent; }
.event.pending { border-left-color: var(--term-blue); opacity: .72; }
.event.command { border-left-color: var(--term-amber); color: #c9d1d9; background: transparent; font-family: inherit; }
.event.error { border-left-color: var(--term-red); }
.event-label { margin-bottom: 5px; color: var(--term-muted); font: 500 9px/1 inherit; letter-spacing: .04em; text-transform: none; }
.event.agent .event-label { color: var(--term-green); }
.event-body { color: inherit; white-space: normal; word-break: break-word; font-size: 12px; line-height: 1.55; }
.event-body .plain-text, .event-body .md-line { white-space: pre-wrap; }
.event-body strong { color: #f3f6fa; font-weight: 700; }
.event-body code {
  padding: 0 0.25em;
  border: 1px solid #263342;
  border-radius: 3px;
  background: #111820;
  color: #d7e7f7;
  font-family: inherit;
}
.event-body h1, .event-body h2, .event-body h3, .event-body h4, .event-body h5, .event-body h6 { margin: .8em 0 .35em; color: var(--term-bright); font: 700 1em/1.35 inherit; }
.event-body h1 { font-size: 1.25em; }
.event-body h2 { font-size: 1.16em; }
.event-body h3 { font-size: 1.08em; }
.event-body ul, .event-body ol { margin: .4em 0 .55em; padding-left: 1.8em; }
.event-body li { margin: .18em 0; }
.event-body .md-task { list-style: none; margin-left: -1.35em; }
.event-body .md-checkbox { display: inline-flex; width: 1em; height: 1em; margin-right: .45em; align-items: center; justify-content: center; border: 1px solid #596777; border-radius: 3px; color: var(--term-green); font-size: .82em; vertical-align: -.08em; }
.event-body pre { margin: .55em 0; padding: 9px 10px; overflow-x: auto; border: 1px solid #263342; background: #070a0e; white-space: pre; }
.event-body pre code { padding: 0; border: 0; background: transparent; }
.event-body blockquote { margin: .5em 0; padding: .2em 0 .2em .8em; border-left: 2px solid var(--term-blue); color: #aab5c2; }
.event-body a { color: var(--term-blue); text-decoration: none; }
.event-body a:hover { text-decoration: underline; }
.event-body hr { height: 1px; margin: .7em 0; border: 0; background: var(--term-border); }
.event-body .md-gap { height: .55em; }
.md-table-wrap { max-width: 100%; margin: .5em 0; overflow-x: auto; }
.event-body table { width: max-content; min-width: 100%; border-collapse: collapse; }
.event-body th, .event-body td { padding: 5px 7px; border: 1px solid var(--term-border); text-align: left; }
.event-body th { color: var(--term-bright); background: var(--term-panel-2); }
.history-more { margin: 7px auto; color: var(--term-blue); background: transparent; }

.approval-box { margin: 0; padding: 10px 12px; border: 0; border-top: 1px solid var(--term-amber); border-radius: 0; color: var(--term-text); background: #16120a; }
.button-row, .composer-actions { gap: 5px; margin-top: 7px; }
.composer { flex: 0 0 auto; padding: 8px 10px 9px; border-top: 1px solid var(--term-border); background: var(--term-panel); }
.terminal-input-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 50px; gap: 7px; align-items: stretch; }
.terminal-prompt { padding: 9px 0 0 2px; color: var(--term-green); font-size: 16px; line-height: 1; }
.input-tools { display: flex; gap: 4px; align-items: flex-end; padding-bottom: 1px; }
.input-tool { width: 29px; height: 29px; padding: 0; border: 1px solid var(--term-border); border-radius: 4px; color: var(--term-muted); background: var(--term-bg); font: 600 15px/1 inherit; }
.input-tool:hover, .input-tool.active { border-color: var(--term-blue); color: var(--term-blue); background: var(--term-hover); }
.attachment-list { display: flex; gap: 5px; margin-bottom: 6px; overflow-x: auto; }
.attachment-chip { display: flex; flex: 0 0 auto; max-width: 210px; align-items: center; gap: 5px; padding: 4px 6px; border: 1px solid #293646; border-radius: 5px; color: #b9c6d3; background: #0c1219; font-size: 9px; }
.attachment-chip span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.attachment-chip button { padding: 0; border: 0; color: #788594; background: transparent; font: 13px/1 inherit; }
.terminal-send { border: 1px solid #238636; border-radius: 5px; color: white; background: #238636; font: 600 11px/1 inherit; }
.terminal-send:hover { border-color: var(--term-green); background: var(--term-hover); }
.terminal-send:disabled { cursor: wait; opacity: .65; }
.composer textarea, .auth-card input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--term-border);
  border-radius: 2px;
  outline: none;
  color: var(--term-bright);
  background: var(--term-bg);
  caret-color: var(--term-green);
}
.composer textarea:focus, .auth-card input:focus { border-color: var(--term-blue); box-shadow: none; }
.composer textarea.voice-recording { border-color: var(--term-green); background: #0b1711; box-shadow: 0 0 0 2px rgba(63,185,80,.1); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.composer textarea.voice-cancel { border-color: var(--term-red); background: #1a0d0d; }
.composer textarea::placeholder, .auth-card input::placeholder { color: #545d68; }
.composer-actions { justify-content: flex-end; }
.button {
  padding: 6px 9px;
  border: 1px solid var(--term-border);
  border-radius: 2px;
  color: var(--term-text);
  background: transparent;
  font-size: 10px;
  font-weight: 500;
}
.button:hover { color: var(--term-bright); background: var(--term-hover); }
.button.primary { border-color: #238636; color: #fff; background: #238636; }
.button.primary:hover { background: #2ea043; }
.button.danger { border-color: #6e2825; color: var(--term-red); }
.button.subtle { background: transparent; }

.auth-layer { background: rgba(9, 12, 16, .96); backdrop-filter: none; }
.auth-card { width: min(430px, 100%); padding: 22px; border: 1px solid var(--term-border); border-radius: 2px; color: var(--term-text); background: var(--term-panel); box-shadow: none; }
.brand-mark { width: auto; height: auto; margin-bottom: 16px; place-items: start; border-radius: 0; color: var(--term-green); background: transparent; font-family: inherit; font-size: 13px; }
.brand-mark::before { content: "$ codex login "; }
.auth-card p { color: var(--term-muted); font-size: 11px; line-height: 1.6; }
.topbar-actions { display: flex; align-items: center; gap: 7px; }
.security-button {
  padding: 4px 7px;
  border: 1px solid var(--term-border);
  border-radius: 2px;
  color: var(--term-muted);
  background: transparent;
  font-size: 9px;
}
.security-button:hover { color: var(--term-bright); border-color: #4b5561; background: var(--term-hover); }
.passkey-button { min-height: 38px; }
.auth-divider { color: var(--term-muted); }
.auth-divider::before, .auth-divider::after { background: var(--term-border); }
.token-login input { border-radius: 2px; color: var(--term-text); background: #090c10; }
.form-error { color: var(--term-red); }
.toast { bottom: 14px; padding: 7px 10px; border: 1px solid var(--term-border); border-radius: 2px; color: var(--term-text); background: var(--term-panel-2); font-size: 10px; }

* { scrollbar-width: thin; scrollbar-color: #30363d #0d1117; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: var(--term-panel); }
*::-webkit-scrollbar-thumb { background: #30363d; }

@media (max-width: 820px) {
  html, body {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }
  .app-shell {
    position: fixed;
    inset: 0;
    height: var(--console-viewport-height, 100dvh);
    max-height: var(--console-viewport-height, 100dvh);
    padding: 0;
  }
  .topbar {
    flex: 0 0 calc(40px + env(safe-area-inset-top));
    min-height: calc(40px + env(safe-area-inset-top));
    margin: 0;
    padding: env(safe-area-inset-top) 9px 0;
  }
  .eyebrow { display: none; }
  .node-tabs { display: grid; flex: 0 0 46px; height: 46px; grid-template-columns: repeat(var(--node-count, 5), minmax(0, 1fr)); overflow: clip; padding: 0 4px; background: #0b0f14; }
  .node-tab { width: 100%; min-width: 0; height: 45px; padding: 7px 2px 5px; border-right-color: #20262e; text-align: center; }
  .node-tab:first-child { border-left: 0; }
  .node-tab span { overflow: hidden; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
  .node-tab.active { border-bottom-width: 3px; background: #121923; }
  .node-tab small { display: none; }
  .workspace-grid { display: flex; flex: 1; min-height: 0; flex-direction: column; }
  .session-panel { display: flex; flex: 0 0 62px; width: 100%; min-height: 0; border-right: 0; border-bottom: 1px solid var(--term-border); background: #0b0f14; }
  .session-panel .panel-heading { display: none; }
  .session-list { display: flex; gap: 5px; width: 100%; overflow-x: auto; overflow-y: hidden; padding: 5px 6px 6px; scroll-snap-type: x proximity; }
  .session-item { flex: 0 0 min(202px, calc(50vw - 9px)); height: 50px; padding: 7px 8px; border: 1px solid #222a34; border-radius: 6px; background: #0e131a; scroll-snap-align: start; }
  .session-item:hover { background: #121923; }
  .session-item.active { border-color: #294a68; background: #111b26; box-shadow: inset 0 -2px var(--term-blue); }
  .session-item .session-name { display: -webkit-box; overflow: hidden; color: #e6edf3; white-space: normal; line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .session-item .session-preview { display: none; }
  .session-item .session-time { color: #65707d; font-size: 8px; }
  .conversation-panel { position: static; flex: 1 1 auto; width: 100%; height: auto; min-height: 0; border: 0; border-radius: 0; background: var(--term-bg); transform: none; transition: none; }
  .conversation-panel.mobile-open { transform: none; }
  .conversation-head { display: none; }
  .conversation-head:before { content: none; }
  .metadata { flex: 0 0 28px; min-width: 0; padding: 6px 10px; background: #0c1117; }
  .metadata span:first-child, .metadata span:nth-child(3) { display: none; }
  .metadata span:nth-child(2) { display: block; width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .working-bar { flex-basis: 32px; padding: 5px 9px; }
  .working-detail { flex: 1; font-size: 9px; }
  .timeline { max-height: none; padding: 7px 7px 11px; }
  .latest-button { right: 9px; bottom: 8px; min-height: 34px; padding: 7px 11px; }
  .event { margin: 0 0 6px; padding: 9px 9px 10px; border: 1px solid #171e26; border-left: 3px solid #30363d; border-radius: 6px; background: #0b0f14; }
  .event.agent { border-color: #173c29; border-left-color: var(--term-green); background: #0b1210; }
  .event.pending { border-color: #18334d; border-left-color: var(--term-blue); background: #0b1118; }
  .event.command { border-color: #3a2b13; border-left-color: var(--term-amber); background: #100e0a; }
  .event-body { font-size: 11px; line-height: 1.62; }
  .event-label { margin-bottom: 6px; }
  .composer { padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); background: #0b0f14; }
  .terminal-input-row { grid-template-columns: 32px minmax(0, 1fr) 52px; gap: 6px; }
  .input-tools { justify-content: flex-end; }
  .input-tool { width: 30px; height: 100%; min-height: 44px; font-size: 17px; }
  .composer textarea { border-radius: 6px; background: #080c11; }
  .terminal-send { border-radius: 6px; background: #238636; }
  .composer-actions .button { flex: 1 1 calc(50% - 5px); }
  .connection-pill { padding: 3px 5px; }
  .security-button { min-height: 28px; padding: 3px 6px; }
  .auth-layer { padding: max(14px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom)); }
  .auth-card { width: 100%; max-width: 390px; padding: 18px 16px; }
  .auth-card h2 { font-size: 17px; }
  .auth-card p { margin: 9px 0; font-size: 11px; }
  .auth-card .button { min-height: 42px; }
}

/* Minimal Codex CLI surface. */
.working-bar {
  position: sticky;
  z-index: 3;
  bottom: 0;
  width: 100%;
  box-sizing: border-box;
  min-height: 38px;
  gap: 6px;
  padding: 7px 14px;
  border-top: 1px solid var(--term-border);
  border-bottom: 0;
  color: var(--term-text);
  background: rgba(9, 12, 16, .97);
  box-shadow: 0 -8px 18px rgba(0, 0, 0, .24);
  font-size: 11px;
}
.working-bullet {
  color: var(--term-blue);
  font-size: 9px;
  animation: cli-working-pulse 1.35s ease-in-out infinite;
}
.working-label { color: var(--term-bright); font-weight: 700; }
.working-meta { color: var(--term-muted); white-space: nowrap; }
.working-separator { color: #4b5561; }
.working-time { color: var(--term-muted); }
.working-stop {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--term-muted);
  background: transparent;
  font: inherit;
}
.working-stop:hover { color: var(--term-red); background: transparent; }
.working-detail { color: var(--term-muted); }
@keyframes cli-working-pulse { 50% { opacity: .28; } }

.event,
.event.agent,
.event.pending,
.event.command,
.event.error {
  margin: 0;
  padding: 10px 7px 11px;
  border: 0;
  border-bottom: 1px solid #151a20;
  border-radius: 0;
  background: transparent;
}
.event-label { margin-bottom: 6px; font-size: 9px; }
.event-body { font-size: 12px; line-height: 1.62; }

.composer { position: relative; padding: 10px 12px 12px; background: #0b0f14; }
.voice-draft {
  position: absolute;
  z-index: 14;
  right: 12px;
  bottom: calc(100% + 8px);
  left: 12px;
  overflow: hidden;
  border: 1px solid #4b5562;
  border-radius: 10px;
  background: #151a20;
  box-shadow: 0 -14px 38px rgba(0,0,0,.48);
}
.voice-draft.recording { border-color: rgba(63,185,80,.82); }
.voice-draft.voice-cancel { border-color: var(--term-red); background: #1a0d0d; }
.voice-draft-head {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-bottom: 1px solid var(--term-border);
  color: #aab4c0;
  font-size: 12px;
}
.voice-draft-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--term-green); }
.voice-draft.recording .voice-draft-dot { animation: working-pulse .75s ease-in-out infinite alternate; }
.voice-draft.voice-cancel .voice-draft-dot { background: var(--term-red); }
.voice-draft textarea {
  display: block;
  width: 100%;
  min-height: 88px;
  max-height: min(180px, 30vh);
  resize: none;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  outline: 0;
  padding: 12px;
  color: var(--term-text);
  background: #0d1218;
  font: 14px/1.65 inherit;
}
.voice-draft textarea[readonly] { color: #eef4fb; }
.voice-draft-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--term-border); }
.voice-draft-actions button { min-width: 64px; border: 1px solid #4b5562; border-radius: 6px; padding: 7px 12px; color: var(--term-text); background: transparent; }
.voice-draft-actions button.primary { border-color: var(--term-green); color: #8fe29f; }
.voice-draft-actions button:disabled { opacity: .38; }
.command-palette {
  position: absolute;
  z-index: 12;
  right: 12px;
  bottom: calc(100% + 1px);
  left: 12px;
  max-height: min(300px, 48vh);
  overflow-y: auto;
  border: 1px solid var(--term-border);
  background: #11151a;
  box-shadow: 0 -12px 35px rgba(0,0,0,.38);
}
.command-option {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(110px, 25%) minmax(0, 1fr);
  gap: 18px;
  padding: 9px 14px;
  border: 0;
  color: var(--term-muted);
  background: transparent;
  text-align: left;
}
.command-option:hover, .command-option.active { color: var(--term-text); background: #1a1e23; }
.command-option:disabled { opacity: .35; }
.command-option code { color: var(--term-text); background: transparent; font: 600 11px/1.4 inherit; }
.command-option.active code { color: #42d5ff; }
.command-option span { overflow: hidden; font-size: 10px; line-height: 1.45; text-overflow: ellipsis; }

.terminal-input-row {
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 0;
  overflow: hidden;
  border: 1px solid #3a4048;
  background: #292c31;
}
.terminal-input-row:focus-within { border-color: #626b76; }
.terminal-editor { position: relative; display: flex; min-width: 0; align-items: stretch; }
.terminal-editor .terminal-prompt {
  position: absolute;
  z-index: 2;
  top: 13px;
  left: 12px;
  padding: 0;
  color: var(--term-blue);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}
.composer .terminal-editor textarea {
  min-height: 46px;
  max-height: 132px;
  padding: 11px 12px 10px 34px;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  line-height: 1.55;
  touch-action: manipulation;
}
.composer .terminal-editor textarea:focus { border-color: transparent; box-shadow: none; }
.composer .terminal-editor textarea.voice-only {
  cursor: default;
  touch-action: manipulation;
  caret-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.composer .terminal-editor textarea.voice-only::placeholder {
  color: #717b88;
  font-size: 14px;
  letter-spacing: -.04em;
  text-align: center;
  opacity: 1;
}
.voice-composer-hint {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  box-sizing: border-box;
  place-items: center;
  padding: 0 34px;
  color: #717b88;
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: -.04em;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}
.voice-composer-hint.hidden { display: none; }
.terminal-send {
  min-height: 46px;
  border: 0;
  border-left: 1px solid #3a4048;
  border-radius: 0;
  background: transparent;
}
.terminal-send { color: var(--term-green); font-size: 18px; }
.terminal-send:hover { border-color: var(--term-green); color: #fff; background: #112016; }

@media (max-width: 820px) {
  .session-panel { flex-basis: 42px; }
  .session-list { display: block; padding: 0; overflow: visible; }
  .session-select-wrap { padding: 4px 7px; }
  .session-select { height: 33px; padding-left: 9px; border-radius: 5px; font-size: 11px; }
  .session-item {
    flex: 0 0 auto;
    width: auto;
    height: 41px;
    grid-template-columns: 7px auto;
    gap: 7px;
    padding: 8px 3px 7px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
  }
  .session-item:hover { background: transparent; }
  .session-item.active { border-color: var(--term-blue); background: transparent; box-shadow: none; }
  .session-item .session-name { display: block; max-width: 145px; white-space: nowrap; font-size: 11px; }
  .session-item .session-time, .session-item .session-preview { display: none; }
  .metadata { flex-basis: 29px; padding: 6px 10px; font-size: 10px; }
  .metadata span:first-child { display: block; width: 100%; overflow: hidden; color: #9aa7b5; white-space: nowrap; text-overflow: ellipsis; }
  .metadata span:nth-child(2), .metadata span:nth-child(3) { display: none; }
  .working-bar { flex-basis: 38px; min-height: 38px; padding: 7px 10px; font-size: 12px; }
  .working-detail { font-size: 10px; }
  .timeline { padding: 4px 10px 9px; }
  .event, .event.agent, .event.pending, .event.command, .event.error { margin: 0; padding: 10px 3px 11px; }
  .event-label { font-size: 10px; }
  .event-body { font-size: 12px; line-height: 1.68; }
  .composer { padding: 8px 9px calc(8px + env(safe-area-inset-bottom)); }
  .command-palette { right: 9px; left: 9px; }
  .command-option { grid-template-columns: 108px minmax(0,1fr); gap: 10px; padding: 10px 12px; }
  .command-option code { font-size: 12px; }
  .command-option span { font-size: 11px; }
  .terminal-input-row { min-height: 64px; grid-template-columns: minmax(0, 1fr) 46px; }
  .composer .terminal-editor textarea {
    min-height: 64px;
    padding-top: 18px;
    padding-bottom: 17px;
  }
  .composer .terminal-editor textarea.voice-only {
    padding-right: 34px;
  }
  .terminal-editor .terminal-prompt { top: 21px; }
  .terminal-send { min-height: 64px; }
  .voice-draft { right: 9px; left: 9px; bottom: calc(100% + 6px); }
  .voice-draft textarea { min-height: 94px; font-size: 14px; }
}

.working-bullet {
  color: var(--term-blue);
  animation: working-pulse .9s ease-in-out infinite alternate;
}
@keyframes working-pulse {
  from { opacity: .35; transform: scale(.78); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 820px) {
  .composer .terminal-editor textarea::placeholder {
    font-size: 12px;
    letter-spacing: -.045em;
  }
  .composer .terminal-editor textarea.voice-only::placeholder {
    font-size: 14px;
    letter-spacing: -.05em;
    text-align: center;
  }
  .node-tab span { font-size: 11px; }
  .list-empty { font-size: 12px; }
  .session-list > .list-empty {
    align-self: center;
    flex: 0 0 auto;
    padding: 8px 2px;
    font-size: 9px;
    line-height: 24px;
    white-space: nowrap;
  }
  .attachment-chip, .toast { font-size: 10px; }
}
