/* ==========================================================================
   Design system reference (/design-system/)
   Loaded after main.css; every component here is built from the site tokens.
   ========================================================================== */

.page-design-system .article {
  max-width: 880px;
}

.ds-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 26px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-subtle);
}

.ds-toolbar-label {
  margin: 0 4px 0 6px;
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ds-seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
}

.ds-seg button {
  padding: 5px 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
}

.ds-seg button[aria-pressed="true"] {
  background: var(--bg-inset);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.ds-seg button:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 1px;
}

.ds-toolbar-note {
  margin: 0 6px 0 auto;
  color: var(--text-faint);
  font-size: 12px;
}

.ds-credit {
  color: var(--text-faint);
  font-size: 12.5px;
}

.ds-credit a {
  color: var(--text-muted);
}

.ds-stage {
  margin: 0 0 16px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
}

.ds-stage--plain {
  background: var(--bg);
}

.ds-stage-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 18px;
}

.ds-stage-head p {
  margin: 0;
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ds-stage-head span {
  color: var(--text-faint);
  font-size: 12px;
}

.ds-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

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

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

.ds-hint {
  margin: 10px 0 0;
  color: var(--text-faint);
  font-size: 12.5px;
  line-height: 1.55;
}

.ds-subhead {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 620;
}

/* Buttons ----------------------------------------------------------------- */

.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.ds-btn:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}

.ds-btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.ds-btn-primary:hover {
  background: var(--accent-hover);
}

.ds-btn-neutral {
  background: var(--neutral-fill);
  color: var(--neutral-ink);
}

.ds-btn-neutral:hover {
  background: var(--neutral-fill-hover);
}

.ds-btn-danger {
  background: var(--danger);
  color: var(--danger-ink);
}

.ds-btn-danger:hover {
  background: var(--danger-hover);
}

.ds-btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.ds-btn-ghost:hover {
  background: var(--bg-inset);
  color: var(--text);
}

.ds-btn-outline {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}

.ds-btn-outline:hover {
  border-color: var(--accent-line);
  color: var(--accent-text);
}

.ds-btn[disabled],
.ds-btn.is-disabled {
  background: var(--disabled-bg);
  border-color: transparent;
  color: var(--text-faint);
  cursor: not-allowed;
}

.ds-btn-lg {
  height: 42px;
  padding: 0 22px;
  font-size: 14.5px;
  border-radius: 12px;
}

.ds-btn-sm {
  height: 30px;
  padding: 0 12px;
  font-size: 12.5px;
  border-radius: 9px;
}

.ds-btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  letter-spacing: 0.06em;
}

.ds-btn-icon:hover {
  background: var(--bg-inset);
  color: var(--text);
}

.ds-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ds-btn-on-accent {
  background: #fff;
  color: #0d3f2c;
}

.ds-btn-on-accent:hover {
  background: #eefaf3;
}

/* Fields ------------------------------------------------------------------ */

.ds-field {
  display: block;
  margin: 0 0 14px;
}

.ds-field:last-child {
  margin-bottom: 0;
}

.ds-field-label {
  display: block;
  margin: 0 0 6px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
}

.ds-input,
.ds-select,
.ds-textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ds-textarea {
  min-height: 82px;
  resize: vertical;
  line-height: 1.55;
}

.ds-input::placeholder,
.ds-textarea::placeholder {
  color: var(--text-faint);
}

.ds-input:focus,
.ds-select:focus,
.ds-textarea:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.ds-select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b8291' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 14px;
}

.ds-help {
  margin: 6px 0 0;
  color: var(--text-faint);
  font-size: 12px;
}

.ds-field.is-error .ds-input {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.ds-field.is-error .ds-help {
  color: var(--danger);
}

.ds-check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text-muted);
  font-size: 13.5px;
  cursor: pointer;
}

.ds-check input {
  position: relative;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-elevated);
  appearance: none;
  cursor: pointer;
}

.ds-check input:checked {
  border-color: var(--accent);
  background: var(--accent);
}

