/* Components: buttons, inputs, cards, badges, tables, dialogs, toasts */

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--control-height);
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: var(--text-sm);
  line-height: var(--lh-sm);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition-fast), border-color var(--transition-fast),
    color var(--transition-fast);
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

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

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--foreground);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--foreground-secondary);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--foreground);
}

.btn-danger {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }

.btn-sm {
  min-height: 32px;
  padding: 0 10px;
  font-size: var(--text-xs);
}

.btn-block { width: 100%; }

.btn .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Form fields ---------- */

.field { display: flex; flex-direction: column; gap: 6px; }

.field > label {
  font-size: var(--text-sm);
  line-height: var(--lh-sm);
  font-weight: 500;
  color: var(--foreground);
}

.field .label-hint {
  color: var(--foreground-tertiary);
  font-weight: 400;
}

.input, .select, .textarea {
  width: 100%;
  min-height: var(--control-height);
  padding: 8px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--foreground);
  font-size: var(--text-base);
  line-height: var(--lh-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.textarea { resize: vertical; line-height: 1.5; }

.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--foreground);
  box-shadow: 0 0 0 1px var(--foreground);
}

.input:disabled, .input[readonly].input-locked {
  background: var(--surface-tertiary);
  color: var(--foreground-secondary);
  cursor: not-allowed;
}

.field .helper {
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  color: var(--foreground-tertiary);
}

.field .error-text {
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  color: var(--danger);
}

.field.has-error .input, .field.has-error .select, .field.has-error .textarea {
  border-color: var(--danger);
}

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.form-grid .span-2 { grid-column: span 2; }

/* Password input with reveal toggle */

.password-wrap { position: relative; }

.password-wrap .input { padding-right: 44px; }

.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--foreground-tertiary);
  cursor: pointer;
}

.password-toggle:hover { background: var(--surface-hover); color: var(--foreground); }
.password-toggle svg { width: 16px; height: 16px; }

/* ---------- Cards & panels ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.card-header h2, .card-header h3 {
  font-size: var(--text-md);
  line-height: var(--lh-md);
  font-weight: 600;
}

.card-header .card-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.card-body { padding: var(--space-5); }
.card-body > * + * { margin-top: var(--space-4); }

.section-number {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface-tertiary);
  color: var(--foreground-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- Metric cards ---------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

.metric-card { padding: var(--space-5); }

.metric-card .metric-label {
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  font-weight: 500;
  color: var(--foreground-tertiary);
}

.metric-card .metric-value {
  margin-top: 6px;
  font-size: var(--text-2xl);
  line-height: var(--lh-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.metric-card .metric-hint {
  margin-top: 4px;
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  color: var(--foreground-tertiary);
}

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface-tertiary);
  color: var(--foreground-secondary);
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  font-weight: 500;
  white-space: nowrap;
}

.badge .badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--foreground-tertiary);
  flex-shrink: 0;
}

.badge-success { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.badge-success .badge-dot { background: var(--success); }
.badge-warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.badge-warning .badge-dot { background: var(--warning); }
.badge-danger { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }
.badge-danger .badge-dot { background: var(--danger); }

/* ---------- Product icon ---------- */

.product-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-tertiary);
  color: var(--foreground);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.product-icon svg { width: 16px; height: 16px; }

.product-icon-sm { width: 22px; height: 22px; border-radius: var(--radius-sm); }
.product-icon-sm svg { width: 13px; height: 13px; }

.product-icon-lg { width: 44px; height: 44px; }
.product-icon-lg svg { width: 24px; height: 24px; }

.product-select { display: flex; align-items: center; gap: 8px; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); line-height: var(--lh-sm); }

.table th {
  text-align: left;
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  font-weight: 500;
  color: var(--foreground-tertiary);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--transition-fast); }
.table tbody tr:hover { background: var(--surface-secondary); }
.table .cell-strong { font-weight: 500; color: var(--foreground); }
.table .cell-muted { color: var(--foreground-tertiary); font-size: var(--text-xs); }

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

/* Mobile stacked table cards */
@media (max-width: 767px) {
  .table-stacked thead { display: none; }
  .table-stacked tbody tr {
    display: block;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
  }
  .table-stacked tbody tr:last-child { border-bottom: 0; }
  .table-stacked td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: 4px 0;
    border-bottom: 0;
  }
  .table-stacked td::before {
    content: attr(data-label);
    font-size: var(--text-xs);
    color: var(--foreground-tertiary);
    flex-shrink: 0;
  }
  .table-stacked td.no-label::before { content: none; }
}

/* ---------- Toolbar / filters ---------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.toolbar .search {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.toolbar .select {
  width: auto;
  min-width: 140px;
}

.result-count {
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  color: var(--foreground-tertiary);
}

/* ---------- Empty state ---------- */

