/* ---------------------------------------------------------------------------
   Design tokens — light mode (default)
   --------------------------------------------------------------------------- */
:root {
  --bg: #fff;
  --bg-surface: #f5f5f5;
  --bg-hover: #f0f0f0;
  --bg-card: #fff;
  --bg-input: #fff;
  --bg-param: #f9f9f9;

  --text: #333;
  --text-secondary: #555;
  --text-muted: #666;
  --text-faint: #888;

  --border: #ccc;
  --border-light: #e0e0e0;
  --border-input: #ccc;

  --accent: #0078d4;
  --accent-hover: #106ebe;
  --accent-bg: #f0f6ff;

  --success-bg: #dff6dd;
  --success-text: #1e7a1e;
  --error-bg: #fde7e9;
  --error-text: #a4262c;
  --danger-text: #a44;
  --danger-border: #daa;
  --danger-bg-hover: #fdf5f5;

  --shadow: rgba(0, 0, 0, 0.15);
  --code-text: #444;
}

/* ---------------------------------------------------------------------------
   Dark mode
   --------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1e1e1e;
    --bg-surface: #2a2a2a;
    --bg-hover: #333;
    --bg-card: #252525;
    --bg-input: #2a2a2a;
    --bg-param: #2a2a2a;

    --text: #e0e0e0;
    --text-secondary: #bbb;
    --text-muted: #999;
    --text-faint: #777;

    --border: #444;
    --border-light: #3a3a3a;
    --border-input: #555;

    --accent: #4ea8f0;
    --accent-hover: #3a96de;
    --accent-bg: #1a3050;

    --success-bg: #1a3a1a;
    --success-text: #5cb85c;
    --error-bg: #3a1a1a;
    --error-text: #e87070;
    --danger-text: #e87070;
    --danger-border: #664;
    --danger-bg-hover: #352020;

    --shadow: rgba(0, 0, 0, 0.4);
    --code-text: #bbb;
  }
}

/* ---------------------------------------------------------------------------
   Base
   --------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  padding: 16px;
}

header {
  margin-bottom: 24px;
  position: relative;
}

.header-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.header-logo {
  width: 24px;
  height: 24px;
}

h1 {
  font-size: 20px;
  font-weight: 600;
}

h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.hidden {
  display: none;
}

/* ---------------------------------------------------------------------------
   Hamburger menu
   --------------------------------------------------------------------------- */
.menu-toggle {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.menu-toggle:hover:not(:disabled) {
  background: var(--bg-hover);
  border-radius: 4px;
}

.menu-dropdown {
  display: none;
  position: absolute;
  top: 36px;
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  box-shadow: 0 4px 12px var(--shadow);
  min-width: 180px;
  z-index: 100;
  padding: 4px 0;
  flex-direction: column;
}

.menu-dropdown.open {
  display: flex;
}

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.menu-item:hover:not(:disabled) {
  background: var(--bg-hover);
}

.menu-item.disabled,
.menu-item:disabled {
  color: var(--text-faint);
  cursor: default;
  opacity: 1;
}

.menu-divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 0;
}

.menu-version {
  display: block;
  padding: 6px 16px 8px;
  font-size: 11px;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------------------
   Profile badge (header)
   --------------------------------------------------------------------------- */
.profile-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-bg);
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

/* ---------------------------------------------------------------------------
   Profile settings
   --------------------------------------------------------------------------- */
.profile-select-row {
  margin-bottom: 8px;
}

.profile-select-group {
  display: flex;
  gap: 4px;
  align-items: stretch;
}

.profile-select-group select {
  flex: 1;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border-input);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text);
  outline: none;
}

.profile-select-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.profile-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.profile-actions .btn-primary {
  flex: 1;
}

.btn-secondary-sm {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 8px 10px;
  white-space: nowrap;
}

.btn-danger-text {
  background: none;
  border: none;
  color: var(--danger-text);
  font-size: 12px;
  padding: 8px 4px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-danger-text:hover:not(:disabled) {
  text-decoration: underline;
  background: none;
}

.btn-danger-confirm {
  color: #fff;
  background: var(--error-text);
  border: 1px solid var(--error-text);
  border-radius: 4px;
  padding: 4px 8px;
}

.btn-danger-confirm:hover:not(:disabled) {
  background: var(--error-text);
  opacity: 0.9;
}

.confirm-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--danger-text);
  padding: 5px 0;
}

