.picker {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 20;
}
.picker[hidden] { display: none; }
.picker__backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
  /*
   * No blur. At 2px it did not obscure anything, it only smeared the greeting
   * behind into legible-but-wrong grey haze, which reads as a rendering fault
   * rather than depth. A stronger dim does the actual job of receding.
   */
}
.picker__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(560px, calc(100vw - 48px));
  max-height: min(70vh, 640px);
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  /*
   * Layered short shadows instead of one long one.
   *
   * A single 60px falloff at low alpha spreads ~115 opacity levels across 60px
   * of near-black, so each 8-bit step covers several pixels and reads as
   * concentric rings. Stacking shorter, denser shadows puts the steps close
   * enough together that the eye cannot resolve them.
   */
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.5),
    0 8px 16px rgba(0, 0, 0, 0.36),
    0 18px 32px rgba(0, 0, 0, 0.24);
  overflow: hidden;
}
.picker__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border-soft);
}
.picker__header h2 { margin: 0; font-size: 15px; font-weight: 500; }
.picker__body {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
}
.picker__group { padding: 12px 8px 4px; }
.picker__group-label {
  color: var(--text-faint);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.model-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background 120ms ease;
}
.model-row:hover { background: var(--bg-hover-solid); }
.model-row.is-selected { background: var(--accent-soft); }
.model-row__info { flex: 1; min-width: 0; }
.model-row__name {
  display: block;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-row__detail {
  display: block;
  color: var(--text-faint);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-row__action {
  flex: none;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
}
.model-row__action:hover { background: var(--bg-raised); color: var(--text); }
.model-row__star {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--text-faint);
  transition: background 120ms ease, color 120ms ease;
}
.model-row__star:hover {
  background: var(--bg-raised);
  color: var(--star);
}
/* Gold, and filled rather than outlined, so the favourite reads at a glance. */
.model-row__star.is-default { color: var(--star); }
.model-row__star.is-default svg { fill: var(--star); }
.picker__empty {
  padding: 26px 16px;
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
  line-height: 1.7;
}
.picker__footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 16px;
  border-top: 1px solid var(--border-soft);
}
.picker__log {
  margin: 8px;
  padding: 10px 12px;
  background: var(--bg-deep);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
  max-height: 160px;
  overflow-y: auto;
}
/* Settings dialog — reuses the picker shell. */
.pref {
  padding: 16px 16px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.pref:last-child { border-bottom: none; }
.pref__title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.pref__hint {
  margin: 10px 0 0;
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.6;
}
.pref__hint code {
  padding: 1px 5px;
  background: var(--bg-deep);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
}
.pref__profile {
  display: flex;
  align-items: center;
  gap: 14px;
}
.field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field__label {
  color: var(--text-faint);
  font-size: 12px;
}
.field__input {
  width: 100%;
  padding: 8px 11px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 120ms ease;
}
.field__input:focus { border-color: var(--accent); }
.pref__actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.folder-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.folder-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.folder-row__path {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.folder-row__badge {
  flex: none;
  color: var(--text-faint);
  font-size: 11px;
}
.folder-row__remove {
  flex: none;
  color: var(--text-faint);
  font-size: 12px;
}
.folder-row__remove:hover { color: var(--accent); }
/* Theme picker ---------------------------------------------------------- */
.theme-select { position: relative; }
.theme-select__trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 9px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background 120ms ease, border-color 120ms ease;
}
.theme-select__trigger:hover { background: var(--bg-hover-solid); }
.theme-select__label {
  flex: 1;
  color: var(--text);
  font-size: 13px;
  text-align: left;
}
.theme-select__trigger [data-icon],
.theme-select__trigger .icon { color: var(--text-faint); }
.theme-select__menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 5;
  max-height: 244px;
  padding: 4px;
  overflow-y: auto;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow:
    0 2px 5px rgba(0, 0, 0, 0.5),
    0 6px 14px rgba(0, 0, 0, 0.34),
    0 14px 26px rgba(0, 0, 0, 0.22);
}
.theme-select__menu[hidden] { display: none; }
.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 7px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: left;
  transition: background 120ms ease, color 120ms ease;
}
.theme-option:hover { background: var(--bg-hover-strong); color: var(--text); }
.theme-option.is-active { background: var(--accent-soft); color: var(--text); }
.theme-option__label { flex: 1; }
.theme-option__check { color: var(--accent); opacity: 0; }
.theme-option.is-active .theme-option__check { opacity: 1; }
/* The preview tile, shared by the trigger and every option. */
.theme-swatch {
  position: relative;
  flex: none;
  width: 46px;
  height: 22px;
  border: 1px solid;
  border-radius: 5px;
  overflow: hidden;
}
.theme-swatch__bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 34%;
}
.theme-swatch__dot {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
/* Switch row ------------------------------------------------------------ */
.switch-row {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}
.switch-row__text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.switch-row__label { color: var(--text); font-size: 13px; }
.switch-row__hint { color: var(--text-faint); font-size: 12px; line-height: 1.5; }
.switch {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  margin: 0;
  appearance: none;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 140ms ease;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 140ms ease, background 140ms ease;
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); background: var(--on-accent); }
/* Permission modes ------------------------------------------------------ */

.mode-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 10px 0;
}
.mode-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background 120ms ease, border-color 120ms ease;
}
.mode-row:hover { background: var(--bg-hover-solid); }
.mode-row.is-active {
  background: var(--accent-soft);
  border-color: var(--border-focus);
}
.mode-row__text { flex: 1; min-width: 0; }
.mode-row__label {
  display: block;
  color: var(--text);
  font-size: 13px;
}
.mode-row__hint {
  display: block;
  color: var(--text-faint);
  font-size: 12px;
}
.mode-row__tick {
  flex: none;
  width: 15px;
  color: var(--accent);
}
/* Full system access reads as a warning once it is actually on. */
.switch-row__hint.is-warning { color: hsl(30 85% 66%); }

/* First-run empty state: the next step is choosing a folder. */
.picker__empty-title {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 15px;
}

.picker__empty-action {
  margin-top: 14px;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 13px;
}

.picker__empty-action:hover { filter: brightness(1.07); }

/* Destructive actions --------------------------------------------------- */

.danger-btn {
  padding: 7px 14px;
  border: 1px solid hsl(5 45% 38%);
  border-radius: 8px;
  color: hsl(5 70% 72%);
  font-size: 13px;
  transition: background 120ms ease, color 120ms ease;
}

.danger-btn:hover { background: hsl(5 55% 42% / 0.18); color: hsl(5 80% 80%); }

.danger-btn--solid {
  border-color: transparent;
  background: hsl(5 62% 44%);
  color: hsl(0 0% 98%);
}

.danger-btn--solid:hover { background: hsl(5 62% 50%); color: hsl(0 0% 100%); }

/* The confirmation replaces the button, so it has to read as a warning. */
.confirm {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid hsl(5 45% 34%);
  border-radius: var(--radius-sm);
  background: hsl(5 40% 20% / 0.28);
}

.confirm__text {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.confirm__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
