@font-face {
  font-family: "Century Gothic Bold";
  src: url("./fonts/CenturyGothicPaneuropeanBold.ttf") format("truetype");
  font-weight: 100 950;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Century Gothic";
  src: url("./fonts/CenturyGothicPaneuropeanBold.ttf") format("truetype");
  font-weight: 100 950;
  font-style: normal;
  font-display: swap;
}

:root {
  --primary: #0064e0;
  --primary-focus: #1876f2;
  --primary-deep: #0457cb;
  --ink: #1c1e21;
  --ink-deep: #0a1317;
  --muted: #5d6c7b;
  --stone: #8595a4;
  --hairline: #ced0d4;
  --soft-line: #dee3e9;
  --canvas: #ffffff;
  --parchment: #f1f4f7;
  --pearl: #f7f9fc;
  --dark: #0a1317;
  --critical: #e41e3f;
  --success: #31a24c;
  --warning: #f7b928;
  --theme-accent-start: #dbe8f5;
  --theme-accent-mid: #dbe8f5;
  --theme-accent-end: #dbe8f5;
  --theme-accent-solid: #4f7196;
  --theme-accent-neutral: #9fb0bf;
  --theme-action-accent: #28b7c4;
  --theme-check: #2678e5;
  --theme-control-gradient: linear-gradient(90deg, var(--theme-accent-start) 0%, var(--theme-accent-start) 100%);
  --theme-control-gradient-vertical: linear-gradient(180deg, var(--theme-accent-start) 0%, var(--theme-accent-start) 100%);
  --theme-panel-wash: linear-gradient(0deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.98) 100%);
  --theme-workbench-gradient-layer: linear-gradient(0deg, #f5f8fb 0%, #f5f8fb 100%);
  --theme-composer-filled: rgba(79, 113, 150, 0.16);
  --panel-radius: 16px;
  --stage-radius: 32px;
  --control-radius: 12px;
  --nav-radius: 100px;
  --letter-spacing: 0;
  --ui-font: "Century Gothic Bold", "Century Gothic", Arial, "Helvetica Neue", Helvetica, sans-serif;
  --field-block: var(--theme-control-gradient);
  --field-action: var(--theme-action-accent);
  --shadow-soft: 0 10px 30px rgba(28, 30, 33, 0.04);
  --shadow-card: 0 14px 36px rgba(28, 30, 33, 0.045);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--parchment);
  color: var(--ink);
  font-family: var(--ui-font);
  letter-spacing: var(--letter-spacing);
}

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

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 50%;
}

input[type="color"]::-moz-color-swatch {
  border: 0;
  border-radius: 50%;
}

.app-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

body[data-view="data"] .app-shell,
body[data-view="settings"] .app-shell {
  grid-template-columns: 360px minmax(0, 1fr);
}

body[data-view="data"] .inspector,
body[data-view="settings"] .inspector {
  display: none;
}

body[data-view="data"] .output-panel,
body[data-view="settings"] .output-panel {
  display: none;
}

.sidebar,
.inspector {
  background: var(--canvas);
  color: var(--ink);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 100vh;
  height: 100vh;
  overflow: auto;
  overscroll-behavior: contain;
}

.inspector {
  display: none;
}

.sidebar {
  --sidebar-brand-h: clamp(76px, 11.5vh, 104px);
  --sidebar-nav-h: clamp(120px, 21vh, 198px);
  --sidebar-x: clamp(28px, 3.2vw, 46px);
  --sidebar-panel-y: clamp(12px, 2.1vh, 22px);
  --sidebar-control-h: clamp(26px, 3.55vh, 38px);
  --sidebar-label-size: clamp(13px, 1.65vh, 17px);
  --sidebar-heading-size: clamp(19px, 2.35vh, 21px);
  --sidebar-row-gap: clamp(3px, 0.8vh, 10px);
  --sidebar-section-gap: clamp(10px, 2vh, 25px);
  --sidebar-add-type-w: clamp(92px, 7.4vw, 110px);
  border-right: 1px solid var(--soft-line);
  align-self: stretch;
  display: grid;
  grid-template-rows: var(--sidebar-brand-h) var(--sidebar-nav-h) minmax(0, 1fr);
  gap: 0;
  padding: 0;
  background: #fff;
  overflow: hidden;
}

.inspector-content {
  min-height: auto;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: visible;
  overscroll-behavior: contain;
  padding-bottom: 0;
  scroll-padding-bottom: 180px;
}

.brand {
  min-height: 0;
  height: var(--sidebar-brand-h);
  display: flex;
  align-items: center;
  padding: 0 var(--sidebar-x);
  border-bottom: 1px solid var(--soft-line);
}

.brand h1,
.panel h2,
.topbar h2,
.data-preview h3,
.empty-state h3 {
  margin: 0;
}

.brand h1 {
  max-width: 210px;
  display: grid;
  gap: 0;
  font-size: 23px;
  line-height: 0.96;
  font-weight: 900;
  letter-spacing: 0;
  white-space: normal;
}

.brand-line {
  display: block;
  white-space: nowrap;
}

.main-nav {
  display: grid;
  align-content: center;
  gap: clamp(10px, 1.5vh, 14px);
  height: var(--sidebar-nav-h);
  padding: 0 var(--sidebar-x);
  border-bottom: 1px solid var(--soft-line);
}

.nav-item {
  min-height: 26px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  border-radius: 0;
  background: transparent;
  color: #111;
  padding: 0;
  font-size: 21px;
  line-height: 1.05;
  font-weight: 850;
  text-align: left;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: transparent;
  color: var(--primary-deep);
  box-shadow: none;
}

.nav-item.active {
  background: transparent;
  color: #111;
}

.panel {
  background: var(--canvas);
  border: 1px solid var(--soft-line);
  border-radius: var(--panel-radius);
  padding: 24px;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.18s var(--ease-out), background 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out);
}

.panel:hover {
  border-color: var(--hairline);
  box-shadow: 0 12px 34px rgba(28, 30, 33, 0.055);
}

.panel h2 {
  font-size: 19px;
  line-height: 1.35;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 20px;
  letter-spacing: 0;
}

.accordion {
  padding: 0;
  overflow: hidden;
  flex: 0 0 auto;
  border-radius: 24px;
}

.accordion summary {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.44;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

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

.accordion summary::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.18s var(--ease-out);
}

.accordion[open] summary::after {
  transform: rotate(225deg);
}

.accordion > :not(summary) {
  margin-left: 20px;
  margin-right: 20px;
}

.accordion[open] {
  padding-bottom: 20px;
}

.panel label {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.29;
  font-weight: 700;
}

.panel input,
.panel select,
.panel textarea {
  width: 100%;
  border: 1px solid var(--hairline);
  background: #fbfcfe;
  color: var(--ink);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}

.panel input:focus,
.panel select:focus,
.panel textarea:focus {
  border-color: var(--primary-focus);
  box-shadow: 0 0 0 2px rgba(24, 118, 242, 0.16);
}

.panel input,
.panel select {
  min-height: 48px;
}

.title-rule-card {
  display: grid;
  gap: 12px;
  margin: 4px 0 16px;
  padding: 14px;
  border: 1px solid var(--soft-line);
  border-radius: 16px;
  background: #f7f8fa;
}

