:root {
  --bg: #f8fbff;
  --surface: #ffffff;
  --surface-soft: #fbfdff;
  --ink: #102033;
  --muted: #64748b;
  --line: #deebf8;
  --primary: #82caff;
  --ad-blue: #bdeaff;
  --sky: #d6f2ff;
  --cyan: #e0f8ff;
  --accent-lime: #9bdc19;
  --green: #16a36c;
  --amber: #c27a12;
  --red: #d04343;
  --nav: #eaf5ff;
  --sidebar-bg: #fbfdff;
  --sidebar-active: #f2f8ff;
  --sidebar-line: #deebf8;
  --panel-glow: 0 10px 28px rgba(31, 76, 132, 0.038);
  --shadow: 0 12px 30px rgba(31, 76, 132, 0.055);
  --soft-shadow: 0 7px 18px rgba(31, 76, 132, 0.032);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, #f7fbff 0%, #ffffff 45%, #f3f9ff 100%),
    var(--bg);
  background-size: auto;
  font-family: "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

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

button {
  min-height: 38px;
  border: 1px solid #bfe5ff;
  border-radius: 8px;
  padding: 0 14px;
  color: #24516f;
  background: linear-gradient(180deg, #f8fdff, #d8f0ff);
  box-shadow: 0 4px 10px rgba(82, 145, 207, 0.05);
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    filter 160ms ease;
}

button:hover {
  filter: brightness(1.01);
  transform: translateY(-1px);
  box-shadow: 0 5px 12px rgba(82, 145, 207, 0.07);
}

button:disabled {
  cursor: wait;
  filter: grayscale(0.15) brightness(0.96);
  opacity: 0.68;
  transform: none;
  box-shadow: none;
}

button.ghost {
  color: #3f7fae;
  background: #fbfdff;
  border: 1px solid #d6eaf8;
  box-shadow: none;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--ad-blue);
  box-shadow: 0 0 0 3px rgba(215, 240, 255, 0.44);
}

textarea {
  min-height: 120px;
  padding: 10px 11px;
  resize: vertical;
  line-height: 1.6;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.15;
}

h2 {
  font-size: 17px;
}

h3 {
  margin-bottom: 12px;
  color: #36506c;
  font-size: 13px;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--ad-blue);
  font-size: 12px;
  font-weight: 800;
}

.login-page {
  position: relative;
  isolation: isolate;
  display: grid;
  overflow: hidden;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  animation: loginGridDrift 18s ease-in-out infinite alternate;
}

.login-motion {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.login-line {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(920px, 82vw);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(130, 202, 255, 0.08), rgba(215, 240, 255, 0.58), rgba(224, 248, 255, 0.22), transparent);
  box-shadow: 0 0 16px rgba(130, 202, 255, 0.1);
  opacity: 0;
  transform-origin: center;
  transform: translate3d(calc(-50% + var(--line-x-start)), var(--line-y-start), 0) rotate(var(--line-angle-start));
  animation:
    loginLineSweep 7.8s ease-in-out infinite,
    loginLineFloat 12.8s ease-in-out infinite alternate;
}

.login-line-a {
  --line-x-start: -8vw;
  --line-x-end: 7vw;
  --line-y-start: -26vh;
  --line-y-end: -16vh;
  --line-angle-start: -13deg;
  --line-angle-end: -7deg;
  animation-delay: -1.2s;
}

.login-line-b {
  width: min(760px, 76vw);
  --line-x-start: 9vw;
  --line-x-end: -6vw;
  --line-y-start: 5vh;
  --line-y-end: 15vh;
  --line-angle-start: 7deg;
  --line-angle-end: 12deg;
  animation-delay: -4.3s;
}

.login-line-c {
  width: min(620px, 68vw);
  --line-x-start: -2vw;
  --line-x-end: 10vw;
  --line-y-start: 24vh;
  --line-y-end: 16vh;
  --line-angle-start: -4deg;
  --line-angle-end: 3deg;
  animation-delay: -6.1s;
}

.login-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #82caff;
  box-shadow:
    0 0 0 5px rgba(215, 240, 255, 0.18),
    0 0 20px rgba(130, 202, 255, 0.18);
  animation: loginDotDrift 6.4s ease-in-out infinite alternate;
}

.login-dot-a {
  top: 27%;
  left: 25%;
}

