/* V2 workspace layout and control panel */
body {
  min-width: 320px;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

.app-shell {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  overflow-y: visible;
}

.app-layout {
  display: grid;
  grid-template-columns: 410px minmax(0, 1fr);
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  transition: grid-template-columns .24s ease;
}

.app-shell[data-sidebar-collapsed="true"] .app-layout {
  grid-template-columns: 76px minmax(0, 1fr);
}

.control-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  z-index: 30;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  color: var(--ink);
  background: var(--surface);
  border-right: 1px solid var(--line);
  box-shadow: 14px 0 38px #172c2512;
  transition: width .24s ease, transform .24s ease;
}

.app-shell[data-sidebar-collapsed="true"] .control-sidebar {
  grid-template-columns: 76px 0;
}

.sidebar-rail {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 76px;
  padding: 18px 9px;
  background: var(--soft);
  border-right: 1px solid var(--line);
}

.rail-brand {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
  background: #fff;
  color: var(--brand);
  box-shadow: 0 8px 22px #142b2412;
}

.rail-brand-logo {
  display: block;
  width: 46px;
  height: 46px;
}

.rail-brand-logo .logo-primary { fill: var(--brand-accent-light, var(--brand)); }
.rail-brand-logo .logo-dark { fill: color-mix(in srgb, var(--brand-accent-light, var(--brand)) 72%, #000); }
.rail-brand-logo .logo-mid { fill: color-mix(in srgb, var(--brand-accent-light, var(--brand)) 66%, #fff); }
.rail-brand-logo .logo-light { fill: color-mix(in srgb, var(--brand-accent-light, var(--brand)) 34%, #fff); }

@supports not (color: color-mix(in srgb, #000 50%, #fff)) {
  .rail-brand-logo .logo-dark { fill: var(--brand-accent-light, var(--brand)); }
  .rail-brand-logo .logo-mid { fill: var(--brand-accent-light, var(--brand)); opacity: .68; }
  .rail-brand-logo .logo-light { fill: var(--brand-accent-light, var(--brand)); opacity: .38; }
}

.rail-navigation {
  display: grid;
  gap: 10px;
  margin-top: 44px;
}

.rail-nav-button,
.rail-theme-indicator {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  width: 58px;
  min-height: 62px;
  padding: 8px 3px;
  border: 0;
  border-radius: 13px;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
  font-weight: 650;
  transition: color .18s ease, background .18s ease, transform .18s ease;
}

.rail-nav-button:hover,
.rail-nav-button.active {
  color: var(--brand);
  background: var(--surface);
}

.rail-nav-button.active {
  box-shadow: 0 7px 20px #142b2412;
}

.rail-nav-button.active::before {
  position: absolute;
  top: 13px;
  left: -9px;
  width: 3px;
  height: 36px;
  border-radius: 0 4px 4px 0;
  background: var(--brand);
  content: "";
}

.rail-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  font-size: 23px;
  font-weight: 500;
  line-height: 1;
}

.rail-icon img {
  display: block;
  width: 24px;
  height: 24px;
  opacity: .62;
  transition: opacity .18s ease;
}

.rail-nav-button:hover .rail-icon img,
.rail-nav-button.active .rail-icon img {
  opacity: 1;
}

.app-shell[data-mode="dark"] .rail-icon img {
  filter: invert(1);
}

.rail-footer {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-top: auto;
}

.app-shell[data-active-tool="dashboard"] .rail-divider,
.app-shell[data-active-tool="dashboard"] .rail-context-navigation {
  display: none;
}

.rail-about-button {
  display: grid;
  place-items: center;
  flex: none;
}

.rail-about-button img,
.rail-global-theme-button img {
  width: 24px;
  height: 24px;
  opacity: .62;
  transition: opacity .18s ease;
}

.rail-about-button:hover,
.rail-about-button.active,
.rail-global-theme-button:hover,
.rail-global-theme-button.active {
  color: var(--brand);
  background: var(--surface);
}

.rail-about-button:hover img,
.rail-about-button.active img,
.rail-global-theme-button:hover img,
.rail-global-theme-button.active img {
  opacity: 1;
}

.rail-about-button.active,
.rail-global-theme-button.active {
  box-shadow: 0 7px 20px #142b2412;
}

.app-shell[data-mode="dark"] .rail-about-button img,
.app-shell[data-mode="dark"] .rail-global-theme-button img {
  filter: invert(1);
}

.rail-theme-indicator {
  min-height: 44px;
  font-size: 22px;
}

.sidebar-panel {
  min-width: 0;
  overflow: hidden auto;
  background: var(--surface);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.app-shell[data-sidebar-collapsed="true"] .sidebar-panel {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.sidebar-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 333px;
  padding: 22px 20px 17px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.sidebar-header p {
  margin: 0 0 2px;
  color: var(--brand);
  letter-spacing: .14em;
  font-size: 9px;
  font-weight: 800;
}

.sidebar-header strong {
  font-size: 15px;
}

.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.sidebar-header-actions button {
  min-height: 34px;
  padding: 7px 9px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: var(--soft);
  font-size: 10px;
}

.sidebar-header-actions button:hover {
  color: var(--brand);
}

.sidebar-mobile-close {
  display: none;
  width: 34px;
  padding: 0 !important;
  font-size: 20px !important;
}

.sidebar-section {
  min-width: 333px;
  padding: 24px 20px 34px;
}

.sidebar-section[hidden] {
  display: none;
}

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

.sidebar-section-heading p {
  margin: 0 0 4px;
  color: var(--brand);
  letter-spacing: .14em;
  font-size: 9px;
  font-weight: 800;
}

.sidebar-section-heading h2 {
  margin: 0;
  letter-spacing: -.025em;
  font-size: 20px;
}

.sidebar-section-heading .sample-button,
.sidebar-section-heading .reset-button {
  flex: none;
  padding: 8px 10px;
  font-size: 10px;
}

.section-help {
  margin: -7px 0 20px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.sidebar-panel .kpi-form {
  grid-template-columns: 1fr 1fr;
  gap: 14px 11px;
}

.sidebar-panel .field-full,
.sidebar-panel .field-wide {
  grid-column: 1 / -1;
}

.sidebar-panel .field {
  gap: 6px;
}

.sidebar-panel .field span {
  font-size: 10px;
}

.sidebar-panel .field input,
.sidebar-panel .field select,
.sidebar-panel .field textarea {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: var(--soft);
  color: var(--ink);
  padding: 9px 10px;
  font: inherit;
  font-size: 11px;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.sidebar-panel .field textarea {
  width: 100%;
  resize: vertical;
  line-height: 1.45;
}

.sidebar-panel .field input:focus,
.sidebar-panel .field select:focus,
.sidebar-panel .field textarea:focus {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 3px #00766416;
}

.computed-field input {
  color: var(--muted);
}

.trend-count {
  flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 9px;
  color: var(--muted);
  background: var(--soft);
  font-size: 9px;
}

.trend-count b {
  color: var(--brand);
}

.trend-editor {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

.trend-table-header,
.trend-table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px;
  align-items: center;
  gap: 8px;
}

.trend-table-header {
  padding: 10px 10px 8px;
  color: var(--muted);
  letter-spacing: .07em;
  font-size: 8px;
  font-weight: 750;
  text-transform: uppercase;
}

.trend-table-body {
  max-height: calc(100vh - 310px);
  min-height: 170px;
  overflow-y: auto;
  padding: 0 6px 7px;
  scrollbar-width: thin;
}

.trend-table-row {
  padding: 5px 4px;
  border-top: 1px solid var(--line);
}

.trend-table-row:first-child {
  border-top: 0;
}

.trend-table-row input {
  min-width: 0;
  width: 100%;
  height: 35px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  outline: none;
  color: var(--ink);
  background: var(--surface);
  font-size: 10px;
}

.trend-table-row input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px #00766414;
}

.remove-trend-row {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 17px;
}

.remove-trend-row:hover {
  color: #c33131;
  background: #fdeaea;
}

.add-trend-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--brand);
  border-radius: 10px;
  color: var(--brand);
  background: transparent;
  font-size: 10px;
  font-weight: 700;
}

.add-trend-row:hover {
  background: #0076640b;
}

.add-trend-row span {
  font-size: 16px;
}

.trend-validation {
  min-height: 17px;
  margin: 9px 2px 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.settings-group {
  border-top: 1px solid var(--line);
}

.settings-category-title {
  margin: 24px 2px 10px;
  color: var(--ink);
  letter-spacing: -.01em;
  font-size: 13px;
  font-weight: 750;
}

.section-help + .settings-category-title {
  margin-top: 0;
}

.settings-group:last-child {
  border-bottom: 1px solid var(--line);
}

.settings-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 2px;
  cursor: pointer;
  list-style: none;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

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

.settings-group summary::after {
  content: "⌄";
  margin-left: auto;
  color: var(--muted);
  font-size: 14px;
  transition: transform .18s ease;
}

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

.settings-group summary > span {
  display: flex;
  align-items: center;
  gap: 9px;
}

.settings-group summary i {
  width: 22px;
  color: var(--brand);
  font-size: 17px;
  font-style: normal;
  text-align: center;
}

.settings-icon-palette {
  display: block;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  fill: var(--brand);
}

.settings-group summary small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 550;
}

.settings-group-content {
  padding: 0 2px 18px;
}

.theme-mode-field,
.language-preference-field {
  margin-bottom: 10px;
}

.sidebar-panel .chip-row {
  gap: 7px;
}

.sidebar-panel .chip-row button {
  flex: 1 1 auto;
  min-width: 83px;
  padding: 8px 9px;
}

.sidebar-panel .segmented button {
  min-height: 48px;
}

.sidebar-panel .swatch-row {
  gap: 12px;
}

.sidebar-panel .swatch-row > button,
.sidebar-panel .custom-color {
  width: 31px;
  height: 31px;
}

.sidebar-panel .swatch-row .custom-color-wrap {
  margin-left: auto;
}

.custom-color-wrap {
  position: relative;
}

.custom-color-popover {
  position: absolute;
  z-index: 5;
  top: calc(100% + 8px);
  right: 0;
  display: none;
  width: 190px;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(20, 42, 35, .16);
}

.custom-color-wrap.is-open .custom-color-popover {
  display: grid;
}

.custom-color-spectrum {
  position: relative;
  height: 118px;
  overflow: hidden;
  border-radius: 6px;
  cursor: crosshair;
  background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(var(--picker-hue) 100% 50%));
}

.custom-color-spectrum i {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .45);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.custom-color-hue {
  width: 100%;
  height: 10px;
  appearance: none;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
}

.custom-color-hue::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  appearance: none;
  border: 2px solid #fff;
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .45);
}

.custom-color-hex {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
}

.custom-color-hex > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.custom-color-hex input {
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.icon-choice-catalog {
  display: grid;
  gap: 15px;
}

.icon-choice-group {
  display: grid;
  gap: 7px;
}

.icon-choice-group > p {
  margin: 0;
  color: var(--muted);
  letter-spacing: .06em;
  font-size: 8px;
  font-weight: 750;
  text-transform: uppercase;
}

.icon-choice-items {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.icon-choice {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: var(--soft);
  font-size: 18px;
  transition: color .18s ease, border-color .18s ease, background .18s ease, transform .18s ease;
}

.icon-choice:hover,
.icon-choice:focus-visible {
  z-index: 2;
  border-color: var(--brand);
  color: var(--brand);
  background: var(--surface);
  outline: none;
  transform: translateY(-1px);
}

.icon-choice.active {
  border-color: var(--brand);
  color: var(--brand);
  background: #00766412;
  box-shadow: inset 0 0 0 1px var(--brand);
}

.icon-choice .svg-icon {
  --icon-size: 21px;
}

.icon-choice::after {
  content: attr(data-label);
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: calc(100% + 7px);
  width: max-content;
  max-width: 120px;
  padding: 5px 7px;
  border-radius: 6px;
  color: var(--surface);
  background: var(--ink);
  font-size: 9px;
  font-weight: 650;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity .15s ease, transform .15s ease;
}

.icon-choice:hover::after,
.icon-choice:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.app-content {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: clip;
}

.kpi-card {
  container-type: inline-size;
}

.app-content .page-wrap {
  width: min(1500px, 100% - 48px);
  max-width: calc(100% - 48px);
  padding-top: 38px;
}

.app-content .hero {
  grid-template-columns: auto 1fr auto;
}

.app-shell[data-sidebar-collapsed="true"] .app-content .hero {
  grid-template-columns: auto 1fr auto;
}

.hero-status {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 9px;
}

.hero-status .result-count {
  border-radius: 999px;
  padding: 9px 13px;
}

.app-content .gallery-section {
  margin-top: 22px;
}

.about-page {
  width: min(1500px, 100% - 48px);
  max-width: calc(100% - 48px);
  margin: 0 auto;
  padding: 38px 0 80px;
}

.about-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  max-width: 920px;
}

.about-hero-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 58px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 12px 30px #16372c12;
}

.about-hero-icon img {
  width: 30px;
  height: 30px;
  opacity: .82;
}

.about-hero h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(32px, 4vw, 48px);
  letter-spacing: -.04em;
  line-height: 1.05;
}

.about-hero > div:last-child > p:last-child {
  max-width: 780px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 32px;
}

.about-card,
.about-credit-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 12px 34px #16372c0c;
}

.about-card {
  padding: 27px 28px;
}

.about-card-wide,
.about-credit-card {
  grid-column: 1 / -1;
}

.about-card-kicker {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .14em;
}

.about-card h2,
.about-credit-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: 21px;
  font-weight: 720;
  letter-spacing: -.025em;
}

.about-card ul {
  display: grid;
  gap: 13px;
  margin: 21px 0 0;
}

.about-card li {
  position: relative;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.62;
}

.about-card li::before {
  position: absolute;
  top: .68em;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  content: "";
}

.about-card li strong {
  color: var(--ink);
}

.about-card > p:last-child {
  margin: 17px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.about-credit-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 25px 28px;
}

.about-credit-card p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.about-credit-card a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 42px;
  padding: 10px 15px;
  border: 1px solid var(--brand);
  border-radius: 10px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.about-credit-card a:hover {
  background: var(--brand);
  color: #fff;
  transform: translateY(-1px);
}

.app-shell[data-mode="dark"] .about-hero-icon img {
  filter: invert(1);
}

.sidebar-scrim {
  display: none;
}

.quick-theme-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  margin: 8px 0 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 9px 28px #1f382f0b;
}

