.cc-advisor {
  --advisor-bg: #152728;
  --advisor-panel: #1a3030;
  --advisor-ink: #f3eadd;
  --advisor-muted: #b8cac3;
  --advisor-accent: #bce2ce;
  --advisor-line: #3d5853;
  --advisor-gold: #efd2a5;
  --advisor-plot-missing: #a9b1ae;

  color-scheme: dark;
  box-sizing: border-box;
  width: min(1080px, calc(100% - 48px));
  height: min(750px, calc(100% - 48px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  color: var(--advisor-ink);
  border: 1px solid #53736b;
  border-radius: 16px;
  background: var(--advisor-bg);
  box-shadow: 0 30px 100px #071110b8;
  font: 400 0.875rem/1.5 var(--sans, system-ui, sans-serif);
}

.cc-advisor *,
.cc-advisor *::before,
.cc-advisor *::after {
  box-sizing: border-box;
}

.cc-advisor [hidden] {
  display: none !important;
}

.cc-advisor::backdrop {
  background: #0b161ad4;
}

.cc-advisor[open] {
  animation: cc-advisor-enter 180ms cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes cc-advisor-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.cc-advisor__frame {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100%;
}

.cc-advisor__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 21px 26px 15px;
  background: radial-gradient(ellipse at 1% 0%, #305148, transparent 76%);
}

.cc-advisor__heading {
  margin: 0;
  color: var(--advisor-gold);
  font: 600 clamp(1.25rem, 3.4vw, 1.9rem)/1.2 var(--serif, Georgia, serif);
}

.cc-advisor__heading:focus,
.cc-advisor__detail-title:focus {
  outline: none;
}

.cc-advisor button,
.cc-advisor select,
.cc-advisor input {
  font: inherit;
}

.cc-advisor button {
  cursor: pointer;
}

.cc-advisor :is(button, a, select, input):focus-visible {
  outline: 2px solid var(--advisor-gold);
  outline-offset: 2px;
}

.cc-advisor .cc-advisor__close {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--advisor-ink);
  font-size: 1.65rem;
  line-height: 1;
  background: transparent;
  border: 1px solid var(--advisor-line);
  border-radius: 50%;
}

.cc-advisor__close:hover {
  background: #2c4742;
}

.cc-advisor__nav {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  scrollbar-color: #668d7d transparent;
  padding: 2px 26px;
  border-bottom: 1px solid var(--advisor-line);
}

.cc-advisor__theme {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 5px 6px 7px;
  color: var(--advisor-muted);
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  white-space: nowrap;
}

.cc-advisor__theme:hover,
.cc-advisor__theme[aria-current="true"] {
  color: var(--advisor-accent);
}

.cc-advisor__theme[aria-current="true"] {
  border-bottom-color: var(--advisor-accent);
  font-weight: 700;
}

.cc-advisor__body {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr);
  min-height: 0;
}

.cc-advisor__work,
.cc-advisor__details {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.cc-advisor__work {
  padding: 20px 26px 26px;
}

.cc-advisor__controls {
  display: grid;
  gap: 11px;
  padding-bottom: 15px;
}

.cc-advisor__control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.cc-advisor__field {
  display: grid;
  flex: 1 1 145px;
  min-width: 0;
  gap: 4px;
  color: var(--advisor-muted);
  font-size: 0.8125rem;
  font-weight: 600;
}

.cc-advisor__field :is(input, select) {
  min-width: 0;
  width: 100%;
  min-height: 42px;
  padding: 6px 9px;
  border: 1px solid var(--advisor-line);
  border-radius: 7px;
  color: var(--advisor-ink);
  background: #102222;
}

.cc-advisor__count {
  margin: 0;
  padding-bottom: 7px;
  color: var(--advisor-muted);
  font-size: 0.8125rem;
}

.cc-advisor__list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cc-advisor__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, max-content);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 45px;
  padding: 8px 12px;
  color: var(--advisor-ink);
  text-align: start;
  background: transparent;
  border: 1px solid transparent;
  border-bottom-color: #2d4743;
  border-radius: 5px;
}

.cc-advisor__row:hover {
  background: #223a36;
}

