:root {
  --bg: #f3eee6;
  --bg-elev: #fffbf6;
  --bg-card: rgba(255, 252, 248, 0.88);
  --line: rgba(42, 36, 30, 0.10);
  --line-strong: rgba(42, 36, 30, 0.16);
  --text: #1c2328;
  --muted: #6a6660;
  --faint: #8a857d;
  --accent: #1f8a7a;
  --accent-2: #c45c2c;
  --accent-warm: #e8a060;
  --warn: #b8860b;
  --danger: #c44c5a;
  --ok: #1b7d66;
  --idle: #3b7ea3;
  --running: #1b7d66;
  --paused: #b8860b;
  --stopped: #c44c5a;
  --shadow: 0 16px 40px rgba(80, 55, 30, 0.08);
  --shadow-sm: 0 6px 18px rgba(80, 55, 30, 0.06);
  --radius: 20px;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei",
    "Noto Sans SC", "Source Han Sans SC", system-ui, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Cascadia Code", "Noto Sans Mono", ui-monospace, monospace;
  --grid: rgba(42, 36, 30, 0.045);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  letter-spacing: 0.01em;
}
button, input { font-family: inherit; }
a { color: var(--accent); }

.eyebrow {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent);
  font-weight: 650;
}
h1, h2 { margin: 0; font-weight: 650; }
h1 { font-size: 22px; letter-spacing: 0.01em; }
h2 { font-size: 12px; color: var(--accent-2); letter-spacing: 0.12em; text-transform: uppercase; }
.muted { color: var(--muted); }
.fine { color: var(--faint); font-size: 12px; }
.hidden { display: none !important; }

.logo {
  width: 40px; height: 40px;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(232, 154, 80, 0.28), 0 0 0 1px rgba(255,255,255,0.6) inset;
  display: block; flex-shrink: 0;
  background: #ffd8b0;
}
.logo-lg { width: 56px; height: 56px; border-radius: 16px; }