.login-dot-b {
  top: 62%;
  right: 22%;
  width: 6px;
  height: 6px;
  animation-delay: -2.8s;
}

.login-dot-c {
  bottom: 20%;
  left: 58%;
  width: 5px;
  height: 5px;
  background: #9bdcf1;
  animation-delay: -4.6s;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 30px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 250, 255, 0.96)),
    var(--surface);
  border: 1px solid rgba(196, 216, 244, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow);
  animation: loginCardIn 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.login-brand {
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
}

.login-brand span {
  width: fit-content;
  padding: 4px 8px;
  color: #24516f;
  background: linear-gradient(135deg, #d7f0ff, #bdeaff);
  border-radius: 6px;
  font-family: "DIN Alternate", "Bahnschrift", "Microsoft YaHei UI", sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  animation: loginFieldIn 360ms ease-out 90ms both;
}

.login-brand strong {
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  animation: loginFieldIn 360ms ease-out 140ms both;
}

.login-form,
.setup-form {
  display: grid;
  gap: 12px;
}

.login-form label,
.field {
  display: grid;
  gap: 6px;
}

.login-form span,
.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field textarea {
  min-height: 132px;
  resize: vertical;
}

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

.file-import-button {
  width: 100%;
  min-height: 38px;
  background: linear-gradient(180deg, #f8fdff, #d8f0ff);
}

.field-note {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.template-picker {
  display: grid;
  gap: 8px;
}

.template-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.template-selection-box {
  overflow: hidden;
  background: var(--wb-surface-muted);
  border: 1px solid var(--wb-line);
  border-radius: var(--wb-radius-sm);
}

.template-selection-box > summary {
  padding: 8px 10px;
  color: var(--wb-ink-soft);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.template-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 8px 8px;
}

.template-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 28px;
  gap: 6px;
  padding: 3px 5px 3px 9px;
  color: var(--wb-ink-soft);
  background: var(--wb-surface);
  border: 1px solid var(--wb-line);
  border-radius: 999px;
}

.template-chip strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workbench-shell .template-chip button {
  width: 22px;
  min-width: 22px;
  min-height: 22px;
  padding: 0;
  color: var(--wb-muted);
  background: transparent;
  border: 0;
}

.template-empty {
  color: var(--wb-muted);
  font-size: 12px;
}

.template-group-panel {
  overflow: hidden;
  background: var(--wb-surface);
  border: 1px solid var(--wb-line);
  border-radius: var(--wb-radius-sm);
}

.template-group-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--wb-ink-soft);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.template-group-panel > summary::-webkit-details-marker {
  display: none;
}

.template-group-panel > summary::after {
  content: "v";
  color: var(--wb-subtle);
  font-size: 12px;
}

.template-group-panel[open] > summary::after {
  content: "^";
}

.template-group-panel > summary small {
  margin-left: auto;
  color: var(--wb-muted);
  font-weight: 800;
}

.template-group-body {
  display: grid;
  gap: 8px;
  padding: 0 8px 8px;
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--wb-ink-soft);
  font-size: 12px;
  font-weight: 800;
}

.template-group-list {
  display: grid;
  max-height: 220px;
  gap: 8px;
  overflow-y: auto;
}

.template-group-card {
  display: grid;
  gap: 8px;
  padding: 9px;
  background: var(--wb-surface-muted);
  border: 1px solid var(--wb-line);
  border-radius: 12px;
}

.template-group-card.current {
  border-color: #bfdbfe;
  background: #f8fbff;
}

.template-group-card-head,
.template-group-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.template-group-card-head label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
}

