/* PP Simulator — page styles */

/* ── Sidebar ──────────────────────────────────────────── */

.btn-sm-primary {
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem; font-weight: 600;
  background: #5B5BD6; color: #fff;
  border: none; border-radius: 5px; cursor: pointer;
  white-space: nowrap; flex-shrink: 0; width: auto;
}
.btn-sm-primary:hover { background: #4747b5; }
.btn-sm-primary:disabled { background: #A1A1AA; cursor: not-allowed; }

.so-info-badge {
  background: #EEF0FF; border: 1px solid #C7D7FE;
  border-radius: 6px; padding: 0.45rem 0.65rem;
  font-size: 0.78rem; font-weight: 600; color: #3730A3;
  line-height: 1.5;
}

.so-detail-wrap {
  max-height: 105px; overflow-y: auto;
  border: 1px solid #E4E4E7; border-radius: 6px;
  isolation: isolate;
}

.no-so-msg {
  font-size: 0.78rem; color: #A1A1AA; padding: 0.25rem 0;
}

.dry-run-notice {
  margin-top: 0.5rem; padding: 0.5rem 0.6rem;
  font-size: 0.78rem; color: #5B5BD6;
  background: #EDEDFE; border-radius: 5px;
  border-left: 3px solid #5B5BD6;
}

.btn-check {
  width: 100%; padding: 0.6rem 1rem;
  background: #5B5BD6; color: #fff;
  border: none; border-radius: 7px; cursor: pointer;
  font-size: 0.86rem; font-weight: 700;
  transition: background 0.15s;
}
.btn-check:hover:not(:disabled) { background: #4747b5; }
.btn-check:disabled { background: #A1A1AA; cursor: not-allowed; }

.btn-simulate {
  width: 100%; padding: 0.6rem 1rem;
  background: #F97316; color: #fff;
  border: none; border-radius: 7px; cursor: pointer;
  font-size: 0.86rem; font-weight: 700;
  transition: background 0.15s; margin-bottom: 0.4rem;
}
.btn-simulate:hover:not(:disabled) { background: #d95f06; }
.btn-simulate:disabled { background: #A1A1AA; cursor: not-allowed; }

.btn-approve {
  width: 100%; padding: 0.6rem 1rem;
  background: #30A46C; color: #fff;
  border: none; border-radius: 7px; cursor: pointer;
  font-size: 0.86rem; font-weight: 700;
  transition: background 0.15s;
}
.btn-approve:hover:not(:disabled) { background: #237553; }
.btn-approve:disabled { background: #A1A1AA; cursor: not-allowed; }

/* ── Tab bar & panes use standard so-tab-* from mes-base.css ── */

/* ── Log pane ─────────────────────────────────────────── */

.log-container {
  flex: 1; display: flex; flex-direction: column;
  margin: 0.75rem 1rem 1rem;
  border: 1px solid #E4E4E7; border-radius: 8px;
  background: #fff; overflow: hidden; min-height: 0;
}
.log-header {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.55rem 0.9rem;
  background: #F6F6F7; border-bottom: 1px solid #E4E4E7;
  flex-shrink: 0;
}
.log-header-left { display: flex; align-items: baseline; gap: 0.5rem; flex: 1; min-width: 0; }
.log-title { font-size: 0.82rem; font-weight: 700; color: #18181B; white-space: nowrap; }
.log-ts    { font-size: 0.72rem; color: #A1A1AA; }
.log-stats { display: flex; gap: 0.6rem; flex-shrink: 0; }
.log-stats span { font-size: 0.75rem; font-weight: 700; }
.stat-ok   { color: #16a34a; }
.stat-err  { color: #dc2626; }
.stat-warn { color: #d97706; }
.btn-clear {
  padding: 0.2rem 0.6rem; font-size: 0.73rem; font-weight: 600;
  background: #F6F6F7; border: 1px solid #E4E4E7;
  border-radius: 4px; cursor: pointer; color: #71717A;
  flex-shrink: 0; width: auto;
}
.btn-clear:hover { background: #E4E4E7; }
.log-body {
  flex: 1; overflow-y: auto; padding: 0.5rem 0;
  font-family: 'Courier New', 'Consolas', 'Monaco', monospace;
  font-size: 0.8rem; line-height: 1.6;
  isolation: isolate;
}
.log-placeholder {
  padding: 2.5rem 1.5rem; text-align: center;
  font-size: 0.72rem; color: #A1A1AA;
  font-family: 'Inter', sans-serif;
}
.log-line           { display: block; padding: 0.04rem 0.9rem; white-space: pre; }
.log-line.log-ok    { color: #16a34a; }
.log-line.log-err   { color: #dc2626; }
.log-line.log-warn  { color: #d97706; }
.log-line.log-sep   { color: #9ca3af; }
.log-line.log-hdr   { color: #18181B; font-weight: 700; }
.log-line.log-sum   { color: #18181B; font-weight: 700; font-size: 0.82rem; }
.log-line.log-pass  { color: #16a34a; font-weight: 700; }
.log-line.log-fail  { color: #dc2626; font-weight: 700; }
.log-line.log-skip  { color: #9ca3af; }
.log-line.log-info  { color: #3F3F46; }

/* ── Simulation pane ──────────────────────────────────── */

.sim-container {
  flex: 1; display: flex; flex-direction: column;
  margin: 0.75rem 1rem 1rem; min-height: 0;
}

/* KPI summary bar */
.sim-summary {
  display: flex; gap: 0.6rem; flex-wrap: wrap;
  background: #fff; border: 1px solid #E4E4E7;
  border-radius: 8px; padding: 0.65rem 1rem;
  margin-bottom: 0.6rem; flex-shrink: 0;
}
.sim-kpi {
  flex: 1; min-width: 100px;
  font-size: 0.72rem; color: #71717A; line-height: 1.6;
}
.sim-kpi strong { display: block; font-size: 1rem; font-weight: 700; color: #18181B; }
.sim-kpi-ok strong { color: #16a34a; }
.sim-kpi-warn strong { color: #d97706; }

/* Proposal grid */
.sim-grid-wrap {
  flex: 1; overflow: auto; min-height: 0;
  border: 1px solid #E4E4E7; border-radius: 8px;
  background: #fff; isolation: isolate;
}

.sim-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.8rem;
}
.sim-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: #F6F6F7; color: #71717A;
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.03em;
  padding: 0.5rem 0.75rem; border-bottom: 1px solid #E4E4E7;
  white-space: nowrap;
}
.sim-table tbody td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid #F0F0F0;
  white-space: nowrap; color: #18181B;
}
.sim-table tbody tr:last-child td { border-bottom: none; }
.sim-table tbody tr:hover { background: #FAFAFA; }
.sim-table tbody tr.slot-first td { border-top: 2px solid #D4D4D8; }

/* Row states */
.sim-table tbody tr.sim-lack  { background: #EFF6FF; }
.sim-table tbody tr.sim-ok    { background: #fff; }
.sim-table tbody tr.sim-near  { background: #FFFBEB; }
.sim-table tbody tr.sim-over  { background: #FFF1F2; }
.sim-table tbody tr.sim-empty { background: #F9FAFB; color: #A1A1AA; }

/* Shift badge */
.shift-badge {
  display: inline-block; padding: 0.1rem 0.45rem;
  border-radius: 3px; font-size: 0.72rem; font-weight: 700;
}
.shift-day   { background: #EEF0FF; color: #4338CA; }
.shift-night { background: #1E1B4B; color: #C7D2FE; }

/* Stacked bar */
.capa-bar {
  height: 14px; width: 130px;
  background: #E4E4E7; border-radius: 3px;
  overflow: hidden; display: flex; flex-shrink: 0;
}
.capa-bar-existing {
  background: #5B5BD6; flex-shrink: 0;
}
.capa-bar-new {
  background: repeating-linear-gradient(
    45deg,
    #A5B4FC, #A5B4FC 3px,
    #C7D2FE 3px, #C7D2FE 6px
  );
  flex-shrink: 0;
}
.capa-bar-over { background: #E5484D; }

/* State badge */
.state-badge {
  display: inline-block; padding: 0.1rem 0.45rem;
  border-radius: 3px; font-size: 0.72rem; font-weight: 700;
}
.state-lack  { background: #DBEAFE; color: #1E40AF; }
.state-ok    { background: #D1FAE5; color: #065F46; }
.state-near  { background: #FEF3C7; color: #92400E; }
.state-over  { background: #FFE4E6; color: #9F1239; }
.state-empty { background: #F3F4F6; color: #9CA3AF; }

/* Per-demand section */
.demand-section {
  margin-bottom: 1rem;
}
.demand-section:last-child { margin-bottom: 0; }
.demand-header {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.5rem 0.75rem;
  background: #F6F6F7; border-bottom: 1px solid #E4E4E7;
  border-radius: 6px 6px 0 0;
}
.demand-no {
  font-size: 0.78rem; font-weight: 700; color: #3730A3;
  background: #EEF0FF; padding: 0.15rem 0.5rem; border-radius: 4px;
}
.demand-meta {
  font-size: 0.75rem; color: #3F3F46;
}
/* Demand allocation detail strip */
.demand-netting-detail {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  padding: 0.45rem 0.75rem;
  background: #FAFAFA; border-bottom: 1px solid #E4E4E7;
  font-size: 0.75rem;
}
.netting-item {
  display: flex; flex-direction: column; align-items: center;
  min-width: 56px;
}
.netting-label {
  font-size: 0.62rem; font-weight: 600; color: #A1A1AA;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.netting-value {
  font-size: 0.82rem; font-weight: 700; color: #18181B;
}
.netting-arrow {
  font-size: 0.9rem; font-weight: 700; color: #A1A1AA;
  margin: 0.5rem 0.1rem 0;
}
.netting-ok .netting-value { color: #16a34a; }
.netting-warn .netting-value { color: #d97706; }

.backup-badge {
  display: inline-block; padding: 0.05rem 0.35rem;
  background: #FEF3C7; color: #92400E;
  border-radius: 3px; font-size: 0.65rem; font-weight: 700;
  margin-left: 0.3rem; vertical-align: middle;
}

/* Approve result */
.wo-result-list {
  margin-top: 0.5rem; padding: 0.5rem 0.75rem;
  background: #D1FAE5; border: 1px solid #A7F3D0;
  border-radius: 6px; font-size: 0.78rem;
  color: #065F46; max-height: 120px; overflow-y: auto;
}

/* ── Allocation Detail pane ──────────────────────────── */

.alloc-container {
  flex: 1; display: flex; flex-direction: column;
  margin: 0.75rem 1rem 1rem; min-height: 0;
}
.alloc-toolbar {
  display: flex; align-items: center; gap: 0.6rem;
  background: #fff; border: 1px solid #E4E4E7;
  border-radius: 8px; padding: 0.5rem 1rem;
  margin-bottom: 0.6rem; flex-shrink: 0;
}
.alloc-nav-btn {
  width: auto; flex-shrink: 0;
  padding: 0.3rem 0.7rem; font-size: 0.78rem; font-weight: 600;
  background: #F6F6F7; border: 1px solid #E4E4E7;
  border-radius: 5px; cursor: pointer; color: #3F3F46;
}
.alloc-nav-btn:hover { background: #E4E4E7; }
.alloc-nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.alloc-day-label {
  font-size: 1rem; font-weight: 700; color: #18181B;
  min-width: 120px; text-align: center;
}
.alloc-page-info {
  font-size: 0.72rem; color: #A1A1AA; margin-left: auto;
}
.alloc-grid-wrap {
  flex: 1; overflow: auto; min-height: 0;
  border: 1px solid #E4E4E7; border-radius: 8px;
  background: #fff; isolation: isolate;
}

/* Day summary strip inside alloc tab */
.alloc-day-summary {
  display: flex; gap: 0.8rem; flex-wrap: wrap;
  padding: 0.6rem 0.75rem;
  background: #F6F6F7; border-bottom: 1px solid #E4E4E7;
  font-size: 0.75rem; color: #3F3F46;
}
.alloc-day-summary strong { color: #18181B; }

/* ── Log tab (Phase 1: Simulation Log) ─────────────── */

/* ── Sticky Live Progress Header (inside Log tab) ──────── */
.sim-live-header {
  position: sticky; top: 0; z-index: 10;
  flex-shrink: 0;
  background: linear-gradient(135deg, #F8F7FF 0%, #F0F4FF 100%);
  border-bottom: 2px solid #5B5BD6;
  padding: 0.5rem 0.75rem 0.4rem;
  animation: liveHeaderIn 0.2s ease-out;
}
.sim-live-header.complete {
  border-bottom-color: #30A46C;
  background: linear-gradient(135deg, #F0FFF4 0%, #ECFDF5 100%);
}
@keyframes liveHeaderIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.sim-live-top {
  display: flex; align-items: center; gap: 0.5rem;
}
.sim-live-phase-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #5B5BD6;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
  animation: liveIconPulse 1s ease-in-out infinite alternate;
}
.sim-live-header.complete .sim-live-phase-icon {
  background: #30A46C; animation: none;
}
@keyframes liveIconPulse {
  from { box-shadow: 0 0 0 0 rgba(91,91,214,0.4); }
  to   { box-shadow: 0 0 0 8px rgba(91,91,214,0); }
}
.sim-live-phase-name {
  font-size: 0.85rem; font-weight: 700; color: #18181B;
  text-transform: uppercase; letter-spacing: 0.03em;
  flex: 1; min-width: 0;
}
.sim-live-timer {
  font-size: 1.1rem; font-weight: 700; color: #5B5BD6;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.sim-live-header.complete .sim-live-timer { color: #30A46C; }
.sim-live-count {
  font-size: 0.72rem; font-weight: 600; color: #71717A;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.sim-live-phases {
  display: flex; gap: 2px; align-items: stretch;
  height: 22px; border-radius: 4px; overflow: hidden;
  background: #E4E4E7;
  margin-top: 0.35rem;
}
.sim-live-phases .sim-phase {
  display: flex; align-items: center; justify-content: center;
  flex: 1; font-size: 0.55rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: #A1A1AA; background: #F6F6F7;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap; padding: 0 0.2rem;
}
.sim-live-phases .sim-phase.active {
  background: #5B5BD6; color: #fff;
  animation: phase-pulse 0.8s ease-in-out infinite alternate;
}
.sim-live-phases .sim-phase.done {
  background: #30A46C; color: #fff;
}
@keyframes phase-pulse {
  from { opacity: 1; }
  to   { opacity: 0.7; }
}
.sim-live-detail {
  margin-top: 0.3rem;
  font-size: 0.72rem; color: #3F3F46;
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  min-height: 1.1em;
  opacity: 0.85;
}

/* ── Phase group headers in log ────────────────────────── */
.pp-phase-group {
  margin: 0;
  animation: phaseGroupIn 0.2s ease-out;
}
@keyframes phaseGroupIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.pp-phase-header {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  background: #F6F6F7; border-top: 1px solid #EDEDEF;
  cursor: pointer; user-select: none;
}
.pp-phase-header:first-child { border-top: none; }
.pp-phase-header:hover { background: #EEEEEF; }
.pp-phase-arrow {
  font-size: 0.6rem; color: #A1A1AA; width: 12px;
  transition: transform 0.15s;
}
.pp-phase-header.collapsed .pp-phase-arrow { transform: rotate(-90deg); }
.pp-phase-name {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pp-phase-count {
  font-size: 0.62rem; color: #A1A1AA; font-weight: 500;
}
.pp-phase-elapsed {
  margin-left: auto;
  font-size: 0.6rem; font-family: monospace; color: #71717A;
}
.pp-phase-check {
  font-size: 0.7rem; color: #30A46C;
}
.pp-phase-body { }
.pp-phase-header.collapsed + .pp-phase-body { display: none; }

.pp-log-container {
  flex: 1; display: flex; flex-direction: column;
  margin: 0.75rem 1rem 1rem; min-height: 0;
  border: 1px solid #E4E4E7; border-radius: 8px;
  background: #fff; overflow: hidden;
}
.pp-log-filter {
  display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap;
  padding: 0.5rem 0.75rem;
  background: #F6F6F7; border-bottom: 1px solid #E4E4E7;
  flex-shrink: 0;
}
.log-filter-btn {
  width: auto; flex-shrink: 0;
  padding: 0.2rem 0.55rem; font-size: 0.72rem; font-weight: 600;
  background: #fff; border: 1px solid #D4D4D8;
  border-radius: 4px; cursor: pointer; color: #3F3F46;
}
.log-filter-btn:hover { background: #F0F0F0; }
.log-filter-btn.active {
  background: #5B5BD6; color: #fff; border-color: #5B5BD6;
}
.pp-log-body {
  flex: 1; overflow-y: auto; padding: 0.4rem 0;
  font-size: 0.8rem; line-height: 1.6;
  isolation: isolate;
}
.pp-log-entry {
  display: flex; align-items: baseline; gap: 0.5rem;
  padding: 0.2rem 0.75rem;
  animation: logSlideIn 0.15s ease-out;
}
@keyframes logSlideIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.pp-log-entry:hover { background: #FAFAFA; }
.pp-log-ts {
  flex-shrink: 0; min-width: 72px;
  font-size: 0.65rem; font-family: monospace;
  color: #A1A1AA; letter-spacing: -0.02em;
}
.pp-log-step {
  display: inline-block; flex-shrink: 0;
  min-width: 56px; text-align: center;
  padding: 0.08rem 0.4rem; border-radius: 3px;
  font-size: 0.65rem; font-weight: 700; color: #fff;
  text-transform: uppercase; letter-spacing: 0.02em;
}
.pp-log-detail {
  color: #18181B; font-size: 0.78rem;
  word-break: break-word;
}

/* ── WC Breakdown (Phase 4) ──────────────────────────── */

.wcbd-container {
  flex: 1; display: flex; flex-direction: column;
  margin: 0.75rem 1rem 1rem; min-height: 0;
  overflow-y: auto;
}
.wcbd-body {
  display: flex; flex-direction: column; gap: 0.75rem;
}
.wcbd-card {
  border: 1px solid #E4E4E7; border-radius: 8px;
  background: #fff; overflow: hidden;
}
.wcbd-card.collapsed .wcbd-card-body { display: none; }
.wcbd-card.collapsed .wcbd-chevron { transform: rotate(-90deg); }
.wcbd-card-header {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0.9rem;
  background: #F6F6F7; border-bottom: 1px solid #E4E4E7;
  cursor: pointer; user-select: none;
}
.wcbd-card-header:hover { background: #EEEEF0; }
.wcbd-wc {
  font-size: 0.88rem; font-weight: 700; color: #18181B;
}
.wcbd-util {
  font-size: 0.88rem; font-weight: 700;
}
.wcbd-summary {
  font-size: 0.72rem; color: #71717A; margin-left: auto;
}
.wcbd-chevron {
  font-size: 0.72rem; color: #A1A1AA;
  transition: transform 0.15s;
  flex-shrink: 0;
}
.wcbd-card-body {
  overflow-x: auto;
  isolation: isolate;
}

/* Scenario add button */
.btn-scenario-add {
  width: auto; min-height: 0; flex-shrink: 0;
  padding: 0.25rem 0.6rem; margin: 0; margin-left: auto;
  font-size: 0.72rem; font-weight: 600;
  background: #FEF3C7; color: #92400E;
  border: 1px solid #FCD34D; border-radius: 4px;
  cursor: pointer; white-space: nowrap;
}
.btn-scenario-add:hover { background: #F59E0B; color: #fff; }
.btn-scenario-add:disabled { opacity: 0.4; cursor: not-allowed; }

/* Capa Matrix tab */
.pp-matrix-container {
  flex: 1; display: flex; flex-direction: column;
  margin: 0.75rem 1rem 1rem; min-height: 0;
}
.pp-matrix-header {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #E4E4E7; flex-shrink: 0;
}
.pp-matrix-count {
  font-size: 0.75rem; color: #71717A; font-weight: 600;
}
.pp-matrix-wrap {
  flex: 1; overflow: auto; min-height: 0;
  border: 1px solid #E4E4E7; border-radius: 8px;
  background: #fff; isolation: isolate; margin-top: 0.5rem;
}
.pp-capa-cell {
  padding: 0.25rem 0.35rem; text-align: center;
  font-size: 0.72rem; font-weight: 600;
  border-radius: 4px; min-width: 72px;
  display: inline-block;
}
.pp-capa-green  { background: #D1FAE5; color: #065F46; }
.pp-capa-yellow { background: #FEF3C7; color: #92400E; }
.pp-capa-red    { background: #FFE4E6; color: #9F1239; }
.pp-capa-gray   { background: #F3F4F6; color: #9CA3AF; }

/* Scenario tab */
.scenario-container {
  flex: 1; display: flex; flex-direction: column;
  margin: 0.75rem 1rem 1rem; min-height: 0;
}
.scenario-header {
  display: flex; align-items: center; gap: 0.6rem;
  background: #fff; border: 1px solid #E4E4E7;
  border-radius: 8px; padding: 0.55rem 0.9rem;
  margin-bottom: 0.6rem; flex-shrink: 0;
}
.scenario-so-list {
  display: flex; flex-direction: column; gap: 0.35rem;
  margin-bottom: 0.6rem;
}
.scenario-so-item {
  display: flex; align-items: center; gap: 0.5rem;
  background: #fff; border: 1px solid #E4E4E7;
  border-radius: 6px; padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
}
.scenario-so-item .so-label {
  font-weight: 700; color: #18181B;
}
.scenario-so-item .so-meta {
  color: #71717A; font-size: 0.72rem;
}
.scenario-so-item .so-remove {
  width: auto; min-height: 0; padding: 0 0.3rem;
  margin: 0; margin-left: auto;
  font-size: 0.72rem; background: none;
  color: #E5484D; border: none; cursor: pointer;
  flex-shrink: 0;
}
.scenario-so-item .so-remove:hover { color: #fff; background: #E5484D; border-radius: 3px; }

.scenario-result {
  flex: 1; overflow-y: auto; min-height: 0;
}
.scenario-summary {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.scenario-so-card {
  flex: 1; min-width: 180px;
  background: #fff; border: 1px solid #E4E4E7;
  border-radius: 8px; padding: 0.6rem 0.8rem;
}
.scenario-so-card .card-so {
  font-size: 0.82rem; font-weight: 700; color: #18181B;
  margin-bottom: 0.3rem;
}
.scenario-so-card .card-detail {
  font-size: 0.72rem; color: #71717A; line-height: 1.6;
}
.scenario-so-card .card-detail strong {
  color: #18181B;
}
.scenario-totals {
  background: #F6F6F7; border: 1px solid #E4E4E7;
  border-radius: 8px; padding: 0.6rem 0.8rem;
  display: flex; gap: 1.5rem; flex-wrap: wrap;
  font-size: 0.78rem; margin-bottom: 0.6rem;
}
.scenario-totals .total-item {
  font-size: 0.72rem; color: #71717A;
}
.scenario-totals .total-item strong {
  display: block; font-size: 0.92rem; font-weight: 700; color: #18181B;
}
.scenario-totals .total-ok strong { color: #16a34a; }
.scenario-totals .total-warn strong { color: #d97706; }

/* Snapshot button */
.btn-snapshot {
  width: auto; min-height: 0; flex-shrink: 0;
  padding: 0.25rem 0.6rem; margin: 0; margin-left: auto;
  font-size: 0.72rem; font-weight: 600;
  background: #F0F9FF; color: #0369A1;
  border: 1px solid #BAE6FD; border-radius: 4px;
  cursor: pointer; white-space: nowrap;
}
.btn-snapshot:hover { background: #0369A1; color: #fff; }
.btn-snapshot:disabled { opacity: 0.4; cursor: not-allowed; }

/* Snapshot list (sidebar) */
.snapshot-list {
  max-height: 200px; overflow-y: auto;
}
.snap-item {
  display: flex; align-items: center; gap: 0.3rem;
  padding: 0.3rem 0; border-bottom: 1px solid #E4E4E7;
  font-size: 0.72rem; cursor: pointer;
}
.snap-item:hover { background: #F6F6F7; }
.snap-item .snap-so { font-weight: 600; color: #18181B; }
.snap-item .snap-dt { color: #A1A1AA; margin-left: auto; }
.snap-item .snap-del {
  width: auto; min-height: 0; padding: 0 0.3rem;
  margin: 0; font-size: 0.65rem; background: none;
  color: #E5484D; border: none; cursor: pointer;
  flex-shrink: 0;
}
.snap-item .snap-del:hover { color: #fff; background: #E5484D; border-radius: 3px; }

/* ── MAA Progress Panel ────────────────────────────────── */

.maa-progress-panel {
  margin-top: 0.6rem;
  border: 1px solid #E4E4E7; border-radius: 8px;
  background: #fff; overflow: hidden;
}
.maa-progress-header {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: #F6F6F7; border-bottom: 1px solid #E4E4E7;
}
.maa-progress-title {
  font-size: 0.82rem; font-weight: 700; color: #18181B;
}
.maa-progress-summary {
  font-size: 0.72rem; color: #71717A; margin-left: auto;
  display: flex; gap: 0.6rem;
}
.maa-progress-body {
  max-height: 260px; overflow-y: auto;
  isolation: isolate;
}
.maa-progress-table {
  width: 100%; border-collapse: collapse; font-size: 0.78rem;
}
.maa-progress-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: #F6F6F7; color: #71717A;
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.03em;
  padding: 0.4rem 0.6rem; border-bottom: 1px solid #E4E4E7;
  white-space: nowrap;
}
.maa-progress-table tbody td {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid #F0F0F0;
  white-space: nowrap; color: #18181B;
}
.maa-progress-table tbody tr:last-child td { border-bottom: none; }
.maa-progress-table tbody tr:hover { background: #FAFAFA; }

/* MAA status badges */
.maa-badge {
  display: inline-block; padding: 0.1rem 0.45rem;
  border-radius: 3px; font-size: 0.7rem; font-weight: 700;
}
.maa-badge-ok      { background: #D1FAE5; color: #065F46; }
.maa-badge-short   { background: #FFE4E6; color: #9F1239; }
.maa-badge-skip    { background: #F3F4F6; color: #9CA3AF; }
.maa-badge-pending { background: #DBEAFE; color: #1E40AF; }

/* MAA summary counts in header */
.maa-summary-ok    { color: #16a34a; font-weight: 700; }
.maa-summary-short { color: #dc2626; font-weight: 700; }
.maa-summary-skip  { color: #9CA3AF; font-weight: 700; }
.maa-summary-pending { color: #2563EB; font-weight: 700; }

/* MAA detail text */
.maa-detail {
  font-size: 0.72rem; color: #71717A; max-width: 180px;
  overflow: hidden; text-overflow: ellipsis;
}

/* ── Build Tree ───────── */

.pp-build-body {
  flex: 1; overflow-y: auto;
  padding: 0.5rem 0.6rem;
  isolation: isolate;
}

/* ── Demand Tree ──────── */

/* ── Require Qty card ── */
.dt-require-card {
  background: #FAFBFF;
  border: 1px solid #C7D7FE;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.75rem;
}
.dt-require-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #3730A3;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.4rem;
}
.dt-require-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.dt-require-table th {
  text-align: right;
  font-size: 0.68rem;
  font-weight: 600;
  color: #71717A;
  padding: 0.2rem 0.5rem;
  border-bottom: 1px solid #E4E4E7;
}
.dt-require-table th:first-child,
.dt-require-table th:nth-child(2),
.dt-require-table th:nth-child(3) { text-align: left; }
.dt-require-table td { padding: 0.3rem 0.5rem; }
.dt-rq-item {
  font-family: monospace;
  font-size: 0.72rem;
  color: #3F3F46;
}
.dt-rq-proc {
  font-size: 0.72rem;
  color: #5B5BD6;
}
.dt-rq-sort {
  font-size: 0.72rem;
  color: #71717A;
}
.dt-rq-num {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.dt-rq-positive { color: #E5484D; }
.dt-rq-zero { color: #30A46C; }

.dt-dryrun-bar {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 0.6rem; margin-top: 0.5rem;
}
.dt-allowance-label {
  display: flex; align-items: center; gap: 0.25rem;
  font-size: 0.72rem; font-weight: 600; color: #3F3F46;
}
.dt-allowance-input {
  width: 2.6rem; padding: 0.2rem 0.3rem;
  font-size: 0.72rem !important; font-weight: 600;
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.4;
  text-align: right;
  border: 1px solid #E4E4E7; border-radius: 4px;
  color: #18181B; background: #fff;
  box-sizing: border-box;
  -moz-appearance: textfield;
}
.dt-allowance-input::-webkit-inner-spin-button,
.dt-allowance-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.dt-start-input {
  padding: 0.2rem 0.3rem;
  font-size: 0.72rem !important; font-weight: 600;
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.4;
  border: 1px solid #E4E4E7; border-radius: 4px;
  color: #18181B; background: #fff;
  box-sizing: border-box;
}
.dt-start-input::-webkit-datetime-edit { font-size: 0.72rem; }
.dt-allowance-input:focus, .dt-start-input:focus {
  outline: none; border-color: #5B5BD6;
  box-shadow: 0 0 0 2px rgba(91,91,214,0.15);
}
.dt-dryrun-btn {
  width: auto; flex-shrink: 0;
  padding: 0.3rem 1rem;
  font-size: 0.72rem; font-weight: 600;
  color: #fff; background: #5B5BD6;
  border: none; border-radius: 4px;
  cursor: pointer;
}
.dt-dryrun-btn:hover { background: #4747b3; }
.dt-dryrun-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Allocation card ── */
.dt-alloc-card {
  background: #FAFBFF;
  border: 1px solid #C7D7FE;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.75rem;
}
.dt-alloc-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: #3730A3;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.4rem;
}
.dt-alloc-placeholder {
  font-size: 0.72rem;
  color: #A1A1AA;
  padding: 1.2rem 0;
  text-align: center;
}
.dt-alloc-demand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  margin-top: 0.5rem;
  border-top: 1px solid #E4E4E7;
  font-size: 0.78rem;
}
.dt-alloc-demand:first-of-type { border-top: none; margin-top: 0; }
.dt-alloc-item { font-family: monospace; font-size: 0.72rem; color: #3F3F46; font-weight: 600; }
.dt-alloc-proc { color: #18181B; font-weight: 600; }
.dt-alloc-wc { color: #5B5BD6; font-weight: 500; }
.dt-alloc-dno { color: #71717A; font-size: 0.7rem; }
.dt-alloc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  margin-bottom: 0.3rem;
}
.dt-alloc-table th {
  text-align: right;
  font-size: 0.66rem;
  font-weight: 600;
  color: #71717A;
  padding: 0.15rem 0.4rem;
  border-bottom: 1px solid #E4E4E7;
}
.dt-alloc-table th:first-child,
.dt-alloc-table th:nth-child(2),
.dt-alloc-table th:nth-child(3),
.dt-alloc-table th:nth-child(4) { text-align: left; }
.dt-alloc-table td { padding: 0.2rem 0.4rem; text-align: left; }
.dt-alloc-table td:first-child { font-size: 0.72rem; color: #5B5BD6; }
.dt-alloc-table td:nth-child(2) { font-size: 0.72rem; font-family: monospace; color: #3F3F46; }
.dt-alloc-table td:nth-child(3) { font-size: 0.72rem; color: #71717A; }
.dt-alloc-table td.dt-al-num { text-align: right; font-variant-numeric: tabular-nums; }
.dt-al-qty { font-weight: 700; color: #18181B; }

/* ── Allocation row click ── */
.dt-alloc-row { cursor: pointer; transition: background 0.12s; }
.dt-alloc-row:hover { background: #EEF0FF; }
.dt-alloc-row.dt-alloc-selected { background: #DBEAFE; }

/* ── Spread card ── */
.dt-spread-card {
  background: #F0F9FF;
  border: 1px solid #BAE6FD;
  border-radius: 8px;
  padding: 0;
  margin-bottom: 0.75rem;
  overflow: hidden;
}
.dt-spread-header {
  display: flex;
  align-items: center;
  padding: 0.45rem 0.75rem;
  background: #E0F2FE;
  border-bottom: 1px solid #BAE6FD;
}
.dt-spread-title {
  font-size: 0.76rem;
  font-weight: 700;
  color: #0369A1;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex: 1;
}
.dt-spread-close {
  width: auto; flex-shrink: 0;
  background: none; border: none;
  font-size: 1.1rem; color: #0369A1;
  cursor: pointer; padding: 0 0.3rem;
  line-height: 1;
}
.dt-spread-close:hover { color: #E5484D; }
.dt-spread-body {
  padding: 0.6rem 0.75rem;
}
.dt-spread-placeholder {
  font-size: 0.72rem;
  color: #A1A1AA;
  padding: 1rem 0;
  text-align: center;
}

.demand-tree {
  font-size: 0.8rem;
  font-family: 'Inter', -apple-system, sans-serif;
}

.dt-line-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.6rem;
  margin-top: 0.5rem;
  background: #EEF0FF;
  border: 1px solid #C7D7FE;
  border-radius: 6px;
  font-weight: 600;
  color: #3730A3;
}
.dt-line-header:first-child { margin-top: 0; }
.dt-child-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0;
  margin-top: 0.25rem;
  font-weight: 600;
  font-size: 0.78rem;
  color: #4338CA;
}
.dt-so {
  font-size: 0.75rem;
  color: #5B5BD6;
  font-weight: 700;
  min-width: 100px;
}
.dt-item {
  font-size: 0.72rem;
  color: #3F3F46;
  font-family: monospace;
}
.dt-nm {
  font-size: 0.72rem;
  color: #71717A;
  font-weight: 400;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dt-node {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid #F4F4F5;
  font-size: 0.78rem;
}
.dt-node:last-child { border-bottom: none; }
.dt-connector {
  color: #D4D4D8;
  font-family: monospace;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.dt-seq {
  color: #71717A;
  font-weight: 600;
  font-size: 0.72rem;
  min-width: 22px;
}
.dt-proc {
  color: #18181B;
  font-weight: 600;
  min-width: 80px;
}
.dt-wc {
  color: #5B5BD6;
  font-weight: 500;
  min-width: 60px;
}
.dt-dno {
  font-family: monospace;
  font-size: 0.7rem;
  color: #A1A1AA;
  min-width: 80px;
}
.dt-qty {
  font-weight: 600;
  color: #18181B;
  text-align: right;
  min-width: 50px;
}
.dt-ct, .dt-hours {
  font-size: 0.7rem;
  color: #71717A;
  min-width: 50px;
}
.dt-status {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.dt-status-released {
  background: #DCFCE7;
  color: #166534;
}
.dt-status-planned {
  background: #FEF9C3;
  color: #854D0E;
}