.title-rule-card strong {
  font-size: 15px;
  line-height: 1.2;
}

.title-rule-card label {
  margin-bottom: 0;
}

.title-rule-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.33;
}

.panel textarea {
  resize: vertical;
  min-height: 78px;
  line-height: 1.47;
}

.dataset-panel {
  padding: 22px;
}

.chart-memory-panel {
  padding: 0;
  overflow: hidden;
}

.chart-memory-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 16px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
  font-weight: 850;
  list-style: none;
  cursor: pointer;
}

.chart-memory-panel summary::-webkit-details-marker {
  display: none;
}

.chart-memory-panel summary::after {
  content: "⌄";
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  transition: transform 0.18s var(--ease-out);
}

.chart-memory-panel[open] summary::after {
  transform: rotate(180deg);
}

.chart-memory-body {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.chart-memory-panel select {
  min-height: 40px;
  padding: 9px 34px 9px 12px;
  border-radius: 12px;
  font-size: 13px;
}

.chart-memory-meta {
  min-height: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  font-weight: 700;
}

.chart-memory-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.chart-memory-actions .secondary-btn {
  min-height: 34px;
  margin: 0;
  padding: 0 10px;
  border-width: 1.5px;
  font-size: 11px;
}

.chart-memory-actions .primary-memory-btn {
  border-color: var(--primary);
  color: var(--primary);
}

.chart-memory-delete {
  width: max-content;
  min-height: auto;
  justify-self: start;
  margin-top: -4px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-size: 11px;
}

.chart-memory-delete:hover {
  background: transparent;
  color: #b91c1c;
}

#fileInput,
#composerFileInput {
  display: none;
}

button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 100px;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  cursor: pointer;
  transition: background 0.16s var(--ease-out), border-color 0.16s var(--ease-out);
}

button:hover {
  background: var(--primary-deep);
  box-shadow: none;
}

button:active {
  transform: none;
}

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

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.secondary-btn {
  background: var(--canvas);
  color: var(--ink-deep);
  border: 2px solid rgba(10, 19, 23, 0.12);
  border-radius: var(--control-radius);
  margin-top: 8px;
}

.secondary-btn:hover,
.icon-btn:hover,
.chart-list-item:hover {
  background: var(--parchment);
  box-shadow: none;
}

.mapping-result {
  margin-top: 12px;
  border-top: 1px solid var(--soft-line);
  padding-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.mapping-result b {
  color: var(--ink);
  font-weight: 700;
}

.mapping-editor {
  display: grid;
  gap: 10px;
}

.field-mapping-panel .mapping-editor:empty {
  display: none;
}

.field-mapping-panel {
  --field-mapping-action-h: clamp(52px, 7vh, 72px);
  --field-mapping-action-gap: clamp(16px, 2.4vh, 28px);
  --field-mapping-action-x: var(--sidebar-x);
  --sidebar-field-control-h: clamp(30px, 3.65vh, 38px);
  --sidebar-field-label-gap: clamp(5px, 0.72vh, 8px);
  --sidebar-field-row-h: calc(var(--sidebar-label-size) * 1.1 + var(--sidebar-field-label-gap) + var(--sidebar-field-control-h));
  --sidebar-field-section-gap: clamp(18px, 2.5vh, 28px);
  --sidebar-action-slot-w: var(--sidebar-field-control-h);
  --sidebar-action-gap: clamp(8px, 1vw, 12px);
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: clamp(8px, 1.35vh, 14px);
  flex: 1 1 auto;
  margin: 0;
  padding: var(--sidebar-panel-y) var(--sidebar-x) calc(var(--field-mapping-action-h) + var(--field-mapping-action-gap) + clamp(10px, 1.8vh, 18px));
  border: 0;
  border-radius: 0;
  box-shadow: none;
  position: relative;
  overflow: hidden;
}

.field-mapping-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0;
}

.field-mapping-heading h2 {
  margin: 0;
  color: #050505;
  font-size: var(--sidebar-heading-size);
  line-height: 1.08;
  font-weight: 900;
  letter-spacing: 0;
}

.field-mapping-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}

.field-mapping-heading .secondary-btn {
  width: auto;
  min-height: var(--sidebar-control-h);
  margin-top: 0;
  border: 0;
  border-radius: 0;
  background: var(--field-action);
  color: #061416;
  padding: 0 9px;
  font-size: 14px;
  line-height: 1;
  font-weight: 900;
  white-space: nowrap;
}

.field-mapping-panel .mapping-result {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.field-mapping-panel .helper-text {
  display: none;
}

.field-chart-config-panel {
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field-split-block .field-chart-config-panel {
  margin-top: var(--sidebar-field-section-gap);
}

.field-chart-config-panel h3 {
  min-height: calc(var(--sidebar-heading-size) * 1.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  color: #050505;
  font-size: var(--sidebar-heading-size);
  line-height: 1.08;
  font-weight: 900;
}

.field-chart-config-grid {
  display: grid;
  gap: var(--sidebar-row-gap);
  margin-top: var(--sidebar-field-label-gap);
}

.field-chart-config-grid label,
.field-chart-config-grid .chart-field-row {
  width: 100%;
  min-height: var(--sidebar-field-row-h);
  display: grid;
  grid-template-rows: calc(var(--sidebar-label-size) * 1.1) var(--sidebar-field-control-h);
  gap: var(--sidebar-field-label-gap);
  margin: 0;
  color: #050505;
  font-size: var(--sidebar-label-size);
  line-height: 1.08;
  font-weight: 850;
}

.field-chart-config-grid input,
.field-chart-config-grid select {
  width: 100%;
  height: var(--sidebar-field-control-h);
  min-height: var(--sidebar-field-control-h);
  border: 0;
  border-radius: 0;
  background: var(--field-block);
  color: #07111f;
  padding: 0 12px;
  font-size: var(--sidebar-label-size);
  line-height: 1;
  font-weight: 900;
}

.field-chart-config-grid > label > input,
.field-chart-config-grid > label > select {
  width: calc(100% - var(--sidebar-action-slot-w) - var(--sidebar-action-gap));
}

.field-chart-config-grid .chart-field-control-row select,
.field-chart-config-grid .chart-field-control-row input {
  width: 100%;
}

.field-chart-config-grid .overall-yoy-calculation-editor:empty {
  display: none;
}

.field-chart-config-grid .overall-yoy-calculation-editor .mapping-result {
  display: none;
}

.field-chart-config-grid .overall-yoy-calculation-editor .chart-recipe-section-yoy {
  background: transparent;
}

.field-chart-config-grid .overall-yoy-calculation-editor .chart-recipe-grid {
  gap: var(--sidebar-row-gap);
}

.chart-group-builder {
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  gap: clamp(9px, 1.25vh, 15px);
  min-height: 0;
  overflow: visible;
}

.field-split-block {
  min-height: 0;
  display: block;
  flex: 0 0 auto;
  margin-top: 0;
  padding-right: 0;
  padding-top: 0;
  padding-bottom: calc(var(--field-mapping-action-h) + var(--field-mapping-action-gap) + clamp(28px, 5vh, 56px));
  border-top: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.field-mapping-actions {
  position: absolute;
  right: var(--field-mapping-action-x);
  bottom: clamp(10px, 1.8vh, 18px);
  left: var(--field-mapping-action-x);
  z-index: 3;
  min-height: var(--field-mapping-action-h);
  display: grid;
  align-items: end;
  justify-items: start;
  padding-top: var(--field-mapping-action-gap);
  background: #fff;
}

.field-mapping-panel #applyMappingBtn {
  justify-self: start;
  align-self: end;
  width: auto;
  min-height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #050505;
  font-size: clamp(24px, 3.35vh, 29px);
  line-height: 1.06;
  font-weight: 900;
  letter-spacing: 0;
}

.field-mapping-panel #applyMappingBtn:hover {
  background: transparent;
  color: var(--primary-deep);
  box-shadow: none;
}

.field-split-block::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.field-split-block h3 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: var(--sidebar-heading-size);
  line-height: 1.08;
  font-weight: 900;
}

.dataset-manager {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--soft-line);
}