/* login */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-bg {
  position: fixed; inset: 0;
  background:
    radial-gradient(900px 480px at 12% -8%, rgba(232, 160, 96, 0.28), transparent 55%),
    radial-gradient(800px 420px at 100% 8%, rgba(31, 138, 122, 0.16), transparent 50%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(180deg, #f7f1e8, #efe6da);
  background-size: auto, auto, 28px 28px, 28px 28px, auto;
}
.login-card {
  position: relative;
  width: min(420px, calc(100vw - 32px));
  padding: 40px 34px 30px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.login-mark { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.login-lead { color: var(--muted); margin: 0 0 24px; line-height: 1.65; font-size: 15px; }
.login-card label { display: block; margin-bottom: 14px; color: var(--muted); font-size: 13px; }
.login-card input {
  width: 100%; margin-top: 6px; padding: 12px 14px;
  border-radius: 12px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--text); font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus { outline: none; border-color: rgba(31, 138, 122, 0.55); box-shadow: 0 0 0 4px rgba(31, 138, 122, 0.12); }
.login-foot { margin: 18px 0 0; color: var(--faint); font-size: 12px; line-height: 1.55; }
.banner { padding: 10px 12px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.banner.error { background: rgba(196, 76, 90, 0.1); color: #8e2f3c; border: 1px solid rgba(196, 76, 90, 0.25); }

.btn {
  appearance: none; border: 1px solid var(--line-strong);
  background: #fff; color: var(--text);
  border-radius: 11px; padding: 8px 14px;
  font-size: 13px; cursor: pointer;
  transition: 0.15s ease;
  box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset;
}
.btn:hover { border-color: rgba(31, 138, 122, 0.45); transform: translateY(-1px); }
.btn.primary {
  background: linear-gradient(180deg, #e28a55, #c45c2c);
  border-color: transparent; color: #fffaf6; font-weight: 700;
  box-shadow: 0 8px 18px rgba(196, 92, 44, 0.28);
}
.btn.accent {
  background: linear-gradient(180deg, #2aa392, #1b7d66);
  border-color: transparent; color: #f4fffc; font-weight: 650;
  box-shadow: 0 8px 18px rgba(27, 125, 102, 0.22);
}
.btn.ghost { background: transparent; box-shadow: none; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.block { width: 100%; padding: 12px; margin-top: 8px; }
.btn:disabled { opacity: 0.38; cursor: not-allowed; transform: none; box-shadow: none; }

/* dashboard */
.dash-body {
  background:
    radial-gradient(1100px 480px at 0% -10%, rgba(232, 160, 96, 0.18), transparent 55%),
    radial-gradient(900px 400px at 100% 0%, rgba(31, 138, 122, 0.12), transparent 50%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, 32px 32px, 32px 32px, auto;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.dash-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 400px);
  overflow: hidden;
}
.dash-main {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overflow-anchor: none;
  padding-bottom: 8px;
}
.topbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 244, 0.82);
  position: relative; z-index: 20;
  flex: 0 0 auto;
  backdrop-filter: blur(18px);
}
.brand { display: flex; gap: 12px; align-items: center; margin-right: auto; }
.top-status, .top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.top-actions form { margin: 0; }
.control-group {
  display: inline-flex; gap: 0;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.control-group .btn {
  border: 0; border-radius: 0; box-shadow: none;
  border-right: 1px solid var(--line);
}
.control-group .btn:last-child { border-right: 0; }
.control-group .btn.primary { box-shadow: none; }
.control-group .btn:hover { transform: none; background: #fff7ef; }
.control-group .btn.primary:hover { background: linear-gradient(180deg, #e28a55, #c45c2c); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 5px 11px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  border: 1px solid transparent;
}
.pill::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent);
}
.pill.idle { color: var(--idle); background: rgba(59, 126, 163, 0.1); }
.pill.running { color: var(--running); background: rgba(27, 125, 102, 0.1); }
.pill.running::before { animation: pulse 1.6s ease-out infinite; }
.pill.paused { color: var(--paused); background: rgba(184, 134, 11, 0.12); }
.pill.stopped { color: var(--stopped); background: rgba(196, 76, 90, 0.1); }
.pill.ghost { color: var(--muted); background: rgba(28, 35, 40, 0.05); }
.pill.ok { color: var(--ok); background: rgba(27, 125, 102, 0.1); }
.pill.bad { color: var(--danger); background: rgba(196, 76, 90, 0.1); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 40%, transparent); }
  100% { box-shadow: 0 0 0 8px transparent; }
}

.thought-hero {
  flex: 0 0 auto;
  margin: 12px 24px 0;
  padding: 14px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(220px, 0.8fr);
  gap: 22px;
  align-items: start;
  background: linear-gradient(120deg, rgba(255,252,248,0.94), rgba(255,243,230,0.9));
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
}
.kicker {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-2);
  font-weight: 700;
}
.thought-title {
  margin: 0;
  font-size: 22px;
  font-weight: 720;
  line-height: 1.4;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--text);
}
.thought-goal {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--muted);
  max-height: 4.8em;
  overflow: auto;
}
.thought-meta {
  display: grid; gap: 12px; margin: 0;
  padding: 4px 0 4px 22px;
  border-left: 1px solid var(--line);
}
.thought-meta div { display: grid; gap: 2px; }
.thought-meta dt { font-size: 11px; color: var(--faint); letter-spacing: 0.06em; }
.thought-meta dd { margin: 0; font-size: 13px; font-weight: 650; word-break: break-word; }

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  padding: 18px 24px 36px;
  align-items: start;
}
.sidebar { display: grid; gap: 14px; }
.main { display: grid; gap: 14px; min-width: 0; }
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 76px 1fr; gap: 6px 10px; margin: 10px 0 0; }
.kv dt { color: var(--faint); font-size: 12px; }
.kv dd { margin: 0; font-size: 13px; }
.kv dd.wrap { white-space: pre-wrap; word-break: break-word; line-height: 1.5; }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.stat {
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 11px;
  display: grid; gap: 4px;
}
.stat.wide { grid-column: 1 / -1; }
.stat span { font-size: 11px; color: var(--faint); letter-spacing: 0.04em; }
.stat strong { font-size: 13px; font-weight: 650; word-break: break-word; }
.error-box { margin-top: 12px; }
.error-box span { font-size: 11px; color: var(--faint); }
.error-box p { margin: 4px 0 0; font-size: 13px; line-height: 1.5; }

.meters { display: grid; gap: 8px; margin-top: 14px; }
.meter span { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.meter em { font-style: normal; color: var(--text); }
.bar { height: 7px; border-radius: 99px; background: rgba(28, 35, 40, 0.08); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-warm)); border-radius: 99px; transition: width 0.4s ease; }
.meter.load { font-size: 12px; color: var(--muted); }

