:root {
  --bg: #070b14;
  --panel: rgba(18, 25, 43, 0.86);
  --panel-strong: rgba(27, 36, 62, 0.94);
  --line: rgba(129, 151, 191, 0.22);
  --text: #edf4ff;
  --muted: #9aa8c5;
  --dim: #67738f;
  --blue: #4c8dff;
  --cyan: #3bd8ff;
  --green: #38d67a;
  --violet: #8f64ff;
  --orange: #f2a64b;
  --red: #f05d68;
  --radius: 8px;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
  background:
    linear-gradient(135deg, rgba(76, 141, 255, 0.12), transparent 30%),
    linear-gradient(225deg, rgba(56, 214, 122, 0.08), transparent 28%),
    #070b14;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 48px 48px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(280px, 390px) 1fr auto;
  gap: 18px;
  align-items: center;
  min-height: 76px;
  padding: 14px 22px;
  background: rgba(6, 10, 20, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(59, 216, 255, 0.42);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(76, 141, 255, 0.35), rgba(59, 216, 255, 0.12));
  box-shadow: 0 0 30px rgba(76, 141, 255, 0.32);
}

.brand-mark span {
  width: 18px;
  height: 18px;
  border: 3px solid #cce7ff;
  border-radius: 5px;
  box-shadow: inset 0 0 12px rgba(59, 216, 255, 0.65), 0 0 16px rgba(59, 216, 255, 0.75);
}

.brand h1,
.brand p,
.hero-panel h2,
.hero-panel p,
.agent-card h3,
.agent-card p {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.2;
}

.brand p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.version {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #c8d6f8;
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
}

.nav-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  min-width: 0;
}

.nav-tabs button,
.quick-actions button,
.command-presets button,
.command-panel form button {
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(20, 28, 48, 0.66);
  border-radius: 8px;
  transition: border-color 0.18s, color 0.18s, background 0.18s, transform 0.18s;
}

.nav-tabs button {
  min-height: 38px;
  padding: 0 14px;
  white-space: nowrap;
}

.nav-tabs button:hover,
.nav-tabs button.active {
  color: var(--text);
  border-color: rgba(76, 141, 255, 0.76);
  background: rgba(76, 141, 255, 0.16);
}

.operator {
  display: flex;
  align-items: center;
  gap: 9px;
  justify-content: flex-end;
  color: #d8e3fb;
  white-space: nowrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 14px rgba(56, 214, 122, 0.8);
}

.dashboard {
  display: grid;
  grid-template-columns: 300px minmax(620px, 1fr) 360px;
  gap: 18px;
  padding: 18px;
}

.left-rail,
.right-rail,
.command-center {
  min-width: 0;
}

.left-rail,
.right-rail {
  display: grid;
  align-content: start;
  gap: 16px;
}

.panel,
.assistant-card,
.hero-panel,
.agent-card,
.command-panel,
.task-center-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel,
.assistant-card,
.command-panel,
.task-center-panel {
  padding: 18px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title span {
  font-weight: 700;
}

.section-title small,
.metric-list small,
.todo-list small,
.timeline small,
.progress-list small {
  color: var(--dim);
}

.company-card {
  padding: 16px;
  border: 1px solid rgba(76, 141, 255, 0.45);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(76, 141, 255, 0.23), rgba(56, 214, 122, 0.12));
}

.company-card span,
.company-card p {
  color: #c2d1ef;
}

.company-card strong {
  display: block;
  margin: 10px 0 8px;
  font-size: 28px;
  line-height: 1.05;
}

.company-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

.editable-card {
  outline: 1px solid transparent;
  outline-offset: 2px;
}

.editable-card:focus {
  outline-color: rgba(59, 216, 255, 0.72);
  background-color: rgba(76, 141, 255, 0.06);
}

.editable-card:focus-visible {
  outline-color: rgba(59, 216, 255, 0.92);
}