/* ---------------------------------------------------------------------------
   Status badge
   --------------------------------------------------------------------------- */
.status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 12px;
  display: inline-block;
}

.status.connected {
  background: var(--success-bg);
  color: var(--success-text);
}

.status.disconnected {
  background: var(--error-bg);
  color: var(--error-text);
}

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */
button {
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: var(--bg-hover);
}

button:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  margin-top: 8px;
  width: 100%;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
}

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 10px;
  font-size: 14px;
  min-width: 40px;
}

.btn-icon:hover:not(:disabled) {
  background: var(--bg-hover);
}

/* ---------------------------------------------------------------------------
   Settings panel
   --------------------------------------------------------------------------- */
#settings-panel label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  margin-top: 12px;
}

#settings-panel input {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border-input);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

#settings-panel input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.api-key-row {
  display: flex;
  gap: 4px;
}

.api-key-row input {
  flex: 1;
}

.api-key-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  min-height: 0;
}

.api-key-hint:not(:empty) {
  min-height: 16px;
}

.settings-save-status {
  font-size: 12px;
  color: var(--success-text);
  text-align: center;
  margin-top: 8px;
  min-height: 0;
}

.user-id-row {
  display: flex;
  gap: 4px;
}

.user-id-row input {
  flex: 1;
  background: var(--bg-surface);
  color: var(--text-muted);
}

/* ---------------------------------------------------------------------------
   Ad-hoc query panel
   --------------------------------------------------------------------------- */
.query-section {
  margin-bottom: 24px;
}

.query-section label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  margin-top: 8px;
}

.query-section input,
.query-section textarea {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border-input);
  border-radius: 6px;
  margin-bottom: 4px;
  background: var(--bg-surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.query-section .cell-input-row input {
  width: auto;
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.query-section select {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border-input);
  border-radius: 6px;
  margin-bottom: 4px;
  background: var(--bg-surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.query-section input:focus,
.query-section textarea:focus,
.query-section select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.query-section input[readonly] {
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: default;
}

.query-section input[readonly]:focus {
  border-color: var(--border-input);
  box-shadow: none;
}

.query-section textarea {
  font-family: "Cascadia Code", "SF Mono", monospace;
  resize: vertical;
}

.query-section > button {
  margin-top: 8px;
  width: 100%;
}

.query-status {
  font-size: 12px;
  margin-top: 8px;
  min-height: 18px;
}

.query-status.loading {
  color: var(--text-muted);
}

.query-status.success {
  color: var(--success-text);
}

.query-status.error {
  color: var(--error-text);
}

.output {
  background: var(--bg-surface);
  border-radius: 6px;
  padding: 12px;
}

#output {
  font-family: "Cascadia Code", "SF Mono", monospace;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--code-text);
}

/* ---------------------------------------------------------------------------
   Query list panel
   --------------------------------------------------------------------------- */
.query-list-status {
  font-size: 12px;
  margin-top: 8px;
  min-height: 0;
  padding: 0;
  border-radius: 6px;
  transition: padding 0.15s, min-height 0.15s;
}

.query-list-status:not(:empty) {
  padding: 8px 10px;
  min-height: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
}

.query-list-actions {
  margin-top: 12px;
  display: flex;
  gap: 6px;
}

.query-list-actions button {
  flex: 1;
  margin-top: 0;
  width: auto;
}

.query-list-empty {
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  padding: 24px 0;
}

.onboarding-card {
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 16px;
  background: var(--bg-card);
}

.onboarding-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.onboarding-card p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.onboarding-card label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.onboarding-card input {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border-input);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text);
  outline: none;
}

.onboarding-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.onboarding-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

.onboarding-hint a {
  color: var(--accent);
}

.query-card {
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--bg-card);
}

.query-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.query-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.query-card-reorder {
  display: flex;
  gap: 2px;
}