.svc { list-style: none; padding: 10px 0 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.svc li {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px 4px 8px;
}
.svc li span:last-child { color: var(--faint); }
.svc b { font-weight: 600; color: var(--text); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--danger); }

.desktop-card { padding-bottom: 12px; }
.vnc-frame-wrap {
  background: #1c2328;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
.win-bar {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 12px;
  background: linear-gradient(180deg, #2a3238, #22292e);
  color: #d7d2cb;
}
.win-dots {
  width: 10px; height: 10px; border-radius: 50%;
  background: #e8a060;
  box-shadow: 16px 0 0 #2aa392, 32px 0 0 #c45c2c;
  margin-right: 28px;
}
.win-title { font-size: 12px; letter-spacing: 0.04em; color: #c9c3bb; }
.vnc-stage {
  position: relative;
  min-height: 280px;
  aspect-ratio: 1400 / 900;
  max-height: min(58vh, calc(100dvh - 260px));
}
#vnc-frame { width: 100%; height: 100%; border: 0; background: #111; position: absolute; inset: 0; }
.vnc-fallback {
  position: absolute; inset: 0; display: grid; place-items: center; background: #151a1e;
}
.vnc-fallback img { max-width: 100%; max-height: 100%; object-fit: contain; }
.vnc-fallback p { position: absolute; bottom: 10px; color: #c9c3bb; font-size: 12px; }
.vnc-guard {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 14px;
  background: transparent;
  cursor: default;
}
.vnc-guard p {
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(28, 24, 20, 0.72);
  color: #efe8de;
  font-size: 12px;
  pointer-events: none;
}
.vnc-frame-wrap.interactive .vnc-guard { display: none; }
.desk-mode {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #e8a060;
  font-weight: 650;
}
.vnc-frame-wrap.interactive .desk-mode { color: #7ee0c8; }

.split { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 14px; }
.shots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  max-height: 280px; overflow: auto;
}
.shots a { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.shots img { width: 100%; height: 90px; object-fit: cover; display: block; background: #1c2328; }
.calls { display: grid; gap: 8px; max-height: 280px; overflow: auto; }
.call { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12px; color: var(--muted); background: #fff; }
.call b { color: var(--text); }
.call.ok { border-color: rgba(27, 125, 102, 0.28); background: rgba(27, 125, 102, 0.04); }
.call.bad { border-color: rgba(196, 76, 90, 0.3); background: rgba(196, 76, 90, 0.05); }

.log-card { min-height: 240px; }
.log {
  margin: 0; max-height: 320px; overflow: auto;
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
  color: #efe8de; background: #231f1c; border-radius: 12px;
  padding: 12px; white-space: pre-wrap; word-break: break-word;
}
.notes { max-height: 640px; overflow: auto; }
.note { margin-bottom: 22px; }
.note h3, .note-file {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 650;
  color: var(--accent-2);
}
.note pre {
  margin: 0; white-space: pre-wrap; font-family: var(--sans);
  font-size: 13px; line-height: 1.55; color: var(--text);
}
.note-truncated {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--faint);
}
.note-md {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
  overflow-wrap: anywhere;
}
.note-md > :first-child { margin-top: 0; }
.note-md > :last-child { margin-bottom: 0; }
.note-md h1, .note-md h2, .note-md h3, .note-md h4, .note-md h5, .note-md h6 {
  margin: 1.05em 0 0.4em;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  line-height: 1.35;
}
.note-md h1 { font-size: 18px; }
.note-md h2 { font-size: 16px; }
.note-md h3 { font-size: 14.5px; color: var(--accent-2); }
.note-md h4, .note-md h5, .note-md h6 { font-size: 13.5px; }
.note-md p, .note-md ul, .note-md ol { margin: 0.5em 0; }
.note-md ul, .note-md ol { padding-left: 1.35em; }
.note-md li { margin: 0.2em 0; }
.note-md li > p { margin: 0.2em 0; }
.note-md strong { font-weight: 700; }
.note-md code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: rgba(42, 36, 30, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
.note-md pre {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  background: rgba(42, 36, 30, 0.05);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--text);
}
.note-md pre code { background: none; padding: 0; }
.note-md blockquote {
  margin: 0.6em 0;
  padding: 0.1em 0 0.1em 12px;
  border-left: 3px solid rgba(196, 92, 44, 0.35);
  color: var(--muted);
}
.note-md table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.6em 0;
  font-size: 12.5px;
}
.note-md th, .note-md td {
  border: 1px solid var(--line-strong);
  padding: 4px 8px;
  text-align: left;
  vertical-align: top;
}
.note-md th { background: rgba(42, 36, 30, 0.04); }
.note-md hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }
.note-md a { word-break: break-all; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .thought-hero { grid-template-columns: 1fr; }
  .thought-meta { padding: 14px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .vnc-stage { min-height: 360px; }
}
@media (max-width: 1280px) {
  .dash-body { height: auto; overflow: visible; }
  .dash-shell { display: block; overflow: visible; }
  .work-rail {
    border-left: 0;
    border-top: 1px solid var(--line);
    max-height: 70vh;
  }
}


/* ---- turn timeline ---- */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: #fff; }
.seg-btn { background: transparent; color: var(--muted); border: 0; padding: 5px 12px; font-size: 12px; cursor: pointer; }
.seg-btn.active { background: rgba(196, 92, 44, 0.1); color: var(--accent-2); font-weight: 650; }
.chk { display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
.banner.sample { background: rgba(184, 134, 11, 0.1); color: #7a5a08; border: 1px solid rgba(184, 134, 11, 0.28); }
.timeline {
  max-height: 720px; overflow: auto; padding: 4px 6px 4px 22px; position: relative;
  display: grid; gap: 14px;
}
.timeline::before {
  content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(180deg, rgba(31,138,122,0.45), rgba(232,160,96,0.25));
}
.turn {
  position: relative; border: 1px solid var(--line); border-radius: 14px;
  background: #fff; padding: 12px 14px 12px;
}
.turn::before {
  content: ""; position: absolute; left: -19px; top: 16px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 0 3px rgba(27, 125, 102, 0.18);
}
.turn.err { border-color: rgba(196, 76, 90, 0.4); background: #fff6f6; }
.turn.err::before { background: var(--danger); box-shadow: 0 0 0 3px rgba(196, 76, 90, 0.18); }
.turn-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 8px; }
.turn-no { font-weight: 750; font-size: 14px; }
.chip { font-size: 11px; color: var(--muted); background: rgba(28,35,40,0.05); border-radius: 999px; padding: 2px 9px; }
.chip.ok { color: var(--ok); background: rgba(27,125,102,0.1); }
.chip.bad { color: var(--danger); background: rgba(196,76,90,0.1); }
.chip.sample { color: var(--warn); background: rgba(184,134,11,0.12); }
.turn-summary { margin: 0 0 10px; font-size: 13px; color: var(--text); padding: 7px 10px; border-radius: 9px; background: rgba(232,160,96,0.12); border-left: 3px solid var(--accent-2); }
.turn-body { display: grid; grid-template-columns: 1fr 168px; gap: 12px; }
.sec { margin-bottom: 8px; }
.sec-title { font-size: 12px; font-weight: 700; color: var(--accent-2); margin-bottom: 3px; letter-spacing: 0.04em; }
.sec p { margin: 0; font-size: 13px; line-height: 1.6; }
.goal { color: var(--muted); font-size: 12px; }
.acts { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.acts li { font-size: 13px; line-height: 1.5; }
.acts li.bad { color: #8e2f3c; }
.acts code, .turn-summary code { font-family: var(--mono); font-size: 12px; background: rgba(28,35,40,0.06); padding: 1px 5px; border-radius: 5px; }
.out { margin: 3px 0 0; max-height: 150px; overflow: auto; font-family: var(--mono); font-size: 11.5px; line-height: 1.5;
  background: #231f1c; color: #efe8de; border-radius: 8px; padding: 6px 8px; white-space: pre-wrap; word-break: break-word; }
.out.bad { color: #ffc9cf; }
.turn details { margin-top: 6px; }
.turn details summary { cursor: pointer; font-size: 12px; color: var(--faint); }
.turn details pre { margin: 6px 0 0; max-height: 260px; overflow: auto; font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap; word-break: break-word; color: #efe8de; background: #231f1c; border-radius: 8px; padding: 8px; }
.thumb { display: grid; gap: 6px; align-content: start; }
.thumb img { width: 100%; border-radius: 9px; border: 1px solid var(--line); cursor: zoom-in; background: #1c2328; display: block; }
.thumb .fine { text-align: center; }
.thumb .noimg { height: 96px; border-radius: 9px; border: 1px dashed var(--line); display: grid; place-items: center; color: var(--faint); font-size: 12px; }
details.rawlog summary { display: flex; justify-content: space-between; align-items: baseline; cursor: pointer; list-style: none; }
details.rawlog summary::-webkit-details-marker { display: none; }
details.rawlog[open] summary { margin-bottom: 10px; }
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(28, 24, 20, 0.72); display: grid; place-items: center; cursor: zoom-out; padding: 24px; }
.lightbox img { max-width: 96vw; max-height: 88vh; border-radius: 10px; box-shadow: var(--shadow); }
.lightbox p { position: absolute; bottom: 14px; color: #efe8de; }
@media (max-width: 800px) { .turn-body { grid-template-columns: 1fr; } }
.tabpane { min-height: 120px; }

.chip.kind { background: rgba(196, 92, 44, 0.1); color: #9a3f16; }
.chip.kind.selfmod { background: rgba(124, 77, 166, 0.12); color: #6b3a96; }
.chip.kind.rollback { background: rgba(196, 76, 90, 0.14); color: #8e2f3c; }
.chip.kind.restart { background: rgba(184, 134, 11, 0.14); color: #7a5a08; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* 最近在做 · 常驻右侧栏 */
.work-rail {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: rgba(255, 250, 244, 0.94);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 28px rgba(28, 24, 20, 0.05);
}
.work-rail.has-doing .work-rail-head h2::after {
  content: "";
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  margin-left: 8px; vertical-align: middle;
  background: var(--running);
  box-shadow: 0 0 0 3px rgba(27, 125, 102, 0.18);
  animation: pulse 1.6s ease-out infinite;
}
.work-rail-head {
  flex: 0 0 auto;
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 244, 0.92);
}
.work-rail-head h2 {
  margin: 0 0 6px;
  font-size: 20px;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--text);
}
.work-rail-head .fine { margin: 0; line-height: 1.5; }
.work-pane {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.work-list {
  min-height: 0;
  overflow: auto; padding: 12px 16px 28px;
  display: grid; gap: 10px; flex: 1;
}
.work-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}
.work-item.doing {
  border-color: rgba(27, 125, 102, 0.35);
  box-shadow: 0 0 0 3px rgba(27, 125, 102, 0.08);
}
.work-item.patrol { background: #fbf7f1; }
.work-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.work-item h3 { margin: 0; font-size: 14px; font-weight: 720; line-height: 1.4; flex: 1; }
.work-item p { margin: 7px 0 0; font-size: 13px; line-height: 1.55; color: var(--text); }
.work-item time { display: block; margin-top: 8px; font-size: 11.5px; color: var(--muted); letter-spacing: 0.02em; }
.chip.doing { color: var(--ok); background: rgba(27, 125, 102, 0.1); }
.chip.done { color: var(--muted); }

.work-more { margin-top: 9px; border-top: 1px dashed var(--line, #eadfce); padding-top: 8px; }
.work-more > summary { cursor: pointer; font-size: 12.5px; color: var(--accent, #d0642c); font-weight: 650; list-style: none; user-select: none; }
.work-more > summary::-webkit-details-marker { display: none; }
.work-more > summary::before { content: "▸ "; }
.work-more[open] > summary::before { content: "▾ "; }
.work-more-item { margin-top: 10px; }
.work-more-at { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.work-more-text { white-space: pre-wrap; word-break: break-word; font-size: 12.8px; line-height: 1.6; color: var(--text); background: #fffaf3; border: 1px solid #f0e4d3; border-radius: 10px; padding: 9px 11px; max-height: 280px; overflow: auto; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.work-rail-tabs {
  display: flex; gap: 0;
  margin: 0 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  overflow: hidden;
  background: #fff;
}
.work-tab {
  flex: 1;
  appearance: none; border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  padding: 7px 10px;
  cursor: pointer;
  letter-spacing: 0.04em;
}
.work-tab + .work-tab { border-left: 1px solid var(--line); }
.work-tab:hover { background: #fff7ef; color: var(--text); }
.work-tab.active {
  background: rgba(196, 92, 44, 0.1);
  color: var(--accent-2);
}
.work-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.work-rail-head h2 { margin: 0 0 6px; }
#mail-intro .kicker { margin-bottom: 6px; }
#mail-status[data-state="busy"] { color: var(--paused); font-weight: 650; }
#mail-status[data-state="replying"] { color: var(--ok); font-weight: 650; }
#mail-status[data-state="idle"] { color: var(--muted); }

.mail-pane {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.mail-thread {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mail-empty { margin: 12px 4px; }
.mail-msg {
  max-width: 92%;
  display: grid;
  gap: 4px;
}
.mail-msg.user { align-self: flex-end; }
.mail-msg.ray { align-self: flex-start; }
.mail-msg-meta {
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.02em;
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.mail-msg.user .mail-msg-meta { justify-content: flex-end; }
.mail-bubble {
  border-radius: 14px;
  padding: 8px 12px;
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
  background: #fff;
}
.mail-msg.user .mail-bubble {
  background: linear-gradient(180deg, #fff7ef, #ffe8d4);
  border-color: rgba(196, 92, 44, 0.22);
}
.mail-msg.ray .mail-bubble {
  background: linear-gradient(180deg, #f4fffc, #e7f6f1);
  border-color: rgba(27, 125, 102, 0.22);
}
.mail-pending {
  font-size: 11px;
  color: var(--warn);
  font-weight: 650;
}
.mail-recall {
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 11px;
  color: var(--faint);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.mail-recall:hover,
.mail-recall:focus-visible {
  color: var(--danger);
}
.mail-recalled {
  font-size: 11px;
  color: var(--faint);
}
.mail-msg.recalled .mail-bubble {
  opacity: 0.55;
  text-decoration: line-through;
  background: #f4f1ee;
  border-color: var(--line);
}
.mail-compose {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  padding: 10px 12px 14px;
  background: rgba(255, 250, 244, 0.96);
  display: grid;
  gap: 8px;
}
.mail-compose textarea {
  width: 100%;
  resize: vertical;
  min-height: 4.2em;
  max-height: 10em;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.55;
}
.mail-compose textarea:focus {
  outline: none;
  border-color: rgba(31, 138, 122, 0.55);
  box-shadow: 0 0 0 4px rgba(31, 138, 122, 0.12);
}
.mail-compose-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
#mail-form-msg { margin: 0; flex: 1; min-height: 1em; }
#mail-form-msg.is-error { color: var(--danger); }
.work-tab .mail-dot {
  display: inline-block;
  width: 7px; height: 7px; border-radius: 50%;
  margin-left: 6px; vertical-align: middle;
  background: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(196, 92, 44, 0.18);
}