.dataset-manager label {
  margin-bottom: 0;
}

.inline-period-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--soft-line);
}

.inline-period-panel summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.3;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.dataset-manager .chart-memory-panel {
  overflow: visible;
}

.dataset-manager .chart-memory-panel summary {
  min-height: 38px;
  padding: 0;
  font-size: 15px;
  font-weight: 800;
}

.dataset-manager .chart-memory-panel .chart-memory-body {
  padding: 0 0 10px;
}

.dataset-manager .chart-memory-panel select {
  min-height: 38px;
}

.inline-period-panel summary::-webkit-details-marker {
  display: none;
}

.inline-period-panel summary::after {
  content: "⌄";
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  transition: transform 0.18s var(--ease-out);
}

.inline-period-panel[open] summary::after {
  transform: rotate(180deg);
}

.inline-period-panel[open] summary {
  margin-bottom: 12px;
}

.inline-period-panel .period-range-bars {
  gap: 8px;
}

.inline-period-panel .period-select-row {
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  min-height: 34px;
  gap: 8px;
}

.inline-period-panel .period-type-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  cursor: pointer;
  user-select: none;
}

.inline-period-panel .period-type-toggle input {
  width: 13px;
  height: 13px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--primary);
}

.inline-period-panel .period-select-row b {
  font-size: 12px;
  line-height: 1;
}

.inline-period-panel .period-select-row.is-disabled {
  opacity: 0.5;
}

.inline-period-panel .period-select-row.is-disabled select {
  cursor: not-allowed;
  background-color: #f4f6f8;
}

.inline-period-panel .period-select-pair {
  grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr);
  gap: 4px;
}

.inline-period-panel .period-select-pair span {
  font-size: 11px;
}

.inline-period-panel select {
  appearance: none;
  -webkit-appearance: none;
  background-image: none;
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 8px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 750;
  text-overflow: ellipsis;
}

.inline-period-panel select::-ms-expand {
  display: none;
}

.inline-period-panel .helper-text {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.35;
}

.inline-period-panel .button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.inline-period-panel .secondary-btn {
  min-height: 36px;
  margin: 0;
  padding: 0 10px;
  border-width: 1.5px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.15;
}

.text-btn.danger {
  color: var(--critical);
}

.text-btn.danger:disabled {
  color: var(--stone);
  cursor: not-allowed;
}

.chart-group-builder label {
  margin-bottom: 0;
}

.chart-type-fieldset {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--panel);
}

.chart-type-fieldset > strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.chart-type-options {
  display: grid;
  gap: 8px;
}

.chart-type-option {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  background: var(--canvas);
  cursor: pointer;
}

.chart-type-option span {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-recipe-section strong {
  color: #050505;
  font-size: var(--sidebar-heading-size);
  line-height: 1.08;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: none;
}

.chart-recipes {
  display: grid;
  gap: 0;
  min-height: 0;
  overflow: visible;
}

.mapping-switcher {
  display: grid;
  gap: 5px;
  padding: 0;
}

.mapping-type-row {
  width: 100%;
  display: grid;
  gap: clamp(2px, 0.45vh, 4px);
}

.field-mapping-panel .mapping-type-row {
  gap: var(--sidebar-field-label-gap);
}

.mapping-type-head {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px;
}

.mapping-type-row label,
.mapping-type-head > label {
  margin: 0;
  color: #050505;
  font-size: var(--sidebar-label-size);
  line-height: 1.05;
  font-weight: 850;
}

.mapping-type-control {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-action-slot-w, var(--sidebar-add-type-w));
  align-items: stretch;
  gap: var(--sidebar-action-gap, clamp(8px, 1vw, 12px));
}

.mapping-add-type-slot {
  display: contents;
}

.mapping-switcher-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  gap: 8px;
}

.mapping-switcher small {
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mapping-switcher-meta {
  display: none;
  align-items: center;
  justify-content: flex-end;
  min-height: calc(var(--sidebar-label-size) * 1.1);
}

.mapping-switcher-meta:has([data-recipe-remove]) {
  display: flex;
}

.mapping-switcher select {
  width: 100%;
  display: block;
  overflow: hidden;
  height: var(--sidebar-control-h);
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: var(--field-block);
  color: var(--ink);
  padding: 0 10px;
  font-size: clamp(12px, 1.55vh, 16px);
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-mapping-panel .mapping-switcher select {
  height: var(--sidebar-field-control-h);
  min-height: var(--sidebar-field-control-h);
}

.chart-field-control-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-action-slot-w, var(--sidebar-add-type-w));
  align-items: stretch;
  gap: var(--sidebar-action-gap, clamp(8px, 1vw, 12px));
}

.chart-field-control-row select,
.chart-field-control-row input {
  width: 100%;
}

.chart-field-action-slot {
  display: grid;
  place-items: center;
  min-width: 0;
}

.field-add-btn {
  position: relative;
  width: var(--sidebar-action-slot-w, var(--sidebar-field-control-h));
  min-width: var(--sidebar-action-slot-w, var(--sidebar-field-control-h));
  height: var(--sidebar-field-control-h);
  min-height: var(--sidebar-field-control-h);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--field-action);
  font-size: clamp(24px, 3vh, 32px);
  line-height: 1;
  font-weight: 900;
  box-shadow: none;
}

.field-add-btn:hover {
  background: transparent;
  color: var(--field-action);
  box-shadow: none;
}

.recipe-count {
  align-self: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.05;
  white-space: nowrap;
}

.mapping-remove-btn {
  width: auto;
  min-height: auto;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--critical);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.05;
  white-space: nowrap;
}

.mapping-remove-btn:hover {
  background: transparent;
  box-shadow: none;
}

.chart-recipe-card {
  display: grid;
  grid-template-rows: auto;
  align-content: start;
  gap: clamp(13px, 1.8vh, 20px);
  height: auto;
  min-height: 0;
  overflow: visible;
}

.field-mapping-panel .chart-recipe-card {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  gap: var(--sidebar-field-section-gap);
  min-height: max-content;
}

.chart-recipe-section {
  display: grid;
  gap: clamp(7px, 1.1vh, 11px);
  min-height: 0;
}

