:root {
  color-scheme: dark;
  --bg: #020617;
  --bg-soft: #07111f;
  --surface: #0f172a;
  --surface-2: #111c31;
  --surface-3: #172033;
  --text: #f8fafc;
  --muted: #a8b3c7;
  --muted-2: #738197;
  --border: #2d3a50;
  --primary: #22c55e;
  --primary-2: #16a34a;
  --blue: #60a5fa;
  --amber: #fbbf24;
  --red: #f87171;
  --red-bg: #3a1115;
  --amber-bg: #33280e;
  --green-bg: #0f2b1b;
  --blue-bg: #10243f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 16% 0%, rgba(34, 197, 94, 0.15), transparent 30rem),
    linear-gradient(135deg, #020617 0%, #07111f 48%, #101827 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
a {
  touch-action: manipulation;
}

button {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 16px;
  z-index: 100;
  transform: translateY(-150%);
  border-radius: 6px;
  background: var(--primary);
  color: #052e16;
  padding: 10px 14px;
  font-weight: 700;
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(2, 6, 23, 0.88);
  padding: 14px clamp(16px, 4vw, 44px);
  backdrop-filter: blur(18px);
}

.brand,
.hero-actions,
.panel-header,
.filter-group,
.case-button,
.inline-meta,
.badge,
.button {
  display: inline-flex;
  align-items: center;
}

.brand {
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(34, 197, 94, 0.38);
  border-radius: var(--radius);
  background: rgba(34, 197, 94, 0.12);
  color: var(--primary);
}

.brand-title {
  margin: 2px 0 0;
  font-size: 17px;
  font-weight: 700;
}

.eyebrow {
  margin: 0;
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.top-nav a {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 9px 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.top-nav a:hover {
  border-color: var(--border);
  background: rgba(148, 163, 184, 0.09);
  color: var(--text);
}

.page-shell {
  width: min(100%, 1600px);
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 44px) 64px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 20px;
  align-items: stretch;
  min-height: 440px;
}

.compact-hero {
  min-height: 0;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
}

.compact-hero .hero-copy,
.compact-hero .hero-panel {
  min-height: 0;
}

.compact-hero h1 {
  max-width: 760px;
  font-size: clamp(30px, 4vw, 48px);
  letter-spacing: 0;
}

.hero-copy,
.hero-panel,
.panel,
.section {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.88);
  box-shadow: var(--shadow);
}

.hero-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 4vw, 48px);
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 940px;
  margin: 12px 0 0;
  font-size: clamp(34px, 5vw, 72px);
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(22px, 2.1vw, 30px);
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.hero-text {
  max-width: 850px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.button {
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 11px 15px;
  font-weight: 800;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  border-color: rgba(34, 197, 94, 0.65);
  background: var(--primary);
  color: #052e16;
}

.button.secondary {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
}

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

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

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.16);
}

.snapshot-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.snapshot-item,
.metric-card,
.stage-column,
.order-card,
.pain-card,
.case-button,
.test-block,
.leadtime-card,
.metric-def {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius);
  background: rgba(17, 28, 49, 0.86);
}

.snapshot-item {
  padding: 16px;
}

.snapshot-item dt {
  color: var(--muted-2);
  font-size: 13px;
}

.snapshot-item dd {
  margin: 6px 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 28px;
  font-weight: 800;
}