.quick-theme-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: none;
}

.quick-theme-label img {
  display: block;
  width: 22px;
  height: 22px;
  opacity: .72;
}

.app-shell[data-mode="dark"] .quick-theme-label img {
  filter: invert(1);
}

.quick-theme-scroll {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow-x: auto;
  padding: 2px;
  scrollbar-width: thin;
}

.quick-theme-scroll .chip-row {
  flex-wrap: nowrap;
  gap: 7px;
}

.quick-theme-scroll .chip-row button,
.theme-all-button {
  flex: none;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  background: var(--soft);
  font-size: 10px;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}

.quick-theme-scroll .chip-row button:hover,
.theme-all-button:hover {
  color: var(--brand);
  border-color: var(--brand);
}

.quick-theme-scroll .chip-row button.active,
.theme-all-button.active {
  color: var(--brand);
  border-color: var(--brand);
  background: #0076640c;
  box-shadow: inset 0 0 0 1px var(--brand);
}

@media (min-width: 901px) {
  .app-shell[data-sidebar-collapsed="false"] .card-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container (max-width: 520px) {
  .target-gauge-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 14px;
  }

  .target-gauge-layout > div:last-child {
    min-height: 0;
    padding-left: 14px;
  }

  .target-gauge-side {
    display: flex !important;
    width: 100%;
    gap: 10px;
  }

  .target-gauge-kpis {
    gap: 6px;
  }

  .target-gauge-kpis span {
    padding: 7px;
  }
}