.empty-state {
  padding: var(--space-10) var(--space-6);
  text-align: center;
}

.empty-state svg {
  width: 32px;
  height: 32px;
  margin: 0 auto var(--space-3);
  color: var(--foreground-tertiary);
}

.empty-state .empty-title {
  font-size: var(--text-md);
  line-height: var(--lh-md);
  font-weight: 600;
}

.empty-state .empty-desc {
  margin-top: 4px;
  font-size: var(--text-sm);
  line-height: var(--lh-sm);
  color: var(--foreground-tertiary);
}

.empty-state .btn { margin-top: var(--space-4); }

/* ---------- Duration selector ---------- */

.duration-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
}

.duration-option {
  position: relative;
  min-height: var(--control-height);
  padding: 8px 12px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--foreground-secondary);
  font-size: var(--text-sm);
  line-height: var(--lh-sm);
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast),
    color var(--transition-fast);
}

.duration-option:hover { border-color: var(--border-strong); background: var(--surface-hover); }

.duration-option[aria-pressed="true"] {
  border-color: var(--foreground);
  background: var(--surface-tertiary);
  color: var(--foreground);
}

.duration-option[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--foreground);
}

/* ---------- Preview card ---------- */

.preview-card { overflow: hidden; }

.preview-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  background: var(--surface-secondary);
}

.preview-title {
  font-size: var(--text-md);
  line-height: var(--lh-md);
  font-weight: 600;
  min-width: 0;
  overflow-wrap: anywhere;
}

.preview-subtitle {
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  color: var(--foreground-tertiary);
  margin-top: 2px;
}

.preview-body { padding: var(--space-5); font-size: var(--text-sm); line-height: var(--lh-sm); }

.detail-rows { display: flex; flex-direction: column; }

.detail-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
}

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

.detail-row .detail-label {
  width: 140px;
  flex-shrink: 0;
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  color: var(--foreground-tertiary);
}

.detail-row .detail-value {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  color: var(--foreground);
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.preview-terms {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.preview-terms .terms-title {
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  font-weight: 600;
  color: var(--foreground-secondary);
  margin-bottom: 6px;
}

.preview-terms ol,
.preview-terms .terms-bullets {
  margin: 0;
  padding-left: 18px;
  color: var(--foreground-secondary);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.preview-terms .terms-bullets { list-style: disc; margin-bottom: var(--space-2); }
.preview-terms .terms-section-title {
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  font-weight: 600;
  color: var(--foreground-secondary);
  margin: var(--space-2) 0 4px;
}

.preview-note {
  margin-top: var(--space-4);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-secondary);
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  color: var(--foreground-secondary);
  overflow-wrap: anywhere;
}

.preview-footer {
  display: flex;
  gap: 8px;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--surface-secondary);
  flex-wrap: wrap;
}

.preview-copy-inline { margin-left: auto; }

.var-missing {
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: 3px;
  padding: 0 3px;
}

/* ---------- Textarea mono editor ---------- */

.code-editor {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.6;
}

/* ---------- Variable reference chips ---------- */

.var-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.var-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 16px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface-tertiary);
  color: var(--foreground-secondary);
  cursor: copy;
}

.var-chip:hover { border-color: var(--border-strong); color: var(--foreground); }

/* ---------- Dialog ---------- */

dialog.dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--foreground);
  padding: 0;
  width: min(440px, calc(100vw - 32px));
  box-shadow: var(--shadow-md);
}

dialog.dialog[open] {
  animation: dialog-in 160ms cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

dialog.dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  animation: backdrop-in 160ms ease;
}

.dialog-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.dialog-header h2 {
  font-size: var(--text-md);
  line-height: var(--lh-md);
  font-weight: 600;
  flex: 1;
}

.dialog-body { padding: var(--space-5); font-size: var(--text-sm); line-height: var(--lh-sm); color: var(--foreground-secondary); }

.dialog-body .dialog-warning {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-md);
  background: var(--warning-bg);
  color: var(--warning);
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
}

.dialog-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- Toast ---------- */

.toast-region {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(420px, calc(100vw - 32px));
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--foreground);
  box-shadow: var(--shadow-md);
  font-size: var(--text-sm);
  line-height: var(--lh-sm);
  animation: toast-in 160ms ease;
}