.metric-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.metric-list article {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(129, 151, 191, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.metric-list span {
  color: var(--muted);
}

.metric-list strong {
  grid-row: span 2;
  font-size: 24px;
}

.good {
  color: var(--green);
}

.quick-actions {
  display: grid;
  gap: 10px;
}

.quick-actions .section-title {
  margin-bottom: 2px;
}

.quick-actions button {
  min-height: 42px;
  color: #d7e2fb;
}

.quick-actions button:hover,
.command-presets button:hover,
.command-panel form button:hover,
.task-form button:hover,
.task-filters button:hover,
.task-filters button.active,
.task-actions button:hover {
  transform: translateY(-1px);
  border-color: rgba(59, 216, 255, 0.65);
  color: var(--text);
}

.assistant-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 13px;
  align-items: center;
}

.assistant-avatar {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: 1px solid rgba(59, 216, 255, 0.42);
  background:
    radial-gradient(circle at 50% 40%, #cce7ff 0 7px, transparent 8px),
    linear-gradient(145deg, rgba(76, 141, 255, 0.38), rgba(59, 216, 255, 0.14));
}

.assistant-card p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.command-center {
  display: grid;
  gap: 16px;
}

.hero-panel {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  min-height: 118px;
  background:
    linear-gradient(120deg, rgba(76, 141, 255, 0.2), rgba(27, 36, 62, 0.88) 48%, rgba(56, 214, 122, 0.1)),
    var(--panel-strong);
}

.eyebrow {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 700;
}

.hero-panel h2 {
  margin-top: 6px;
  font-size: 28px;
}

.hero-panel p {
  max-width: 720px;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.hero-stats {
  display: grid;
  align-content: center;
  min-width: 190px;
  padding: 14px;
  border: 1px solid rgba(76, 141, 255, 0.34);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
}

.hero-stats span {
  color: var(--muted);
  font-size: 13px;
}

.hero-stats strong {
  margin-top: 7px;
  color: #dbe8ff;
}

.agent-map {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 16px;
  align-items: stretch;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
}

.agent-card {
  position: relative;
  overflow: hidden;
  min-height: 194px;
  padding: 16px;
}

.agent-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-top: 3px solid var(--agent-color, var(--blue));
  opacity: 0.82;
}

.agent-card.ceo {
  min-height: 100%;
  background:
    linear-gradient(160deg, rgba(76, 141, 255, 0.22), rgba(20, 28, 48, 0.9)),
    var(--panel);
}

.agent-head {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: start;
}

.agent-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: #eef6ff;
  font-size: 11px;
  font-weight: 800;
  background: color-mix(in srgb, var(--agent-color, var(--blue)) 36%, #111827);
  border: 1px solid color-mix(in srgb, var(--agent-color, var(--blue)) 58%, transparent);
}

.agent-card h3 {
  font-size: 16px;
}

.agent-card p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.agent-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 13px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
}

.agent-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.agent-status.active {
  color: var(--green);
}

.agent-status.building {
  color: var(--orange);
}

.agent-status.planned {
  color: var(--cyan);
}

.agent-card ul {
  margin: 13px 0 0;
  padding-left: 18px;
  color: #c7d3ea;
  line-height: 1.55;
  font-size: 13px;
}

.command-panel {
  display: grid;
  gap: 12px;
}

.command-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.command-presets button {
  min-height: 36px;
  padding: 0 13px;
}

.command-panel form {
  display: grid;
  grid-template-columns: 1fr 88px;
  gap: 10px;
}

.command-panel input,
.task-form input,
.task-form select,
.task-meta select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(7, 11, 20, 0.62);
  outline: none;
}

.command-panel input:focus,
.task-form input:focus,
.task-form select:focus,
.task-meta select:focus {
  border-color: rgba(59, 216, 255, 0.62);
}

.command-panel form button {
  color: var(--text);
  background: rgba(76, 141, 255, 0.24);
}

#commandResult {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.timeline,
.todo-list,
.progress-list {
  display: grid;
  gap: 10px;
}