.template-group-card-head strong {
  min-width: 0;
  overflow: hidden;
  color: var(--wb-ink);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-group-card-head span {
  flex: 0 0 auto;
  color: var(--wb-muted);
  font-size: 11px;
  font-weight: 900;
}

.template-group-card .template-chip-list {
  padding: 0;
}

.template-group-actions {
  justify-content: flex-end;
}

.workbench-shell .template-group-actions button {
  min-height: 28px;
  padding: 4px 9px;
  font-size: 12px;
}

.workbench-shell .danger-lite {
  color: #b42318;
  background: #fff7f7;
  border-color: #fed7d7;
}

.template-group-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.template-group-editor select,
.template-group-editor button {
  min-width: 0;
}

.template-group-empty {
  padding: 10px;
  color: var(--wb-muted);
  background: var(--wb-surface-muted);
  border: 1px dashed var(--wb-line);
  border-radius: 12px;
  font-size: 12px;
}

.login-form button {
  margin-top: 4px;
}

.login-form label {
  animation: loginFieldIn 360ms ease-out 190ms both;
}

.login-form button {
  animation: loginFieldIn 360ms ease-out 240ms both;
}

.setup-box {
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
}

.setup-box summary {
  width: fit-content;
  cursor: pointer;
}

.setup-form {
  margin-top: 12px;
}

@keyframes loginGridDrift {
  from {
    background-position:
      0 0,
      0 0,
      0 0;
  }

  to {
    background-position:
      0 0,
      18px 10px,
      -10px 18px;
  }
}

@keyframes loginCardIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes loginFieldIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes loginLineSweep {
  0% {
    opacity: 0;
    clip-path: inset(0 100% 0 0);
  }

  32% {
    opacity: 0.72;
  }

  64% {
    opacity: 0.72;
    clip-path: inset(0 0 0 0);
  }

  100% {
    opacity: 0;
    clip-path: inset(0 0 0 100%);
  }
}

@keyframes loginLineFloat {
  from {
    transform: translate3d(calc(-50% + var(--line-x-start)), var(--line-y-start), 0) rotate(var(--line-angle-start));
  }

  to {
    transform: translate3d(calc(-50% + var(--line-x-end)), var(--line-y-end), 0) rotate(var(--line-angle-end));
  }
}

@keyframes loginDotDrift {
  from {
    opacity: 0.42;
    transform: translate3d(-14px, 10px, 0);
  }

  to {
    opacity: 0.92;
    transform: translate3d(18px, -16px, 0);
  }
}
/* tokens */
:root {
  --wb-bg: #f6f7f9;
  --wb-surface: #ffffff;
  --wb-surface-muted: #f9fafb;
  --wb-surface-strong: #f2f4f7;
  --wb-ink: #111827;
  --wb-ink-soft: #344054;
  --wb-muted: #667085;
  --wb-subtle: #98a2b3;
  --wb-line: #e4e7ec;
  --wb-line-strong: #d0d5dd;
  --wb-primary: #3b82f6;
  --wb-primary-soft: #eff6ff;
  --wb-primary-line: #bfdbfe;
  --wb-green: #079455;
  --wb-green-soft: #ecfdf3;
  --wb-amber: #b54708;
  --wb-amber-soft: #fffaeb;
  --wb-red: #d92d20;
  --wb-red-soft: #fef3f2;
  --wb-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  --wb-shadow-float: 0 12px 30px rgba(16, 24, 40, 0.08);
  --wb-radius: 10px;
  --wb-radius-sm: 8px;
  --wb-mono: "JetBrains Mono", "DIN Alternate", "Bahnschrift", "Microsoft YaHei UI", monospace;
}

/* base */
.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  color: var(--wb-ink);
  background: var(--wb-bg);
  font-family: "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

.workbench-shell * {
  min-width: 0;
}

.workbench-shell button,
.workbench-shell input,
.workbench-shell select,
.workbench-shell textarea {
  font: inherit;
}

.workbench-shell button:not(nav button):not(.session-card button) {
  min-height: 36px;
  padding: 0 14px;
  color: #1d4ed8;
  background: var(--wb-surface);
  border: 1px solid var(--wb-primary-line);
  border-radius: var(--wb-radius-sm);
  box-shadow: none;
  font-weight: 700;
}

.workbench-shell button:not(nav button):not(.session-card button):hover {
  background: var(--wb-primary-soft);
  box-shadow: var(--wb-shadow);
  transform: none;
}

.workbench-shell button:focus-visible {
  outline: 2px solid var(--wb-primary-line);
  outline-offset: 2px;
}

.workbench-shell button.ghost:not(nav button):not(.session-card button) {
  color: var(--wb-ink-soft);
  background: var(--wb-surface-muted);
  border-color: var(--wb-line);
}

.workbench-shell input,
.workbench-shell select,
.workbench-shell textarea {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  color: var(--wb-ink);
  background: var(--wb-surface);
  border: 1px solid var(--wb-line-strong);
  border-radius: var(--wb-radius-sm);
  outline: none;
}

.workbench-shell textarea {
  min-height: 118px;
  padding: 10px;
  line-height: 1.55;
  resize: vertical;
}

.workbench-shell input:focus,
.workbench-shell select:focus,
.workbench-shell textarea:focus {
  border-color: var(--wb-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

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

/* layout */
.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh;
  padding: 18px 12px;
  background: var(--wb-surface);
  border-right: 1px solid var(--wb-line);
}

.brand {
  display: grid;
  gap: 8px;
  padding: 0 8px 18px;
  border-bottom: 1px solid var(--wb-line);
}

.brand p {
  width: fit-content;
  padding: 3px 7px;
  color: #175cd3;
  background: var(--wb-primary-soft);
  border: 1px solid var(--wb-primary-line);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 900;
}

.brand strong {
  color: var(--wb-ink);
  font-size: 18px;
  line-height: 1.2;
}

nav {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 16px 0;
}

nav button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  color: var(--wb-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--wb-radius-sm);
  box-shadow: none;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}

nav button:hover {
  color: var(--wb-ink);
  background: var(--wb-surface-muted);
  transform: none;
}

nav button.active {
  color: #175cd3;
  background: var(--wb-primary-soft);
  border-color: var(--wb-primary-line);
  box-shadow: none;
}

.mobile-more-menu {
  display: none;
}

.mobile-more-panel {
  display: grid;
  gap: 6px;
}

.session-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--wb-surface-muted);
  border: 1px solid var(--wb-line);
  border-radius: var(--wb-radius);
}