@container (max-width: 450px) {
  .gauge-arc-card .card-canvas {
    min-height: 430px;
  }

  .gauge-layout {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 14px;
  }

  .gauge-side {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    padding: 14px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .gauge-side .card-description {
    max-width: 100%;
  }
}

@container (max-width: 400px) {
  .gauge-target-card .card-canvas {
    min-height: 430px;
  }

  .target-gauge-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .target-gauge-layout > div:last-child {
    padding: 15px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .target-gauge-side {
    display: grid !important;
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1400px) {
  .app-shell[data-sidebar-collapsed="false"] .card-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .app-shell[data-sidebar-collapsed="false"] .card-gallery > .kpi-card {
    width: 100%;
    aspect-ratio: 16 / 9;
  }

  .app-shell[data-sidebar-collapsed="false"] .card-gallery > .kpi-card > .card-canvas {
    width: 150%;
    height: 150%;
    min-height: 0 !important;
    transform: scale(.666667);
    transform-origin: top left;
  }

  .app-shell[data-sidebar-collapsed="false"] .card-gallery > .gauge-arc-card .gauge-layout {
    grid-template-columns: minmax(0, 1.45fr) minmax(110px, .75fr);
    align-content: normal;
    gap: 20px;
  }

  .app-shell[data-sidebar-collapsed="false"] .card-gallery > .gauge-arc-card .gauge-side {
    display: flex;
    width: auto;
    padding: 0 0 0 20px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .app-shell[data-sidebar-collapsed="false"] .card-gallery > .gauge-target-card .target-gauge-layout {
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 26px;
  }

  .app-shell[data-sidebar-collapsed="false"] .card-gallery > .gauge-target-card .target-gauge-layout > div:last-child {
    min-height: 182px;
    padding: 0 0 0 22px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .app-shell[data-sidebar-collapsed="false"] .card-gallery > .gauge-target-card .target-gauge-side {
    display: flex !important;
    width: auto;
    gap: 14px;
  }

  .app-shell[data-sidebar-collapsed="false"] .card-gallery > .gauge-target-card .target-gauge-kpis {
    gap: 8px;
  }

  .app-shell[data-sidebar-collapsed="false"] .card-gallery > .gauge-target-card .target-gauge-kpis span {
    padding: 9px;
  }
}

@media (max-width: 1280px) {
  .app-layout {
    grid-template-columns: 370px minmax(0, 1fr);
  }

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

@media (max-width: 900px) {
  body.sidebar-mobile-open {
    overflow: hidden;
  }

  .app-layout,
  .app-shell[data-sidebar-collapsed="true"] .app-layout {
    display: block;
  }

  .control-sidebar,
  .app-shell[data-sidebar-collapsed="true"] .control-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    grid-template-columns: 72px 0;
    width: 72px;
    height: 100dvh;
    overflow: visible;
    transform: none;
    box-shadow: 10px 0 30px #07120f18;
  }

  .app-shell[data-sidebar-open="true"] .control-sidebar {
    grid-template-columns: 72px minmax(0, 1fr);
    width: min(410px, 94vw);
    box-shadow: 20px 0 60px #07120f42;
  }

  .sidebar-panel,
  .app-shell[data-sidebar-collapsed="true"] .sidebar-panel {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }

  .app-shell[data-sidebar-open="true"] .sidebar-panel,
  .app-shell[data-sidebar-open="true"][data-sidebar-collapsed="true"] .sidebar-panel {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-rail {
    min-width: 72px;
  }

  .sidebar-mobile-close {
    display: grid;
    place-items: center;
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0 0 0 72px;
    z-index: 25;
    border: 0;
    background: #0b1714a6;
    backdrop-filter: blur(5px);
  }

  .app-shell[data-sidebar-open="true"] .sidebar-scrim {
    display: block;
  }

  .app-content {
    width: calc(100% - 72px);
    margin-left: 72px;
  }

  .app-content .page-wrap {
    width: min(100% - 32px, 1500px);
    padding-top: 26px;
  }

  .about-page {
    width: min(100% - 32px, 1500px);
    max-width: calc(100% - 32px);
    padding-top: 26px;
  }

  .app-content .hero,
  .app-shell[data-sidebar-collapsed="true"] .app-content .hero {
    grid-template-columns: auto 1fr;
  }

  .app-content .hero .hero-status {
    display: none;
  }
}

@media (max-width: 600px) {
  .app-content .hero {
    grid-template-columns: 1fr;
    gap: 11px;
  }

  .app-content .hero .brand-mark {
    display: none;
  }

  .app-content .hero h1 {
    font-size: 25px;
  }

  .app-content .hero-copy {
    grid-column: 1 / -1;
    margin-top: 2px;
  }

  .about-hero {
    align-items: flex-start;
    gap: 14px;
  }

  .about-hero-icon {
    width: 48px;
    height: 48px;
    border-radius: 13px;
  }

  .about-hero-icon img {
    width: 25px;
    height: 25px;
  }

  .about-grid {
    grid-template-columns: 1fr;
    margin-top: 24px;
  }

  .about-card-wide,
  .about-credit-card {
    grid-column: auto;
  }

  .about-card {
    padding: 22px;
  }

  .about-credit-card {
    align-items: flex-start;
    flex-direction: column;
    padding: 22px;
  }

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

  .quick-theme-toolbar {
    display: block;
  }

  .quick-theme-label {
    margin-bottom: 8px;
  }

  .sidebar-header-actions button span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-layout,
  .control-sidebar {
    transition: none;
  }
}

/* Dark mode contrast: keep the chosen brand color for charts and swatches,
   but lift accent-colored labels and icons onto dark surfaces. */
.app-shell {
  --brand-accent: var(--brand-accent-light, var(--brand));
  --brand-contrast: var(--brand-accent);
}

.app-shell[data-mode="dark"] {
  --brand-accent: var(--brand-accent-dark, #79d8c7);
  --brand-contrast: var(--brand-accent);
}

@supports (color: color-mix(in srgb, black, white)) {
  .app-shell[data-mode="dark"] {
    --brand-contrast: var(--brand-accent);
  }
}

/* Theme color roles: the selected color remains the data/background color;
   foreground accents use a contrast-safe derivative for the current surface. */
.rail-nav-button:hover,
.rail-nav-button.active,
.rail-about-button:hover,
.rail-about-button.active,
.rail-global-theme-button:hover,
.rail-global-theme-button.active,
.sidebar-header p,
.sidebar-header-actions button:hover,
.sidebar-section-heading p,
.trend-count b,
.settings-group summary i,
.icon-choice:hover,
.icon-choice:focus-visible,
.icon-choice.active,
.about-card-kicker,
.about-credit-card a,
.quick-theme-scroll .chip-row button:hover,
.quick-theme-scroll .chip-row button.active,
.theme-all-button:hover,
.theme-all-button.active,
.result-count strong,
.app-content .eyebrow {
  color: var(--brand-accent);
}

.rail-nav-button.active::before,
.about-card li::before {
  background: var(--brand-accent);
}

.icon-choice:hover,
.icon-choice:focus-visible,
.icon-choice.active,
.quick-theme-scroll .chip-row button:hover,
.quick-theme-scroll .chip-row button.active,
.theme-all-button:hover,
.theme-all-button.active {
  border-color: var(--brand-accent);
}

.app-content .brand-mark {
  border: 1px solid color-mix(in srgb, var(--brand-accent-light, var(--brand)) 32%, var(--line));
}

.app-content .brand-mark span {
  background: var(--brand-ink, #fff);
}

.app-shell[data-mode="dark"] .rail-nav-button:hover,
.app-shell[data-mode="dark"] .rail-nav-button.active,
.app-shell[data-mode="dark"] .rail-global-theme-button:hover,
.app-shell[data-mode="dark"] .rail-global-theme-button.active {
  color: var(--brand-contrast);
  background: color-mix(in srgb, var(--brand) 14%, var(--surface));
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--brand-contrast) 26%, var(--line)),
    0 7px 20px #00000024;
}

.app-shell[data-mode="dark"] .rail-icon img,
.app-shell[data-mode="dark"] .rail-about-button img,
.app-shell[data-mode="dark"] .rail-global-theme-button img {
  opacity: .82;
}

.app-shell[data-mode="dark"] .rail-nav-button:hover .rail-icon img,
.app-shell[data-mode="dark"] .rail-nav-button.active .rail-icon img,
.app-shell[data-mode="dark"] .rail-about-button:hover img,
.app-shell[data-mode="dark"] .rail-about-button.active img,
.app-shell[data-mode="dark"] .rail-global-theme-button:hover img,
.app-shell[data-mode="dark"] .rail-global-theme-button.active img {
  opacity: 1;
}

.app-shell[data-mode="dark"] .sidebar-header p,
.app-shell[data-mode="dark"] .sidebar-section-heading p,
.app-shell[data-mode="dark"] .eyebrow,
.app-shell[data-mode="dark"] .step-label,
.app-shell[data-mode="dark"] .settings-group summary i,
.app-shell[data-mode="dark"] .about-card-kicker,
.app-shell[data-mode="dark"] .site-credit a,
.app-shell[data-mode="dark"] .result-count strong,
.app-shell[data-mode="dark"] .design-tag span,
.app-shell[data-mode="dark"] .quick-theme-label,
.app-shell[data-mode="dark"] .dashboard-editor-toolbar p {
  color: var(--brand-contrast);
}

.app-shell[data-mode="dark"] .chip-row button:hover,
.app-shell[data-mode="dark"] .chip-row button.active,
.app-shell[data-mode="dark"] .segmented button.active,
.app-shell[data-mode="dark"] .icon-choice:hover,
.app-shell[data-mode="dark"] .icon-choice:focus-visible,
.app-shell[data-mode="dark"] .icon-choice.active {
  border-color: var(--brand-contrast);
  color: var(--brand-contrast);
}

.app-shell[data-mode="dark"] .icon-choice.active {
  background: color-mix(in srgb, var(--brand) 16%, var(--soft));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-contrast) 34%, transparent);
}

.app-shell[data-mode="dark"] .status-success {
  color: #63d99d;
}

.app-shell[data-mode="dark"] .status-warning {
  color: #ffc56b;
}

.app-shell[data-mode="dark"] .status-danger {
  color: #ff8c8c;
}

.app-shell[data-mode="dark"] .status-neutral,
.app-shell[data-mode="dark"] .neutral-change {
  color: #a9c0c8;
}

.app-shell[data-mode="dark"] .design-number {
  color: var(--brand-contrast);
  background: color-mix(in srgb, var(--brand) 18%, var(--surface));
}

.app-shell[data-mode="dark"] .visual-card-head .icon-outline {
  border-color: color-mix(in srgb, var(--brand-contrast) 55%, var(--line));
  color: var(--brand-contrast);
}

.app-shell[data-mode="dark"] .target-line-copy > strong,
.app-shell[data-mode="dark"] .progress-meta strong,
.app-shell[data-mode="dark"] .target-split-layout > div > strong,
.app-shell[data-mode="dark"] .target-split-layout > div + div > b,
.app-shell[data-mode="dark"] .executive-command-grid > div + div > strong,
.app-shell[data-mode="dark"] .target-distance-row.gap-on-target strong,
.app-shell[data-mode="dark"] .achievement-emblem span,
.app-shell[data-mode="dark"] .milestone-points b {
  color: var(--brand-contrast);
}

.app-shell[data-mode="dark"] .milestone-points .reached b {
  border-color: var(--brand-contrast);
}
