:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #6f7787;
  --soft: #f1f3f7;
  --line: #e6e8ef;
  --paper: #ffffff;
  --cream: #fbf8f1;
  --navy: #101b2d;
  --orange: #ff8a4c;
  --orange-soft: #fff0e7;
  --teal: #20a990;
  --teal-soft: #e7f8f4;
  --purple: #785be8;
  --purple-soft: #f0ecff;
  --blue: #3f7cf5;
  --blue-soft: #eaf1ff;
  --red: #e55757;
  --red-soft: #ffeded;
  --green: #3ea66b;
  --green-soft: #e9f7ef;
  --yellow: #e8a62d;
  --shadow: 0 12px 40px rgba(25, 34, 55, 0.08);
}

* { box-sizing: border-box; }

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

body {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 10% -10%, rgba(255, 181, 128, .22), transparent 30%),
    radial-gradient(circle at 90% 0%, rgba(88, 192, 170, .16), transparent 28%),
    #f4f5f8;
  color: var(--ink);
  overflow-x: hidden;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.topbar {
  min-height: 76px;
  padding: 12px 22px;
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(520px, 2fr) minmax(260px, auto);
  align-items: center;
  gap: 18px;
  background: rgba(255, 255, 255, .9);
  border-bottom: 1px solid rgba(221, 225, 234, .9);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 15px;
  display: grid; place-items: center;
  color: white; font-size: 24px; font-weight: 900;
  background: linear-gradient(145deg, #ff9d5f, #ff6f4a);
  box-shadow: 0 8px 20px rgba(255, 122, 74, .28);
  transform: rotate(-4deg);
}
.brand-title { font-size: 18px; font-weight: 850; letter-spacing: -.4px; }
.brand-subtitle { color: var(--muted); font-size: 11px; margin-top: 2px; }

.company-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  gap: 7px;
}
.stat-pill {
  min-height: 49px;
  padding: 8px 10px;
  background: #f7f8fb;
  border: 1px solid #eceef4;
  border-radius: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.stat-icon { font-size: 18px; }
.stat-label { color: var(--muted); font-size: 10px; white-space: nowrap; }
.stat-value { font-weight: 850; font-size: 14px; margin-top: 1px; white-space: nowrap; }

.top-actions { display: flex; justify-content: flex-end; gap: 8px; }
.button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 760;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.button-primary { color: white; background: var(--navy); box-shadow: 0 8px 18px rgba(16, 27, 45, .18); }
.button-primary:hover { box-shadow: 0 11px 24px rgba(16, 27, 45, .24); }
.button-soft { background: var(--orange-soft); color: #b84f19; }
.button-soft.active { background: #ff7f47; color: white; }
.button-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.button-small { padding: 7px 10px; border-radius: 9px; font-size: 12px; }

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(620px, 1fr) 320px;
  gap: 14px;
  padding: 14px;
  max-width: 1900px;
  margin: 0 auto;
  align-items: start;
}
.left-rail, .right-rail { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.workspace { min-width: 0; }

.panel {
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(224, 227, 235, .92);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-heading {
  padding: 17px 17px 8px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.panel-heading h2 { margin: 2px 0 0; font-size: 17px; letter-spacing: -.35px; }
.small-heading { padding-bottom: 11px; }
.eyebrow {
  color: #9a6f4b;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.panel-note { margin: 0; padding: 0 17px 13px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.count-badge {
  display: inline-grid; place-items: center;
  min-width: 28px; height: 28px; padding: 0 8px;
  border-radius: 999px; background: var(--orange-soft); color: #c85a22; font-weight: 850; font-size: 12px;
}

.opportunity-list { padding: 0 10px 12px; display: flex; flex-direction: column; gap: 9px; max-height: calc(100vh - 310px); overflow: auto; }
.opportunity-card {
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 12px;
  background: #fff;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.opportunity-card:hover { border-color: #ffc09c; transform: translateY(-1px); box-shadow: 0 8px 22px rgba(33, 39, 55, .07); }
.opportunity-title-row { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.opportunity-title { font-size: 14px; line-height: 1.25; font-weight: 850; }
.money-tag { color: var(--green); background: var(--green-soft); border-radius: 8px; padding: 4px 6px; font-size: 10px; font-weight: 850; white-space: nowrap; }
.opportunity-subtitle { margin-top: 5px; color: #50596b; font-size: 11px; line-height: 1.45; }
.opportunity-meta { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.tag { padding: 4px 7px; border-radius: 999px; background: var(--soft); color: #697184; font-size: 9px; font-weight: 750; }
.opportunity-card { cursor: pointer; }
.opportunity-card.selected { border-color: #ffaf7a; background: #fff7f1; }

.compact-panel { box-shadow: none; }
.project-tabs { padding: 0 10px 12px; display: flex; flex-direction: column; gap: 7px; }
.project-tab {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px;
  display: grid; grid-template-columns: 1fr auto; gap: 7px; text-align: left; color: var(--ink);
}
.project-tab.active { border-color: #ffaf7a; background: #fff7f1; }
.project-tab-title { font-weight: 800; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-tab-progress { grid-column: 1 / -1; height: 4px; background: #eceef2; border-radius: 99px; overflow: hidden; }
.project-tab-progress i { display: block; height: 100%; background: var(--orange); border-radius: inherit; }
.project-state { font-size: 9px; color: var(--muted); white-space: nowrap; }

.empty-workspace {
  min-height: calc(100vh - 110px);
  border: 1px dashed #d7dbe5;
  border-radius: 24px;
  background: rgba(255,255,255,.72);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 50px;
}
.empty-illustration { display: flex; margin-bottom: 24px; }
.empty-illustration span {
  width: 57px; height: 57px; margin-left: -10px;
  border-radius: 20px; display: grid; place-items: center; font-size: 30px;
  background: #fff; border: 1px solid var(--line); box-shadow: 0 8px 18px rgba(35, 44, 66, .08);
}
.empty-illustration span:nth-child(even) { transform: translateY(-9px) rotate(3deg); }
.empty-workspace h1 { margin: 10px 0; font-size: 30px; letter-spacing: -.9px; }
.empty-workspace p { max-width: 580px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.empty-hints { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.empty-hints span { background: white; border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; color: #616a7b; font-size: 11px; }

.project-page { display: flex; flex-direction: column; gap: 14px; }
.project-hero {
  position: relative;
  border-radius: 23px;
  padding: 23px;
  color: white;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 15%, rgba(255,255,255,.13), transparent 22%),
    linear-gradient(135deg, #111d31 0%, #263d5e 58%, #284f55 100%);
  box-shadow: 0 18px 45px rgba(20, 31, 51, .18);
}
.project-hero::after {
  content: ""; position: absolute; width: 190px; height: 190px; border-radius: 50%;
  border: 35px solid rgba(255,255,255,.035); right: -62px; top: -65px;
}
.hero-top { display: flex; justify-content: space-between; gap: 20px; position: relative; z-index: 1; }
.project-kicker { color: #ffd5ba; font-size: 10px; letter-spacing: .12em; font-weight: 800; }
.project-hero h1 { font-size: clamp(22px, 2.4vw, 34px); margin: 8px 0 6px; letter-spacing: -1px; }
.project-hero .subtitle { color: rgba(255,255,255,.74); font-size: 12px; line-height: 1.55; max-width: 660px; }
.client-chip { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 7px 10px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.13); border-radius: 999px; font-size: 10px; }
.hero-metrics { min-width: 300px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; align-content: start; }
.hero-metric { padding: 11px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.1); border-radius: 14px; }
.hero-metric-label { color: rgba(255,255,255,.6); font-size: 9px; }
.hero-metric-value { margin-top: 4px; font-size: 17px; font-weight: 850; }
.hero-metric-value.warning { color: #ffcb89; }

.strategy-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; position: relative; z-index: 1; }
.strategy-chip { padding: 6px 9px; border-radius: 999px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.12); font-size: 10px; font-weight: 730; }

.command-dock {
  margin-top: 18px; padding: 12px; position: relative; z-index: 1;
  background: rgba(255,255,255,.96); color: var(--ink); border-radius: 16px;
  display: grid; grid-template-columns: 1fr auto; gap: 9px;
}
.command-main { min-width: 0; }
.command-label { font-size: 10px; color: #7a8291; font-weight: 800; margin-bottom: 6px; }
.command-input {
  width: 100%; border: 0; outline: none; resize: none; min-height: 44px; max-height: 105px;
  color: var(--ink); background: transparent; line-height: 1.5; font-size: 13px;
}
.command-actions { display: flex; align-items: flex-end; gap: 7px; }
.command-suggestions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 5px; }
.suggestion {
  border: 0; border-radius: 999px; padding: 5px 8px; background: #f1f3f7; color: #60697a; font-size: 9px; font-weight: 720;
}
.suggestion:hover { background: var(--orange-soft); color: #bd5721; }

.progress-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.progress-card { background: white; border: 1px solid var(--line); border-radius: 17px; padding: 14px; box-shadow: 0 7px 22px rgba(30, 38, 59, .045); }
.progress-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.progress-card-icon { font-size: 20px; }
.progress-card-value { font-size: 20px; font-weight: 880; letter-spacing: -.6px; }
.progress-card-label { color: var(--muted); font-size: 10px; margin-top: 3px; }
.progress-track { height: 6px; background: #eff1f5; border-radius: 999px; overflow: hidden; margin-top: 10px; }
.progress-track i { display: block; height: 100%; border-radius: inherit; transition: width .4s ease; }

.two-column { display: grid; grid-template-columns: minmax(360px, .9fr) minmax(520px, 1.4fr); gap: 14px; }
.requirements-panel, .tasks-panel { padding-bottom: 13px; }
.requirement-list { padding: 2px 13px 4px; display: grid; gap: 8px; }
.requirement-card { border: 1px solid var(--line); border-radius: 13px; padding: 10px; background: #fff; }
.requirement-top { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 8px; }
.req-index { width: 30px; height: 30px; border-radius: 10px; background: var(--purple-soft); color: var(--purple); display: grid; place-items: center; font-size: 10px; font-weight: 900; }
.req-text { font-size: 11px; line-height: 1.45; font-weight: 680; }
.req-progress { font-size: 10px; font-weight: 850; color: var(--muted); }
.req-bar { height: 4px; background: #eff0f4; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.req-bar i { display: block; height: 100%; background: var(--purple); border-radius: inherit; }
.requirement-card.done { border-color: #bfe6cf; background: #fbfffc; }
.requirement-card.done .req-index { background: var(--green-soft); color: var(--green); }

.task-board { padding: 2px 11px 5px; display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 8px; align-items: start; overflow-x: auto; }
.task-column { min-width: 150px; background: #f5f6f9; border: 1px solid #eceef3; border-radius: 14px; min-height: 180px; padding: 8px; }
.task-column-header { display: flex; justify-content: space-between; align-items: center; padding: 3px 3px 8px; font-size: 10px; color: #6d7585; font-weight: 850; }
.task-column-count { width: 20px; height: 20px; border-radius: 7px; display: grid; place-items: center; background: white; border: 1px solid var(--line); }
.task-stack { display: flex; flex-direction: column; gap: 7px; max-height: 520px; overflow-y: auto; padding-right: 2px; }
.task-card { background: white; border: 1px solid #e1e4eb; border-radius: 11px; padding: 9px; box-shadow: 0 4px 10px rgba(26, 35, 55, .04); }
.task-card.blocked { border-color: #f3b4b4; background: #fff9f9; }
.task-card.working { border-color: #a8c5ff; }
.task-card.done { opacity: .8; }
.task-title-row { display: flex; gap: 7px; align-items: flex-start; }
.task-icon { width: 25px; height: 25px; border-radius: 8px; background: var(--blue-soft); display: grid; place-items: center; flex: 0 0 auto; font-size: 13px; }
.task-title { font-size: 10px; font-weight: 820; line-height: 1.42; }
.task-desc { color: #858c99; font-size: 8.5px; line-height: 1.45; margin-top: 5px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.task-progress-line { margin-top: 8px; display: flex; align-items: center; gap: 7px; }
.task-progress-bar { flex: 1; height: 4px; background: #eceef2; border-radius: 99px; overflow: hidden; }
.task-progress-bar i { display: block; height: 100%; background: var(--blue); border-radius: inherit; }
.task-progress-number { font-size: 8px; color: #7a8291; font-weight: 800; }
.task-meta { display: flex; justify-content: space-between; gap: 5px; margin-top: 7px; color: #7b8391; font-size: 8px; }
.task-assignee { width: 100%; margin-top: 7px; border: 1px solid #e3e5eb; background: #fafbfc; border-radius: 8px; padding: 5px 6px; font-size: 8.5px; color: #4f5869; outline: none; }
.task-assignee:disabled { opacity: .65; }

.mini-toggle { border: 1px solid var(--line); background: #f7f8fa; border-radius: 999px; padding: 6px 8px; font-size: 9px; color: #687184; font-weight: 800; }
.mini-toggle.active { color: #20745f; border-color: #a5ddcf; background: var(--teal-soft); }
.agent-list { padding: 0 10px 12px; display: grid; gap: 7px; }
.agent-card { display: grid; grid-template-columns: 40px 1fr auto; gap: 9px; align-items: center; border: 1px solid var(--line); background: white; border-radius: 13px; padding: 9px; }
.agent-card.working { border-color: #b7ccff; background: #fbfcff; }
.agent-card.tired { border-color: #f0c2c2; background: #fffafa; }
.agent-avatar { width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center; background: #f2f4f8; font-size: 24px; }
.agent-name { font-size: 11px; font-weight: 850; }
.agent-role { color: var(--muted); font-size: 8.5px; margin-top: 2px; }
.agent-task { color: #586276; font-size: 8px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 145px; }
.agent-status { text-align: right; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 3px; background: #96a0b1; }
.status-dot.working { background: var(--blue); box-shadow: 0 0 0 4px rgba(63,124,245,.1); }
.status-dot.idle { background: var(--green); }
.status-dot.waiting { background: var(--yellow); }
.status-dot.tired { background: var(--red); }
.status-label { font-size: 8px; color: var(--muted); }
.energy { margin-top: 6px; width: 48px; height: 4px; border-radius: 99px; overflow: hidden; background: #eceef2; }
.energy i { display: block; height: 100%; background: var(--teal); border-radius: inherit; }

.feed-panel { max-height: 430px; }
.live-dot { color: var(--red); font-size: 8px; font-weight: 900; display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.live-dot i { width: 6px; height: 6px; border-radius: 50%; background: var(--red); animation: pulse 1.5s infinite; }
.feed-list { padding: 0 12px 13px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: 330px; }
.feed-item { display: grid; grid-template-columns: 30px 1fr; gap: 8px; padding: 9px 0; border-bottom: 1px solid #eff0f3; }
.feed-item:last-child { border-bottom: 0; }
.feed-emoji { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: #f4f5f8; font-size: 16px; }
.feed-title { font-size: 10px; font-weight: 850; }
.feed-message { color: #777f8f; font-size: 8.5px; line-height: 1.5; margin-top: 3px; }
.feed-day { color: #afb4bf; font-size: 8px; margin-top: 4px; }

.decision-panel { border-color: #ffd4aa; background: linear-gradient(180deg, #fffaf5, white); }
.decision-panel.hidden { display: none; }
.decision-wrap { padding: 16px; }
.decision-icon { font-size: 29px; }
.decision-title { margin: 8px 0 5px; font-size: 16px; }
.decision-body { color: #6d7482; line-height: 1.55; font-size: 10px; }
.decision-options { display: grid; gap: 7px; margin-top: 12px; }
.decision-option { border: 1px solid #eadfd5; background: white; border-radius: 11px; padding: 9px; text-align: left; }
.decision-option:hover { border-color: #ffac70; background: #fff9f4; }
.option-label { font-size: 10px; font-weight: 850; color: var(--ink); }
.option-desc { font-size: 8px; color: #7c8390; line-height: 1.45; margin-top: 3px; }

.toast {
  position: fixed; z-index: 100; right: 20px; top: 90px; max-width: 360px;
  background: var(--navy); color: white; border-radius: 13px; padding: 11px 14px;
  box-shadow: 0 15px 35px rgba(16,27,45,.25); font-size: 11px; line-height: 1.45;
  opacity: 0; transform: translateY(-8px); pointer-events: none; transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #9e3131; }

.skeleton { animation: shimmer 1.5s infinite linear; background: linear-gradient(90deg, #f1f2f5 25%, #fafafa 50%, #f1f2f5 75%); background-size: 200% 100%; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 0%,100% { opacity: .45; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.2); } }

@media (max-width: 1320px) {
  .topbar { grid-template-columns: 210px 1fr auto; }
  .company-stats .stat-pill:nth-child(4) { display: none; }
  .company-stats { grid-template-columns: repeat(4, minmax(82px, 1fr)); }
  .app-shell { grid-template-columns: 250px minmax(560px, 1fr) 285px; }
  .hero-metrics { min-width: 250px; }
}

@media (max-width: 1080px) {
  .topbar { grid-template-columns: 1fr auto; }
  .company-stats { grid-column: 1 / -1; grid-row: 2; }
  .app-shell { grid-template-columns: 230px 1fr; }
  .right-rail { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
  .decision-panel { grid-column: 1 / -1; }
  .progress-grid { grid-template-columns: repeat(2, 1fr); }
  .two-column { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .topbar { position: static; padding: 10px; }
  .brand-subtitle { display: none; }
  .company-stats { grid-template-columns: repeat(2, 1fr); }
  .company-stats .stat-pill { display: flex !important; }
  .top-actions { grid-column: 1 / -1; justify-content: stretch; }
  .top-actions .button { flex: 1; }
  .app-shell { display: block; padding: 8px; }
  .left-rail, .right-rail, .workspace { margin-bottom: 10px; }
  .opportunity-list { max-height: none; }
  .hero-top { display: block; }
  .hero-metrics { min-width: 0; margin-top: 15px; }
  .command-dock { grid-template-columns: 1fr; }
  .command-actions { justify-content: flex-end; }
  .task-board { grid-template-columns: repeat(4, 205px); }
  .right-rail { display: flex; }
}

/* ---- M2-00: AI supervisor preview ---- */
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid var(--line);
  background: #f7f8fb;
  color: var(--muted);
}
.ai-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ai-badge.ai-on { color: var(--teal); border-color: #c9ece2; background: var(--teal-soft); }
.ai-badge.ai-off { color: var(--red); border-color: #f6cfcf; background: var(--red-soft); }
.ai-badge.ai-unknown { color: var(--muted); }

.ai-panel { margin-top: 14px; }
.ai-preview-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 17px 4px;
}
.ai-mode-select {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f8fb;
  color: var(--ink);
  font-size: 12px;
}
.ai-preview-result {
  padding: 10px 17px 14px;
  display: grid;
  gap: 8px;
}
.ai-preview-loading { color: var(--muted); font-size: 12px; padding: 6px 0; }
.ai-preview-error {
  background: var(--red-soft);
  border: 1px solid #f6cfcf;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  color: #8c3a3a;
  display: grid;
  gap: 5px;
}
.ai-run-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .2px;
}
.ai-run-badge.real { background: var(--green-soft); color: var(--green); }
.ai-run-meta { color: var(--muted); font-size: 10.5px; }
.ai-decision-summary {
  font-size: 12.5px;
  line-height: 1.7;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.ai-action-item {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 12px;
  padding: 5px 4px;
  border-bottom: 1px dashed var(--line);
}
.ai-action-type {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  color: var(--purple);
  background: var(--purple-soft);
  border-radius: 6px;
  padding: 2px 6px;
  white-space: nowrap;
}
.ai-debug-details { font-size: 11px; color: var(--muted); }
.ai-debug-details summary { cursor: pointer; padding: 4px 0; }
.ai-debug-grid {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 3px 10px;
  margin: 8px 0;
  font-size: 11px;
}
.ai-debug-grid code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink);
  word-break: break-all;
}
.ai-raw-json {
  background: #101b2d;
  color: #c8d3ea;
  border-radius: 10px;
  padding: 10px;
  font-size: 10.5px;
  line-height: 1.55;
  overflow-x: auto;
  max-height: 300px;
}
.ai-runs-head { padding: 0 17px 6px; }
.ai-runs-list { padding: 0 17px 16px; display: grid; gap: 7px; }
.ai-run-item {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 7px 9px;
  background: #fafbfe;
  display: grid;
  gap: 4px;
}
.ai-run-top { display: flex; gap: 7px; align-items: center; justify-content: space-between; }
.ai-run-summary { font-size: 11.5px; line-height: 1.55; color: var(--ink); }
.ai-run-error { font-size: 10.5px; color: var(--red); }

.now-banner {
  margin: 0 14px;
  padding: 12px 18px;
  border-radius: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 16px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}
.now-banner strong { font-size: 14px; }
.now-banner span { color: var(--muted); font-size: 12px; }
.now-banner.ai { border-color: #c9ece2; background: var(--teal-soft); }
.now-banner.crew { border-color: #c9d8ff; background: var(--blue-soft); }
.now-banner.wait { border-color: #f3e0b8; background: #fff8e8; }
.now-banner.you { border-color: #ffd0b5; background: var(--orange-soft); }
.now-banner.off { border-color: #f6cfcf; background: var(--red-soft); }
.who {
  font-size: 10px; font-weight: 850; letter-spacing: .04em;
  padding: 4px 8px; border-radius: 999px; background: #fff;
}
.who-ai { color: var(--teal); }
.who-crew { color: var(--blue); }
.who-you { color: #b84f19; }

.stage-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stage-card {
  border: 1px solid var(--line); border-radius: 16px; padding: 14px 15px; background: #fff;
}
.stage-card h3 { margin: 4px 0 6px; font-size: 15px; letter-spacing: -.3px; }
.stage-card p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.55; }
.stage-kicker { font-size: 10px; font-weight: 850; letter-spacing: .08em; color: #9a6f4b; }
.stage-card.ai { background: var(--teal-soft); border-color: #c9ece2; }
.stage-card.ai.live { box-shadow: 0 0 0 3px rgba(32,169,144,.12); }
.stage-card.crew { background: var(--blue-soft); border-color: #c9d8ff; }
.stage-card.you { background: var(--cream); }

.compact-two { grid-template-columns: 1.1fr .9fr; }
.work-list, .report-list { padding: 0 14px 16px; display: grid; gap: 8px; }
.work-card, .report-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff;
}
.work-card.working { border-color: #a8c5ff; background: #fbfcff; }
.work-card.submitted { border-color: #f3c98b; background: #fffaf1; }
.work-card.done { opacity: .78; }
.work-top { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); font-weight: 750; }
.work-title { margin: 5px 0 8px; font-size: 13px; font-weight: 800; }
.work-artifact { margin-top: 6px; font-size: 11px; color: #3d4a63; }
.report-head { font-size: 10px; font-weight: 800; color: #7a5a3a; margin-bottom: 4px; }
.report-body { font-size: 12px; line-height: 1.55; }
.agent-kind { color: #a0a6b0; font-size: 8px; font-weight: 700; margin-left: 4px; }
.agent-card.boss { border-color: #c9ece2; background: #f7fffc; }

@media (max-width: 1100px) {
  .stage-grid, .compact-two { grid-template-columns: 1fr; }
  .app-shell { grid-template-columns: 1fr; }
}

.work-attempts { margin-top: 5px; font-size: 10.5px; color: #a2542c; background: var(--orange-soft); border-radius: 8px; padding: 4px 7px; }

/* ---- Opening scene: make it read as a GAME in 5 seconds ---- */
.intro {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 177, 116, .28), transparent 42%),
    radial-gradient(circle at 82% 85%, rgba(88, 192, 170, .22), transparent 40%),
    linear-gradient(160deg, #16233a 0%, #1d3049 55%, #213d42 100%);
  color: #fff; text-align: center;
}
.intro-stage { max-width: 620px; padding: 30px; animation: introRise .5s ease-out both; }
@keyframes introRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.intro-animals { display: flex; justify-content: center; margin-bottom: 26px; }
.intro-animals span {
  width: 58px; height: 58px; margin-left: -12px;
  border-radius: 20px; display: grid; place-items: center; font-size: 30px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 10px 24px rgba(0,0,0,.25);
}
.intro-animals span:nth-child(even) { transform: translateY(-10px) rotate(3deg); }
.intro-animals span:nth-child(1) { animation: animalBob 2.2s ease-in-out infinite; }
.intro-animals span:nth-child(3) { animation: animalBob 2.2s .3s ease-in-out infinite; }
.intro-animals span:nth-child(5) { animation: animalBob 2.2s .6s ease-in-out infinite; }
.intro-animals span:nth-child(7) { animation: animalBob 2.2s .9s ease-in-out infinite; }
@keyframes animalBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.intro-kicker { color: #ffc79b; font-size: 13px; font-weight: 800; letter-spacing: .08em; }
.intro-title { margin: 12px 0 14px; font-size: clamp(40px, 7vw, 64px); letter-spacing: -2px; line-height: 1.05; }
.intro-pitch { color: rgba(255,255,255,.78); font-size: 15px; line-height: 1.85; margin: 0 0 26px; }
.intro-cta {
  border: 0; cursor: pointer; color: #221408;
  background: linear-gradient(145deg, #ffd08a, #ff9d5f);
  font-size: 17px; font-weight: 900; letter-spacing: .02em;
  padding: 15px 34px; border-radius: 16px;
  box-shadow: 0 14px 34px rgba(255, 140, 74, .38);
  transition: transform .15s ease, box-shadow .15s ease;
}
.intro-cta:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 18px 44px rgba(255,140,74,.5); }
.intro-cta:active { transform: scale(.98); }
.intro-cta-small { font-size: 13px; padding: 10px 22px; box-shadow: 0 8px 20px rgba(35,44,66,.12); background: #fff; color: var(--ink); }
.intro-hint { margin-top: 18px; color: rgba(255,255,255,.5); font-size: 11.5px; }
.opportunity-card.glow { border-color: #ff9d5f; box-shadow: 0 0 0 4px rgba(255,157,95,.25); animation: cardPulse 1.2s ease-in-out 3; }
@keyframes cardPulse { 50% { box-shadow: 0 0 0 8px rgba(255,157,95,.12); } }
.hidden { display: none !important; }

/* ---- Quest bar: always answers "现在该干什么" ---- */
.quest-bar {
  margin: 10px 14px 0;
  padding: 10px 18px;
  border-radius: 14px;
  display: flex; align-items: center; gap: 12px;
  background: var(--navy); color: #fff;
  box-shadow: 0 10px 28px rgba(16,27,45,.22);
}
.quest-step {
  font-size: 10px; font-weight: 900; letter-spacing: .1em;
  padding: 4px 9px; border-radius: 999px;
  background: rgba(255,255,255,.14); color: #ffd9b8; white-space: nowrap;
}
.quest-text { font-size: 13.5px; font-weight: 650; line-height: 1.5; }
.quest-cta {
  margin-left: auto; border: 0; cursor: pointer; white-space: nowrap;
  background: linear-gradient(145deg, #ffd08a, #ff9d5f); color: #221408;
  font-weight: 850; font-size: 12.5px; padding: 8px 16px; border-radius: 11px;
}
.quest-bar.urgent { background: #b3541e; }
.quest-bar.urgent .quest-step { background: rgba(255,255,255,.2); color: #fff; }

/* ---- Settlement ceremony ---- */
.settlement {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  background: rgba(13, 20, 33, .62); backdrop-filter: blur(6px);
}
.settlement-card {
  width: min(480px, calc(100vw - 40px));
  background: #fff; border-radius: 24px; padding: 30px 30px 24px;
  text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.35);
  animation: introRise .4s ease-out both;
}
.settlement-kicker { color: var(--teal); font-size: 11px; font-weight: 900; letter-spacing: .14em; }
.settlement-card h2 { margin: 10px 0 4px; font-size: 22px; letter-spacing: -.5px; }
.settlement-amount { font-size: 46px; font-weight: 900; color: var(--green); letter-spacing: -1.5px; margin: 8px 0 16px; }
.settlement-amount span { font-size: 12px; color: var(--muted); margin-left: 8px; letter-spacing: 0; }
.settlement-rows { text-align: left; display: grid; gap: 8px; margin-bottom: 20px; }
.settlement-rows > div {
  display: flex; justify-content: space-between; align-items: baseline;
  background: var(--cream); border-radius: 11px; padding: 10px 13px; font-size: 12.5px;
}
.settlement-rows span { color: var(--muted); }
.settlement-later {
  display: block; margin: 12px auto 0; border: 0; background: none;
  color: var(--muted); font-size: 11.5px; text-decoration: underline; cursor: pointer;
}

/* ---- Recruits & goals: give cash a purpose ---- */
.recruit-list { padding: 0 12px 12px; display: grid; gap: 9px; }
.recruit-card { border: 1px solid var(--line); border-radius: 13px; padding: 11px; background: #fff; display: grid; gap: 9px; }
.recruit-head { display: flex; gap: 10px; align-items: center; }
.recruit-avatar { width: 38px; height: 38px; border-radius: 12px; background: var(--purple-soft); display: grid; place-items: center; font-size: 22px; }
.recruit-name { font-size: 12.5px; font-weight: 850; }
.recruit-liner { color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.recruit-actions { display: flex; justify-content: space-between; align-items: center; }
.recruit-cost { font-weight: 850; color: var(--green); font-size: 13px; }
.quest-cta:disabled { opacity: .45; cursor: not-allowed; }
.opportunity-card.locked { opacity: .6; }
.opportunity-card.star { border-color: #f3d48a; background: #fffdf4; }
.settlement-nextgoal { margin-top: 6px; }
.goal-row { background: var(--cream); border-radius: 12px; padding: 10px 13px; }
.goal-line { font-size: 12px; font-weight: 700; margin-bottom: 7px; }
.goal-track { height: 7px; border-radius: 99px; background: #e8e2d4; overflow: hidden; }
.goal-track i { display: block; height: 100%; background: linear-gradient(90deg, #ffd08a, #ff9d5f); border-radius: inherit; }

/* ---- Curiosity layer: intel card, agent sheet, live desk, first-time toast ---- */
.intel-card {
  margin: 0 17px 16px; padding: 13px 15px;
  background: var(--cream); border: 1px dashed #d9cba8; border-radius: 13px;
  font-size: 12.5px; line-height: 1.8; color: #5a4a2f;
}
.intel-card strong { color: #8a5a17; }
.intel-note { color: var(--muted); font-size: 10.5px; }
.agent-card { cursor: pointer; transition: transform .12s ease, border-color .12s ease; }
.agent-card:hover { transform: translateY(-1px); border-color: #ffc09c; }
.sheet-emoji { font-size: 44px; }
.sheet-species { font-size: 12px; color: var(--muted); font-weight: 600; }
.sheet-quote { margin: 10px 0; font-size: 14px; font-weight: 700; color: #4a3d28; }
.sheet-quirk { font-size: 11.5px; color: #6b5d42; background: var(--cream); border-radius: 9px; padding: 7px 10px; margin: 4px 0; text-align: left; }
.sheet-skills { display: grid; gap: 6px; margin: 12px 0; text-align: left; }
.sheet-skill { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; position: relative; background: #f2f3f7; border-radius: 8px; padding: 6px 9px; overflow: hidden; }
.sheet-skill i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, rgba(120,91,232,.16), rgba(120,91,232,.05)); }
.sheet-skill em { font-style: normal; font-size: 11px; font-weight: 700; position: relative; }
.sheet-skill b { font-size: 11px; color: var(--purple); position: relative; }
.sheet-rap { font-size: 11.5px; color: #7a5a3a; background: var(--orange-soft); border-radius: 9px; padding: 8px 11px; margin: 8px 0; text-align: left; }
.desk { display: grid; gap: 5px; margin: 8px 0; }
.desk-row { display: flex; align-items: center; gap: 7px; background: rgba(255,255,255,.75); border-radius: 8px; padding: 5px 8px; font-size: 11px; }
.desk-who { font-weight: 800; white-space: nowrap; }
.desk-what { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #55607a; }
.desk-due { color: var(--blue); font-weight: 800; white-space: nowrap; font-size: 10px; }
.toast.ft { font-size: 13px; padding: 13px 18px; max-width: 430px; line-height: 1.6; }
.toast.ft .ft-emoji { font-size: 18px; margin-right: 8px; }
.toast.ft b { color: #b3541e; }

/* ---- G0 feedback row ---- */
.fb-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.fb-btn { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 12px; font-size: 12px; font-weight: 750; cursor: pointer; }
.fb-btn.fb-down { margin-left: 2px; }
.fb-btn:hover { border-color: #ffc09c; }

/* ---- Rarity ---- */
.rarity-badge { display:inline-block; font-size:9px; font-weight:900; letter-spacing:.08em; border-radius:6px; padding:2px 6px; vertical-align:2px; margin-right:4px; }
.rarity-badge.r { background:#eef1f5; color:#6b7686; }
.rarity-badge.sr { background:#e8f0ff; color:#2f6bd8; }
.rarity-badge.ssr { background:linear-gradient(135deg,#ffe9b0,#ffc95e); color:#7a5205; box-shadow:0 2px 8px rgba(255,197,94,.5); }
.recruit-card.rarity-ssr { border-color:#f3d48a; background:#fffdf4; }
.recruit-card.rarity-sr { border-color:#c9d8ff; }

/* ---- Training zone ---- */
.train-zone { text-align: left; margin: 8px 0; background: #f4f6fa; border-radius: 12px; padding: 10px 12px; }
.train-title { font-size: 11px; font-weight: 850; color: #4a5568; margin-bottom: 7px; }
.train-rows { display: flex; flex-wrap: wrap; gap: 6px; }
.train-btn { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 6px 10px; font-size: 11px; font-weight: 750; cursor: pointer; }
.train-btn:hover { border-color: #ffc09c; background: var(--orange-soft); }

.sheet-perk { text-align:left; font-size:11px; line-height:1.6; border-radius:9px; padding:7px 10px; margin:4px 0; background:#eef7f1; color:#2f5d43; }
.sheet-perk.fierce { background:#fdeeee; color:#8c3a3a; }
.sheet-perk b { margin-right:4px; }

.rush-btn { margin-top:7px; width:100%; border:0; cursor:pointer; border-radius:9px; padding:7px 10px; font-size:11px; font-weight:850; background:linear-gradient(135deg,#ffe9b0,#ffc95e); color:#7a5205; }
.rush-btn:hover { filter:brightness(1.05); }
.rush-btn:active { transform:scale(.98); }

/* ---- Recruit card density (sell the value at a glance) ---- */
.recruit-card { display:grid; gap:8px; padding:10px; }
.recruit-card.rarity-ssr { border-color:#f3d48a; background:#fffdf4; box-shadow: inset 0 0 0 1px rgba(255,201,94,.4); }
.recruit-card.rarity-sr  { box-shadow: 0 0 0 1px rgba(120,154,232,.35); }
@keyframes ssrGlow { 50% { box-shadow: 0 0 0 4px rgba(255,201,94,.7); } }
.recruit-meta { display:flex; flex-wrap:wrap; gap:3px; align-items:center; margin-top:2px; padding:0; }
.recruit-skill { display:inline-block; font-size:10px; padding:1px 5px; border-radius:5px; background:#f2f4f8; color:#4a5568; font-weight:700; }
.recruit-skill b { color:#2f6bd8; margin-left:3px; }
.perk-chip { font-size:10px; padding:1px 5px; border-radius:5px; background:#eef7f1; color:#2f5d43; font-weight:700; max-width:60px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.perk-chip.fierce { background:#fdeeee; color:#8c3a3a; }
.recruit-upkeep { margin-left:auto; font-size:10px; color:#8a6d3b; font-weight:700; }