.session-card span {
  color: var(--wb-muted);
  font-size: 12px;
}

.session-card button {
  min-height: 34px;
  color: #175cd3;
  background: var(--wb-surface);
  border: 1px solid var(--wb-primary-line);
  border-radius: var(--wb-radius-sm);
  box-shadow: none;
  font-weight: 800;
}

.workspace {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: auto;
  overflow-x: hidden;
  padding: 18px 22px 36px;
}

.page-toolbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin: -18px -22px 18px;
  padding: 14px 22px;
  background: rgba(246, 247, 249, 0.94);
  border-bottom: 1px solid var(--wb-line);
  backdrop-filter: blur(16px);
}

.eyebrow,
.section-kicker {
  margin-bottom: 4px;
  color: var(--wb-primary);
  font-family: var(--wb-mono);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.page-toolbar h1 {
  color: var(--wb-ink);
  font-size: 26px;
  line-height: 1.12;
}

.topbar-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
}

.compact-field {
  min-width: 180px;
}

.account-menu {
  display: none;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.grid,
.workbench-grid {
  display: grid;
  gap: 16px;
}

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

.controls-layout {
  grid-template-columns: minmax(340px, 0.78fr) minmax(0, 1.22fr);
  align-items: start;
}

.build-layout,
.cid-layout {
  grid-template-columns: minmax(420px, 0.85fr) minmax(0, 1.15fr);
}

/* components */
.panel,
.metric,
.overview-command,
.dashboard-insight,
.dashboard-actions,
.sync-status,
.chart-panel,
.parameter-details,
.build-status-card,
.operation-strip,
.distribution-preview,
.allocation-preview,
.action-footer,
.log-detail-panel,
.log-summary-strip div,
.agent-picker,
.date-picker-popover {
  background: var(--wb-surface);
  border: 1px solid var(--wb-line);
  border-radius: var(--wb-radius);
  box-shadow: var(--wb-shadow);
}

.data-section {
  min-width: 0;
}

.panel {
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-head.compact {
  margin-bottom: 10px;
}

.panel-head h2,
.panel-head h3 {
  color: var(--wb-ink);
  font-size: 17px;
  line-height: 1.25;
}

.panel-head span,
.hint,
.field-note,
.row-meta {
  color: var(--wb-muted);
  font-size: 12px;
  line-height: 1.45;
}

.field {
  display: grid;
  gap: 6px;
}

.field span,
.login-form span {
  color: var(--wb-muted);
  font-size: 12px;
  font-weight: 800;
}

.form-grid,
.member-form,
.build-form,
.config-form,
.button-row,
.action-row,
.allocation-actions,
.transfer-import-grid {
  display: grid;
  gap: 12px;
}

.form-grid.two,
.member-form,
.build-form,
.config-form,
.cid-budget-form,
.transfer-import-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.button-row,
.action-row,
.allocation-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.button-row button,
.action-row button,
.allocation-actions button,
.primary-wide,
.file-import-button {
  width: 100%;
}

.divider {
  height: 1px;
  margin: 14px 0;
  background: var(--wb-line);
}

.kpi-strip,
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-metrics {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 16px 0;
}

.metric {
  position: relative;
  min-height: 104px;
  padding: 16px;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--wb-line-strong);
}

.metric span {
  display: block;
  margin-bottom: 10px;
  color: var(--wb-muted);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  color: var(--wb-ink);
  font-family: var(--wb-mono);
  font-size: 30px;
  line-height: 1;
}

.metric.warn strong {
  color: var(--wb-amber);
}

.metric.danger strong {
  color: var(--wb-red);
}

.task-list,
.list,
.agent-list,
.cid-detail-list {
  display: grid;
  gap: 8px;
}

.row,
.agent-check,
.preview-chip,
.allocation-group,
.cid-detail-summary div,
.allocation-metrics div,
.risk-stack div,
.insight-grid div {
  background: var(--wb-surface-muted);
  border: 1px solid var(--wb-line);
  border-radius: var(--wb-radius-sm);
}

.row {
  display: grid;
  gap: 6px;
  padding: 12px;
}

.row strong {
  color: var(--wb-ink);
}

.badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  padding: 0 8px;
  color: var(--wb-ink-soft);
  background: var(--wb-surface-strong);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.success,
.badge.success,
.status-pill.success {
  color: var(--wb-green);
}

.warn,
.badge.warn,
.status-pill.warn {
  color: var(--wb-amber);
}

.danger,
.badge.danger,
.status-pill.danger {
  color: var(--wb-red);
}

/* page blocks */
.overview-command {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 14px;
  padding: 18px;
}

.command-copy {
  display: grid;
  align-content: center;
  gap: 8px;
}

.command-copy h2 {
  color: var(--wb-ink);
  font-size: 24px;
  line-height: 1.15;
}

.command-copy strong,
.risk-stack strong,
.insight-primary strong,
.insight-grid strong,
.allocation-metrics strong,
.preview-total strong {
  font-family: var(--wb-mono);
}

.command-copy p {
  color: var(--wb-muted);
  line-height: 1.6;
}

.risk-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.risk-stack div {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.risk-stack span {
  color: var(--wb-muted);
  font-size: 12px;
  font-weight: 800;
}

.risk-stack strong {
  color: var(--wb-ink);
  font-size: 26px;
}

.mobile-quick-actions {
  display: none;
}

.operation-strip {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  margin-bottom: 12px;
}

.build-status-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: none;
}

.build-status-main {
  display: grid;
  gap: 8px;
}

.build-status-main > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.build-status-main span,
.build-status-grid span {
  color: var(--wb-muted);
  font-size: 12px;
  font-weight: 800;
}

.build-status-main strong {
  color: var(--wb-ink);
  font-size: 28px;
  line-height: 1;
}

.build-status-main small {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--wb-subtle);
  font-size: 12px;
}