.ds-check input:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid var(--accent-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(43deg);
}

.ds-check input:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}

.ds-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13.5px;
}

.ds-switch-row:last-child {
  border-bottom: 0;
}

.ds-switch-row strong {
  display: block;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
}

.ds-switch-row small {
  display: block;
  color: var(--text-faint);
  font-size: 12px;
}

.ds-switch {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: var(--neutral-fill);
  appearance: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.ds-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease;
}

.ds-switch:checked {
  background: var(--accent);
}

.ds-switch:checked::after {
  transform: translateX(16px);
}

.ds-switch:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}

/* Sliders ----------------------------------------------------------------- */

.ds-slider-block + .ds-slider-block {
  margin-top: 20px;
}

.ds-slider-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 6px;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
}

.ds-slider-head span {
  color: var(--text-faint);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.ds-slider {
  width: 100%;
  height: 22px;
  margin: 0;
  background: transparent;
  appearance: none;
  cursor: pointer;
}

.ds-slider::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    var(--accent) var(--fill, 50%),
    var(--bg-inset) var(--fill, 50%),
    var(--bg-inset) 100%
  );
}

.ds-slider::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: var(--bg-inset);
}

.ds-slider::-moz-range-progress {
  height: 5px;
  border-radius: 999px;
  background: var(--accent);
}

.ds-slider::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  margin-top: -5.5px;
  border: 2px solid var(--bg-elevated);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 3px rgba(12, 16, 24, 0.25);
  appearance: none;
}

.ds-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid var(--bg-elevated);
  border-radius: 50%;
  background: var(--accent);
}

.ds-slider:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 4px;
}

.ds-ticks {
  display: flex;
  justify-content: space-between;
  margin: 6px 0 0;
  color: var(--text-faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* Composer ---------------------------------------------------------------- */

.ds-composer {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.ds-composer textarea {
  display: block;
  width: 100%;
  min-height: 74px;
  padding: 15px 18px 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  line-height: 1.55;
  resize: none;
  outline: none;
}

.ds-composer textarea::placeholder {
  color: var(--text-faint);
}

.ds-composer-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 10px 12px;
}

.ds-composer-spacer {
  flex: 1;
}

.ds-model {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.ds-model:hover {
  background: var(--bg-inset);
  color: var(--text);
}

.ds-model svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.ds-send {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}

.ds-send:hover {
  background: var(--accent-hover);
}

.ds-send svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ds-composer-note {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 9px 2px 0;
  color: var(--text-faint);
  font-size: 11.5px;
}

.ds-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-inset);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 550;
}

/* Dashboard --------------------------------------------------------------- */

.ds-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--bg-inset);
}

.ds-tabs button {
  padding: 6px 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
}

.ds-tabs button.is-active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.ds-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 0;
}

.ds-stat {
  padding: 14px 14px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-elevated);
}