.field-mapping-panel .chart-group-builder,
.field-mapping-panel .chart-recipes,
.field-mapping-panel .chart-recipe-section,
.field-mapping-panel .chart-recipe-grid,
.field-mapping-panel .chart-field-row {
  align-self: stretch;
  min-height: max-content;
}

.field-mapping-panel .chart-recipe-section,
.field-mapping-panel .chart-field-row {
  flex: 0 0 auto;
}

.overall-yoy-calculation-editor .chart-recipe-section-yoy {
  position: relative;
  z-index: 1;
  margin-top: 0;
  padding-top: 0;
  background: #fff;
}

.field-mapping-panel .chart-recipe-section-split {
  margin-top: 0;
}

.chart-recipe-section-split summary strong {
  display: block;
  width: 100%;
  min-height: 1.08em;
  color: #050505;
  font-size: var(--sidebar-heading-size);
  line-height: 1.08;
  font-weight: 900;
  letter-spacing: 0;
}

.chart-recipe-section-split {
  align-content: start;
}

.chart-recipe-section-split summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  list-style: none;
  cursor: pointer;
}

.chart-recipe-section-split summary::-webkit-details-marker {
  display: none;
}

.chart-recipe-section-split summary::after {
  content: "⌄";
  color: #050505;
  font-size: 15px;
  line-height: 1;
  font-weight: 900;
  transform: rotate(0deg);
}

.chart-recipe-section-split:not([open]) summary::after {
  transform: rotate(-90deg);
}

.chart-recipe-section-split:not([open]) {
  gap: 0;
}

.chart-recipe-grid {
  display: grid;
  gap: var(--sidebar-row-gap);
}

.field-mapping-panel .chart-recipe-grid {
  gap: clamp(10px, 1.45vh, 16px);
}

.chart-recipe-grid label {
  display: grid;
  gap: clamp(2px, 0.45vh, 4px);
  margin: 0;
  color: #050505;
  font-size: var(--sidebar-label-size);
  line-height: 1.05;
  font-weight: 850;
}

.field-mapping-panel .chart-recipe-grid label {
  min-height: var(--sidebar-field-row-h);
  gap: var(--sidebar-field-label-gap);
  align-content: start;
}

.chart-recipe-grid .chart-field-row {
  min-width: 0;
}

.field-mapping-panel .chart-recipe-grid .chart-field-row {
  display: grid;
  grid-template-rows: calc(var(--sidebar-label-size) * 1.1) var(--sidebar-field-control-h);
  align-items: start;
}