.build-status-main b {
  color: var(--wb-ink);
  font-weight: 900;
}

.build-status-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.build-status-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #9bc5ff, #74d4ff);
  transition: width 180ms ease;
}

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

.build-status-grid div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #dbe7f3;
  border-radius: 12px;
  background: #f8fbff;
}

.build-status-grid strong {
  color: var(--wb-ink);
  font-size: 18px;
  line-height: 1.1;
}

.parameter-details {
  padding: 0;
  overflow: hidden;
}

.parameter-details > summary,
.log-detail-panel > summary,
.dashboard-analytics > summary,
.agent-picker > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  cursor: pointer;
  list-style: none;
  color: var(--wb-ink);
  font-weight: 900;
}

.parameter-details > summary::-webkit-details-marker,
.log-detail-panel > summary::-webkit-details-marker,
.dashboard-analytics > summary::-webkit-details-marker,
.agent-picker > summary::-webkit-details-marker {
  display: none;
}

.parameter-details > summary::after,
.log-detail-panel > summary::after,
.dashboard-analytics > summary::after,
.agent-picker > summary::after {
  content: "v";
  color: var(--wb-subtle);
  font-size: 14px;
}

.parameter-details[open] > summary::after,
.log-detail-panel[open] > summary::after,
.dashboard-analytics[open] > summary::after,
.agent-picker[open] > summary::after {
  content: "^";
}

.parameter-details > summary small,
.dashboard-analytics > summary small {
  color: var(--wb-muted);
  font-size: 12px;
  font-weight: 700;
}

.parameter-details > :not(summary),
.log-detail-body,
.dashboard-analytics > .grid {
  padding: 14px;
}