.ds-stat-label {
  margin: 0 0 6px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.ds-stat-value {
  margin: 0;
  color: var(--text);
  font-size: 21px;
  font-weight: 660;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.ds-stat-delta {
  margin: 4px 0 0;
  color: var(--accent-text);
  font-size: 11.5px;
}

.ds-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 76px;
  margin: 16px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
}

.ds-bar {
  flex: 1;
  min-height: 5px;
  border: 1px solid var(--accent-line);
  border-radius: 7px 7px 3px 3px;
  background: var(--accent-soft);
}

.ds-bar.is-peak {
  border-color: transparent;
  background: var(--accent);
}

.ds-table-mini {
  width: 100%;
  margin: 16px 0 0;
  border-collapse: collapse;
  font-size: 12.5px;
}

.ds-table-mini th {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-align: left;
}

.ds-table-mini td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

.ds-table-mini tr:last-child td {
  border-bottom: 0;
}

/* Accent, swatches, tokens ------------------------------------------------ */

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

.ds-swatch {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
}

.ds-swatch-chip {
  height: 58px;
  border-bottom: 1px solid var(--border);
}

.ds-swatch-meta {
  padding: 8px 10px 9px;
}

.ds-swatch-name {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.ds-swatch-value {
  margin: 2px 0 0;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11px;
}

.ds-scale {
  display: flex;
  height: 34px;
  margin: 14px 0 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.ds-scale span {
  flex: 1;
}

.ds-scale-note {
  display: flex;
  justify-content: space-between;
  margin: 6px 0 0;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.ds-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.ds-pane {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
  color: var(--text);
}

.ds-pane:not(.ds-pane--dark) {
  color-scheme: light;
  --chrome: #e3e7e4;
  --bg: #f0f2ef;
  --bg-subtle: #e9ede8;
  --bg-inset: #e3e8e1;
  --bg-elevated: #f7f8f5;
  --selected: #dce3d8;
  --text: #232b26;
  --text-muted: #526057;
  --text-faint: #5e6a60;
  --border: #d8ded8;
  --border-strong: #bac5b6;
  --accent: #b5cea5;
  --accent-hover: #a6c293;
  --accent-text: #4e653f;
  --accent-soft: #e1e9db;
  --accent-line: #a0b590;
  --accent-ink: #232b26;
  --neutral-fill: #dfe5dc;
  --neutral-fill-hover: #d4ddce;
  --neutral-ink: #232b26;
  --danger: #a13a3a;
  --danger-hover: #852c2c;
  --danger-soft: #f5e4e0;
  --danger-ink: #fff;
  --disabled-bg: #e3e8e1;
  --warn: #8b610f;
  --code-bg: #e9ede8;
  --code-border: #d1dacd;
  --shadow-sm: 0 2px 6px rgb(28 33 27 / 4%);
  --shadow-lg: 0 24px 72px -20px rgb(28 33 27 / 22%);
  --logo-filter: brightness(0) invert(.16);
}

.ds-pane--dark {
  --chrome: #292b2a;
  --bg: #1c1d1c;
  --bg-subtle: #222423;
  --bg-inset: #282a29;
  --bg-elevated: #252725;
  --selected: #363a35;
  --text: #dedfdd;
  --text-muted: #b3b8b1;
  --text-faint: #a0a69e;
  --border: #2f322f;
  --border-strong: #484d46;
  --accent: #b5cea5;
  --accent-hover: #c5dbb7;
  --accent-text: #b5cea5;
  --accent-soft: #2d3529;
  --accent-line: #4b5a42;
  --accent-ink: #1c211b;
  --neutral-fill: #363a35;
  --neutral-fill-hover: #41473e;
  --neutral-ink: #dedfdd;
  --danger: #e7a3a3;
  --danger-hover: #f0b6b6;
  --danger-soft: #392a29;
  --danger-ink: #251b1b;
  --disabled-bg: #282a29;
  --warn: #f5c86f;
  --code-bg: #222423;
  --code-border: #353a33;
  --shadow-sm: 0 2px 6px rgb(0 0 0 / 8%);
  --shadow-lg: 0 24px 72px -20px rgb(0 0 0 / 48%);
}

.ds-pane-label {
  margin: 0 0 14px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ds-pane h4 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 640;
  letter-spacing: -0.01em;
}

.ds-pane p {
  margin: 0 0 14px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

/* Gradient ---------------------------------------------------------------- */

.ds-gradient {
  position: relative;
  overflow: hidden;
  margin: 0 0 16px;
  padding: 30px;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--text);
}

.ds-gradient::after {
  display: none;
}

.ds-gradient h3,
.ds-gradient p {
  position: relative;
  z-index: 1;
  color: var(--text);
}

.ds-gradient h3 {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.ds-gradient p {
  max-width: 46ch;
  margin: 0 0 18px;
  font-size: 14px;
  opacity: 0.9;
}

.ds-gradient .ds-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* Thinking ---------------------------------------------------------------- */

.ds-think {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-subtle);
}

.ds-think summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 550;
  list-style: none;
  cursor: pointer;
}

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

.ds-think summary svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  transition: transform 0.15s ease;
}

.ds-think[open] summary svg {
  transform: rotate(90deg);
}

.ds-think-time {
  margin-left: auto;
  color: var(--text-faint);
  font-weight: 450;
  font-variant-numeric: tabular-nums;
}

.ds-think-body {
  padding: 12px 14px 14px 36px;
  border-top: 1px dashed var(--border);
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.65;
}

.ds-think-body p {
  margin: 0 0 8px;
}

.ds-think-body p:last-child {
  margin-bottom: 0;
}

.ds-shimmer {
  height: 8px;
  margin: 8px 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--bg-inset) 20%, var(--accent-soft) 50%, var(--bg-inset) 80%);
  background-size: 220% 100%;
  animation: ds-shimmer 1.7s linear infinite;
}

