:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --line: #d9e1ec;
  --text: #172033;
  --muted: #64748b;
  --blue: #1769e0;
  --blue-soft: #e9f1ff;
  --green: #16835a;
  --green-soft: #e6f6ef;
  --orange: #b85b00;
  --orange-soft: #fff1df;
  --red: #b42318;
  --red-soft: #fee7e4;
  --ink-soft: #eff3f8;
  --shadow: 0 14px 30px rgba(28, 43, 67, 0.08);
  font-family: "Yu Gothic UI", "Meiryo", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px 1fr;
}

.sidebar {
  background: #0f233d;
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: #0f233d;
  font-weight: 800;
  font-size: 20px;
}

.brand-title,
.brand-subtitle,
.side-note p {
  margin: 0;
}

.brand-title {
  font-weight: 700;
  font-size: 15px;
}

.brand-subtitle {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
}

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

.tab-button {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.82);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

.tab-button.active {
  background: #ffffff;
  color: #0f233d;
  border-color: #ffffff;
}

.tab-icon {
  font-size: 12px;
  font-weight: 800;
}

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

.side-label {
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px !important;
}

.workspace {
  padding: 28px;
  overflow: auto;
}

.view {
  display: none;
  gap: 18px;
}

.view.active {
  display: grid;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 4px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.28;
}

h2 {
  margin: 0;
  font-size: 16px;
}

h3 {
  margin: 0;
  font-size: 15px;
}

.header-kpis {
  display: grid;
  grid-auto-flow: column;
  gap: 10px;
}

.kpi {
  min-width: 122px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.kpi-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
}

.kpi-value {
  font-weight: 800;
  font-size: 20px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

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

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

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

.segmented button {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
}

.segmented button.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.constraint-grid,
.sku-grid,
.action-grid,
.decision-board {
  display: grid;
  gap: 12px;
}

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

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

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

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

.metric-card,
.sku-card,
.action-card,
.decision-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.metric-card.active,
.sku-card.active,
.action-card.best,
.scenario-card.active {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
  background: var(--blue-soft);
}

.card-label {
  color: var(--muted);
  font-size: 11px;
}

.card-value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 800;
}

.card-caption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 18px;
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
}

th {
  color: var(--muted);
  font-weight: 700;
  background: var(--surface-soft);
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.active-row {
  background: var(--blue-soft);
}

.risk-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.risk-high {
  color: var(--red);
  background: var(--red-soft);
}

.risk-mid {
  color: var(--orange);
  background: var(--orange-soft);
}

.risk-low {
  color: var(--green);
  background: var(--green-soft);
}

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

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

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.detail-row span:first-child {
  color: var(--muted);
}

.bar {
  margin-top: 10px;
  height: 8px;
  border-radius: 999px;
  background: var(--ink-soft);
  overflow: hidden;
}

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

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

.scenario-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: var(--surface-soft);
  cursor: pointer;
}

.scenario-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.scenario-score {
  font-weight: 800;
  color: var(--blue);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .tabs,
  .constraint-grid,
  .sku-grid,
  .action-grid,
  .decision-board,
  .two-column,
  .header-kpis {
    grid-template-columns: 1fr;
    grid-auto-flow: row;
  }

  .page-header {
    align-items: stretch;
    flex-direction: column;
  }
}