.agent-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
}

.agent-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 42px;
  padding: 9px 10px;
}

.agent-check input {
  width: 16px;
  min-height: 16px;
}

.agent-check span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.distribution-preview,
.allocation-preview {
  display: grid;
  gap: 10px;
  padding: 12px;
  margin-top: 12px;
}

.preview-total {
  color: var(--wb-ink-soft);
  font-weight: 800;
}

.preview-grid,
.allocation-metrics,
.cid-detail-summary,
.pressure-grid,
.insight-grid,
.action-card-grid {
  display: grid;
  gap: 10px;
}

.preview-grid,
.allocation-metrics,
.cid-detail-summary,
.pressure-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.preview-chip,
.allocation-metrics div,
.cid-detail-summary div,
.pressure-grid div {
  display: grid;
  gap: 6px;
  padding: 12px;
}

.action-footer {
  padding: 12px;
  margin-top: 12px;
}

/* logs */
.log-panel,
.timeline-panel {
  min-height: min(720px, calc(100vh - 130px));
}

.log-summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.log-summary-strip div {
  min-height: 68px;
  padding: 10px;
}

.log-summary-strip span {
  display: block;
  margin-bottom: 6px;
  color: var(--wb-muted);
  font-size: 12px;
  font-weight: 800;
}

.log-summary-strip strong {
  color: var(--wb-ink);
  font-family: var(--wb-mono);
  font-size: 18px;
}

.log-detail-panel {
  padding: 0;
  overflow: hidden;
}

.log-tabs {
  display: flex;
  gap: 8px;
  padding-bottom: 6px;
  overflow-x: auto;
}

.log-tabs button {
  flex: 0 0 auto;
  min-height: 34px;
  white-space: nowrap;
}

.log-date-filter {
  display: flex;
  align-items: end;
  gap: 8px;
  margin: 10px 0;
}

.log-date-filter label {
  flex: 0 1 210px;
}

.log-console,
.log-list {
  display: grid;
  gap: 0;
  min-height: 300px;
  max-height: min(62vh, 620px);
  overflow-y: auto;
  padding: 10px 12px;
  color: #d0d5dd;
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: var(--wb-radius);
  font-family: var(--wb-mono);
}

.log-item {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  color: #e5e7eb;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(229, 231, 235, 0.12);
  border-radius: 0;
  font-size: 12px;
  line-height: 1.55;
}

.log-item:last-child {
  border-bottom: 0;
}

.log-item time {
  color: #98a2b3;
}

.log-more {
  padding: 10px 0;
  color: #98a2b3;
  text-align: center;
  font-size: 12px;
}

/* dashboard */
.dashboard-shell {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.dashboard-shell > .panel-head {
  display: none;
}

.dashboard-command-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.1fr) minmax(240px, 0.65fr);
  gap: 14px;
  align-items: stretch;
}

.dashboard-actions,
.dashboard-insight,
.sync-status {
  padding: 14px;
}

.dashboard-actions .panel-head {
  margin-bottom: 10px;
}

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

.action-card {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 108px;
  padding: 12px;
  text-align: left;
  border-top: 3px solid var(--wb-primary-line) !important;
}

.action-card strong {
  color: var(--wb-ink);
  font-size: 24px;
}

.action-card.success {
  border-top-color: var(--wb-green) !important;
}

.action-card.warn {
  border-top-color: var(--wb-amber) !important;
}

.action-card.danger {
  border-top-color: var(--wb-red) !important;
}

.dashboard-insight {
  display: grid;
  gap: 14px;
}

.insight-primary {
  display: grid;
  gap: 8px;
}

.insight-primary span,
.insight-grid span {
  color: var(--wb-muted);
  font-size: 12px;
  font-weight: 800;
}

.insight-primary strong {
  color: var(--wb-primary);
  font-size: 48px;
  line-height: 1;
}

.insight-primary p {
  color: var(--wb-muted);
  line-height: 1.55;
}

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

.insight-grid div {
  padding: 12px;
}

.sync-status {
  display: grid;
  align-content: start;
  gap: 10px;
}

.dashboard-analytics {
  margin-top: 16px;
  background: var(--wb-surface);
  border: 1px solid var(--wb-line);
  border-radius: var(--wb-radius);
  box-shadow: var(--wb-shadow);
}

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

