/* Settings modal — the shell, the rail and the row grammar every panel is built from.
   Scoped to .set-dlg so nothing here can reach the rest of the app. Colour, type and
   spacing come from the app tokens in app.css; nothing is hard-coded. */

.u-modal.set-dlg .u-card {
  width: min(1120px, 96vw);
  height: min(820px, 92vh);
  max-height: min(820px, 92vh);
}

.u-modal.set-dlg .u-head {
  padding: 14px 18px;
  border-bottom: var(--line);
  gap: 18px;
}

.u-modal.set-dlg .u-body {
  padding: 0;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
  min-height: 0;
}

/* ---------------------------------------------------------------- search -- */

.set-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 300px;
  padding: 6px 12px;
  border: var(--line);
  border-radius: var(--bradi);
  background: var(--strans);
  color: var(--text-muted);
  transition: border-color var(--ui-motion-fast) ease, color var(--ui-motion-fast) ease;
}

.set-search:focus-within {
  border-color: color-mix(in srgb, var(--primary) 45%, transparent);
  color: var(--text);
}

.set-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--fs-body);
}

.set-search .icon { width: var(--icon-md); height: var(--icon-md); flex: none; }

/* ------------------------------------------------------------------ rail -- */

.set-rail {
  border-right: var(--line);
  background: var(--strans);
  padding: 14px 10px 20px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.set-rail-group-label {
  padding: 0 10px 6px;
  font-size: var(--fs-meta);
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.set-rail-group { display: flex; flex-direction: column; gap: 2px; }

.set-nav-btn {
  position: relative;
  display: grid;
  grid-template-columns: var(--icon-md) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--ui-control-radius);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--fs-body);
  text-align: left;
  cursor: pointer;
  transition: background var(--ui-motion-fast) ease, color var(--ui-motion-fast) ease;
}

.set-nav-btn .icon { width: var(--icon-md); height: var(--icon-md); }
.set-nav-btn:hover { background: var(--ui-surface-soft); color: var(--text); }

.set-nav-btn.is-active {
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--text);
  font-weight: 600;
}

.set-nav-btn.is-active::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 50%;
  translate: 0 -50%;
  width: 3px;
  height: 18px;
  border-radius: var(--bradi);
  background: var(--primary);
}

.set-nav-count {
  font-size: var(--fs-meta);
  font-weight: 700;
  color: var(--primary);
}

.set-nav-btn.is-empty { opacity: .35; }

/* ----------------------------------------------------------------- panel -- */

.set-panel-wrap { overflow: auto; min-height: 0; padding: 20px 24px 32px; }

.set-panel[hidden] { display: none; }

.set-panel-head { margin-bottom: 16px; }
.set-panel-title { font-size: var(--fs-title); font-weight: 700; letter-spacing: -.02em; }
.set-panel-desc { margin-top: 4px; font-size: var(--fs-ui); color: var(--text-muted); }

.set-card {
  border: var(--line);
  border-radius: var(--ui-card-radius);
  background: var(--ui-surface-soft);
  padding: 4px 18px;
}

.set-card + .set-card { margin-top: 14px; }

.set-card-head { padding: 14px 0 0; }
.set-card-title { font-size: var(--fs-ui); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.set-card-hint { margin-top: 5px; font-size: var(--fs-meta); color: var(--text-muted); line-height: 1.5; }

/* ------------------------------------------------------------------- row -- */

.set-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 300px);
  align-items: center;
  gap: 20px;
  padding: 14px 0;
  border-top: var(--line);
}

.set-card-head + .set-row,
.set-card > .set-row:first-child { border-top: 0; }

.set-row.is-stacked { grid-template-columns: minmax(0, 1fr); gap: 10px; }
.set-row.is-toggle { grid-template-columns: minmax(0, 1fr) auto; }
.set-row[hidden] { display: none; }

.set-row-label { font-size: var(--fs-body); font-weight: 600; }
.set-row-hint { margin-top: 4px; font-size: var(--fs-meta); color: var(--text-muted); line-height: 1.5; }
.set-row-control { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.set-row.is-stacked .set-row-control { justify-content: flex-start; }
.set-row-control > .bits-ss { flex: 1 1 auto; width: 100%; min-width: 0; }
/* bits-ss-btn is capped at 135px for toolbar selects, which truncates a device name
   like "System default" in a settings row. Here the control fills its column. */
.set-row-control .bits-ss-btn { max-width: none; width: 100%; }
.set-row-control > .bits-slider-wrap { width: 100%; }
/* .btn.sm is align-self: flex-end app-wide, which reads as a misalignment against a
   select on the same row. */
.set-row-control .btn,
.set-btn-row .btn,
.set-form-actions .btn { margin: 0; align-self: center; }

.set-row.is-hit {
  background: color-mix(in srgb, var(--primary) 9%, transparent);
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--primary) 9%, transparent);
  border-radius: 4px;
}

.set-input {
  width: 100%;
  min-width: 0;
  padding: 8px 12px;
  border: var(--line);
  border-radius: var(--ui-control-radius);
  background: var(--strans);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-body);
  outline: none;
}

.set-input:focus { border-color: color-mix(in srgb, var(--primary) 45%, transparent); }

.set-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 14px 0; border-top: var(--line); }
.set-fact-label { font-size: var(--fs-meta); color: var(--text-muted); }
.set-fact-value { margin-top: 3px; font-size: var(--fs-body); font-weight: 600; overflow-wrap: anywhere; }

.set-note { padding: 12px 0 16px; font-size: var(--fs-meta); color: var(--text-muted); line-height: 1.6; }
.set-note strong { color: var(--text); font-weight: 600; }

.set-btn-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 0; border-top: var(--line); }
.set-btn-row .btn { margin: 0; }

.set-empty { padding: 26px 4px; font-size: var(--fs-body); color: var(--text-muted); }

/* Accent + gradient chips sit inline in Appearance; .set-palette-grid and
   .set-chip are the shared chip styles from app.css. */
.set-palette-block { padding: 14px 0; border-top: var(--line); display: flex; flex-direction: column; gap: 10px; }
.set-palette-block .set-palette-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); }
/* Chips are a picker, not a mural: the shared .set-chip is square by default, which
   at ten across made the accent grid taller than the rest of the panel put together. */
.set-palette-block .set-chip { aspect-ratio: auto; height: 34px; border-radius: 10px; }
.set-palette-block .set-chip.is-selected::after { right: 3px; bottom: 3px; width: 14px; height: 14px; font-size: 10px; }
.set-palette-block .set-palette-title { font-size: var(--fs-body); font-weight: 600; letter-spacing: 0; }

.set-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.set-form { display: flex; flex-direction: column; gap: 12px; padding: 14px 0; border-top: var(--line); }
.set-form .set-field { display: flex; flex-direction: column; gap: 6px; }
.set-form .set-field > span { font-size: var(--fs-meta); color: var(--text-muted); }
.set-form-actions { display: flex; align-items: center; gap: 10px; }
.set-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.set-form-actions[data-align="end"] { justify-content: flex-end; }

/* Search hides rows without touching [hidden], which panels use for their own
   conditional rows (the quiet-hours schedule, for one). */
.set-card.is-filtered-out,
.set-row.is-filtered-out { display: none; }

/* Nothing ever lands in the footer of this dialog — every change saves itself. */
.u-modal.set-dlg .u-foot { display: none; }

.u-modal.set-edit-dlg .u-card { width: min(620px, 94vw); }
