@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800&display=swap");

:root {
  color-scheme: light;
  --bg-top: #f7f7f4;
  --bg-bottom: #e7ede8;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-strong: rgba(255, 255, 255, 0.9);
  --field-bg: rgba(255, 255, 255, 0.9);
  --line: rgba(83, 103, 129, 0.12);
  --line-strong: rgba(70, 88, 112, 0.18);
  --ink: #1e2735;
  --muted: #647488;
  --blue: #5a7188;
  --teal: #5f8a84;
  --amber: #b78656;
  --rose: #b96b76;
  --shadow-lg: 0 14px 30px rgba(102, 114, 126, 0.1);
  --shadow-xl: 0 24px 52px rgba(92, 104, 116, 0.1);
  --radius-xl: 34px;
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Manrope", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(90, 113, 136, 0.14), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(95, 138, 132, 0.12), transparent 22%),
    radial-gradient(circle at 50% 100%, rgba(183, 134, 86, 0.08), transparent 30%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.14), transparent 42%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.32), transparent 72%);
}

button,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.glass-panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px) saturate(1.14);
  border-radius: var(--radius-xl);
  overflow: clip;
}

.ambient {
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 999px;
  filter: blur(86px);
  opacity: 0.6;
  pointer-events: none;
}

.ambient-left {
  top: 24px;
  left: -120px;
  background: rgba(90, 113, 136, 0.16);
}

.ambient-right {
  top: 190px;
  right: -120px;
  background: rgba(95, 138, 132, 0.14);
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  gap: 18px;
  width: min(1580px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 18px 42px;
}

.side-nav {
  position: sticky;
  top: 18px;
  align-self: start;
  display: grid;
  gap: 18px;
  padding: 18px;
  min-height: calc(100vh - 36px);
  border-radius: 28px;
}

.side-brand {
  display: grid;
  gap: 4px;
  padding: 8px 8px 16px;
}

.side-brand strong {
  font-size: 32px;
  line-height: 0.95;
  letter-spacing: 0;
}

.side-brand span,
.section-kicker,
.pulse-label,
.pulse-note,
.table-note,
.filter-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.side-nav-list {
  display: grid;
  align-content: start;
  gap: 8px;
}

.side-nav-link {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 800;
}

.side-nav-link.is-active,
.side-nav-link:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--line);
}

.side-nav-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: rgba(90, 113, 136, 0.12);
}

.app-main {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  border-radius: 28px;
  padding: 18px 22px;
  overflow: visible;
  z-index: 10;
}

.brand-mark {
  display: inline-grid;
  gap: 6px;
}

.brand-mark h1 {
  margin: 0;
  font-size: 54px;
  line-height: 0.9;
  letter-spacing: 0;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.1;
  letter-spacing: 0.04em;
}

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

.filter-field {
  display: grid;
  gap: 8px;
  width: min(340px, 100%);
}

.filter-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 8px;
}

select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  color: var(--ink);
  background: var(--field-bg);
  font-weight: 800;
  outline: none;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0 16px;
  color: #fff;
  background: linear-gradient(135deg, #5a7188, #4b6277);
  box-shadow: 0 10px 22px rgba(90, 113, 136, 0.18);
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(90, 113, 136, 0.2);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  box-shadow: none;
}

.icon-button {
  display: grid;
  place-items: center;
  min-width: 46px;
  padding: 0;
}

.secondary-button,
.meta-chip,
.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  box-shadow: none;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.feedback {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(185, 107, 118, 0.2);
  border-left: 4px solid var(--rose);
  border-radius: 16px;
  background: rgba(185, 107, 118, 0.08);
  color: var(--ink);
  font-weight: 800;
}