.cc-advisor__row[aria-pressed="true"] {
  color: var(--advisor-accent);
  background: #29443c;
  border-color: #668d7d;
}

.cc-advisor__frame--explorer .cc-advisor__row,
.cc-advisor__column-head {
  grid-template-columns: minmax(0, 1.05fr) repeat(2, minmax(0, 1fr));
}

.cc-advisor__column-head {
  display: grid;
  gap: 10px;
  padding: 7px 13px;
  border-bottom: 1px solid var(--advisor-line);
  color: var(--advisor-muted);
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}

.cc-advisor__column-head span:not(:first-child) {
  text-align: end;
}

.cc-advisor__row-name,
.cc-advisor__value,
.cc-advisor__details {
  overflow-wrap: anywhere;
}

.cc-advisor__row-name small {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  color: var(--advisor-muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.cc-advisor__value {
  max-width: 9rem;
  color: var(--advisor-accent);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  text-align: end;
}

.cc-advisor__empty {
  margin: 14px 0 0;
  color: var(--advisor-muted);
}

.cc-advisor__more,
.cc-advisor__locate,
.cc-advisor__back {
  min-height: 44px;
  padding: 7px 13px;
  border: 1px solid #739789;
  border-radius: 7px;
  color: var(--advisor-ink);
  background: #2b4941;
}

.cc-advisor__more {
  width: 100%;
  margin-top: 12px;
}

.cc-advisor__details {
  padding: 25px 28px 28px;
  border-inline-start: 1px solid var(--advisor-line);
  background: var(--advisor-panel);
}

.cc-advisor__context {
  margin: 0 0 6px;
  color: var(--advisor-muted);
  font-size: 0.8125rem;
}

.cc-advisor__detail-title {
  margin: 0 0 12px;
  font: 600 1.5rem/1.3 var(--serif, Georgia, serif);
}

.cc-advisor__detail-value {
  margin: 0 0 12px;
  padding: 12px 0;
  border-top: 1px solid var(--advisor-line);
  border-bottom: 1px solid var(--advisor-line);
  color: var(--advisor-accent);
  font-size: clamp(1.25rem, 3vw, 1.85rem);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

.cc-advisor__copy {
  margin: 0 0 8px;
  color: var(--advisor-muted);
}

.cc-advisor__details > .cc-advisor__field {
  margin-top: 13px;
  max-width: 23rem;
}

.cc-advisor .cc-advisor__locate {
  margin: 9px 0;
  background: var(--advisor-accent);
  color: #11281e;
  font-weight: 700;
}

.cc-advisor__locate:hover {
  background: #d6ebd9;
}

.cc-advisor__more:hover,
.cc-advisor__back:hover {
  background: #385d50;
}

.cc-advisor__back {
  display: none;
}

.cc-advisor__observations {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 4px;
}

.cc-advisor__observations div {
  padding: 9px;
  border: 1px solid var(--advisor-line);
  border-radius: 6px;
}

.cc-advisor__observations dt {
  color: var(--advisor-muted);
}

.cc-advisor__observations dd {
  margin: 0;
}

.cc-advisor__observations--columns {
  margin-bottom: 10px;
}

.cc-advisor__observations--columns dd {
  margin-top: 4px;
  color: var(--advisor-accent);
  font-weight: 650;
}

.cc-advisor__observations--columns dd small {
  display: block;
  color: var(--advisor-muted);
  font-weight: 400;
}

.cc-advisor__sources {
  display: grid;
  justify-items: start;
  gap: 5px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--advisor-line);
}

.cc-advisor__sources h4 {
  margin: 0 0 2px;
  color: var(--advisor-gold);
  font-size: 0.875rem;
}

.cc-advisor__sources h5 {
  margin: 6px 0 0;
  color: var(--advisor-ink);
  font-size: 0.8125rem;
}

.cc-advisor__sources a {
  display: inline-block;
  max-width: 100%;
  padding-block: 4px;
  color: var(--advisor-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cc-advisor__locator {
  color: var(--advisor-muted);
  font-size: 0.8125rem;
}
.cc-plot { padding: 10px 0; }
.cc-plot-label, .cc-plot-range { margin: 5px 0; color: var(--advisor-muted); font-size: 11px; }
.cc-plot-grid {
  position: relative;
  isolation: isolate;
  height: 170px;
  margin: 8px 4px;
  border: 1px solid var(--advisor-line);
  background: repeating-linear-gradient(0deg, transparent 0 24%, #34504a 25% 25.4%);
  touch-action: pan-y;
  cursor: crosshair;
}
.cc-plot-point {
  display: grid;
  position: absolute;
  z-index: var(--cc-mark-layer, 1);
  width: max(14px, var(--cc-mark-size, 14px));
  height: max(14px, var(--cc-mark-size, 14px));
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  transform: translate(-50%, -50%);
}
.cc-plot-mark,
.cc-plot-point::before {
  flex: 0 0 auto;
  width: var(--cc-mark-size, 14px);
  height: var(--cc-mark-size, 14px);
  border: 2px solid var(--advisor-bg);
  border-radius: 50%;
  background: var(--cc-mark-color, var(--advisor-accent));
}
.cc-plot-point::before { content: ""; pointer-events: none; }
.cc-plot-mark.cc-plot-size-missing,
.cc-plot-size-missing::before {
  outline: 1px dashed var(--advisor-ink);
}
.cc-plot-point--muted { z-index: 0; opacity: .28; }
.cc-plot-point:hover, .cc-plot-point:focus-visible { z-index: 26; opacity: 1; }
.cc-plot-point:hover::before { border-color: var(--advisor-gold); }
.cc-plot-brush { position: absolute; z-index: 27; border: 1px solid var(--advisor-gold); background: #a6d8c044; pointer-events: none; }
.cc-advisor .cc-plot-clear { display: inline-block; }

.cc-plot-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: 6px 12px;
  margin-block: 8px;
  color: var(--advisor-muted);
  font-size: 0.75rem;
}
.cc-plot-legend-item {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid var(--advisor-line);
  border-radius: 6px;
  overflow-wrap: anywhere;
}
.cc-plot-legend-item strong { color: var(--advisor-ink); font-weight: 600; }
.cc-plot-legend-bounds {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 3px 8px;
  font-variant-numeric: tabular-nums;
}
.cc-plot-legend-ramp {
  flex: 0 0 100%;
  height: 5px;
  border-radius: 3px;
}
.cc-plot-legend-sample {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cc-advisor--docked {
  position: fixed;
  inset: var(--topbar-h, 42px) 0 0 auto;
  margin: 0;
  z-index: 29;
  width: min(500px, 45vw);
  height: auto;
  border-radius: 0;
}
.cc-advisor--docked .cc-advisor__body { display: block; overflow: auto; }
.cc-advisor--docked .cc-advisor__work,
.cc-advisor--docked .cc-advisor__details { padding: 16px 20px; overflow: visible; }
.cc-advisor--docked .cc-advisor__header { padding: 14px 20px; }
.cc-advisor--docked .cc-advisor__details { border: 0; border-top: 1px solid var(--advisor-line); }
.cc-advisor--docked .cc-advisor__list { max-height: 260px; overflow: auto; }
.cc-advisor--docked .cc-advisor__back { display: inline-block; margin-bottom: 12px; }

@media (max-width: 680px) {
  .cc-advisor {
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    height: calc(100dvh - 16px);
    border-radius: 12px;
  }

  .cc-advisor__header {
    padding: 12px 13px 6px;
  }

  .cc-advisor__nav {
    gap: 0 10px;
    padding-inline: 12px;
  }

  .cc-advisor__theme {
    padding-inline: 2px;
  }

  .cc-advisor__body {
    display: block;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .cc-advisor__work,
  .cc-advisor__details {
    overflow: visible;
    padding: 14px 13px 20px;
  }

  .cc-advisor__field {
    flex-basis: 123px;
  }

  .cc-advisor__field :is(input, select) {
    font-size: 1rem;
  }

  .cc-advisor__list {
    max-height: min(22rem, 44dvh);
    overflow-y: auto;
    padding: 2px 3px 3px;
  }

  .cc-advisor__details {
    border: 0;
    border-top: 1px solid var(--advisor-line);
  }

  .cc-advisor__back {
    display: inline-block;
    margin: 0 0 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cc-advisor[open] {
    animation: none;
  }
}