.chart-field-label {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #050505;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-recipe-card input[type="text"],
.chart-recipe-card select {
  width: 100%;
  display: block;
  overflow: hidden;
  border: 0;
  background: var(--field-block);
  color: var(--ink);
  border-radius: 0;
  height: var(--sidebar-control-h);
  min-height: 0;
  padding: 0 10px;
  font-size: clamp(12px, 1.55vh, 16px);
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-mapping-panel .chart-recipe-card input[type="text"],
.field-mapping-panel .chart-recipe-card select {
  height: var(--sidebar-field-control-h);
  min-height: var(--sidebar-field-control-h);
}

.field-mapping-panel .mapping-switcher select,
.field-mapping-panel .chart-recipe-card select {
  min-width: 0;
  max-width: 100%;
  appearance: none;
  padding-right: 26px;
  background-image:
    linear-gradient(45deg, transparent 50%, #050505 50%),
    linear-gradient(135deg, #050505 50%, transparent 50%);
  background-position:
    calc(100% - 15px) 50%,
    calc(100% - 10px) 50%;
  background-repeat: no-repeat;
  background-size: 5px 5px;
}

.field-mapping-panel select:disabled {
  opacity: 1;
  background: var(--field-block);
  color: #050505;
  -webkit-text-fill-color: #050505;
}

.secondary-btn.compact {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 12px;
}

.secondary-btn.compact.in-type-row {
  width: 100%;
  height: var(--sidebar-control-h);
  min-height: 0;
  margin: 0;
  padding: 0 6px;
  border: 0;
  border-radius: 0;
  background: var(--field-action);
  color: #061416;
  font-size: 14px;
  line-height: 1;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.field-mapping-panel .secondary-btn.compact.in-type-row {
  height: var(--sidebar-field-control-h);
  min-height: var(--sidebar-field-control-h);
}

.mapping-row {
  display: grid;
  gap: 6px;
}

.mapping-row label {
  margin: 0;
}

.mapping-row .field-name {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.mapping-row.required .field-name::after {
  content: " *";
  color: var(--primary);
}

.mapping-row select {
  width: 100%;
  border: 1px solid var(--hairline);
  background: var(--canvas);
  color: var(--ink);
  border-radius: 8px;
  min-height: 44px;
  padding: 9px 12px;
}

.chart-list {
  display: grid;
  gap: 8px;
}

.chart-list-item {
  width: 100%;
  min-height: 54px;
  display: grid;
  justify-items: start;
  align-content: center;
  gap: 4px;
  border-radius: 16px;
  border: 1px solid var(--soft-line);
  background: var(--pearl);
  color: var(--ink);
  padding: 10px 12px;
  text-align: left;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}

.chart-list-item:hover {
  transform: none;
}

.chart-list-item.active {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 1px var(--primary);
}

.chart-list-item span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
}

.chart-list-item small {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.color-editor {
  display: grid;
  gap: 10px;
}

.series-order-tools {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  flex-direction: column;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  padding: 8px 10px;
  border: 1px dashed var(--soft-line);
  border-radius: 14px;
  background: var(--pearl);
}

.series-order-tools span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.series-order-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.series-order-tools .icon-btn {
  grid-column: 1 / -1;
  flex: 0 0 auto;
  min-height: 30px;
  width: 100%;
  max-width: none;
  padding: 0 10px;
  background: var(--ink-deep);
  border-color: var(--ink-deep);
  color: var(--canvas);
  font-size: 12px;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.ghost-mini-btn {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--soft-line);
  border-radius: 999px;
  background: var(--canvas);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.ghost-mini-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(0, 100, 224, 0.06);
}

.color-row,
.series-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 38px;
}

.series-row {
  grid-template-columns: 28px 34px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 8px;
  min-height: 76px;
  padding: 10px 12px;
  border: 1px solid var(--soft-line);
  border-radius: 14px;
  background: var(--canvas);
  overflow: hidden;
  transition: background 0.18s var(--ease-out), border-color 0.18s var(--ease-out), transform 0.18s var(--ease-out);
}

.series-row:hover {
  background: rgba(0, 100, 224, 0.06);
}

.series-row.dragging {
  opacity: 0.58;
  transform: scale(0.99);
}

.series-row.drop-before {
  border-top-color: var(--primary);
  box-shadow: inset 0 3px 0 var(--primary);
}

.series-row.drop-after {
  border-bottom-color: var(--primary);
  box-shadow: inset 0 -3px 0 var(--primary);
}

.drag-handle {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: stretch;
  width: 24px;
  min-height: 0;
  padding: 0;
  border-radius: 14px;
  background: var(--pearl);
  color: transparent;
  border: 1px solid var(--soft-line);
  cursor: grab;
  position: relative;
}

.drag-handle::before {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--stone);
  box-shadow: 0 -8px 0 var(--stone), 0 8px 0 var(--stone), 7px -8px 0 var(--stone), 7px 0 0 var(--stone), 7px 8px 0 var(--stone);
  transform: translate(-6px, -2px);
}

.drag-handle:active {
  cursor: grabbing;
}

.color-row input[type="color"],
.series-row input[type="color"] {
  grid-column: 2;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 9999px;
  overflow: hidden;
  background: transparent;
  border: 2px solid var(--canvas);
  box-shadow: 0 0 0 1px var(--hairline);
}

.color-swatch-button {
  width: 42px;
  height: 42px;
  min-height: 42px;
  flex: 0 0 auto;
  padding: 0;
  border: 4px solid #fff;
  border-radius: 50%;
  background:
    linear-gradient(var(--swatch-color, #4e3dd6), var(--swatch-color, #4e3dd6)),
    linear-gradient(45deg, #d8dee6 25%, transparent 25%),
    linear-gradient(-45deg, #d8dee6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d8dee6 75%),
    linear-gradient(-45deg, transparent 75%, #d8dee6 75%);
  background-color: #fff;
  background-position: 0 0, 0 0, 0 6px, 6px -6px, -6px 0;
  background-size: auto, 12px 12px, 12px 12px, 12px 12px, 12px 12px;
  box-shadow: 0 0 0 1px var(--hairline), 0 8px 18px rgba(28, 30, 33, 0.08);
  cursor: pointer;
  overflow: hidden;
}

.color-swatch {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background:
    linear-gradient(var(--swatch-color), var(--swatch-color)),
    linear-gradient(45deg, #d8dee6 25%, transparent 25%),
    linear-gradient(-45deg, #d8dee6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d8dee6 75%),
    linear-gradient(-45deg, transparent 75%, #d8dee6 75%);
  background-color: #fff;
  background-position: 0 0, 0 0, 0 6px, 6px -6px, -6px 0;
  background-size: auto, 12px 12px, 12px 12px, 12px 12px, 12px 12px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  flex: 0 0 auto;
  overflow: hidden;
}

.color-swatch-button:hover {
  box-shadow: 0 0 0 2px var(--primary-focus), 0 8px 18px rgba(28, 30, 33, 0.1);
}

.color-swatch-button:focus-visible {
  outline: 2px solid var(--primary-focus);
  outline-offset: 3px;
}

.series-row .series-swatch {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  border-width: 3px;
}

.color-rule-form .color-swatch-button {
  width: 38px;
  height: 38px;
  min-height: 38px;
}

.color-row span,
.series-row span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.series-row-main {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.series-row-main span {
  min-width: 0;
}

.series-row-controls {
  grid-column: 3;
  grid-row: 2;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  min-width: 0;
  overflow: visible;
}

.mini-check {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px !important;
  margin: 0 !important;
  color: var(--muted) !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  white-space: nowrap;
}

.mini-check input {
  flex: 0 0 auto;
  width: 16px;
  min-height: 16px;
  height: 16px;
  accent-color: var(--primary);
}

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

.button-row .secondary-btn {
  margin-top: 0;
  min-height: 38px;
  padding: 0 10px;
  font-size: 13px;
}

.helper-text {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.color-rule-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px;
  background: #f7f9fc;
  border: 1px solid var(--soft-line);
  border-radius: 14px;
}

.color-rule-form input {
  margin: 0;
  min-height: 42px;
  border-radius: 12px;
}

.color-rule-form input[type="color"] {
  width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
  background: transparent;
  border: 4px solid #fff;
  box-shadow: 0 0 0 1px var(--hairline), 0 8px 18px rgba(28, 30, 33, 0.08);
}

.color-rule-form input[type="hidden"] {
  display: none;
}

.color-rule-form .secondary-btn {
  margin-top: 0;
  min-width: 78px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
}

.text-library-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px;
  background: #f7f9fc;
  border: 1px solid var(--soft-line);
  border-radius: 14px;
}

.text-library-form.stacked {
  grid-template-columns: minmax(0, 1fr);
}

.text-library-form input,
.text-library-form textarea {
  margin: 0;
  border-radius: 12px;
}

.text-library-form .secondary-btn {
  margin-top: 0;
  min-width: 78px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
}

.color-rule-form .secondary-btn:hover,
.text-library-form .secondary-btn:hover {
  background: var(--primary-deep);
  border-color: var(--primary-deep);
  color: #fff;
}

.color-library-editor {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.library-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 8px 10px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: #fbfcfe;
  box-shadow: none;
  transition: border-color 0.18s var(--ease-out), background 0.18s var(--ease-out), transform 0.18s var(--ease-out);
  cursor: grab;
}

.library-row:hover {
  background: #fff;
  border-color: var(--hairline);
  transform: translateY(-1px);
}

.library-row.dragging {
  opacity: 0.58;
}

.library-row.drop-before {
  border-top-color: var(--primary);
  box-shadow: inset 0 3px 0 var(--primary), 0 6px 18px rgba(28, 30, 33, 0.025);
}

.library-row.drop-after {
  border-bottom-color: var(--primary);
  box-shadow: inset 0 -3px 0 var(--primary), 0 6px 18px rgba(28, 30, 33, 0.025);
}

.library-token {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.library-row input[type="color"] {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 50%;
  overflow: hidden;
  background: transparent;
  border: 4px solid #fff;
  box-shadow: 0 0 0 1px var(--hairline), 0 6px 14px rgba(28, 30, 33, 0.08);
}

.library-row input[type="color"]:disabled {
  opacity: 0.92;
}

.library-row .library-swatch {
  width: 34px;
  height: 34px;
  min-height: 34px;
}

.library-row span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  line-height: 1.33;
  font-weight: 700;
}

.library-row small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.33;
  margin-top: 2px;
}

.color-source-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 22px;
  padding: 0 9px;
  border: 1px solid rgba(93, 108, 123, 0.18);
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.color-source-tag.auto {
  border-color: rgba(0, 100, 224, 0.16);
  background: #eef5ff;
  color: #2f6fbf;
}

.color-source-tag.library,
.color-source-tag.built-in {
  background: #f7f9fc;
  color: var(--muted);
}

.color-source-tag.custom {
  border-color: rgba(78, 61, 214, 0.2);
  background: #f2efff;
  color: #4e3dd6;
}

.series-row .color-source-tag {
  grid-column: auto;
}

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

.text-library-editor {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
  padding-right: 4px;
}

.text-library-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px 10px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: #fbfcfe;
  box-shadow: none;
}

.text-library-row span {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
}

.text-library-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.library-select-label {
  margin-top: -2px;
}

.icon-btn {
  width: auto;
  min-height: 32px;
  border-radius: 100px;
  padding: 0 12px;
  background: var(--canvas);
  color: var(--primary);
  border: 1px solid var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.icon-btn.danger {
  color: var(--critical);
  border-color: rgba(228, 30, 63, 0.38);
  background: #fff7f9;
}

.icon-btn.danger:hover {
  background: #fff0f3;
  border-color: var(--critical);
}

.icon-btn:disabled {
  color: var(--stone);
  border-color: var(--soft-line);
  background: var(--pearl);
}

.workspace {
  min-width: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: 104px minmax(360px, 1fr) 250px;
  overflow: hidden;
  background: #fff;
  overscroll-behavior: contain;
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

body[data-view="settings"] .workspace {
  background: var(--parchment);
}

.view-panel[data-view="settings"] .data-preview {
  max-width: none;
  width: 100%;
  padding: 28px;
  border-radius: var(--stage-radius);
  box-shadow: var(--shadow-card);
}

.view-panel[data-view="settings"] .section-title {
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(222, 227, 233, 0.88);
}

.view-panel[data-view="settings"] .section-title h3 {
  font-size: 24px;
  line-height: 1.25;
  font-weight: 800;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 104px;
  padding: 0 28px 0 50px;
  margin: 0;
  border-bottom: 1px solid var(--soft-line);
  background: #fff;
}

.workspace-heading {
  display: none;
}

.function-tabs {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: clamp(11px, 1vw, 18px);
  overflow-x: auto;
  scrollbar-width: none;
}

.function-tabs::-webkit-scrollbar {
  display: none;
}

.function-tab {
  width: auto;
  min-height: 44px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #111;
  font-size: 16px;
  line-height: 1;
  font-weight: 850;
  white-space: nowrap;
}

.function-tab:hover {
  background: transparent;
  color: var(--primary-deep);
}

.function-tab.active {
  color: #111;
  box-shadow: inset 0 -3px 0 #111;
}

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

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--soft-line);
  border-radius: 999px;
  background: var(--canvas);
  color: var(--charcoal, #444950);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.language-switch span {
  display: none;
}

.language-switch select {
  width: 112px;
  min-height: 34px;
  margin: 0;
  padding: 6px 32px 6px 12px;
  border-radius: 999px;
  background-color: var(--pearl);
  font-size: 13px;
}

.tour-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  inline-size: auto;
  max-width: max-content;
  flex: 0 0 auto;
  min-height: 34px;
  margin: 0;
  padding: 5px 8px 5px 6px;
  border: 1px solid var(--soft-line);
  border-radius: 999px;
  background: var(--canvas);
  color: var(--charcoal, #444950);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.04);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.tour-button b {
  display: none;
}

.tour-button span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #061416;
  color: white;
  font-size: 12px;
  line-height: 1;
}

.tour-button:hover,
.tour-button:focus-visible {
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  text-transform: none;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0;
}

.topbar h2 {
  font-size: 48px;
  line-height: 1.17;
  font-weight: 500;
  letter-spacing: 0;
}

.data-source-workbench {
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(0, 1.4fr);
  gap: 20px;
  margin-bottom: 24px;
}

.main-upload-zone {
  min-height: 190px;
  display: grid;
  align-content: center;
  gap: 12px;
  margin: 0;
  padding: 28px;
  border: 1.5px dashed #9fb2c5;
  border-radius: 32px;
  background: var(--canvas);
  cursor: pointer;
}

.main-upload-zone span {
  color: var(--ink);
  font-size: 28px;
  line-height: 1.2;
  font-weight: 800;
}

.main-upload-zone small {
  max-width: 520px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 700;
}

.main-upload-zone.drag-over {
  border-color: var(--primary);
  background: rgba(0, 100, 224, 0.06);
}

.data-source-detail {
  padding: 24px;
}

.dataset-library-panel {
  grid-column: 1 / -1;
  min-height: 190px;
  background: var(--canvas);
  border: 1px solid var(--soft-line);
  border-radius: 32px;
  padding: 24px;
}

.dataset-library {
  display: grid;
  gap: 10px;
}

.dataset-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--soft-line);
  border-radius: 18px;
  background: var(--pearl);
  padding: 14px;
}

.dataset-row.active {
  border-color: var(--primary);
  background: rgba(0, 100, 224, 0.05);
}

.dataset-row strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.dataset-row span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 700;
}

.dataset-row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  max-width: 288px;
}

.dataset-row-actions .secondary-btn,
.dataset-row-actions .text-btn {
  width: 86px;
  height: 40px;
  min-height: 40px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  margin: 0;
  border: 2px solid rgba(10, 19, 23, 0.12);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.dataset-row-actions .secondary-btn {
  background: var(--canvas);
  color: var(--ink);
}

.dataset-row-actions .text-btn {
  background: var(--canvas);
  color: var(--critical);
}

.dataset-row-actions .text-btn:hover {
  background: rgba(228, 30, 63, 0.08);
  box-shadow: none;
}

.compact-table {
  max-height: 460px;
  overflow: auto;
}

.status {
  border: 1px solid var(--soft-line);
  background: var(--canvas);
  border-radius: 100px;
  padding: 10px 16px;
  color: var(--charcoal, #444950);
  font-size: 14px;
  font-weight: 700;
  max-width: 152px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}

.status.loading {
  border-color: rgba(0, 100, 224, 0.3);
  background: rgba(0, 100, 224, 0.08);
  color: var(--primary);
  box-shadow: none;
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.3fr) minmax(520px, 0.7fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
  max-width: 100%;
}

.summary-grid article {
  background: var(--canvas);
  border: 1px solid var(--soft-line);
  border-radius: var(--stage-radius);
  min-height: 158px;
  padding: 22px 24px;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}

.summary-grid article:hover {
  transform: none;
  border-color: var(--hairline);
  box-shadow: none;
}

.summary-grid article > span {
  display: block;
  color: var(--slate);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}

.summary-grid strong {
  display: grid;
  gap: 4px;
  min-width: 0;
  font-size: inherit;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.kpi-yoy-value {
  display: block;
  color: var(--ink);
  font-size: clamp(36px, 3vw, 44px);
  line-height: 1;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.kpi-subtitle {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.driver-card-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.driver-card-subtitle {
  color: var(--slate);
  font-size: 15px;
  line-height: 1.25;
  font-weight: 800;
}

.driver-card-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--slate) 10%, white);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
}

.driver-card-badge.up {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 10%, white);
}

.driver-card-badge.down {
  color: var(--critical);
  background: color-mix(in srgb, var(--critical) 10%, white);
}

.kpi-delta {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 700;
  transition: color 0.22s var(--ease-out);
}

.kpi-delta-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--slate) 9%, white);
  color: inherit;
  font-size: 14px;
  line-height: 1;
  font-weight: 800;
}

.kpi-delta-line.up {
  background: color-mix(in srgb, var(--success) 10%, white);
  color: var(--success);
}

.kpi-delta-line.down {
  background: color-mix(in srgb, var(--critical) 10%, white);
  color: var(--critical);
}

.kpi-delta-line strong {
  font-size: 15px;
  font-weight: 900;
}

.trend-arrow {
  font-size: 13px;
  line-height: 1;
}

.kpi-previous {
  display: block;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.driver-list {
  display: grid;
  gap: 12px;
  color: var(--ink);
}

.driver-row {
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr) auto;
  grid-template-rows: auto 5px;
  column-gap: 14px;
  row-gap: 10px;
  align-items: center;
  min-height: 68px;
  padding: 12px 14px;
  border: 1px solid var(--soft-line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff 0%, color-mix(in srgb, var(--surface) 62%, white) 100%);
}

.driver-row:hover {
  border-color: color-mix(in srgb, var(--driver-color, var(--primary)) 28%, var(--soft-line));
  background: color-mix(in srgb, var(--driver-color, var(--primary)) 5%, white);
}

.driver-accent {
  grid-row: 1 / 3;
  width: 6px;
  height: 38px;
  margin: 0;
  border-radius: 999px;
  background: var(--driver-color, var(--hairline));
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.driver-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.driver-metric {
  display: grid;
  gap: 3px;
  min-width: 178px;
  margin: 0;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.driver-impact-main {
  font-size: 24px;
  line-height: 1;
  font-weight: 900;
}

.driver-metric.up .driver-impact-main {
  color: var(--success);
}

.driver-metric.down .driver-impact-main {
  color: var(--critical);
}

.driver-metric.flat .driver-impact-main {
  color: var(--muted);
}

.driver-share {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.driver-progress {
  grid-column: 2 / 4;
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--driver-color, var(--primary)) 10%, white);
}

.driver-progress i {
  display: block;
  width: var(--driver-share, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--driver-color, var(--primary));
}

.kpi-delta.up {
  color: var(--success);
}

.kpi-delta.down {
  color: var(--critical);
}

.kpi-delta.flat,
.kpi-delta.muted {
  color: var(--muted);
}

.chart-gallery-section,
.chart-stage,
.data-preview {
  background: var(--canvas);
  border: 1px solid var(--soft-line);
  border-radius: var(--stage-radius);
}

.combine-workbench {
  display: grid;
  gap: 14px;
  background: var(--canvas);
  border: 1px solid var(--soft-line);
  border-radius: 28px;
  padding: 20px;
}

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

.combine-header strong {
  font-size: 18px;
  line-height: 1.2;
}

.combine-header span {
  max-width: 520px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-align: right;
}

.composer-upload-zone {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border: 1.5px dashed #9fb2c5;
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
}

.composer-upload-zone.drag-over {
  border-color: var(--primary);
  background: rgba(0, 100, 224, 0.06);
}

.composer-upload-zone span {
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
}

.composer-upload-zone small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.combine-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.combine-slot {
  width: 100%;
  min-height: 76px;
  padding: 14px;
  border: 1px dashed var(--hairline);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.combine-slot:hover {
  background: #fff;
  border-color: var(--primary);
}

.combine-slot.filled {
  border-style: solid;
  border-color: color-mix(in srgb, var(--primary) 42%, var(--soft-line));
  background: color-mix(in srgb, var(--primary) 6%, white);
}

.combine-slot b {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
}

.combine-slot span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.combine-slot small {
  display: block;
  margin-top: 8px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
}

.composer-action-btn {
  min-height: 44px;
  border-radius: 16px;
}

.period-range-bars {
  display: grid;
  gap: 10px;
}

.period-select-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 38px;
}

.period-select-row b {
  font-size: 13px;
  white-space: nowrap;
}

.period-select-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.period-select-pair span {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.period-range-card {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--soft-line);
  background: #fff;
}

.period-range-card.is-disabled {
  opacity: 0.54;
}

.period-card-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0;
}

.period-card-toggle span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.period-card-toggle b {
  color: #111;
  font-size: 20px;
  line-height: 1;
  font-weight: 900;
}

.period-card-toggle small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 750;
}

.period-card-selects {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  min-width: 0;
}

.period-card-selects label {
  display: grid;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  font-weight: 850;
  text-transform: uppercase;
}

.period-card-selects select {
  min-width: 0;
  min-height: 42px;
}

.period-range-empty {
  min-height: 96px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--soft-line);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.style-control-grid {
  display: grid;
  gap: 12px;
}

.chart-style-preset-control {
  display: grid;
  gap: 8px;
  margin: 18px 20px 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--soft-line);
}

.chart-style-preset-control select {
  min-height: 42px;
  border-radius: var(--control-radius);
}

.style-control-grid label:has(.studio-range),
.advanced-yoy-control:has(.studio-range) {
  grid-template-columns: minmax(0, 1fr) 52px;
  align-items: center;
  gap: 10px 12px;
  min-width: 0;
}

.studio-range {
  --range-progress: 0%;
  --range-active: #11161c;
  --range-rest: #d8e0e6;
  --range-track-size: 3px;
  --range-thumb-size: 14px;
  -webkit-appearance: none;
  appearance: none;
  grid-column: 1 / -1;
  width: min(78%, 280px);
  height: 24px;
  min-height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

.studio-range:focus {
  outline: none;
}

.studio-range:focus-visible {
  outline: 1px solid rgba(17, 22, 28, 0.34);
  outline-offset: 5px;
}

.studio-range::-webkit-slider-runnable-track {
  height: var(--range-track-size);
  border: 0;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--range-active) 0%,
    var(--range-active) var(--range-progress),
    var(--range-rest) var(--range-progress),
    var(--range-rest) 100%
  );
}

.studio-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--range-thumb-size);
  height: var(--range-thumb-size);
  margin-top: -5.5px;
  border: 0;
  border-radius: 50%;
  background: var(--range-active);
  box-shadow: none;
  transition: transform 120ms ease;
}