.timeline article,
.todo-list article,
.progress-list article {
  border: 1px solid rgba(129, 151, 191, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.032);
}

.timeline article {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  padding: 11px;
}

.timeline strong,
.todo-list strong,
.progress-list strong {
  display: block;
  color: #dce8ff;
  font-size: 14px;
}

.timeline p,
.todo-list p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.4;
  font-size: 13px;
}

.todo-list article {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px;
}

.priority {
  align-self: start;
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--text);
  font-size: 12px;
}

.priority.high {
  background: rgba(240, 93, 104, 0.22);
  color: #ffb9bf;
}

.priority.mid {
  background: rgba(242, 166, 75, 0.2);
  color: #ffd29a;
}

.priority.low {
  background: rgba(56, 214, 122, 0.18);
  color: #a8f1c8;
}

.progress-list article {
  padding: 12px;
}

.progress-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 8px;
}

.bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.bar span {
  display: block;
  height: 100%;
  width: var(--value);
  border-radius: inherit;
  background: var(--agent-color, var(--blue));
}

.task-center-panel {
  display: grid;
  gap: 14px;
}

.task-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px 110px 110px;
  gap: 10px;
}

.task-form button,
.task-filters button,
.task-actions button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #d7e2fb;
  background: rgba(20, 28, 48, 0.66);
}

.task-form button {
  color: var(--text);
  border-color: rgba(76, 141, 255, 0.45);
  background: rgba(76, 141, 255, 0.22);
}

.task-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-filters button {
  min-height: 34px;
  padding: 0 12px;
}

.task-filters button.active,
.task-filters button:hover,
.task-actions button:hover,
.task-form button:hover {
  background: rgba(76, 141, 255, 0.16);
}

.task-list {
  display: grid;
  gap: 10px;
}

.task-card,
.empty-task {
  border: 1px solid rgba(129, 151, 191, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.032);
}

.task-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 14px;
}

.task-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.task-card strong {
  color: #dce8ff;
}

.task-card p {
  margin: 8px 0 12px;
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
}

.task-meta {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 90px auto;
  gap: 9px;
  align-items: center;
}

.task-meta select {
  min-height: 36px;
  padding: 0 10px;
  font-size: 13px;
}

.task-status {
  justify-self: end;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.task-status.todo {
  color: #c9d7f2;
  background: rgba(255, 255, 255, 0.07);
}

.task-status.doing {
  color: #ffd29a;
  background: rgba(242, 166, 75, 0.2);
}

.task-status.review {
  color: #cdbdff;
  background: rgba(143, 100, 255, 0.2);
}

.task-status.done {
  color: #a8f1c8;
  background: rgba(56, 214, 122, 0.18);
}

.task-actions {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 78px;
}

.task-actions button {
  min-height: 34px;
  padding: 0 10px;
}

.empty-task {
  padding: 16px;
  color: var(--muted);
}

@media (max-width: 1380px) {
  .dashboard {
    grid-template-columns: 280px minmax(560px, 1fr);
  }

  .right-rail {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 980px) {
  .topbar {
    position: static;
    grid-template-columns: 1fr;
  }

  .nav-tabs {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .operator {
    justify-content: flex-start;
  }

  .dashboard,
  .right-rail {
    grid-template-columns: 1fr;
  }

  .agent-map {
    grid-template-columns: 1fr;
  }

  .agent-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 620px) {
  .dashboard {
    padding: 12px;
  }

  .brand {
    align-items: flex-start;
  }

  .hero-panel {
    display: grid;
  }

  .hero-stats {
    min-width: 0;
  }

  .agent-grid {
    grid-template-columns: 1fr;
  }

  .command-panel form {
    grid-template-columns: 1fr;
  }

  .task-form,
  .task-card,
  .task-meta {
    grid-template-columns: 1fr;
  }

  .task-status {
    justify-self: start;
  }

  .company-card strong {
    font-size: 24px;
  }
}