.ds-shimmer:nth-child(2) {
  width: 72%;
}

.ds-shimmer:nth-child(3) {
  width: 88%;
}

.ds-shimmer:nth-child(4) {
  width: 54%;
}

@keyframes ds-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -120% 0;
  }
}

/* Overlays ---------------------------------------------------------------- */

.ds-modal {
  max-width: 360px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-lg);
}

.ds-modal-title {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.ds-modal p {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.ds-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.ds-popover {
  width: 186px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-lg);
}

.ds-popover-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 12.5px;
}

.ds-popover-item.is-active {
  background: var(--bg-inset);
  color: var(--text);
}

.ds-kbd {
  margin-left: auto;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-subtle);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.ds-popover-sep {
  height: 1px;
  margin: 5px 2px;
  background: var(--border);
}

.ds-tooltip {
  position: relative;
  display: inline-block;
  padding: 6px 10px;
  border-radius: 8px;
  background: #1b2029;
  color: #eef1f7;
  font-size: 11.5px;
  box-shadow: var(--shadow-lg);
}

.ds-tooltip::after {
  content: "";
  position: absolute;
  left: 16px;
  bottom: -4px;
  width: 8px;
  height: 8px;
  background: #1b2029;
  transform: rotate(45deg);
}

.ds-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-lg);
  color: var(--text-muted);
  font-size: 12.5px;
}

.ds-toast-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.ds-overlay-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
  gap: 18px;
  align-items: start;
}

.ds-overlay-side {
  display: grid;
  gap: 16px;
  justify-items: start;
}

/* Chat -------------------------------------------------------------------- */

.ds-chat {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ds-msg {
  max-width: 86%;
  font-size: 14px;
  line-height: 1.62;
}

.ds-msg-user {
  align-self: flex-end;
  padding: 10px 14px;
  border: 1px solid var(--accent-line);
  border-radius: 16px 16px 5px 16px;
  background: var(--accent-soft);
  color: var(--text);
}

.ds-msg-agent {
  align-self: flex-start;
  color: var(--text-muted);
}

.ds-msg-agent p {
  margin: 0 0 10px;
}

.ds-msg-agent p:last-child {
  margin-bottom: 0;
}

.ds-agent-name {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 600;
}

.ds-avatar {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 700;
}

.ds-toolrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.ds-toolrow svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
}

.ds-toolrow strong {
  color: var(--text);
  font-weight: 600;
}

.ds-code {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--code-border);
  border-radius: 10px;
  background: var(--code-bg);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.6;
  overflow-x: auto;
}

.ds-code b {
  color: var(--accent-text);
  font-weight: 550;
}

.ds-typing {
  display: inline-flex;
  gap: 4px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-elevated);
}

.ds-typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-faint);
  animation: ds-pulse 1.1s ease-out infinite;
}

.ds-typing i:nth-child(2) {
  animation-delay: 0.15s;
}

.ds-typing i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes ds-pulse {
  0%,
  70%,
  100% {
    opacity: 0.55;
  }
  35% {
    opacity: 1;
  }
}

/* Type and surfaces ------------------------------------------------------- */

.ds-type-list {
  margin: 0 0 16px;
  border-top: 1px solid var(--border);
}