.studio-range:hover::-webkit-slider-thumb,
.studio-range:focus-visible::-webkit-slider-thumb {
  transform: scale(1.08);
}

.studio-range::-moz-range-track {
  height: var(--range-track-size);
  border: 0;
  border-radius: 999px;
  background: var(--range-rest);
}

.studio-range::-moz-range-progress {
  height: var(--range-track-size);
  border: 0;
  border-radius: 999px;
  background: var(--range-active);
}

.studio-range::-moz-range-thumb {
  width: var(--range-thumb-size);
  height: var(--range-thumb-size);
  border: 0;
  border-radius: 50%;
  background: var(--range-active);
  box-shadow: none;
}

.style-control-grid small {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  color: #11161c;
  font-size: 13px;
  line-height: 1;
  font-weight: 850;
  text-align: right;
}

.advanced-yoy-control small {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  color: #11161c;
  font-size: 13px;
  line-height: 1;
  font-weight: 850;
  text-align: right;
}

.range-empty {
  min-height: 48px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--stone);
  border-radius: 16px;
  color: var(--muted);
  font-size: 13px;
}

.settings-page {
  display: block;
}

.settings-accordion-list {
  display: grid;
  gap: 14px;
  margin-bottom: 22px;
}

.settings-card {
  border: 1px solid var(--soft-line);
  border-radius: var(--panel-radius);
  background: var(--canvas);
  padding: 26px;
  box-shadow: var(--shadow-card);
}