.workspace-section {
  display: grid;
  gap: 18px;
  padding: 24px;
  border-radius: 28px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.section-heading h2 {
  margin: 0;
  font-size: 32px;
  line-height: 1.04;
  letter-spacing: 0;
}

.section-heading p:not(.section-kicker) {
  margin: 9px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.pulse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.pulse-card {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  min-height: 112px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.pulse-card.is-good {
  border-color: rgba(95, 138, 132, 0.22);
  background: linear-gradient(180deg, rgba(95, 138, 132, 0.13), rgba(255, 255, 255, 0.58));
}

.pulse-card.is-bad {
  border-color: rgba(185, 107, 118, 0.22);
  background: linear-gradient(180deg, rgba(185, 107, 118, 0.12), rgba(255, 255, 255, 0.58));
}

.pulse-value {
  color: var(--ink);
  font-size: 24px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  overflow-wrap: normal;
  white-space: nowrap;
}

.pulse-note {
  letter-spacing: 0;
  text-transform: none;
}

.legend {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  font-size: 13px;
  font-weight: 800;
}

.swatch {
  width: 22px;
  height: 3px;
  border-radius: 999px;
}

.swatch.plan {
  background: var(--blue);
}

.swatch.fact {
  background: var(--amber);
}

.swatch.trajectory {
  background: var(--teal);
}

.chart-root {
  min-width: 0;
}

.chart-panel {
  display: grid;
  gap: 12px;
}

.chart-context {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(95, 138, 132, 0.2);
  border-radius: 18px;
  background: rgba(95, 138, 132, 0.1);
  color: var(--ink);
  font-weight: 800;
}

.chart-actions {
  display: inline-flex;
  gap: 8px;
}

.chart-actions button {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid rgba(95, 138, 132, 0.22);
  background: rgba(255, 255, 255, 0.76);
  color: var(--teal);
  box-shadow: none;
  font-size: 12px;
}

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

.chart-svg {
  display: block;
  width: 100%;
  min-width: 760px;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(247, 249, 252, 0.62)),
    rgba(255, 255, 255, 0.55);
}

.grid-line {
  stroke: rgba(83, 103, 129, 0.12);
}

.axis-label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.line-plan {
  fill: none;
  stroke: var(--blue);
  stroke-width: 3;
}

.line-fact {
  fill: none;
  stroke: var(--amber);
  stroke-width: 3.4;
}

.line-trajectory {
  fill: none;
  stroke: var(--teal);
  stroke-width: 3.4;
  stroke-dasharray: 8 6;
}

.table-root {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 4px;
}

table {
  width: max-content;
  min-width: 1440px;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
  overflow: hidden;
}

th,
td {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  line-height: 1.4;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  border-top: 0;
  background: rgba(248, 250, 252, 0.96);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 380px;
  min-width: 380px;
  max-width: 380px;
  background: inherit;
}

th:first-child {
  z-index: 3;
  background: rgba(248, 250, 252, 0.96);
}

td[data-numeric="true"] {
  min-width: 132px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

tr.row-manager {
  background: rgba(90, 113, 136, 0.08);
  font-weight: 900;
}

tr.row-group {
  background: rgba(255, 255, 255, 0.72);
}

tr.row-sku {
  background: rgba(255, 255, 255, 0.5);
}

tr.is-selected {
  background: rgba(95, 138, 132, 0.14);
}

tr.is-good .delta-cell {
  color: var(--teal);
  font-weight: 900;
}

tr.is-bad .delta-cell {
  color: var(--rose);
  font-weight: 900;
}

.label-meta {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.main-label {
  display: block;
  min-width: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.group-button,
.sku-button {
  width: 100%;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
  text-align: left;
}

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

.group-button:hover,
.sku-button:hover {
  transform: none;
  box-shadow: none;
  color: var(--teal);
}

.group-button[aria-expanded="true"] .chevron {
  transform: rotate(90deg);
}

.chevron {
  display: inline-grid;
  place-items: center;
  color: var(--teal);
  font-size: 20px;
  transition: transform 0.16s ease;
}

.copy-button {
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  box-shadow: none;
}

.sku-cell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 6px;
}

.table-note {
  margin: 0;
  letter-spacing: 0;
  text-transform: none;
}

.empty-state {
  width: 100%;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 22px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

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

  .side-nav {
    position: relative;
    top: auto;
    min-height: auto;
    grid-template-columns: auto 1fr;
    align-items: center;
  }

  .side-nav-list {
    grid-auto-flow: column;
    justify-content: end;
  }

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

@media (max-width: 760px) {
  .app-shell {
    padding: 10px;
  }

  .topbar,
  .section-heading,
  .topbar-actions {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .topbar,
  .workspace-section {
    padding: 18px;
  }

  .filter-field,
  .meta-chip,
  .secondary-button {
    width: 100%;
  }

  .side-nav {
    grid-template-columns: 1fr;
  }

  .side-nav-list {
    grid-auto-flow: row;
  }

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

  .brand-mark h1 {
    font-size: 38px;
  }

  .section-heading h2 {
    font-size: 26px;
  }

  .pulse-value {
    font-size: 28px;
  }
}
