:root {
  /* ── Surf 品牌色板 ─────────────────────────
     科技蓝 #1A73E8 · 浪花白 #F5F6FA
     深邃灰 #2C2C2C · 琥珀金 #C49A6C          */
  --bg: #f5f6fa; /* 浪花白 */
  --panel: #ffffff;
  --panel-2: #fafbfd;
  --border: #e6e9f0;
  --border-strong: #d5dae5;
  --text: #1a1a1a; /* 接近纯黑，保证可读性 */
  --text-2: #3c4043;
  --text-3: #5f6368;
  --accent: #1a73e8; /* 科技蓝 */
  --accent-deep: #0f2a5c;
  --accent-soft: #e8f0fe;
  --gold: #c49a6c; /* 琥珀金 —— 静观品牌核心色，用于图形 */
  --gold-ink: #a17c50; /* 琥珀金的文字可读版本 */
  --gold-soft: #f7f0e7;
  --ok: #1e7a46;
  --ok-soft: #e7f4ec;
  --warn: #a0671a;
  --warn-soft: #fcf3e4;
  --err: #b3261e;
  --err-soft: #fcedeb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);

  /* 思源宋体（标题）/ 思源黑体（正文）/ Inter（英文） */
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", SimSun, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC",
    "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── 顶栏 ───────────────────────────────── */
.topbar {
  height: 58px;
  flex: 0 0 58px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  /* 浅蓝 → 浅金的通透底色，呼应「静观」静谧通透的调性 */
  background: linear-gradient(135deg, #eaf1fd 0%, #fbf5ec 100%);
  border: 1px solid #dfe6f5;
  display: grid;
  place-items: center;
}

.brand-text h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--accent-deep);
}

.brand-text p {
  margin: 1px 0 0;
  font-family: var(--font-serif); /* 思源宋体，东方韵味 */
  font-size: 13px;
  color: var(--gold-ink);
  letter-spacing: 0.05em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 9px;
}

.model-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s;
}

.model-chip:hover {
  border-color: var(--border-strong);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  flex: 0 0 7px;
}

.dot.ok {
  background: #22c55e;
}

.dot.err {
  background: #ef4444;
}

/* ── 按钮 ───────────────────────────────── */
.btn {
  font-family: inherit;
  font-size: 14px;
  padding: 7px 15px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: all 0.14s;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: var(--panel-2);
  border-color: #b9c0cc;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 550;
}

.btn.primary:hover:not(:disabled) {
  background: #4338ca;
  border-color: #4338ca;
}

.btn.danger {
  background: #fff;
  border-color: #f0b4b4;
  color: var(--err);
}

.btn.danger:hover:not(:disabled) {
  background: var(--err-soft);
}

.btn-tiny {
  font-family: inherit;
  font-size: 12.5px;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-2);
  cursor: pointer;
}

.btn-tiny:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #c7cbfa;
}

/* ── 布局 ───────────────────────────────── */
.layout {
  flex: 1;
  display: grid;
  /* 右侧浏览视窗加宽，左侧任务记录收窄，中间内容紧凑 */
  grid-template-columns: 220px minmax(360px, 1fr) 540px;
  gap: 0;
  overflow: hidden;
}