.settings-card h4 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.28;
  font-weight: 800;
}

.settings-accordion {
  padding: 0;
  overflow: hidden;
}

.settings-accordion summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 24px;
  list-style: none;
  cursor: pointer;
}

.settings-accordion summary::-webkit-details-marker {
  display: none;
}

.settings-accordion summary::after {
  content: "";
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.settings-accordion[open] summary::after {
  transform: rotate(225deg);
}

.settings-accordion summary span {
  min-width: 0;
}

.settings-accordion summary p {
  max-width: 760px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.settings-accordion-body {
  padding: 0 24px 22px;
  border-top: 1px solid rgba(222, 227, 233, 0.82);
}

.settings-accordion-body > :first-child {
  margin-top: 18px;
}

.settings-card-header {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(222, 227, 233, 0.82);
}

.settings-card-header p {
  max-width: 680px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.settings-card input,
.settings-card select,
.settings-card textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--hairline);
  border-radius: var(--control-radius);
  background: var(--canvas);
  color: var(--ink);
  padding: 12px 14px;
  outline: none;
}

.theme-preset-control {
  display: grid;
  gap: 8px;
}

.theme-preset-preview {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--soft-line);
}

.theme-preset-preview span {
  width: 34px;
  height: 34px;
  border-radius: var(--control-radius);
  background: var(--swatch-color);
  border: 1px solid rgba(10, 19, 23, 0.1);
}