.chart-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.chart-panel.wide {
  grid-column: 1 / -1;
}

.chart-panel h3 {
  margin: 0;
  color: var(--wb-ink-soft);
  font-size: 13px;
}

.chart {
  width: 100%;
  height: 300px;
}

.bars {
  display: grid;
  gap: 8px;
}

.table-wrap {
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid var(--wb-line);
}

.data-table th {
  color: var(--wb-muted);
  background: var(--wb-surface-muted);
  font-size: 12px;
  font-weight: 900;
}

.data-table-mobile-card,
.date-breakdown-cards {
  display: none;
}

.date-breakdown-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: var(--wb-surface-muted);
  border: 1px solid var(--wb-line);
  border-radius: var(--wb-radius-sm);
}

.date-breakdown-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.date-breakdown-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.date-breakdown-card dl div {
  display: grid;
  gap: 4px;
}

.date-breakdown-card dt,
.date-breakdown-card dd {
  margin: 0;
}

.date-breakdown-card dt {
  color: var(--wb-muted);
  font-size: 12px;
}

.date-breakdown-card dd {
  color: var(--wb-ink);
  font-weight: 900;
}

/* date picker */
.date-picker {
  position: relative;
}

.date-picker-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 180px;
  justify-content: space-between;
}

.date-picker-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 70;
  width: 292px;
  padding: 12px;
}

.date-calendar-nav,
.date-calendar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.date-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin-top: 8px;
}

.date-calendar-grid button,
.date-calendar-grid span {
  display: grid;
  min-height: 32px;
  place-items: center;
  font-size: 12px;
}

.date-calendar-grid button.active {
  color: #ffffff;
  background: var(--wb-primary);
  border-color: var(--wb-primary);
}