.toast svg { width: 15px; height: 15px; flex-shrink: 0; }
.toast-success svg { color: var(--success); }
.toast-error svg { color: var(--danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- List rows (dashboard recent) ---------- */

.item-list { display: flex; flex-direction: column; }

.item-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 12px var(--space-5);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: background var(--transition-fast);
}

.item-row:last-child { border-bottom: 0; }
.item-row:hover { background: var(--surface-secondary); }

.item-row .item-main { flex: 1; min-width: 0; }
.item-row .item-title {
  font-size: var(--text-sm);
  line-height: var(--lh-sm);
  font-weight: 500;
  overflow-wrap: anywhere;
}
.item-row .item-sub {
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  color: var(--foreground-tertiary);
  margin-top: 2px;
}

/* ---------- Status meta (terms) ---------- */

.meta-block {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-secondary);
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  color: var(--foreground-secondary);
  overflow-wrap: anywhere;
}

.meta-block strong { color: var(--foreground); font-weight: 500; }

.review-banner {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-md);
  background: var(--warning-bg);
  color: var(--warning);
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
}

.review-banner svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; }

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-4);
  overflow-x: auto;
}

.tab {
  padding: 8px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--foreground-tertiary);
  font-size: var(--text-sm);
  line-height: var(--lh-sm);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.tab:hover { color: var(--foreground); }

.tab[aria-selected="true"] {
  color: var(--foreground);
  border-bottom-color: var(--foreground);
}

/* ---------- Switch ---------- */

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

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

.switch-row .switch-text { min-width: 0; }
.switch-row .switch-title { font-size: var(--text-sm); line-height: var(--lh-sm); font-weight: 500; }
.switch-row .switch-desc { font-size: var(--text-xs); line-height: var(--lh-xs); color: var(--foreground-tertiary); margin-top: 2px; }

.switch {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}

.switch .track {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  background: var(--border-strong);
  transition: background var(--transition-fast);
  pointer-events: none;
}

.switch .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.switch input:checked + .track { background: var(--foreground); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Segmented (theme) ---------- */

.segmented {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
  background: var(--surface);
}

.segmented button {
  border: 0;
  background: transparent;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  line-height: var(--lh-xs);
  font-weight: 500;
  color: var(--foreground-tertiary);
  cursor: pointer;
  min-height: 28px;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.segmented button[aria-pressed="true"] {
  background: var(--surface-tertiary);
  color: var(--foreground);
}

/* ---------- Settings layout ---------- */

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

/* ---------- Danger zone ---------- */

.danger-zone {
  border-color: var(--danger-border);
}

.danger-zone .card-header { border-bottom-color: var(--danger-border); }
.danger-zone .card-header h3 { color: var(--danger); }

/* ---------- Sidebar footer link ---------- */

.danger-link { color: var(--danger); }

/* ---------- Fallback when JS off ---------- */

.nojs-note {
  padding: var(--space-6);
  color: var(--foreground-tertiary);
  font-size: var(--text-sm);
}

/* ---------- Demo session lock ---------- */

.session-lock {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: color-mix(in srgb, var(--background) 88%, transparent);
  backdrop-filter: blur(6px);
}

.session-lock-card {
  width: min(380px, 100%);
  padding: var(--space-8);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.session-lock-mark {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-tertiary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.session-lock-mark svg { width: 24px; height: 24px; }
.session-lock-card h2 { font-size: var(--text-lg); line-height: var(--lh-lg); }
.session-lock-card p { font-size: var(--text-sm); line-height: var(--lh-sm); color: var(--foreground-secondary); }
.session-lock-card .btn { margin-top: var(--space-2); min-width: 180px; }

@media (max-width: 767px) {
  .session-lock-card { padding: var(--space-6); }
}

/* ---------- Searchable product picker ---------- */

.product-picker { position: relative; }
.picker-box { position: relative; min-width: 0; }
.picker-input-row { position: relative; }

.picker-input-row > svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--foreground-tertiary);
  pointer-events: none;
}

.picker-input-row .input { padding-left: 36px; }

.picker-selected {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-secondary);
  min-width: 0;
}

.picker-selected[hidden] { display: none; }
.picker-selected-name { flex: 1; min-width: 0; font-size: var(--text-sm); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.picker-clear {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--foreground-tertiary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.picker-clear:hover { background: var(--surface-hover); color: var(--foreground); }

.picker-options {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.picker-options[hidden] { display: none; }

.picker-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--foreground);
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.picker-option:hover, .picker-option.is-highlighted { background: var(--surface-tertiary); }
.picker-option > svg { width: 14px; height: 14px; margin-left: auto; flex-shrink: 0; }
.picker-option-main { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.picker-option-name { font-size: var(--text-sm); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-option-sub { font-size: var(--text-xs); color: var(--foreground-tertiary); }
.picker-empty { padding: var(--space-4); text-align: center; font-size: var(--text-xs); color: var(--foreground-tertiary); }

@media (max-width: 767px) {
  .picker-option { min-height: 44px; }
}
