:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #667085;
  --line: #d8dee7;
  --panel: #ffffff;
  --wash: #f3f6fa;
  --soft: #edf2f7;
  --teal: #0f8b8d;
  --green: #2f9e62;
  --amber: #d99022;
  --coral: #d45d4c;
  --blue: #3366cc;
  --shadow: 0 18px 45px rgba(31, 42, 68, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--wash);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a {
  font: inherit;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  background: #111820;
  color: #f7fafc;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--teal), #70b77e);
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.side-panel p,
.label {
  color: #b8c1cc;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  color: #dce4ed;
  text-decoration: none;
}

.nav-list a span {
  width: 18px;
  text-align: center;
  color: #93d5cf;
}

.nav-list a.active,
.nav-list a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.side-panel {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.side-panel strong {
  display: block;
  margin-top: 6px;
}

.side-panel p {
  margin: 8px 0 0;
  line-height: 1.45;
}

.shell {
  margin-left: 248px;
  padding: 28px;
}

.topbar,
.panel-header,
.top-actions,
.capacity,
.health-list div {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 32px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 5px;
  font-size: 18px;
}

.panel-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  gap: 10px;
}

.icon-button,
.primary-button,
.text-button,
.segmented button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.icon-button {
  width: 40px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.primary-button {
  padding: 0 16px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 800;
}

.text-button {
  padding: 0 12px;
  background: var(--soft);
  color: var(--ink);
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.control-band {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.secretary-panel {
  display: grid;
  gap: 16px;
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid rgba(15, 139, 141, 0.24);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f7fbfb);
  box-shadow: var(--shadow);
}

.secretary-main {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.secretary-avatar {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #111820;
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
}

.secretary-main h2 {
  margin-bottom: 5px;
}

.secretary-main p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.command-box {
  display: grid;
  gap: 10px;
}

textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  line-height: 1.5;
}

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

.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.inline-toggle input {
  width: 16px;
  min-height: 16px;
  height: 16px;
}

.route-preview {
  display: grid;
  gap: 8px;
}

.route-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 92px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  font-size: 13px;
}

.route-card strong {
  overflow-wrap: anywhere;
}

.route-card small {
  color: var(--muted);
  line-height: 1.45;
}

.route-card .pill {
  justify-self: end;
}

.workflow-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.workflow-card {
  display: grid;
  gap: 10px;
  min-height: 174px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.workflow-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.workflow-card small {
  color: var(--muted);
  line-height: 1.45;
}

.workflow-card .text-button {
  align-self: end;
  justify-self: start;
}

.shopee-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 10px;
}

.connector-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.product-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.product-card img {
  width: 100%;
  aspect-ratio: 1.5;
  object-fit: cover;
  border-radius: 6px;
  background: var(--soft);
}

.product-card strong,
.product-card small {
  overflow-wrap: anywhere;
}

.product-card small {
  color: var(--muted);
}

.search-box,
.select-box,
.toggle-row,
.task-dialog label {
  display: grid;
  gap: 6px;
}

.search-box span,
.select-box span,
.task-dialog label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  background: #ffffff;
  color: var(--ink);
}

.toggle-row {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  min-height: 40px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.toggle-row input {
  min-height: auto;
  width: 16px;
  height: 16px;
}

.status-strip article,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.status-strip article {
  padding: 16px;
}

.metric-label,
.table-head,
.agent-meta,
.log-list time {
  color: var(--muted);
  font-size: 12px;
}

.status-strip strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

small.up {
  color: var(--green);
}

small.down {
  color: var(--blue);
}

small.steady {
  color: var(--amber);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(290px, 0.8fr);
  gap: 14px;
}

.dev-team-panel {
  grid-column: 1 / -1;
}

.dev-team-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.dev-role-card {
  display: grid;
  gap: 8px;
  min-height: 154px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.dev-role-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.dev-role-card small {
  color: var(--muted);
  line-height: 1.45;
}

.dev-role-card .meter {
  width: 100%;
  margin-top: auto;
}

.dev-role-tag {
  justify-self: start;
  padding: 4px 8px;
  border-radius: 999px;
  background: #dff5f2;
  color: #075e60;
  font-size: 11px;
  font-weight: 900;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-header {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background: var(--soft);
}

.segmented button {
  min-height: 30px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
}

.segmented .selected {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 2px 10px rgba(31, 42, 68, 0.08);
}

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

.agent-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 86px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  cursor: pointer;
}

.agent-card.selected {
  border-color: rgba(15, 139, 141, 0.55);
  box-shadow: inset 3px 0 0 var(--teal);
}

.agent-card:hover {
  border-color: rgba(15, 139, 141, 0.45);
}

.avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  font-weight: 800;
}

.avatar.teal {
  background: var(--teal);
}

.avatar.green {
  background: var(--green);
}

.avatar.coral {
  background: var(--coral);
}

.avatar.blue {
  background: var(--blue);
}

.agent-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.agent-meta {
  display: block;
  margin-top: 4px;
}

.load {
  text-align: right;
  font-weight: 800;
}

.load span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.detail-panel {
  min-height: 318px;
}

.agent-detail {
  display: grid;
  gap: 14px;
}

.detail-hero {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.detail-hero .avatar {
  width: 52px;
  height: 52px;
}

.detail-hero strong {
  display: block;
}

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

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-stat {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.detail-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.detail-stat strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.mini-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.agent-detail .meter {
  width: 100%;
}

.map-panel,
.pipeline-panel,
.health-panel {
  min-height: 318px;
}

.pipeline-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pipeline-list li {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.pipeline-list li span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #dff5f2;
  color: #075e60;
  font-size: 12px;
  font-weight: 900;
}

.pipeline-list li strong {
  display: block;
}

.pipeline-list li small {
  display: block;
  color: var(--muted);
  line-height: 1.45;
}

.network-visual {
  position: relative;
  height: 208px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(15, 139, 141, 0.09) 1px, transparent 1px),
    linear-gradient(rgba(15, 139, 141, 0.09) 1px, transparent 1px),
    #f8fbfd;
  background-size: 28px 28px;
}

.node {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 62px;
  height: 38px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(31, 42, 68, 0.12);
  font-size: 12px;
  font-weight: 800;
}

.node-main {
  top: 84px;
  left: calc(50% - 31px);
  color: var(--teal);
}

.node-a {
  top: 24px;
  left: 12%;
}

.node-b {
  top: 26px;
  right: 12%;
}

.node-c {
  bottom: 28px;
  left: 16%;
}

.node-d {
  right: 15%;
  bottom: 28px;
}

.link {
  position: absolute;
  z-index: 1;
  height: 2px;
  border-radius: 2px;
  background: rgba(15, 139, 141, 0.45);
  transform-origin: left center;
}

.link-a {
  width: 35%;
  left: 28%;
  top: 72px;
  transform: rotate(20deg);
}

.link-b {
  width: 34%;
  right: 24%;
  top: 75px;
  transform: rotate(-20deg);
}

.link-c {
  width: 31%;
  left: 30%;
  bottom: 74px;
  transform: rotate(-22deg);
}

.link-d {
  width: 31%;
  right: 27%;
  bottom: 72px;
  transform: rotate(23deg);
}

.capacity {
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.capacity strong {
  margin-left: auto;
  color: var(--ink);
}

.meter {
  width: 110px;
  height: 8px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--soft);
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.trend-panel {
  min-height: 260px;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(5, minmax(24px, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 172px;
  padding-top: 8px;
}

.bar-item {
  display: grid;
  gap: 7px;
  align-items: end;
  height: 170px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.bar-item span:first-child {
  align-self: end;
  min-height: 24px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--teal), #70b77e);
}

.bar-item strong {
  font-size: 12px;
  color: var(--ink);
}

.tasks-panel,
.log-panel {
  grid-column: span 1;
}

.kanban-panel {
  grid-column: 1 / -1;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.kanban-column {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 210px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fc;
}

.kanban-column h3 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.kanban-column h3 span {
  color: var(--ink);
}

.kanban-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  font-size: 13px;
}

.kanban-card strong {
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.kanban-card small {
  color: var(--muted);
}

.kanban-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.kanban-actions button {
  min-height: 30px;
  padding: 0 9px;
}

.task-table {
  display: grid;
  gap: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.4fr) minmax(92px, 0.8fr) 74px 88px;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 8px;
}

.table-head {
  min-height: 30px;
  font-weight: 800;
  text-transform: uppercase;
}

#taskRows {
  display: grid;
  gap: 8px;
}

#taskRows .table-row {
  border: 1px solid var(--line);
  background: #fbfcfe;
  font-size: 13px;
}

.pill {
  justify-self: start;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.pill.running {
  color: #075e60;
  background: #dff5f2;
}

.pill.queued {
  color: #7a4c00;
  background: #fff1d6;
}

.pill.review {
  color: #7a3027;
  background: #ffe1dc;
}

.pill.approved {
  color: #16562f;
  background: #dcf7e7;
}

.pill.blocked {
  color: #4f5b66;
  background: #e7ebf0;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.donut {
  width: 154px;
  height: 154px;
  display: grid;
  place-items: center;
  margin: 6px auto 18px;
  border-radius: 50%;
  background: conic-gradient(var(--green) calc(var(--value) * 1%), #e9edf3 0);
}

.donut span {
  width: 108px;
  height: 108px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  font-size: 28px;
  font-weight: 900;
}

.health-list {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.health-list div {
  gap: 9px;
}

.dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.dot.green {
  background: var(--green);
}

.dot.amber {
  background: var(--amber);
}

.log-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 20px;
}

.log-list li {
  padding-left: 4px;
}

.log-list strong {
  display: block;
  font-size: 13px;
}

.log-list time {
  display: block;
  margin-top: 3px;
}

.task-dialog {
  width: min(460px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  box-shadow: 0 28px 70px rgba(17, 24, 32, 0.22);
}

.task-dialog::backdrop {
  background: rgba(17, 24, 32, 0.35);
}

.task-dialog form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.task-dialog menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 6px 0 0;
  padding: 0;
}

.output-dialog {
  width: min(760px, calc(100vw - 28px));
}

.output-dialog-content {
  padding: 18px;
}

.output-dialog pre {
  max-height: 62vh;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fc;
  color: var(--ink);
  font: 14px/1.65 ui-monospace, SFMono-Regular, Consolas, monospace;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

@media (max-width: 1040px) {
  .status-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .dev-team-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workflow-grid,
  .kanban-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-band {
    grid-template-columns: 1fr 180px;
  }

  .toggle-row {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .sidebar {
    position: static;
    width: auto;
    padding: 16px;
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(42px, 1fr));
  }

  .nav-list a {
    justify-content: center;
    padding: 0 6px;
    font-size: 0;
  }

  .nav-list a span {
    font-size: 16px;
  }

  .side-panel {
    display: none;
  }

  .shell {
    margin-left: 0;
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-strip {
    grid-template-columns: 1fr;
  }

  .control-band {
    grid-template-columns: 1fr;
  }

  .secretary-main {
    grid-template-columns: 1fr;
  }

  .route-card {
    grid-template-columns: 1fr;
  }

  .route-card .pill {
    justify-self: start;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .agent-card {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .load {
    grid-column: 2;
    text-align: left;
  }

  .table-row {
    grid-template-columns: minmax(130px, 1fr) 76px 68px 78px;
    overflow-x: auto;
  }

  .bar-chart {
    gap: 7px;
  }

  .dev-team-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workflow-grid,
  .kanban-board {
    grid-template-columns: 1fr;
  }

  .shopee-toolbar,
  .product-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .shell {
    padding: 14px;
  }

  h1 {
    font-size: 26px;
  }

  .top-actions {
    width: 100%;
  }

  .primary-button {
    flex: 1;
  }

  .task-table {
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .table-row {
    min-width: 500px;
  }

  .dev-team-grid {
    grid-template-columns: 1fr;
  }
}