.sidebar,
.viewer {
  background: var(--panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar {
  border-right: 1px solid var(--border);
}

.viewer {
  border-left: 1px solid var(--border);
}

.panel-head {
  flex: 0 0 auto;
  padding: 12px 15px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-3);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* 品牌功能名：Surf Log / Surf Radar */
.panel-title-brand {
  font-weight: 650;
  letter-spacing: 0.09em;
  color: var(--accent);
}

.viewer-url {
  font-size: 12.5px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 11px;
}

/* ── 任务列表 ───────────────────────────── */
.task-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.task-item {
  padding: 9px 11px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 3px;
  border: 1px solid transparent;
  transition: background 0.12s;
}

.task-item:hover {
  background: var(--panel-2);
}

.task-item.active {
  background: var(--accent-soft);
  border-color: #d5d8fb;
}

.task-item-top {
  display: flex;
  align-items: center;
  gap: 7px;
}

.task-item-title {
  font-size: 13.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.task-item-meta {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
  padding-left: 15px;
}

.badge {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 600;
  flex: 0 0 auto;
}

.badge.running {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge.queued {
  background: #f1f3f5;
  color: var(--text-2);
}

.badge.done {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.failed,
.badge.stopped {
  background: var(--err-soft);
  color: var(--err);
}

.badge.waiting {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.pending {
  background: #f1f3f5;
  color: var(--text-2);
}

/* ── 主区 ───────────────────────────────── */
.main-col {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.composer {
  flex: 0 0 auto;
  padding: 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

/* 执行分身选择器 */
.agent-pick {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 9px;
  flex-wrap: wrap;
}

.pick-label {
  font-size: 12.5px;
  color: var(--text-3);
  flex: 0 0 auto;
}

.pick-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.pick-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px 3px 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.14s;
  white-space: nowrap;
}

.pick-item:hover {
  border-color: var(--accent);
}

.pick-item.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-deep);
  font-weight: 550;
}

.pick-avatar {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(135deg, #eaf1fd, #fbf5ec);
  border: 1px solid #dfe6f5;
  display: grid;
  place-items: center;
  font-size: 12px;
  flex: 0 0 22px;
}

.pick-manage {
  font-size: 12.5px;
  color: var(--accent);
  flex: 0 0 auto;
}

.pick-manage:hover {
  text-decoration: underline;
}

#taskInput {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 11px 13px;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.6;
  resize: vertical;
  min-height: 62px;
  color: var(--text);
  background: var(--panel-2);
  transition: border-color 0.15s;
}

#taskInput:focus,
.composer-row input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}

.composer-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.composer-row input {
  flex: 1;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13.5px;
  background: var(--panel-2);
  color: var(--text);
}

.examples {
  margin-top: 10px;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: baseline;
  overflow-x: auto;
  padding-bottom: 4px;
}

.ex-label {
  font-size: 12.5px;
  color: var(--text-3);
  padding-top: 2px;
  flex: 0 0 auto;
}

.chip {
  font-family: inherit;
  font-size: 12.5px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.13s;
  flex: 0 0 auto;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip:hover {
  border-color: #c7cbfa;
  background: var(--accent-soft);
  color: var(--accent);
}

/* ── 时间线 ─────────────────────────────── */
.timeline-head {
  flex: 0 0 auto;
  padding: 9px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}

.task-title {
  font-size: 13.5px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-counter {
  font-size: 12.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.timeline {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 20px;
}

.step-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 13px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  animation: slideIn 0.22s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.step-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.step-num {
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  min-width: 19px;
  height: 19px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  flex: 0 0 auto;
}

.step-num.final {
  background: var(--ok);
}

.step-action {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1.5px 8px;
  border-radius: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.step-thought {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.65;
}

.step-result {
  font-size: 13.5px;
  color: var(--text-2);
  background: var(--panel-2);
  border-left: 2px solid var(--border-strong);
  padding: 6px 10px;
  border-radius: 0 6px 6px 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
  font-family: var(--mono);
  line-height: 1.55;
}

.log-line {
  font-size: 12.5px;
  padding: 3px 9px;
  margin-bottom: 4px;
  border-radius: 6px;
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.log-line.info {
  color: var(--text-2);
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.log-line.warn {
  color: var(--warn);
  background: var(--warn-soft);
  border: 1px solid #f5dcb4;
}

.log-line.error {
  color: var(--err);
  background: var(--err-soft);
  border: 1px solid #f4c7c7;
}

.log-line.success {
  color: var(--ok);
  background: var(--ok-soft);
  border: 1px solid #bfe5cd;
}

.result-card {
  background: linear-gradient(135deg, #f0fdf4, #ffffff);
  border: 1px solid #bfe5cd;
  border-radius: var(--radius);
  padding: 13px 15px;
  margin-bottom: 8px;
}

.result-card h3 {
  margin: 0 0 7px;
  font-size: 12.5px;
  color: var(--ok);
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-card .body {
  font-size: 14.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

/* ── 交互条（提问 / 确认） ───────────────── */
.interact-bar {
  flex: 0 0 auto;
  border-top: 1px solid var(--border);
  background: var(--warn-soft);
  padding: 12px 16px;
  animation: slideIn 0.2s ease-out;
}

.interact-bar .q {
  font-size: 14.5px;
  color: var(--text);
  margin-bottom: 9px;
  font-weight: 550;
}

.interact-bar .row {
  display: flex;
  gap: 8px;
}

.interact-bar input {
  flex: 1;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  background: #fff;
  color: var(--text);
}

.interact-bar input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── 浏览器画面 ─────────────────────────── */
.viewer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg);
}

.shot-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.shot-card img {
  width: 100%;
  display: block;
  cursor: zoom-in;
  background: #fff;
}

.shot-meta {
  padding: 7px 11px;
  font-size: 12.5px;
  color: var(--text-3);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.shot-meta .action {
  font-family: var(--mono);
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 空状态 ─────────────────────────────── */
.empty-state {
  text-align: center;
  color: var(--text-3);
  padding: 46px 20px;
}

.empty-state.small {
  padding: 30px 14px;
  font-size: 12.5px;
}

.empty-icon {
  font-size: 42px;
  line-height: 1;
  color: #bfd3f5; /* 淡浪花蓝 */
  margin-bottom: 12px;
}

.empty-state p {
  margin: 4px 0;
}

.empty-state .sub {
  font-size: 13px;
  color: #a8b0bd;
}

.empty-hint {
  padding: 24px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

/* ── 弹窗 ───────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 30, 0.5);
  display: grid;
  place-items: center;
  z-index: 100;
  backdrop-filter: blur(2px);
  padding: 20px;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  background: var(--panel);
  border-radius: 14px;
  width: min(480px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.18s ease-out;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-head {
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  border: none;
  background: none;
  font-size: 15px;
  color: var(--text-3);
  cursor: pointer;
  padding: 3px 7px;
  border-radius: 6px;
  line-height: 1;
}

.modal-close:hover {
  background: var(--panel-2);
  color: var(--text);
}

.modal-close.light {
  position: absolute;
  top: 14px;
  right: 16px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 17px;
  padding: 6px 11px;
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
}

.modal-foot {
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
}

.spacer {
  flex: 1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 13px;
  flex: 1;
}

.field > span {
  font-size: 12.5px;
  color: var(--text-2);
  font-weight: 550;
}

.field input,
.field select {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 8px 11px;
  font-family: inherit;
  font-size: 14px;
  background: var(--panel-2);
  color: var(--text);
  width: 100%;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}

.field-row {
  display: flex;
  gap: 11px;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-2);
  margin-bottom: 10px;
  cursor: pointer;
  line-height: 1.5;
}

.check input {
  margin-top: 3px;
  flex: 0 0 auto;
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}

.divider {
  margin: 18px 0 14px;
  border-top: 1px solid var(--border);
  position: relative;
  text-align: center;
}

.divider span {
  position: relative;
  top: -9px;
  background: var(--panel);
  padding: 0 9px;
  font-size: 12px;
  color: var(--text-3);
}

.tip {
  font-size: 12.5px;
  color: var(--text-3);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  margin: 14px 0 0;
  line-height: 1.6;
}

.tip strong {
  color: var(--text-2);
}

.lightbox {
  background: rgba(0, 0, 0, 0.86);
  cursor: zoom-out;
}

.lightbox img {
  max-width: 94vw;
  max-height: 92vh;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* ── 滚动条 ─────────────────────────────── */
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d5dae2;
  border-radius: 5px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #b8c0cc;
  background-clip: content-box;
}

/* ── 响应式 ─────────────────────────────── */
@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 180px minmax(320px, 1fr) 420px;
  }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }
  .layout {
    grid-template-columns: 1fr;
    overflow: visible;
  }
  .sidebar {
    display: none;
  }
  .viewer {
    border-left: none;
    border-top: 1px solid var(--border);
  }
}

/* ── 语言切换器（右上角）───────────────── */
.lang-switcher {
  position: relative;
  display: inline-block;
  font-size: 14px;
  line-height: 1;
}

.lang-current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 13px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  white-space: nowrap;
}

.lang-current:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.lang-current svg {
  color: var(--text-3);
  flex: 0 0 auto;
}

.lang-current[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 158px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.12);
  padding: 6px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: langPop 0.14s ease-out;
}

.lang-dropdown[hidden] {
  display: none;
}

@keyframes langPop {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 8px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.lang-option:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.lang-option.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.lang-option.active::after {
  content: "✓";
  font-size: 12px;
  color: var(--accent);
}