/* utilities */
.visually-hidden {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.notice {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  max-width: min(420px, calc(100vw - 40px));
  padding: 12px 14px;
  color: var(--wb-ink);
  background: var(--wb-surface);
  border: 1px solid var(--wb-line);
  border-radius: var(--wb-radius);
  box-shadow: var(--wb-shadow-float);
}

/* responsive */
@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 196px minmax(0, 1fr);
  }

  .dashboard-command-grid,
  .controls-layout,
  .build-layout,
  .cid-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  body {
    background: var(--wb-bg);
  }

  .workbench-shell {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
  }

  .sidebar {
    position: static;
    display: block;
    height: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .sidebar .brand,
  .sidebar .session-card {
    display: none;
  }

  .sidebar nav {
    position: fixed;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 10px;
    z-index: 80;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(56px, 1fr);
    gap: 6px;
    width: calc(100vw - 20px);
    padding: 7px;
    overflow: visible;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--wb-line);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.06);
    backdrop-filter: blur(18px);
  }

  .sidebar nav button {
    display: grid;
    min-width: 0;
    min-height: 46px;
    padding: 5px 6px;
    place-items: center;
    font-size: 0;
    text-align: center;
  }

  .sidebar nav button::after,
  .mobile-more-menu > summary::after {
    content: attr(data-mobile-label);
    font-size: 12px;
    line-height: 1.1;
  }

  .sidebar nav > button.mobile-secondary-nav {
    display: none;
  }

  .mobile-more-menu {
    position: relative;
    display: block;
  }

  .mobile-more-menu > summary {
    display: grid;
    min-height: 46px;
    padding: 5px 6px;
    place-items: center;
    color: var(--wb-muted);
    border-radius: var(--wb-radius-sm);
    cursor: pointer;
    font-size: 0;
    font-weight: 900;
    list-style: none;
  }

  .mobile-more-menu > summary::-webkit-details-marker {
    display: none;
  }

  .mobile-more-menu[open] > summary {
    color: #175cd3;
    background: var(--wb-primary-soft);
  }

  .mobile-more-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    width: 154px;
    padding: 8px;
    background: var(--wb-surface);
    border: 1px solid var(--wb-line);
    border-radius: 12px;
    box-shadow: var(--wb-shadow-float);
  }

  .sidebar nav .mobile-more-panel button {
    display: flex;
    justify-content: flex-start;
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    font-size: 12px;
    text-align: left;
  }

  .sidebar nav .mobile-more-panel button::after {
    content: none;
  }

  .workspace {
    display: block;
    height: auto;
    min-height: 100vh;
    padding: 14px 12px 110px;
    overflow: visible;
  }

  .page-toolbar {
    position: sticky;
    top: 0;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin: -14px -12px 12px;
    padding: 14px 12px;
  }

  .page-toolbar h1 {
    font-size: 24px;
  }

  .topbar-actions {
    align-items: center;
    gap: 8px;
  }

  #task-member-field {
    display: none;
  }

  .account-menu {
    display: block;
    position: relative;
  }

  .account-menu summary {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 0 10px;
    background: var(--wb-surface);
    border: 1px solid var(--wb-line);
    border-radius: var(--wb-radius-sm);
    list-style: none;
  }

  .account-menu summary::-webkit-details-marker {
    display: none;
  }

  .mobile-role-label {
    display: inline-flex;
    max-width: 112px;
    overflow: hidden;
    color: var(--wb-ink-soft);
    font-size: 12px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .account-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 90;
    display: grid;
    gap: 8px;
    width: 180px;
    padding: 10px;
    background: var(--wb-surface);
    border: 1px solid var(--wb-line);
    border-radius: var(--wb-radius);
    box-shadow: var(--wb-shadow-float);
  }

  .mobile-logout-button {
    width: 100%;
  }

  .overview-command,
  .grid.two,
  .workbench-grid,
  .controls-layout,
  .build-layout,
  .cid-layout,
  .dashboard-command-grid,
  .dashboard-analytics > .grid {
    grid-template-columns: 1fr;
  }

  .page[data-page="overview"].active {
    display: flex;
    flex-direction: column;
  }

  .overview-metrics {
    order: 1;
  }

  .overview-command {
    order: 2;
  }

  .mobile-quick-actions {
    order: 3;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 12px;
  }

  .workbench-grid {
    order: 4;
  }

  .panel,
  .metric,
  .overview-command,
  .dashboard-insight,
  .dashboard-actions,
  .sync-status,
  .chart-panel {
    padding: 13px;
    border-radius: var(--wb-radius);
  }

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

  .build-status-main > div:first-child {
    align-items: flex-start;
    flex-direction: column;
  }

  .kpi-strip,
  .metrics,
  .overview-metrics,
  .dashboard-metrics,
  .risk-stack,
  .insight-grid,
  .action-card-grid,
  .allocation-metrics,
  .cid-detail-summary,
  .pressure-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    min-height: 88px;
    padding: 12px;
  }

  .metric strong {
    font-size: 24px;
  }

  .operation-strip {
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .form-grid.two,
  .member-form,
  .build-form,
  .config-form,
  .cid-budget-form,
  .transfer-import-grid,
  .button-row,
  .action-row,
  .allocation-actions,
  .agent-checks,
  .preview-grid {
    grid-template-columns: 1fr;
  }

  .agent-picker:not([open]) .agent-checks {
    display: none;
  }

  .agent-picker > summary {
    min-height: 44px;
  }

  .agent-picker[open] .agent-checks {
    max-height: 42vh;
    overflow-y: auto;
  }

  .agent-check {
    min-width: 0;
  }

  .agent-check input {
    min-height: 16px;
  }

  .agent-check span {
    overflow-wrap: anywhere;
  }

  .action-footer {
    position: sticky;
    bottom: calc(72px + env(safe-area-inset-bottom));
    z-index: 35;
  }

  .log-summary-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .log-summary-strip div {
    min-height: 60px;
    padding: 8px;
  }

  .log-summary-strip strong {
    font-size: 15px;
  }

  .log-console,
  .log-list {
    min-height: 260px;
    max-height: min(52vh, 460px);
  }

  .log-tabs button {
    max-width: 148px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .log-date-filter {
    flex-wrap: wrap;
  }

  .log-date-filter label {
    flex: 1 1 180px;
  }

  .chart {
    height: 230px;
  }

  .table-wrap {
    display: none;
  }

  .data-table-mobile-card,
  .date-breakdown-cards {
    display: grid;
    gap: 8px;
  }

  .date-picker-popover {
    position: fixed;
    top: 126px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .page,
  .panel,
  .log-detail-panel {
    scroll-margin-bottom: 120px;
  }

  .notice {
    right: 12px;
    bottom: 92px;
    left: 12px;
    max-width: none;
  }
}

@media (max-width: 420px) {
  .kpi-strip,
  .metrics,
  .overview-metrics,
  .dashboard-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-quick-actions,
  .insight-grid,
  .allocation-metrics,
  .cid-detail-summary,
  .pressure-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