.settings-card textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

.settings-card input:focus,
.settings-card select:focus,
.settings-card textarea:focus {
  border-color: var(--primary-focus);
  box-shadow: 0 0 0 3px rgba(24, 118, 242, 0.14);
}

.settings-card input[type="color"] {
  padding: 0;
}

.settings-card .helper-text {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(222, 227, 233, 0.82);
}

.color-palette-popover {
  position: fixed;
  z-index: 1000;
  width: 284px;
  max-height: var(--palette-max-height, min(560px, calc(100vh - 32px)));
  box-sizing: border-box;
  display: none;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--soft-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 44px rgba(28, 30, 33, 0.16);
}

.color-palette-popover.open {
  display: flex;
}

.palette-fixed {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.98);
}

.palette-header {
  display: grid;
  gap: 10px;
  padding: 14px 14px 12px;
}

.palette-scroll {
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 14px 12px;
}

.palette-footer {
  position: sticky;
  bottom: 0;
  z-index: 1;
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(222, 227, 233, 0.88);
  box-shadow: 0 -8px 18px rgba(255, 255, 255, 0.86);
}

.palette-title {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.3;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.palette-section-label {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  font-weight: 800;
  text-transform: uppercase;
}

.palette-current {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: var(--pearl);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.palette-current-swatch {
  width: 26px;
  height: 26px;
  border: 3px solid #fff;
  border-radius: 50%;
  background:
    linear-gradient(var(--swatch-color), var(--swatch-color)),
    linear-gradient(45deg, #d8dee6 25%, transparent 25%),
    linear-gradient(-45deg, #d8dee6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d8dee6 75%),
    linear-gradient(-45deg, transparent 75%, #d8dee6 75%);
  background-color: #fff;
  background-position: 0 0, 0 0, 0 5px, 5px -5px, -5px 0;
  background-size: auto, 10px 10px, 10px 10px, 10px 10px, 10px 10px;
  box-shadow: 0 0 0 1px var(--hairline);
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.palette-swatch {
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background:
    linear-gradient(var(--swatch-color), var(--swatch-color)),
    linear-gradient(45deg, #d8dee6 25%, transparent 25%),
    linear-gradient(-45deg, #d8dee6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d8dee6 75%),
    linear-gradient(-45deg, transparent 75%, #d8dee6 75%);
  background-color: #fff;
  background-position: 0 0, 0 0, 0 5px, 5px -5px, -5px 0;
  background-size: auto, 10px 10px, 10px 10px, 10px 10px, 10px 10px;
  box-shadow: 0 0 0 1px var(--hairline);
}

.palette-swatch:hover {
  box-shadow: 0 0 0 2px var(--primary-focus);
}

.palette-swatch.selected {
  box-shadow: 0 0 0 3px var(--primary), 0 0 0 6px rgba(0, 100, 224, 0.12);
}

.palette-hex {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.palette-native {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.palette-hex input,
.palette-rgb input,
.palette-native input {
  min-height: 38px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--pearl);
  color: var(--ink);
  padding: 8px 10px;
  outline: none;
}

.palette-rgb {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.palette-rgb label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.palette-apply {
  min-height: 42px;
  width: 100%;
  margin-top: 0;
  border-radius: 12px;
}

.output-panel {
  position: sticky;
  bottom: 0;
  width: 100%;
  z-index: 6;
  box-shadow: rgba(20, 22, 26, 0.16) 0px 1px 4px 0px;
  padding: 18px;
  border-radius: 24px;
  margin-top: 24px;
  flex: 0 0 auto;
}

.output-panel h2 {
  margin-bottom: 12px;
}

.output-panel button {
  min-height: 46px;
  font-size: 15px;
}

.output-panel .primary-action {
  width: 100%;
  margin-top: 8px;
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.output-panel .primary-action:hover {
  background: var(--primary-deep);
  border-color: var(--primary-deep);
}

.chart-gallery-section {
  display: none;
  padding: 16px;
  margin-bottom: 18px;
}

.gallery-header-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.gallery-select-action {
  width: auto;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--soft-line);
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.gallery-select-action:hover:not(:disabled),
.gallery-select-action:focus-visible {
  border-color: var(--primary);
  background: rgba(10, 102, 255, 0.06);
  outline: none;
}

.gallery-select-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chart-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 10px;
}

.chart-gallery-card {
  position: relative;
  min-height: 0;
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--soft-line);
  border-radius: 16px;
  background: var(--canvas);
  color: var(--ink);
  text-align: left;
}

.chart-gallery-trigger {
  display: grid;
  gap: 7px;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.chart-gallery-select {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  min-height: 24px;
  margin: 0;
  padding: 3px 7px;
  border: 1px solid var(--soft-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.chart-gallery-select input {
  width: 12px;
  height: 12px;
  min-height: 12px;
  margin: 0;
}

.chart-gallery-card:hover,
.chart-gallery-card.active {
  background: #fbfcff;
  border-color: var(--primary);
}

.chart-gallery-trigger:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.chart-gallery-image {
  height: 88px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: var(--pearl);
}

.chart-gallery-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: white;
}

.chart-gallery-placeholder {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chart-gallery-meta {
  display: grid;
  gap: 3px;
}

.chart-gallery-meta strong {
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.3;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-gallery-badge {
  flex: none;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0, 100, 224, 0.1);
  color: var(--primary);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
}

.chart-gallery-meta span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.33;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-stage {
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: 18px;
  position: relative;
  scrollbar-gutter: stable;
}

.empty-state {
  min-height: 640px;
  display: grid;
  align-content: center;
  justify-items: center;
  color: var(--muted);
  text-align: center;
  padding: 40px;
}

.empty-state h3 {
  color: var(--ink);
  font-size: 36px;
  line-height: 1.28;
  font-weight: 500;
  margin-bottom: 10px;
}

.empty-state p {
  margin: 0;
  font-size: 17px;
  line-height: 1.47;
}

.chart-host,
.matplotlib-host {
  padding: 18px;
}

.chart-host svg {
  display: block;
  background: #fff;
  min-width: 980px;
  border-radius: 16px;
}

.matplotlib-host {
  display: none;
}

.matplotlib-host img {
  display: block;
  max-width: none;
  width: max(100%, 1680px);
  min-width: 1320px;
  background: #fff;
  border-radius: 16px;
}