.section,
.panel {
  min-width: 0;
  margin-top: 20px;
  padding: clamp(18px, 2.4vw, 28px);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading > p {
  max-width: 600px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.section-heading.compact {
  align-items: start;
  margin-bottom: 16px;
}

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

.kpi-strip {
  grid-template-columns: repeat(6, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.metric-card {
  min-width: 0;
  padding: 16px;
}

.kpi-strip .metric-card {
  min-height: 92px;
  border-left-width: 3px;
  padding: 10px 12px;
}

.metric-card.tone-green {
  border-left-color: var(--primary);
}

.metric-card.tone-blue {
  border-left-color: var(--blue);
}

.metric-card.tone-amber {
  border-left-color: var(--amber);
}

.metric-card.tone-red {
  border-left-color: var(--red);
}

.metric-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin-top: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 32px;
  line-height: 1;
}

.kpi-strip .metric-card strong {
  margin-top: 7px;
  font-size: 23px;
}

.kpi-strip .metric-card small {
  margin-top: 5px;
  line-height: 1.3;
}

.metric-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.5;
}

.board-heading {
  align-items: start;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.filter-group {
  flex-wrap: wrap;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(2, 6, 23, 0.28);
  padding: 5px;
}

.filter-group > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chip {
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 800;
}

.chip:hover,
.chip.active {
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.14);
  color: var(--text);
}

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

.stage-column {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 12px;
  padding: 12px;
}

.stage-top {
  min-height: 118px;
}

.stage-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.stage-index {
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 700;
}

.stage-owner {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.wip-row {
  margin-top: 13px;
}

.wip-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted-2);
  font-size: 12px;
}

.wip-track {
  height: 8px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #253247;
}

.wip-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.wip-bar.warn {
  background: var(--amber);
}

.wip-bar.over {
  background: var(--red);
}

.order-card {
  min-width: 0;
  padding: 10px;
}

.order-card {
  min-height: 138px;
  padding: 8px;
}

.order-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.order-id {
  color: var(--muted-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 700;
}

.order-card h4 {
  margin: 4px 0 0;
  font-size: 15px;
  line-height: 1.25;
}

.order-desc,
.order-meta,
.order-done {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.order-desc {
  margin: 8px 0 0;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.order-card .order-desc {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.35;
}

.order-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.order-blocker {
  margin: 10px 0 0;
  border: 1px solid rgba(248, 113, 113, 0.34);
  border-radius: 6px;
  background: rgba(248, 113, 113, 0.1);
  color: #fecaca;
  padding: 8px;
  font-size: 12px;
  line-height: 1.55;
}

.order-meta {
  margin-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  padding-top: 9px;
}

.card-compact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 6px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.4;
}

.order-card .order-tags {
  margin-top: 7px;
}

.order-card .badge {
  min-height: 24px;
  padding: 3px 6px;
  font-size: 11px;
}

.work-badges {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 6px;
}

.work-badges .badge {
  min-width: 0;
  min-height: 22px;
  padding: 2px;
  overflow-wrap: anywhere;
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
}

.order-card .card-actions {
  margin-top: 8px;
}

.split-section {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(320px, 0.94fr);
  gap: 20px;
}

.split-section.lower {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
}

.formula {
  display: grid;
  gap: 6px;
  border: 1px solid rgba(34, 197, 94, 0.28);
  border-radius: var(--radius);
  background: rgba(34, 197, 94, 0.08);
  padding: 14px;
}

.formula span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.formula strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.6;
}

.leadtime-list,
.pain-list,
.metric-defs {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.leadtime-card,
.pain-card,
.metric-def {
  padding: 14px;
}

.leadtime-head,
.pain-card-head,
.metric-def {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.leadtime-head h3,
.pain-card h3,
.metric-def h3 {
  font-size: 15px;
}

.work-comparison {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.work-comparison > div {
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 6px;
  background: rgba(2, 6, 23, 0.28);
  padding: 10px;
}

.work-comparison > div.tone-green {
  border-color: rgba(34, 197, 94, 0.42);
}

.work-comparison > div.tone-amber {
  border-color: rgba(251, 191, 36, 0.46);
}

.work-comparison > div.tone-red {
  border-color: rgba(248, 113, 113, 0.48);
}

.work-comparison span,
.work-comparison em {
  display: block;
  color: var(--muted-2);
  font-size: 11px;
  font-style: normal;
}

.work-comparison strong {
  display: block;
  margin: 3px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 23px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.work-comparison strong small {
  margin-left: 2px;
  font-size: 11px;
}

.leadtime-bars {
  display: flex;
  height: 12px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #253247;
}

.leadtime-bars span {
  min-width: 2px;
}

.leadtime-legend {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.pain-card p,
.metric-def p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.pain-question {
  color: var(--text);
  font-weight: 700;
}

.adversarial-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
}

.case-list {
  display: grid;
  align-content: start;
  gap: 9px;
}

.case-button {
  width: 100%;
  min-height: 54px;
  cursor: pointer;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
  transition:
    border-color 180ms ease,
    background 180ms ease,
    transform 180ms ease;
}

.case-button:hover {
  transform: translateY(-1px);
}

.case-button.active {
  border-color: rgba(34, 197, 94, 0.48);
  background: rgba(34, 197, 94, 0.13);
}

.case-detail {
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: var(--radius);
  background: rgba(2, 6, 23, 0.28);
  padding: clamp(16px, 2.4vw, 24px);
}

.case-detail-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.case-detail p {
  color: var(--muted);
}

.test-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.test-block {
  min-width: 0;
  padding: 14px;
}

.test-block-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
}

.test-block ol {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
  padding-left: 22px;
}

.test-block li {
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

.evidence {
  margin-top: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius);
  background: rgba(17, 28, 49, 0.82);
  padding: 14px;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.raci-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.raci-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 6px;
  background: rgba(2, 6, 23, 0.24);
  padding: 7px 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.raci-legend-item strong {
  flex: 0 0 auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.raci-legend-item.tone-red {
  border-color: rgba(248, 113, 113, 0.34);
}

.raci-legend-item.tone-blue {
  border-color: rgba(96, 165, 250, 0.34);
}

.raci-legend-item.tone-amber {
  border-color: rgba(251, 191, 36, 0.34);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  padding: 12px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
}

td {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  font-weight: 700;
}

td:first-child {
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

.badge {
  flex: 0 0 auto;
  justify-content: center;
  min-height: 28px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 6px;
  padding: 4px 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.badge.green {
  border-color: rgba(34, 197, 94, 0.34);
  background: var(--green-bg);
  color: #bbf7d0;
}

.badge.blue {
  border-color: rgba(96, 165, 250, 0.36);
  background: var(--blue-bg);
  color: #bfdbfe;
}

.badge.amber {
  border-color: rgba(251, 191, 36, 0.36);
  background: var(--amber-bg);
  color: #fde68a;
}

.badge.red {
  border-color: rgba(248, 113, 113, 0.36);
  background: var(--red-bg);
  color: #fecaca;
}

.icon {
  width: 18px;
  height: 18px;
}

[data-lucide] {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.tone-red {
  color: var(--red);
}

.tone-amber {
  color: var(--amber);
}

.tone-blue {
  color: var(--blue);
}

.tone-green {
  color: var(--primary);
}

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

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

.fill-green {
  background: var(--primary);
}

.fill-slate {
  background: #64748b;
}

/* V2.2.1 interactive workspace */
.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.button.compact {
  min-height: 40px;
  padding: 8px 11px;
  font-size: 13px;
}

@media (min-width: 921px) {
  .top-icon-action {
    width: 40px;
    padding: 0;
  }

  .top-icon-action .action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

.button:disabled,
.mini-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr) minmax(320px, 0.9fr);
  gap: 20px;
  margin-top: 20px;
}

.identity-panel,
.repo-panel,
.activity-preview {
  display: grid;
  gap: 12px;
}

.identity-card,
.repo-panel > div,
.activity-item,
.choice-card,
.person-row {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius);
  background: rgba(2, 6, 23, 0.28);
}

.identity-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
}

.identity-card p,
.repo-panel p,
.activity-item p,
.muted-text {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.identity-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.people-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.repo-panel > div {
  padding: 14px;
}

.repo-panel strong {
  display: block;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.process-overview {
  display: grid;
  gap: 14px;
}

.process-lane {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius);
  background: rgba(2, 6, 23, 0.24);
  padding: 14px;
}

.process-lane.emergency {
  border-color: rgba(251, 191, 36, 0.34);
  background: rgba(251, 191, 36, 0.07);
}

.process-lane > header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.process-lane > header p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

.process-lane.emergency .process-steps {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.process-node {
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.72);
  padding: 10px;
}

.process-node summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  cursor: pointer;
  list-style: none;
}

.process-node summary::-webkit-details-marker,
.appendix-details summary::-webkit-details-marker {
  display: none;
}

.process-step {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 6px;
  background: rgba(34, 197, 94, 0.14);
  color: var(--primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 800;
}

.process-lane.emergency .process-step {
  background: rgba(251, 191, 36, 0.16);
  color: var(--amber);
}

.process-node strong,
.process-node em,
.process-node small {
  display: block;
  min-width: 0;
}

.process-node strong {
  font-size: 14px;
  line-height: 1.35;
}

.process-node em {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.process-node small {
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.45;
}

.process-node p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.activity-preview {
  max-height: 280px;
  overflow: auto;
  padding-right: 4px;
}

.activity-list {
  display: grid;
  gap: 10px;
  max-height: min(64vh, 680px);
  overflow: auto;
  padding-right: 4px;
}

.activity-item {
  padding: 12px;
}

.activity-item strong {
  display: block;
  font-size: 14px;
}

.stage-column {
  min-height: 320px;
}

.drop-zone {
  display: grid;
  min-height: 136px;
  align-content: start;
  gap: 12px;
  border: 1px dashed transparent;
  border-radius: var(--radius);
  transition:
    background 160ms ease,
    border-color 160ms ease;
}

.drop-zone.drag-over {
  border-color: rgba(34, 197, 94, 0.6);
  background: rgba(34, 197, 94, 0.08);
}

.order-card {
  min-height: 136px;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease,
    opacity 160ms ease;
}

.order-card[draggable="true"] {
  cursor: grab;
}

.order-card.dragging {
  opacity: 0.48;
  transform: scale(0.985);
}

.empty-card {
  border-style: dashed;
  background: rgba(2, 6, 23, 0.18);
}

.order-card.deadline-green {
  border-color: rgba(34, 197, 94, 0.34);
}

.order-card.deadline-amber {
  border-color: rgba(251, 191, 36, 0.45);
  box-shadow: inset 3px 0 0 var(--amber);
}

.order-card.deadline-red,
.order-card.is-blocked {
  border-color: rgba(248, 113, 113, 0.48);
  box-shadow: inset 3px 0 0 var(--red);
}

.order-card.is-completed {
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: inset 3px 0 0 var(--primary);
}

.order-note {
  margin: 10px 0 0;
  border: 1px solid rgba(96, 165, 250, 0.26);
  border-radius: 6px;
  background: rgba(96, 165, 250, 0.09);
  color: #dbeafe;
  padding: 8px;
  font-size: 12px;
  line-height: 1.55;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.card-actions.has-reject {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.mini-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  cursor: pointer;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.72);
  color: var(--text);
  font-weight: 800;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.mini-button {
  gap: 5px;
  padding: 7px 8px;
  font-size: 12px;
}

.order-card .mini-button {
  min-height: 32px;
  padding: 5px;
  font-size: 0;
}

.order-card .mini-button [data-lucide],
.order-card .mini-button svg {
  width: 17px;
  height: 17px;
}

.mini-button.primary-action {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.15);
  color: #bbf7d0;
}

.advance-button {
  width: 100%;
  min-height: 40px;
  margin-top: 10px;
  border-color: rgba(96, 165, 250, 0.52);
  background: rgba(37, 99, 235, 0.18);
  color: #dbeafe;
}

.order-card .advance-button {
  min-height: 38px;
  padding: 7px 8px;
  font-size: 12px;
}

.stage-history {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  padding-top: 10px;
}

.stage-history > strong,
.history-empty {
  color: var(--muted);
  font-size: 12px;
}

.history-empty {
  margin: 10px 0 0;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 8px;
  border-left: 2px solid rgba(96, 165, 250, 0.5);
  padding-left: 8px;
  font-size: 12px;
}

.history-row small {
  grid-column: 1 / -1;
  color: var(--muted-2);
  line-height: 1.45;
}

.history-row.rejection {
  border-left-color: rgba(248, 113, 113, 0.65);
}

.mini-button:hover,
.icon-button:hover {
  border-color: rgba(34, 197, 94, 0.42);
  background: rgba(34, 197, 94, 0.12);
  transform: translateY(-1px);
}

.mini-button.danger {
  border-color: rgba(248, 113, 113, 0.34);
  color: #fecaca;
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
}

.signature-hint {
  margin: 8px 0 0;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.5;
}

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

.export-toggle {
  display: inline-flex;
  width: auto;
  min-height: 40px;
  color: var(--muted);
  font-size: 12px;
}

.appendix-shell {
  padding-bottom: 18px;
}

.appendix-section,
.appendix-panel {
  box-shadow: none;
}

.appendix-details {
  min-width: 0;
}

.appendix-details > summary {
  display: flex;
  min-height: 54px;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius);
  background: rgba(2, 6, 23, 0.24);
  padding: 12px 14px;
  list-style: none;
}

.appendix-details > summary strong {
  display: block;
  margin-top: 2px;
  font-size: 16px;
}

.pain-summary {
  flex-wrap: wrap;
}

.pain-export-button {
  flex: 0 0 auto;
  margin-left: auto;
}

.appendix-details[open] > summary {
  margin-bottom: 14px;
  border-color: rgba(34, 197, 94, 0.34);
  background: rgba(34, 197, 94, 0.08);
}

.appendix-details[open] > summary [data-lucide],
.appendix-details[open] > summary svg {
  transform: rotate(180deg);
}

.appendix-grid {
  margin-top: 0;
}

.appendix-grid > * {
  min-width: 0;
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-items: center;
  padding: 18px;
}

.modal-root.active,
.modal-root.open {
  display: grid;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.74);
  backdrop-filter: blur(14px);
}

.modal {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(100%, 720px);
  max-height: min(86vh, 860px);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.98);
  box-shadow: var(--shadow);
}

.modal.large,
.modal.wide {
  width: min(100%, 980px);
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-color: rgba(148, 163, 184, 0.18);
  padding: 16px 18px;
}

.modal-header {
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.modal-footer {
  flex-wrap: wrap;
  justify-content: flex-end;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.modal-body {
  overflow: auto;
  padding: 18px;
}

.movement-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 6px;
  background: rgba(37, 99, 235, 0.1);
  padding: 12px;
  text-align: center;
}

.movement-summary.reject {
  border-color: rgba(248, 113, 113, 0.34);
  background: rgba(248, 113, 113, 0.08);
}

.form-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 14px;
  border: 1px solid rgba(251, 191, 36, 0.36);
  border-radius: 6px;
  background: rgba(251, 191, 36, 0.09);
  color: #fde68a;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
}

.form-warning svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

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

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

.full-span {
  grid-column: 1 / -1;
}

fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
  margin: 0;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius);
  padding: 13px;
}

legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 6px;
  background: rgba(2, 6, 23, 0.42);
  color: var(--text);
  padding: 10px 11px;
  font: inherit;
  font-size: 14px;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input[readonly] {
  color: var(--muted);
  background: rgba(148, 163, 184, 0.08);
  cursor: not-allowed;
}

.button.danger {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
}

.checkbox-line {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 8px;
}

.checkbox-line input {
  width: 18px;
  min-height: 18px;
}

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

.choice-card {
  display: grid;
  cursor: pointer;
  gap: 4px;
  color: var(--text);
  padding: 14px;
  text-align: left;
}

.choice-card:hover {
  border-color: rgba(34, 197, 94, 0.42);
  background: rgba(34, 197, 94, 0.1);
}

.choice-card strong {
  font-size: 15px;
}

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

.people-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 16px;
}

.people-list,
.person-form {
  display: grid;
  align-content: start;
  gap: 10px;
}

.person-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
}

.person-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  gap: 10px;
  width: min(340px, calc(100vw - 36px));
}

.toast {
  border: 1px solid rgba(34, 197, 94, 0.34);
  border-radius: var(--radius);
  background: rgba(15, 23, 42, 0.98);
  color: var(--text);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 700;
}

.toast.danger {
  border-color: rgba(248, 113, 113, 0.42);
}

@media (max-width: 1280px) {
  .board-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

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

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

  .kpi-strip {
    grid-template-columns: repeat(6, minmax(100px, 1fr));
  }

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

@media (max-width: 920px) {
  .topbar,
  .section-heading,
  .board-heading,
  .hero,
  .workspace-grid,
  .split-section,
  .split-section.lower,
  .adversarial-layout,
  .people-editor {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .top-actions,
  .top-nav {
    justify-content: start;
  }

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

  .identity-actions {
    justify-content: start;
  }

  .process-lane > header,
  .leadtime-actions {
    display: grid;
    justify-content: stretch;
  }

  .process-steps,
  .process-lane.emergency .process-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-heading {
    display: grid;
  }

  .filters {
    justify-content: start;
  }

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

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

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

  .form-grid,
  fieldset,
  .choice-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .page-shell {
    padding: 18px 12px 48px;
  }

  .topbar {
    padding: 12px;
  }

  .top-nav {
    display: none;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .top-actions #newCardBtn {
    grid-column: 1 / -1;
  }

  .hero {
    min-height: auto;
  }

  .hero-copy,
  .hero-panel,
  .panel,
  .section {
    padding: 16px;
  }

  .hero-actions,
  .top-actions .button,
  .button {
    width: 100%;
  }

  .board-grid,
  .metrics-grid,
  .process-steps,
  .process-lane.emergency .process-steps,
  .leadtime-legend {
    grid-template-columns: 1fr;
  }

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

  .filter-group,
  .chip {
    width: 100%;
  }

  .filter-group > span {
    min-height: 32px;
  }

  .case-detail-header,
  .leadtime-head,
  .pain-card-head,
  .metric-def,
  .person-row {
    display: grid;
  }

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

  .card-actions.has-reject {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .leadtime-actions,
  .leadtime-actions .button,
  .export-toggle {
    width: 100%;
  }

  .pain-export-button {
    width: 100%;
    margin-left: 0;
  }

  .modal-root {
    padding: 10px;
  }

  .modal-header,
  .modal-footer,
  .modal-body {
    padding: 14px;
  }

  .toast-root {
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
  }
}

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

/* V3.1.1 skin: Mingbao Bio operations SaaS */
:root {
  color-scheme: light;
  --brand-900: #0e3b2c;
  --brand-800: #0f5138;
  --brand-700: #16724f;
  --brand-600: #1b7a5a;
  --brand-500: #22a06b;
  --brand-050: #e7f5ef;
  --sidebar-top: #0e3b2c;
  --sidebar-bottom: #0a2a20;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f0f3f5;
  --border: #e5e8ec;
  --text: #1f2937;
  --text-1: #1f2937;
  --muted: #4b5563;
  --muted-2: #7b8491;
  --primary: #1b7a5a;
  --primary-2: #16724f;
  --green-bg: #e8f7ee;
  --blue: #3b82f6;
  --blue-bg: #e7f0fe;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
  --radius: 12px;
}

html { background: var(--bg); }
body { min-width: 320px; min-height: 100dvh; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; }
body > .app-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; display: flex; width: 232px; min-height: 100dvh; flex-direction: column; background: linear-gradient(180deg, var(--sidebar-top), var(--sidebar-bottom)); box-shadow: 2px 0 12px rgba(0,0,0,.12); color: #fff; transition: width .18s ease; }
.app-content { min-width: 0; margin-left: 232px; transition: margin-left .18s ease; }
.sidebar-brand-row { display: flex; align-items: center; gap: 4px; padding: 12px; }
.app-sidebar .sidebar-brand { display: flex; min-width: 0; flex: 1; align-items: center; gap: 12px; padding: 8px; color: #fff; }
.sidebar-brand .brand-mark { width: 40px; height: 40px; border: 1px solid rgba(255,255,255,.56); border-radius: 50%; background: transparent; color: #fff; font-size: 14px; font-weight: 800; }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand strong { font-size: 15px; }
.sidebar-brand small { margin-top: 2px; color: rgba(255,255,255,.64); font-size: 11px; font-weight: 600; }
.sidebar-toggle { display: inline-grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border: 1px solid rgba(255,255,255,.18); border-radius: 8px; background: rgba(255,255,255,.08); color: #fff; cursor: pointer; transition: background .18s ease, border-color .18s ease; }
.sidebar-toggle:hover { border-color: rgba(255,255,255,.42); background: rgba(255,255,255,.16); }.sidebar-toggle:disabled { cursor: default; opacity: .58; }
.sidebar-nav { display: grid; gap: 4px; padding: 16px 12px; }
.sidebar-nav a { display: flex; min-height: 44px; align-items: center; gap: 12px; border-radius: 10px; padding: 0 14px; color: rgba(255,255,255,.78); font-size: 14px; font-weight: 600; transition: background .18s ease, color .18s ease; }
.sidebar-nav a svg { width: 18px; height: 18px; }
.sidebar-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-nav a.active { border-left: 3px solid #54d69b; background: rgba(255,255,255,.14); color: #fff; padding-left: 11px; }
.sidebar-bottom { margin-top: auto; padding: 16px 12px 20px; }
.sidebar-user { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; border-top: 1px solid rgba(255,255,255,.13); background: transparent; color: #fff; padding: 14px 6px 0; text-align: left; cursor: pointer; }
.user-avatar { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #22a06b; color: #fff; font-size: 14px; font-weight: 800; }
.sidebar-user strong, .sidebar-user small { display: block; }.sidebar-user strong { font-size: 13px; }.sidebar-user small { color: rgba(255,255,255,.63); font-size: 11px; }

.topbar { position: sticky; top: 0; z-index: 50; min-height: 60px; border: 0; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.94); padding: 8px clamp(16px, 3vw, 32px); backdrop-filter: blur(12px); }
.topbar-meta, .top-actions { display: flex; align-items: center; }.topbar-meta { gap: 8px; color: var(--muted); font-size: 13px; }.topbar-meta svg { width: 16px; }.top-actions { flex-wrap: nowrap; gap: 8px; }
.topbar .icon-button { display: inline-grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.topbar .icon-button:hover { border-color: var(--border); background: var(--surface-2); color: var(--brand-700); }.notification-button { position: relative; }.notification-button b { position: absolute; top: 2px; right: 1px; min-width: 16px; border-radius: 99px; background: var(--red); color: #fff; font-size: 10px; line-height: 16px; }
.page-shell { width: 100%; max-width: none; margin: 0; padding: 28px clamp(16px, 3vw, 32px) 64px; }
.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin: 0 0 24px; }.page-intro h1 { margin: 3px 0 6px; color: var(--text-1); font-size: 26px; line-height: 1.2; }.page-intro p { margin: 0; color: var(--muted); font-size: 14px; }.breadcrumb { color: #9ca3af !important; font-size: 14px !important; font-weight: 600; }
.board-search { display: flex; width: min(360px, 100%); min-height: 42px; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 12px; background: #fff; padding: 0 12px; color: var(--muted-2); box-shadow: var(--shadow); }.board-search input { min-height: 40px; border: 0; background: transparent; color: var(--text); padding: 0; }.board-search input:focus { outline: 0; }

.section, .panel, .hero-copy, .hero-panel { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }.section { padding: 20px; }.panel { padding: 20px; }.section + .section, .section + .split-section, .split-section + .workspace-grid, .workspace-grid + .section { margin-top: 24px; }
.section-heading { gap: 16px; }.section-heading h2, .panel h2 { color: var(--text-1); font-size: 20px; }.section-heading > p, .muted-text, .formula { color: var(--muted); }.eyebrow { color: var(--brand-700); font-family: inherit; font-size: 12px; font-weight: 700; letter-spacing: 0; }
.button { min-height: 40px; border-radius: 10px; font-weight: 650; }.button.primary { background: var(--brand-500); color: #fff; }.button.primary:hover { background: var(--brand-600); }.button.secondary { border-color: var(--border); background: #fff; color: var(--text-1); }.button.danger { border-color: #f3aaaa; background: #fff; color: var(--red); }.button.compact { min-height: 36px; }.chip { border-color: var(--border); background: #fff; color: var(--text-2); }.chip.active { border-color: var(--brand-500); background: var(--brand-050); color: var(--brand-700); }

.kpi-strip { display: flex; gap: 12px; overflow-x: auto; margin: 20px 0; padding: 2px 0 7px; scrollbar-width: thin; }.kpi-strip .metric-card { display: flex; min-width: 196px; min-height: 96px; flex: 1 0 196px; align-items: center; gap: 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff; padding: 14px; box-shadow: var(--shadow); }.metric-card .metric-icon { display: grid; width: 44px; height: 44px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--brand-050); color: var(--brand-600); }.metric-card.tone-blue .metric-icon { background: var(--blue-bg); color: var(--blue); }.metric-card.tone-red .metric-icon { background: var(--red-bg); color: var(--red); }.metric-card.tone-amber .metric-icon { background: var(--amber-bg); color: var(--amber); }.metric-card small, .metric-card em { display: block; }.metric-card small { color: var(--muted); font-size: 13px; font-style: normal; }.metric-card strong { color: var(--text-1); font-size: 28px; line-height: 1.18; }.metric-card em { color: var(--muted-2); font-size: 11px; font-style: normal; }

.board-scroll-controls { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin: 0 0 10px; color: var(--muted-2); font-size: 12px; font-weight: 600; }.board-scroll-controls > div { display: flex; gap: 6px; }.board-scroll-controls .icon-button { display: inline-grid; width: 36px; height: 36px; place-items: center; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text-2); cursor: pointer; }.board-scroll-controls .icon-button:hover { border-color: var(--brand-500); background: var(--brand-050); color: var(--brand-700); }
.board-grid { display: grid; grid-template-columns: repeat(7, minmax(165px, 1fr)); gap: 10px; overflow-x: auto; overflow-y: visible; padding-bottom: 14px; scrollbar-color: var(--brand-500) #dfe5e8; scrollbar-width: auto; }.board-grid::-webkit-scrollbar { height: 10px; }.board-grid::-webkit-scrollbar-track { border-radius: 999px; background: #dfe5e8; }.board-grid::-webkit-scrollbar-thumb { border-radius: 999px; background: var(--brand-500); }.stage-column { min-width: 165px; container-type: inline-size; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); box-shadow: none; }.stage-top, .drop-zone, .order-card, .card-actions { min-width: 0; max-width: 100%; }.stage-top, .drop-zone { width: 100%; }.stage-top { position: sticky; top: 0; z-index: 2; align-self: start; border-bottom: 1px solid var(--border); background: #fff; padding: 14px; }.stage-title { display: flex; min-width: 0; gap: 10px; }.stage-title > div { min-width: 0; }.stage-icon { display: grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; border-radius: 8px; background: var(--brand-050); color: var(--brand-700); }.stage-icon svg { width: 17px; }.stage-title h3 { overflow: hidden; color: var(--text-1); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }.stage-title h3 small { color: var(--muted-2); font-size: 12px; }.stage-owner { min-height: 32px; margin: 3px 0 0; overflow: hidden; color: var(--muted-2); font-size: 12px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }.stage-index { display: none; }.wip-row { margin-top: 12px; }.wip-label { color: var(--muted); font-size: 12px; }.wip-track { background: #e9edef; }.wip-bar { background: var(--brand-500); }.wip-bar.warn, .wip-bar.over { background: var(--red); }
@container (max-width: 185px) { .stage-column .mini-button { min-width: 0; justify-content: center; font-size: 0; padding: 0 4px; } .stage-column .mini-button svg { width: 15px; height: 15px; } }
.drop-zone { min-height: 160px; padding: 10px; }.order-card { border: 1px solid var(--border); border-radius: 12px; background: #fff; box-shadow: var(--shadow); padding: 14px; transition: transform .18s ease, box-shadow .18s ease; }.order-card:hover { box-shadow: 0 4px 12px rgba(16,24,40,.10); transform: translateY(-1px); }.order-card { min-height: 0; }.order-card-head { align-items: start; }.order-id { color: #6b7280; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }.order-card h4 { color: var(--text-1); font-size: 15px; }.order-desc { color: var(--text-2); font-size: 13px; }.order-tags { gap: 6px; }.badge { border: 0; border-radius: 999px; background: #eef1f4; color: var(--text-2); font-size: 12px; font-weight: 600; padding: 3px 8px; }.badge.green { background: var(--green-bg); color: #167a3c; }.badge.blue { background: var(--blue-bg); color: #2765c5; }.badge.amber { background: var(--amber-bg); color: #9a6100; }.badge.red { background: var(--red-bg); color: var(--red); }.badge.high { background: var(--red-bg); color: var(--red); }.badge.mid { background: var(--amber-bg); color: #9a6100; }.badge.low { background: #ecfdf5; color: #047857; }.badge.neutral { background: #eef1f4; color: var(--text-2); }
.card-meta-row { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 10px; color: var(--muted); font-size: 12px; }.card-meta-row span { display: inline-flex; align-items: center; gap: 4px; }.card-meta-row svg { width: 14px; }.card-status-row { margin-top: 8px; }.card-progress { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted-2); font-size: 11px; }.card-progress span { height: 6px; flex: 1; overflow: hidden; border-radius: 99px; background: #e5e8ec; }.card-progress i { display: block; height: 100%; border-radius: inherit; background: var(--brand-500); }.card-progress b { font-weight: 600; white-space: nowrap; }.work-badges { margin-top: 8px; }.card-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }.card-actions.has-reject { grid-template-columns: repeat(5, minmax(0, 1fr)); }.mini-button { min-height: 30px; border-color: var(--border); border-radius: 8px; background: #fff; color: var(--text-2); font-size: 12px; }.mini-button:hover { border-color: var(--brand-500); background: var(--brand-050); color: var(--brand-700); }.mini-button.danger { border-color: #f3aaaa; color: var(--red); }.mini-button.primary-action { background: var(--brand-500); color: #fff; }.advance-button { background: var(--brand-050); color: var(--brand-700); }

.analysis-section { margin-top: 24px; scroll-margin-top: 84px; }.analysis-heading { margin: 0 0 12px; }.analysis-heading h2 { margin: 3px 0 0; color: var(--text-1); font-size: 20px; }.analysis-section > .split-section { margin-top: 0; }#leadtime, #painpoints { scroll-margin-top: 84px; }
.split-section, .workspace-grid { gap: 20px; }.leadtime-card, .pain-card, .process-node, .identity-card, .case-detail, .test-block, .metric-def { border-color: var(--border); border-radius: 12px; background: var(--surface-2); box-shadow: none; }.leadtime-card { padding: 16px; }.work-comparison > div { border-color: var(--border); background: #fff; }.work-comparison strong { color: var(--text-1); }.pain-card { padding: 14px; }.pain-dynamic { margin-top: 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff; padding: 14px; }.pain-dynamic h3 { display: flex; align-items: center; gap: 7px; margin: 0 0 10px; color: var(--text-1); font-size: 14px; }.pain-dynamic h3 svg { width: 16px; color: var(--brand-700); }.pain-dynamic h3 small { color: var(--muted-2); font-size: 11px; font-weight: 500; }.termination-row { display: grid; grid-template-columns: minmax(130px, .9fr) minmax(100px, .7fr) minmax(180px, 1.4fr) minmax(120px, .8fr); gap: 10px; align-items: center; border-top: 1px solid var(--border); padding: 9px 0; color: var(--text-2); font-size: 12px; }.termination-row:first-of-type { border-top: 0; }.termination-row p, .termination-row small { margin: 0; }.termination-row small { color: var(--muted-2); }.termination-aggregate { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }.termination-aggregate small { color: var(--muted); }.reorder-summary p { margin: 0; color: var(--muted); }.reorder-summary strong { color: var(--brand-700); }.termination-note { margin: 12px 0 0; border-left: 3px solid var(--red); background: var(--red-bg); color: #991b1b; padding: 8px 10px; font-size: 13px; }

.modal { border: 0; border-radius: 16px; background: #fff; color: var(--text); box-shadow: 0 12px 32px rgba(16,24,40,.22); }.modal-header, .modal-footer { border-color: var(--border); }.modal-backdrop { background: rgba(15,23,42,.45); }.modal h2 { color: var(--text-1); }.modal input, .modal select, .modal textarea { border-color: var(--border); background: #fff; color: var(--text); border-radius: 8px; }.modal input[readonly] { background: var(--surface-2); }.form-warning { border-color: #f7d189; background: var(--amber-bg); color: #8a5900; }.toast { border-color: #a7e2bf; border-radius: 10px; background: #fff; color: var(--text); box-shadow: var(--shadow); }.toast.danger { border-color: #f1abab; }

@media (min-width: 761px) { body.sidebar-collapsed > .app-sidebar { width: 64px; } body.sidebar-collapsed .app-content { margin-left: 64px; } body.sidebar-collapsed .sidebar-brand-row { flex-direction: column; gap: 6px; padding: 12px 0; } body.sidebar-collapsed .sidebar-brand { justify-content: center; flex: 0 0 auto; padding: 0; } body.sidebar-collapsed .sidebar-brand > span:last-child, body.sidebar-collapsed .sidebar-nav a { font-size: 0; } body.sidebar-collapsed .sidebar-nav a { justify-content: center; padding: 0; } body.sidebar-collapsed .sidebar-nav a.active { border-left-width: 0; box-shadow: inset 3px 0 #54d69b; } body.sidebar-collapsed .sidebar-nav a svg { width: 20px; height: 20px; } body.sidebar-collapsed .sidebar-user > span:last-child { display: none; } body.sidebar-collapsed .sidebar-user { justify-content: center; } }
@media (max-width: 1180px) and (min-width: 761px) { .app-sidebar { width: 64px !important; }.app-content { margin-left: 64px; }.sidebar-brand-row { flex-direction: column; gap: 6px; padding: 12px 0; }.sidebar-brand { justify-content: center; flex: 0 0 auto; padding: 0 !important; }.sidebar-brand > span:last-child, .sidebar-nav a { font-size: 0; }.sidebar-nav a { justify-content: center; padding: 0; }.sidebar-nav a.active { border-left-width: 0; box-shadow: inset 3px 0 #54d69b; }.sidebar-nav a svg { width: 20px; height: 20px; }.sidebar-user > span:last-child { display: none; }.sidebar-user { justify-content: center; }.topbar-meta { display: none; }.board-grid { grid-template-columns: repeat(7, 165px); } }
@media (max-width: 760px) { .app-sidebar { position: static !important; display: block !important; width: 100% !important; min-height: 0 !important; }.app-content { margin-left: 0; }.sidebar-brand-row { padding: 8px 12px 0; }.sidebar-brand { display: inline-flex; }.sidebar-brand > span:last-child { display: inline-block; }.sidebar-toggle { display: none; }.sidebar-nav { display: flex; overflow-x: auto; padding: 6px 12px 12px; }.sidebar-nav a { min-width: max-content; font-size: 12px; justify-content: flex-start; padding: 0 10px; }.sidebar-nav a.active { box-shadow: none; border-left: 0; }.sidebar-bottom { display: none; }.topbar { position: static; }.top-actions { width: 100%; overflow-x: auto; }.topbar .button.compact { white-space: nowrap; }.page-intro { display: grid; gap: 14px; }.page-intro h1 { font-size: 24px; }.board-search { width: 100%; }.section, .panel { padding: 16px; }.board-scroll-controls { justify-content: space-between; }.board-grid { grid-template-columns: repeat(7, 234px); margin-right: -16px; }.analysis-section { margin-top: 24px; }.termination-row { grid-template-columns: 1fr; gap: 4px; }.card-actions, .card-actions.has-reject { grid-template-columns: repeat(2, minmax(0, 1fr)); }.order-card .mini-button { display: inline-flex; }.kpi-strip .metric-card { min-width: 180px; }.split-section, .workspace-grid { grid-template-columns: 1fr; }.table-wrap { overflow-x: auto; }.topbar .icon-button { width: 36px; }.topbar #switchIdentityBtn { display: none; } }

/* V3.1.2: compact cards retain every field and action while using tighter rhythm. */
.drop-zone { gap: 8px; }
.order-card { min-height: 100px; padding: 10px; }
.order-card .order-card-head { gap: 6px; }
.order-card .order-id { font-size: 11px; line-height: 1.15; }
.order-card h4 { margin-top: 2px; font-size: 14px; line-height: 1.18; }
.order-card .order-desc { margin-top: 3px; font-size: 11px; line-height: 1.25; }
.order-card .order-tags { gap: 4px; margin-top: 4px; }
.order-card .badge { min-height: 20px; padding: 2px 5px; font-size: 10px; line-height: 1.2; }
.order-card .card-meta-row { gap: 3px 8px; margin-top: 5px; font-size: 11px; line-height: 1.2; }
.order-card .card-meta-row svg { width: 12px; height: 12px; }
.order-card .card-status-row { margin-top: 4px; }
.order-card .work-badges { gap: 3px; margin-top: 4px; }
.order-card .work-badges .badge { min-height: 19px; font-size: 9px; }
.order-card .card-progress { gap: 6px; margin-top: 5px; font-size: 10px; }
.order-card .card-progress span { height: 5px; }
.order-card .card-actions,
.order-card .card-actions.has-reject { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; margin-top: 5px; }
.order-card .mini-button { min-height: 28px; padding: 4px; }
.order-card .advance-button { min-height: 30px; margin-top: 5px; padding: 4px 6px; font-size: 11px; }
.advance-short { display: none; }
.order-card .advance-short { display: inline; }
.order-card .advance-full { display: none; }
.stage-column[data-stage-id="material-production"] .order-card .card-actions { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 760px) {
  .order-card .card-actions,
  .order-card .card-actions.has-reject,
  .stage-column[data-stage-id="material-production"] .order-card .card-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* V3.2.1: single-density cards, compact actions and viewport-aware detail popover. */
.order-card {
  min-height: 100px;
  padding: 10px;
  cursor: help;
}
.order-card.popover-open {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 2px rgba(27, 122, 90, .12), var(--shadow);
}
.order-card .order-card-head { gap: 6px; }
.order-card .order-id { font-size: 11px; line-height: 1.15; }
.order-card h4 { margin-top: 2px; font-size: 14px; line-height: 1.18; }
.order-card .order-desc { margin-top: 3px; font-size: 11px; line-height: 1.25; }
.order-card .order-tags { gap: 4px; margin-top: 4px; }
.order-card .badge { min-height: 20px; padding: 2px 5px; font-size: 10px; line-height: 1.2; }
.order-card .card-meta-row { gap: 3px 8px; margin-top: 5px; font-size: 11px; line-height: 1.2; }
.order-card .card-meta-row svg { width: 12px; height: 12px; }
.order-card .card-status-row,
.order-card .work-badges { margin-top: 4px; }
.order-card .work-badges { gap: 3px; }
.order-card .work-badges .badge { min-height: 19px; font-size: 9px; }
.order-card .card-progress { gap: 6px; margin-top: 5px; font-size: 10px; }
.order-card .card-progress span { height: 5px; }
.order-card .card-actions,
.order-card .card-actions.has-reject,
.stage-column[data-stage-id="material-production"] .order-card .card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
@container (max-width: 185px) {
  .stage-column .order-card .mini-button {
    display: inline-grid;
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
    flex: 0 0 28px;
    place-items: center;
    margin: 0;
    padding: 0;
    font-size: 12px;
    line-height: 1;
  }
}
.order-card .mini-button,
.order-card .advance-button {
  display: inline-grid;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  flex: 0 0 28px;
  place-items: center;
  margin: 0;
  padding: 0;
  font-size: 12px;
  line-height: 1;
}
.stage-column .order-card .mini-button,
.stage-column .order-card .advance-button { font-size: 12px; }
.order-card .mini-button svg { display: none; }

.card-detail-popover[hidden] { display: none; }
.card-detail-popover {
  position: absolute;
  z-index: 90;
  width: min(340px, calc(100vw - 24px));
  max-height: min(520px, calc(100vh - 24px));
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #cfd8d4;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 18px 48px rgba(15, 61, 46, .22);
}
.card-popover-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  padding: 12px 14px;
}
.card-popover-head strong { display: block; margin-top: 3px; color: var(--text-1); font-size: 14px; }
.card-popover-body { display: grid; gap: 12px; padding: 12px 14px 14px; }
.card-popover-notes { display: grid; gap: 8px; }
.card-popover-notes section { border-left: 3px solid var(--border); border-radius: 6px; background: var(--surface-2); padding: 8px 10px; }
.card-popover-notes section.tone-red { border-left-color: var(--red); background: var(--red-bg); }
.card-popover-notes section.tone-amber { border-left-color: var(--amber); background: var(--amber-bg); }
.card-popover-notes section.tone-green { border-left-color: var(--brand-500); background: var(--brand-050); }
.card-popover-notes b { color: var(--text-1); font-size: 12px; }
.card-popover-notes p { margin: 4px 0 0; overflow-wrap: anywhere; color: var(--text-2); font-size: 12px; line-height: 1.55; white-space: pre-line; }
.card-popover-facts { display: grid; gap: 0; margin: 0; }
.card-popover-facts > div { display: grid; grid-template-columns: 106px minmax(0, 1fr); gap: 10px; border-top: 1px solid var(--border); padding: 7px 0; }
.card-popover-facts > div:first-child { border-top: 0; }
.card-popover-facts dt { color: var(--muted); font-size: 12px; }
.card-popover-facts dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: var(--text-1); font-size: 12px; font-weight: 600; text-align: right; }
.card-popover-reorder { margin: 0; border-radius: 7px; background: var(--blue-bg); color: var(--blue); padding: 7px 9px; font-size: 12px; }

.record-list-toggle {
  width: 100%;
  min-height: 38px;
  margin-top: 10px;
  border: 1px dashed #aac9bd;
  border-radius: 8px;
  background: var(--brand-050);
  color: var(--brand-700);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.record-list-toggle:hover { border-style: solid; background: #e4f4ed; }
.order-history-disclosure { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 9px; }
.order-history-disclosure summary { color: var(--brand-700); font-size: 12px; font-weight: 700; cursor: pointer; }
.order-history-disclosure .stage-history { max-height: 300px; overflow: auto; margin-top: 8px; }
.split-section > *,
#painpoints,
.pain-list,
.pain-card,
.pain-dynamic { min-width: 0; max-width: 100%; }
.termination-row { grid-template-columns: minmax(0, .9fr) minmax(0, .7fr) minmax(0, 1.4fr) minmax(0, .8fr); }
.termination-row > * { min-width: 0; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .order-card .card-actions,
  .order-card .card-actions.has-reject,
  .stage-column[data-stage-id="material-production"] .order-card .card-actions { gap: 6px; }
  .order-card .mini-button,
  .order-card .advance-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    flex-basis: 44px;
    font-size: 14px;
  }
  .stage-column .order-card .mini-button,
  .stage-column .order-card .advance-button { font-size: 14px; }
  .card-detail-popover { width: calc(100vw - 24px); max-height: min(70vh, 560px); }
  .card-popover-facts > div { grid-template-columns: 96px minmax(0, 1fr); }
}
