@layer adapt-sdk {

  /* ════════════════════════ Dark Theme (default) ════════════════════════ */

  .adapt-signal-selector {
    --adapt-bg: #121212;
    --adapt-bg-input: #2a2a2a;
    --adapt-bg-dropdown: #1e1e1e;
    --adapt-bg-header: rgba(30, 30, 30, 0.95);
    --adapt-bg-hover: #333333;
    --adapt-bg-highlighted: rgba(255, 247, 0, 0.1);
    --adapt-text: #ffffff;
    --adapt-text-secondary: rgba(255, 255, 255, 0.6);
    --adapt-text-muted: rgba(255, 255, 255, 0.35);
    --adapt-border: #3a3a3a;
    --adapt-border-focus: #FFF700;
    --adapt-border-error: #ff6b6b;
    --adapt-ring-focus: rgba(255, 247, 0, 0.25);
    --adapt-ring-error: rgba(255, 107, 107, 0.25);
    --adapt-color-standard: #5cb85c;
    --adapt-color-failure: #ff6b6b;
    --adapt-color-stream: #5bc0de;
    --adapt-chip-bg: #1e1e1e;
    --adapt-chip-border: #3a3a3a;
    --adapt-chip-text: rgba(255, 255, 255, 0.6);
    --adapt-chip-mime-bg: #052e16;
    --adapt-chip-mime-border: #166534;
    --adapt-chip-mime-text: #86efac;
    --adapt-chip-complex-bg: #172554;
    --adapt-chip-complex-border: #1e40af;
    --adapt-chip-complex-text: #93c5fd;
    --adapt-optional-bg: #451a03;
    --adapt-optional-border: #92400e;
    --adapt-optional-text: #fcd34d;
    --adapt-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --adapt-radius: 8px;
    --adapt-radius-sm: 4px;
    --adapt-radius-chip: 12px;
    --adapt-font-family: inherit;
    --adapt-font-mono: ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', monospace;
    --adapt-font-size: 14px;
    --adapt-font-size-sm: 12px;
    --adapt-font-size-xs: 10px;
    --adapt-transition: 150ms ease;
    --adapt-z-dropdown: 1000;
    --adapt-max-height: 360px;

    position: relative;
    font-family: var(--adapt-font-family);
    font-size: var(--adapt-font-size);
    color: var(--adapt-text);
    box-sizing: border-box;
  }

  .adapt-signal-selector *, .adapt-signal-selector *::before, .adapt-signal-selector *::after {
    box-sizing: border-box;
  }

  /* ════════════════════════ Light Theme (explicit) ════════════════════════ */

  .adapt-signal-selector[data-adapt-theme="light"],
  [data-adapt-theme="light"] .adapt-signal-selector {
    --adapt-bg: #ffffff;
    --adapt-bg-input: #ffffff;
    --adapt-bg-dropdown: #ffffff;
    --adapt-bg-header: rgba(248, 250, 252, 0.95);
    --adapt-bg-hover: #f1f5f9;
    --adapt-bg-highlighted: rgba(204, 170, 0, 0.12);
    --adapt-text: #0f172a;
    --adapt-text-secondary: #475569;
    --adapt-text-muted: #94a3b8;
    --adapt-border: #cbd5e1;
    --adapt-border-focus: #CCAA00;
    --adapt-border-error: #ef4444;
    --adapt-ring-focus: rgba(204, 170, 0, 0.3);
    --adapt-ring-error: rgba(239, 68, 68, 0.2);
    --adapt-color-standard: #16a34a;
    --adapt-color-failure: #dc2626;
    --adapt-color-stream: #2563eb;
    --adapt-chip-bg: #f1f5f9;
    --adapt-chip-border: #e2e8f0;
    --adapt-chip-text: #475569;
    --adapt-chip-mime-bg: #ecfdf5;
    --adapt-chip-mime-border: #a7f3d0;
    --adapt-chip-mime-text: #065f46;
    --adapt-chip-complex-bg: #eff6ff;
    --adapt-chip-complex-border: #bfdbfe;
    --adapt-chip-complex-text: #1e40af;
    --adapt-optional-bg: #fef3c7;
    --adapt-optional-border: #fcd34d;
    --adapt-optional-text: #92400e;
    --adapt-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
  }

  /* ════════════════════════ Input ════════════════════════ */

  .adapt-signal-selector-input {
    width: 100%;
    padding: 10px 12px;
    font-family: var(--adapt-font-mono);
    font-size: var(--adapt-font-size);
    color: var(--adapt-text);
    background: var(--adapt-bg-input);
    border: 1.5px solid var(--adapt-border);
    border-radius: var(--adapt-radius);
    outline: none;
    box-sizing: border-box;
    transition:
      border-color var(--adapt-transition),
      box-shadow var(--adapt-transition);
  }

  .adapt-signal-selector-input::placeholder {
    color: var(--adapt-text-muted);
  }

  .adapt-signal-selector-input:focus {
    border-color: var(--adapt-border-focus);
    box-shadow: 0 0 0 3px var(--adapt-ring-focus);
  }

  .adapt-signal-selector--error .adapt-signal-selector-input {
    border-color: var(--adapt-border-error);
  }

  .adapt-signal-selector--error .adapt-signal-selector-input:focus {
    border-color: var(--adapt-border-error);
    box-shadow: 0 0 0 3px var(--adapt-ring-error);
  }

  .adapt-signal-selector-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .adapt-signal-selector-input--hidden {
    position: absolute;
    clip: rect(0, 0, 0, 0);
    width: 1px;
    height: 1px;
    overflow: hidden;
    white-space: nowrap;
  }

  /* ════════════════════════ Selected value display ════════════════════════ */

  .adapt-signal-selector-selected {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    background: var(--adapt-bg-input);
    border: 1.5px solid var(--adapt-border);
    border-radius: var(--adapt-radius);
    cursor: pointer;
    transition:
      border-color var(--adapt-transition),
      box-shadow var(--adapt-transition);
    min-width: 0;
  }

  .adapt-signal-selector-selected:hover {
    border-color: var(--adapt-border-focus);
    box-shadow: 0 0 0 3px var(--adapt-ring-focus);
  }

  .adapt-signal-selector-selected--disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
  }

  .adapt-signal-selector:focus-within .adapt-signal-selector-selected {
    border-color: var(--adapt-border-focus);
    box-shadow: 0 0 0 3px var(--adapt-ring-focus);
  }

  .adapt-signal-selector-selected-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
  }

  .adapt-signal-selector-selected-dot--standard {
    background: var(--adapt-color-standard);
  }

  .adapt-signal-selector-selected-dot--failure {
    background: var(--adapt-color-failure);
  }

  .adapt-signal-selector-selected-dot--stream {
    background: var(--adapt-color-stream);
  }

  .adapt-signal-selector-selected-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .adapt-signal-selector-selected-icon img,
  .adapt-signal-selector-selected-icon svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 2px;
  }

  .adapt-signal-selector-selected-node {
    font-weight: 600;
    color: var(--adapt-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
  }

  .adapt-signal-selector-selected-sep {
    color: var(--adapt-text-muted);
    font-size: 16px;
    flex-shrink: 0;
  }

  .adapt-signal-selector-selected-signal {
    font-weight: 500;
    color: var(--adapt-text-secondary);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .adapt-signal-selector-selected-clear {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--adapt-text-muted);
    opacity: 0.5;
    font-size: 14px;
    line-height: 1;
    transition:
      opacity var(--adapt-transition),
      background var(--adapt-transition),
      color var(--adapt-transition);
  }

  .adapt-signal-selector-selected-clear:hover {
    opacity: 1;
    background: var(--adapt-bg-hover);
    color: var(--adapt-text);
  }

  /* ════════════════════════ Error message ════════════════════════ */

  .adapt-signal-selector-error {
    display: block;
    margin-top: 4px;
    font-size: var(--adapt-font-size-sm);
    color: var(--adapt-border-error);
  }

  /* ════════════════════════ Dropdown ════════════════════════ */

  .adapt-signal-selector-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--adapt-bg-dropdown);
    border: 1.5px solid var(--adapt-border);
    border-radius: var(--adapt-radius);
    box-shadow: var(--adapt-shadow);
    max-height: var(--adapt-max-height);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: var(--adapt-z-dropdown);
  }

  .adapt-signal-selector-dropdown::-webkit-scrollbar {
    width: 6px;
  }

  .adapt-signal-selector-dropdown::-webkit-scrollbar-track {
    background: transparent;
  }

  .adapt-signal-selector-dropdown::-webkit-scrollbar-thumb {
    background: var(--adapt-border);
    border-radius: 3px;
  }

  .adapt-signal-selector-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--adapt-text-muted);
  }

  /* ════════════════════════ Group header ════════════════════════ */

  .adapt-signal-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--adapt-bg-header);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--adapt-border);
    position: sticky;
    top: 0;
    z-index: 1;
    user-select: none;
  }

  .adapt-signal-group-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .adapt-signal-group-icon img,
  .adapt-signal-group-icon svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--adapt-radius-sm);
  }

  .adapt-signal-group-node-label {
    font-weight: 600;
    color: var(--adapt-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .adapt-signal-group-node-id {
    font-family: var(--adapt-font-mono);
    font-size: var(--adapt-font-size-xs);
    color: var(--adapt-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
  }

  .adapt-signal-group-separator {
    width: 1px;
    height: 12px;
    background: var(--adapt-border);
    flex-shrink: 0;
  }

  .adapt-signal-group-transmitter {
    font-family: var(--adapt-font-mono);
    font-size: var(--adapt-font-size-sm);
    font-weight: 500;
    white-space: nowrap;
  }

  .adapt-signal-group-transmitter--standard {
    color: var(--adapt-color-standard);
  }

  .adapt-signal-group-transmitter--failure {
    color: var(--adapt-color-failure);
  }

  .adapt-signal-group-transmitter--stream {
    color: var(--adapt-color-stream);
  }

  /* ════════════════════════ Option ════════════════════════ */

  .adapt-signal-selector-option {
    padding: 8px 12px 8px 20px;
    cursor: pointer;
    transition: background-color var(--adapt-transition);
  }

  .adapt-signal-selector-option:hover {
    background: var(--adapt-bg-hover);
  }

  .adapt-signal-selector-option--highlighted {
    background: var(--adapt-bg-highlighted);
  }

  .adapt-signal-option-label {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
  }

  .adapt-signal-option-name {
    font-weight: 600;
    color: var(--adapt-text);
  }

  .adapt-signal-option-code {
    font-family: var(--adapt-font-mono);
    font-size: var(--adapt-font-size-sm);
    color: var(--adapt-text-muted);
  }

  .adapt-signal-option-optional {
    font-size: var(--adapt-font-size-xs);
    font-weight: 500;
    padding: 1px 6px;
    border-radius: var(--adapt-radius-chip);
    background: var(--adapt-optional-bg);
    border: 1px solid var(--adapt-optional-border);
    color: var(--adapt-optional-text);
    line-height: 1.4;
  }

  /* ════════════════════════ Format chips ════════════════════════ */

  .adapt-signal-format-viewer {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 4px;
  }

  .adapt-signal-format-chip {
    display: inline-flex;
    align-items: center;
    font-size: var(--adapt-font-size-xs, 10px);
    font-family: var(--adapt-font-mono, ui-monospace, 'SF Mono', Monaco, 'Cascadia Code', monospace);
    padding: 1px 8px;
    border-radius: var(--adapt-radius-chip, 12px);
    background: var(--adapt-chip-bg, #1e1e1e);
    border: 1px solid var(--adapt-chip-border, #3a3a3a);
    color: var(--adapt-chip-text, rgba(255, 255, 255, 0.6));
    line-height: 1.5;
    white-space: nowrap;
  }

  .adapt-signal-format-chip--mime {
    background: var(--adapt-chip-mime-bg, #052e16);
    border-color: var(--adapt-chip-mime-border, #166534);
    color: var(--adapt-chip-mime-text, #86efac);
  }

  .adapt-signal-format-chip--primitive {
    background: var(--adapt-chip-bg, #1e1e1e);
    border-color: var(--adapt-chip-border, #3a3a3a);
    color: var(--adapt-chip-text, rgba(255, 255, 255, 0.6));
  }

  .adapt-signal-format-chip--complex {
    background: var(--adapt-chip-complex-bg, #172554);
    border-color: var(--adapt-chip-complex-border, #1e40af);
    color: var(--adapt-chip-complex-text, #93c5fd);
    cursor: pointer;
  }

  .adapt-signal-format-chip--complex:hover {
    filter: brightness(1.1);
  }

  .adapt-signal-format-chip--medium {
    font-size: var(--adapt-font-size-sm, 12px);
    padding: 2px 10px;
  }

  .adapt-signal-format-chip-delete {
    margin-left: 4px;
    cursor: pointer;
    opacity: 0.6;
    font-size: 12px;
    line-height: 1;
    transition: opacity var(--adapt-transition, 150ms ease);
  }

  .adapt-signal-format-chip-delete:hover {
    opacity: 1;
  }

  .adapt-signal-format-overflow {
    font-size: var(--adapt-font-size-xs, 10px);
    color: var(--adapt-text-muted, rgba(255, 255, 255, 0.35));
    padding-left: 2px;
  }

  /* ════════════════════════ No results ════════════════════════ */

  .adapt-signal-selector-no-results {
    padding: 20px 16px;
    text-align: center;
    color: var(--adapt-text-muted);
    font-size: var(--adapt-font-size-sm);
  }
}