.btn-move {
  background: none;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 9px;
  padding: 1px 5px;
  line-height: 1;
  cursor: pointer;
  border-radius: 3px;
}

.btn-move:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-move:disabled {
  opacity: 0.3;
  cursor: default;
}

.query-card-sql {
  font-family: "Cascadia Code", "SF Mono", monospace;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

.query-card-last-run {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.query-card-last-run.success {
  color: var(--success-text);
}

.query-card-last-run.error {
  color: var(--error-text);
}

.query-card-actions {
  display: flex;
  gap: 4px;
}

.btn-duplicate {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text-secondary);
}

.btn-duplicate:hover:not(:disabled) {
  background: var(--bg-hover);
}

.query-card-actions button {
  flex: 1;
  padding: 5px 6px;
  font-size: 12px;
}

.btn-run {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-run:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-edit {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text-secondary);
}

.btn-edit:hover:not(:disabled) {
  background: var(--bg-hover);
}

.btn-delete {
  background: var(--bg-card);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.btn-delete:hover:not(:disabled) {
  background: var(--danger-bg-hover);
}

.btn-cancel {
  background: var(--bg-card);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
  margin-top: 8px;
  width: 100%;
}

.btn-cancel:hover:not(:disabled) {
  background: var(--danger-bg-hover);
}

/* ---------------------------------------------------------------------------
   Query editor panel
   --------------------------------------------------------------------------- */
.editor-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
  margin-top: 10px;
}

.editor-form input:not([type="checkbox"]),
.editor-form textarea {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border-input);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.editor-form select {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border-input);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.editor-form input:not([type="checkbox"]):focus,
.editor-form textarea:focus,
.editor-form select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.editor-form textarea {
  font-family: "Cascadia Code", "SF Mono", monospace;
  resize: vertical;
}

.editor-form select {
  background: var(--bg-surface);
}

.editor-form input[readonly] {
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: default;
}

.editor-form input[readonly]:focus {
  border-color: var(--border-input);
  box-shadow: none;
}

.editor-checkbox-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.editor-checkbox-row input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.editor-checkbox-row label {
  margin: 0;
  font-weight: normal;
}

.editor-details {
  margin-top: 12px;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 0 10px;
}

.editor-details summary {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px 0;
}

.editor-details[open] summary {
  margin-bottom: 4px;
}

.editor-details[open] {
  padding-bottom: 10px;
}

.editor-actions {
  margin-top: 12px;
  display: flex;
  gap: 6px;
}

.editor-actions button {
  flex: 1;
}

/* ---------------------------------------------------------------------------
   Parameter rows
   --------------------------------------------------------------------------- */
.param-row {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-bottom: 6px;
  padding: 6px 8px;
  background: var(--bg-param);
  border-radius: 4px;
  border: 1px solid var(--border-light);
}

.param-name {
  font-family: "Cascadia Code", "SF Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--code-text);
  min-width: 70px;
}

.param-row select {
  width: 80px;
  padding: 4px;
  font-size: 11px;
  border: 1px solid var(--border-input);
  border-radius: 4px;
  background: var(--bg-surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.param-row select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.param-row input:not([type="checkbox"]) {
  flex: 1;
  padding: 4px 6px;
  font-size: 11px;
  border: 1px solid var(--border-input);
  border-radius: 4px;
  min-width: 0;
  background: var(--bg-surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.param-row input:not([type="checkbox"]):focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.param-row input[readonly] {
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: default;
}

.param-row input[readonly]:focus {
  border-color: var(--border-input);
  box-shadow: none;
}

.btn-pick-cell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 6px;
  font-size: 11px;
  white-space: nowrap;
  min-width: auto;
}

.btn-pick-cell:hover:not(:disabled) {
  background: var(--bg-hover);
}

/* ---------------------------------------------------------------------------
   Cell input row (readonly input + Pick button)
   --------------------------------------------------------------------------- */
.cell-input-row {
  display: flex;
  gap: 4px;
  align-items: stretch;
}

.cell-input-row input {
  flex: 1;
  min-width: 0;
}

.cell-input-row .btn-pick-cell {
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 6px;
}

.pick-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.editor-actions .btn-secondary {
  margin-top: 0;
  width: auto;
}

/* ---------------------------------------------------------------------------
   CodeMirror overrides
   --------------------------------------------------------------------------- */
.cm-editor {
  border: 1px solid var(--border-input);
  border-radius: 6px;
  background: var(--bg-surface);
  max-height: 200px;
  overflow: auto;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.cm-editor.cm-focused {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

/* ---------------------------------------------------------------------------
   Validation status
   --------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------
   Connection status (settings panel)
   --------------------------------------------------------------------------- */
.connection-status {
  font-size: 12px;
  min-height: 0;
  margin-top: 8px;
  text-align: center;
}

.connection-status.success {
  color: var(--success-text);
}

.connection-status.error {
  color: var(--error-text);
}

.connection-status.loading {
  color: var(--text-muted);
}

/* ---------------------------------------------------------------------------
   Validation status
   --------------------------------------------------------------------------- */
.validation-status {
  font-size: 11px;
  min-height: 0;
  padding: 0;
  transition: padding 0.15s;
}

.validation-status:not(:empty) {
  padding: 4px 0;
}

.validation-status.checking {
  color: var(--text-muted);
}

.validation-status.valid {
  color: var(--success-text);
}

.validation-status.invalid {
  color: var(--error-text);
}

/* ---------------------------------------------------------------------------
   Preview table
   --------------------------------------------------------------------------- */
.preview-container {
  margin-top: 8px;
  max-height: 250px;
  overflow: auto;
  border: 1px solid var(--border-light);
  border-radius: 6px;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.preview-table th {
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  font-weight: 600;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.preview-table td {
  padding: 3px 8px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-table .null-val {
  color: var(--text-faint);
  font-style: italic;
}

/* ---------------------------------------------------------------------------
   History panel
   --------------------------------------------------------------------------- */
.history-entry {
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  background: var(--bg-card);
}

.history-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.history-entry-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.history-entry-status {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.history-entry-status.success {
  color: var(--success-text);
}

.history-entry-status.error {
  color: var(--error-text);
}

.history-entry-meta {
  font-size: 11px;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------------------
   Schema Browser
   --------------------------------------------------------------------------- */
.schema-search {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border-input);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text);
  outline: none;
  margin-bottom: 10px;
  -webkit-appearance: none;
  appearance: none;
}

.schema-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.schema-groups {
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

.schema-group {
  margin-bottom: 12px;
}

.schema-group-header {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.schema-group-count {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--accent-bg);
  color: var(--accent);
}

.schema-table {
  border: 1px solid var(--border-light);
  border-radius: 6px;
  background: var(--bg-card);
  margin-bottom: 4px;
  overflow: hidden;
}

.schema-table-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  cursor: pointer;
}

.schema-table-header:hover {
  background: var(--bg-hover);
}

.schema-table-toggle {
  font-size: 9px;
  color: var(--text-muted);
  transition: transform 0.15s;
  flex-shrink: 0;
}

.schema-table.open .schema-table-toggle {
  transform: rotate(90deg);
}

.schema-table-name {
  font-family: "Cascadia Code", "SF Mono", monospace;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schema-table-name:hover {
  color: var(--accent);
  text-decoration: underline;
}

.schema-table-col-count {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
  flex-shrink: 0;
}

.schema-table-columns {
  display: none;
  padding: 2px 10px 8px 26px;
}

.schema-table.open .schema-table-columns {
  display: block;
}

.schema-column {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 0;
}

.schema-column-name {
  font-family: "Cascadia Code", "SF Mono", monospace;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schema-column-name:hover {
  color: var(--accent);
  text-decoration: underline;
}

.schema-column-type {
  font-family: "Cascadia Code", "SF Mono", monospace;
  font-size: 11px;
  color: var(--text-faint);
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

.schema-highlight {
  background: var(--accent-bg);
  border-radius: 2px;
}

.schema-copy-toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text);
  box-shadow: 0 4px 12px var(--shadow);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 200;
}

.schema-copy-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
