/* equyx — the settings dialog.
 *
 * A left rail of sections and one pane at a time, because the AI pane is long
 * and a person arriving to paste a key should not have to scroll past the
 * theme picker to reach it. Everything here is scoped to `.set-` so it cannot
 * reach the console underneath.
 */

.set-scrim {
  /* ABOVE EVERYTHING, INCLUDING THE ANALYST. The analyst's bar is fixed to the
     bottom of the screen and was painting over the dialog's lower edge on a
     phone - measured on the first screenshot, where it covered the Load models
     row. This sits above every other fixed layer in the app. */
  position: fixed; inset: 0; z-index: 900;
  background: rgba(8, 10, 14, .55);
  display: grid; place-items: center;
  padding: 24px;
}

.set-box {
  display: grid; grid-template-columns: 260px minmax(0, 1fr);
  width: min(1040px, 100%); height: min(720px, calc(100vh - 48px));
  background: var(--panel, #fff); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius, 12px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
  overflow: hidden;
}

/* ---- the rail ---------------------------------------------------------- */
.set-rail {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 12px; background: var(--surface, var(--bg-2));
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.set-rail-h {
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); padding: 2px 10px 10px;
}
.set-nav {
  display: flex; gap: 10px; align-items: flex-start; text-align: left;
  padding: 10px 12px; border: 1px solid transparent; border-radius: 10px;
  background: none; color: inherit; cursor: pointer; font: inherit;
  min-height: 44px;
}
.set-nav:hover { background: var(--hover, rgba(127, 127, 127, .08)); }
.set-nav.on { background: var(--accent-soft, rgba(20, 88, 240, .10)); border-color: var(--accent-line, var(--border)); }
.set-nav svg { flex: 0 0 auto; margin-top: 2px; opacity: .8; }
.set-nav span { display: block; min-width: 0; }
.set-nav b { display: block; font-size: 13px; font-weight: 600; }
.set-nav small { display: block; font-size: 11px; color: var(--muted); line-height: 1.4; }
.set-rail .spacer { flex: 1 1 auto; }
.set-close { width: 100%; justify-content: center; }

/* ---- the pane ---------------------------------------------------------- */
.set-body { overflow-y: auto; padding: 22px 26px 28px; }
.set-pane h2 { margin: 0 0 6px; font-size: 20px; font-weight: 700; }
.set-lede { margin: 0 0 14px; font-size: 13px; line-height: 1.6; color: var(--muted); max-width: 70ch; }
.set-lab {
  margin: 18px 0 8px; font-size: 10.5px; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted);
}
.set-small { margin-top: 6px; font-size: 11.5px; line-height: 1.55; color: var(--muted); }
.set-small code { font-family: var(--code); font-size: 11px; background: var(--surface-3, var(--surface)); padding: 1px 5px; border-radius: 4px; }
.set-list { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.7; color: var(--muted); max-width: 72ch; }
.set-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.set-row.mt { margin-top: 14px; }

/* The one thing on this screen nobody should be able to miss: whose key pays. */
.set-note {
  padding: 12px 14px; border-radius: 10px; font-size: 12.5px; line-height: 1.65;
  background: var(--accent-soft, rgba(20, 88, 240, .08));
  border: 1px solid var(--accent-line, var(--border));
  max-width: 78ch;
}

.set-input {
  flex: 1 1 260px; min-width: 0;
  padding: 11px 13px; font-size: 14px; font-family: inherit;
  background: var(--surface-2, var(--surface)); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
}
.set-input:focus { outline: 2px solid var(--accent-line, var(--border)); outline-offset: -1px; }

.set-msg { margin-top: 12px; padding: 10px 12px; border-radius: 8px; font-size: 12.5px; line-height: 1.6; max-width: 78ch; }
.set-msg.ok { background: var(--good-soft, rgba(0, 163, 109, .12)); color: var(--good-ink, var(--good)); }
.set-msg.bad { background: var(--bad-soft, rgba(255, 74, 46, .12)); color: var(--bad-ink, var(--bad)); }

/* ---- the engines ------------------------------------------------------- */
.eng-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.eng-card {
  display: flex; flex-direction: column; gap: 3px; align-items: flex-start;
  padding: 12px 14px; min-height: 64px; cursor: pointer; font: inherit; text-align: left;
  background: var(--surface-2, var(--surface)); color: inherit;
  border: 1px solid var(--border); border-radius: 10px;
}
.eng-card:hover { border-color: var(--accent-line, var(--border-strong)); }
.eng-card.on { border-color: var(--accent, var(--amber)); border-width: 2px; padding: 11px 13px; }
.eng-name { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
.eng-host { font-family: var(--code); font-size: 11px; color: var(--muted); }
.eng-badge {
  font-style: normal; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 4px; white-space: nowrap;
  background: var(--good-soft, rgba(0, 163, 109, .14)); color: var(--good-ink, var(--good));
}

/* the header button's "no key yet" dot */
.set-dot {
  display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%;
  background: var(--amber, #ffa028); vertical-align: middle;
}

/* ---- the phone --------------------------------------------------------- */
/* Same breakpoints as mobile.css: the rail becomes a strip across the top and
   the engine grid drops to two columns, which is the widest a 390px screen
   fits without the provider names truncating. */
@media (pointer: coarse), (max-width: 760px) {
  .set-scrim { padding: 0; }
  .set-box { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); width: 100%; height: 100%; border-radius: 0; }
  /* The rail becomes a strip that scrolls sideways, which pushed Close off the
     right-hand edge - it was half-drawn in the first screenshot. Close leaves
     the strip on a phone and becomes a round button pinned to the top-right of
     the pane, always reachable however far the strip is scrolled. */
  .set-rail { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 8px 56px 8px 8px; gap: 8px; }
  .set-rail-h { display: none; }
  .set-nav { flex: 0 0 auto; }
  .set-nav small { display: none; }
  .set-rail .spacer { display: none; }
  .set-close {
    position: fixed; top: 8px; right: 8px; z-index: 2;
    width: 44px; height: 44px; padding: 0; border-radius: 50%;
    font-size: 0; overflow: hidden;
  }
  .set-close::after { content: '×'; font-size: 24px; line-height: 1; }
  /* the home indicator eats the last row otherwise */
  .set-body { padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
  .eng-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- which engine does what --------------------------------------------
   One row per job. The right-hand column always states what the row RESOLVES
   to, because "The active engine" is a rule and a person wants the answer. */
.purpose-grid { display: grid; gap: 8px; margin: 10px 0 18px; }
.purpose-row {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto;
  gap: 10px; align-items: center;
}
.purpose-l { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.purpose-now { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (pointer: coarse), (max-width: 760px) {
  .purpose-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .purpose-now { white-space: normal; }
}