.ds-type-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.ds-type-token {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11px;
}

.ds-type-sample {
  color: var(--text);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ds-type-meta {
  color: var(--text-faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ds-token-list {
  margin: 0;
  border-top: 1px solid var(--border);
}

.ds-token-row {
  display: grid;
  grid-template-columns: 104px 62px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}

.ds-token-name {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.ds-token-chip {
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 7px;
}

.ds-token-use {
  color: var(--text-muted);
}

/* Playground -------------------------------------------------------------- */

.ds-playground {
  display: grid;
  grid-template-columns: minmax(0, 236px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.ds-controls {
  display: grid;
  gap: 12px;
}

.ds-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  color: var(--text-muted);
  font-size: 12px;
}

.ds-control-wide {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.ds-control > span:first-child {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 11px;
}

.ds-control input[type="color"] {
  width: 42px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}

.ds-control input[type="range"] {
  width: 100%;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.ds-control output {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
}

.ds-preview {
  --ds-p-bg: var(--bg-elevated);
  --ds-p-text: var(--text);
  --ds-p-muted: color-mix(in srgb, var(--ds-p-text) 62%, var(--ds-p-bg));
  --ds-p-border: var(--border);
  --ds-p-accent: var(--accent);
  --ds-p-radius: 14px;
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-subtle);
}

.ds-preview-card {
  padding: 16px;
  border: 1px solid var(--ds-p-border);
  border-radius: var(--ds-p-radius);
  background: var(--ds-p-bg);
  color: var(--ds-p-text);
  box-shadow: var(--shadow-sm);
}

.ds-preview-card h4 {
  margin: 0 0 5px;
  color: var(--ds-p-text);
  font-size: 14.5px;
  font-weight: 640;
  letter-spacing: -0.01em;
}

.ds-preview-card p {
  margin: 0 0 14px;
  color: var(--ds-p-muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.ds-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ds-preview .ds-btn-primary {
  background: var(--ds-p-accent);
  color: var(--accent-ink);
  border-radius: min(var(--ds-p-radius), 14px);
}

.ds-preview .ds-btn-primary:hover {
  background: color-mix(in srgb, var(--ds-p-accent) 86%, #000);
}

.ds-preview .ds-btn-ghost {
  color: var(--ds-p-muted);
}

.ds-preview .ds-btn-ghost:hover {
  background: color-mix(in srgb, var(--ds-p-border) 55%, transparent);
  color: var(--ds-p-text);
}

.ds-preview-input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--ds-p-border);
  border-radius: min(var(--ds-p-radius), 14px);
  background: var(--ds-p-bg);
  color: var(--ds-p-text);
  font: inherit;
  font-size: 12.5px;
}

.ds-preview-input::placeholder {
  color: var(--ds-p-muted);
  opacity: 0.8;
}

.ds-preview-reset {
  justify-self: start;
}

/* Reference helpers ------------------------------------------------------- */

.ds-rules {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.ds-rules li {
  position: relative;
  margin: 0 0 8px;
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.ds-rules li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 8px;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent);
}

.ds-spec {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.7;
}

.ds-spec b {
  color: var(--text);
  font-weight: 600;
}

@media (max-width: 900px) {
  .ds-playground,
  .ds-overlay-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .ds-stage {
    padding: 18px;
  }
}

@media (max-width: 720px) {
  .ds-grid-2,
  .ds-split,
  .ds-stats {
    grid-template-columns: minmax(0, 1fr);
  }

  .ds-type-row {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 4px;
  }

  .ds-type-token {
    grid-column: 1 / -1;
  }

  .ds-toolbar-note {
    margin-left: 0;
    width: 100%;
  }

  .ds-msg {
    max-width: 100%;
  }
}

/* Icon reference grid — every mark in the shipped sprite. */
.ds-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.ds-icon-grid li {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 8px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.ds-icon-grid .icon {
  width: 22px;
  height: 22px;
  color: var(--text);
}
