/* Setting Mosaik up: the Models, Spending and assistant pages of Settings,
 * the setup guide and the tips in the corner. The Settings frame and its
 * Advanced sections are settings.css.
 * (js/settings_pages.js, js/hints.js)
 */

.dialog-layer.instant .scrim, .dialog-layer.instant .dialog, .dialog-layer.instant .settings-page.entering { animation: none; }

/* ---- presets ---------------------------------------------------------------- */
/* A plan picker: one row per preset, a radio at the start, the chat model and
   its price set right in tabular figures, so the rows read down as a table. */
.preset-grid { display: flex; flex-direction: column; gap: 6px; }
.preset-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 11.5rem);
  align-items: center;
  gap: 12px;
  padding: 9px 14px 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text2);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.preset-card:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.preset-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.preset-card.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent-wash) 45%, var(--surface)); }
.preset-radio {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  transition: border-color var(--dur-fast) var(--ease), border-width var(--dur-fast) var(--ease);
}
.preset-card.on .preset-radio { border: 5px solid var(--accent); }
.preset-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.preset-name { font-weight: 600; font-size: 13.5px; color: var(--text); }
.preset-text { font-size: var(--ui-small); line-height: 1.4; color: var(--text3); }
.preset-model { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; min-width: 0; font-size: var(--ui-small); text-align: right; }
.preset-model-name { display: flex; align-items: center; gap: 6px; max-width: 100%; color: var(--text2); font-weight: 500; }
.preset-model-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset-model .mark, .rec-row .mark { display: inline-flex; width: 14px; height: 14px; flex: none; }
.preset-model .mark svg, .rec-row .mark svg { width: 100%; height: 100%; }
.preset-price { color: var(--text3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.preset-card.own { padding-right: 44px; }
.preset-delete { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); opacity: 0; }
.preset-card:hover .preset-delete, .preset-card:focus-within .preset-delete { opacity: 1; }
@media (max-width: 560px) {
  .preset-card { grid-template-columns: auto minmax(0, 1fr); }
  .preset-model { grid-column: 2; align-items: flex-start; text-align: left; }
}
.role-list { display: flex; flex-direction: column; gap: 14px; }
.preset-save { max-width: 420px; }
.models-waiting { margin-top: -6px; }

/* ---- recommended models ----------------------------------------------------- */
.recommended { display: flex; flex-direction: column; margin-top: 8px; }
.rec-tier { margin: 12px 0 4px; font-size: var(--ui-meta); font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text3); }
.rec-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-top: 1px solid var(--border); }
.rec-row.missing { opacity: 0.55; }
.rec-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.rec-name { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); font-size: 13px; }
.rec-note { font-size: var(--ui-small); color: var(--text3); }
.rec-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.rec-price { font-size: var(--ui-small); color: var(--text2); font-variant-numeric: tabular-nums; }
.test-badge { display: inline-flex; align-items: center; gap: 4px; font-size: var(--ui-meta); color: var(--text3); }
.test-badge .icon { width: 12px; height: 12px; }
.test-badge.ok { color: color-mix(in srgb, var(--added) 90%, var(--text)); }
.test-badge.bad { color: var(--danger); }
.test-badge.busy { color: var(--accent-ink); }

/* ---- spending ----------------------------------------------------------------- */
.spend-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.spend-stat { display: flex; flex-direction: column; gap: 3px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.spend-stat .label { font-size: var(--ui-small); color: var(--text3); }
.spend-stat .value { font-size: 22px; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.spend-stat .detail { font-size: var(--ui-small); color: var(--text3); }
.spend-bar { position: relative; display: block; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--text) 8%, transparent); overflow: hidden; min-width: 40px; }
.spend-bar .fill { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--accent); }
.spend-stat .spend-bar { margin-top: 4px; }
.spend-breakdown { display: flex; flex-direction: column; gap: 16px; }
.spend-days { display: flex; align-items: flex-end; gap: 4px; height: 56px; padding: 6px 2px 0; border-bottom: 1px solid var(--border); }
.spend-days .day { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.spend-days .fill { display: block; width: 100%; border-radius: 3px 3px 0 0; background: color-mix(in srgb, var(--accent) 75%, transparent); }
.spend-days .day:hover .fill { background: var(--accent); }
.spend-group { display: flex; flex-direction: column; gap: 6px; }
.spend-row { display: grid; grid-template-columns: minmax(90px, 1.3fr) 2fr 76px 68px; align-items: center; gap: 10px; font-size: 13px; }
.spend-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.spend-row .cost { font-variant-numeric: tabular-nums; color: var(--text2); text-align: right; }
.spend-row .calls { font-size: var(--ui-small); color: var(--text3); min-width: 56px; text-align: right; }
.spend-recent { max-height: 280px; overflow-y: auto; }
.settings-activity { display: flex; flex-direction: column; gap: 10px; }

/* The Settings assistant's page is css/assistant.css, read when the window is
   first idle (docs/speed.md, Start). */
.key-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; line-height: 1.5; color: var(--text2); }
.key-steps a, .guide a, .settings-page .form-hint a { color: var(--link, var(--accent-ink)); }

/* ---- the setup guide -------------------------------------------------------------- */
.dialog.guide { width: min(640px, 100%); min-height: min(560px, 86vh); }
.dialog-body.guide { flex: 1; overflow-y: auto; }
.guide-body { display: flex; flex-direction: column; gap: 16px; }
.guide-body.entering { animation: rise-in var(--dur-slow) var(--ease-out) both; }
.guide-hero { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 12px 0 4px; }
.guide-title { margin: 0; font-family: var(--display); font-size: 26px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.guide-lead { margin: 0; font-size: 14px; line-height: 1.55; color: var(--text2); }
.guide-hero .guide-lead { max-width: 420px; }
.guide-note { margin: 0; font-size: var(--ui-small); color: var(--text3); }
/* Why Free was chosen for a key with no credit: one line, above the choice. */
.guide-credit { margin: 0; padding: 8px 12px; border-radius: var(--radius-sm); font-size: var(--ui-small); line-height: 1.5;
  color: var(--text2); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.guide-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.guide-card { display: flex; flex-direction: column; gap: 5px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); font-size: 13px; line-height: 1.5; color: var(--text2); }
.guide-card b { color: var(--text); font-size: 14px; }
.guide-card .icon { width: 18px; height: 18px; color: var(--accent-ink); }
.guide-dots { display: flex; gap: 6px; align-items: center; }
.guide-dots .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); transition: width var(--dur) var(--ease), background var(--dur) var(--ease); }
.guide-dots .dot.done { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.guide-dots .dot.on { width: 20px; border-radius: 4px; background: var(--accent); }

/* ---- tips beside what they explain (js/hints.js places them) ---------------------- */
.tip-card {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 85;
  display: flex;
  gap: 12px;
  width: min(300px, calc(100vw - 24px));
  padding: 18px 13px 11px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--raised);
  box-shadow: 0 1px 2px var(--shadow-soft), 0 14px 36px -12px var(--shadow-cast);
  animation: fade-in var(--dur-fast) var(--ease-out) both;
}
/* The arrow: a small square turned on its corner, on the side facing the anchor. */
.tip-card::before {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--raised);
  border: 1px solid var(--border);
  transform: rotate(45deg);
}
.tip-card[data-side="top"]::before { bottom: -6px; left: calc(var(--arrow, 50%) - 5px); border-top: 0; border-left: 0; }
.tip-card[data-side="bottom"]::before { top: -6px; left: calc(var(--arrow, 50%) - 5px); border-bottom: 0; border-right: 0; }
.tip-card[data-side="left"]::before { right: -6px; top: calc(var(--arrow, 50%) - 5px); border-bottom: 0; border-left: 0; }
.tip-card[data-side="right"]::before { left: -6px; top: calc(var(--arrow, 50%) - 5px); border-top: 0; border-right: 0; }
/* Topped with the mosaic strip like every Mosaik window. The card keeps its
   overflow for the arrow, so the strip rounds its own top corners. */
.tip-card > .mosaic-strip { position: absolute; top: 0; left: 0; right: 0; width: auto; border-radius: 13px 13px 0 0; }
.tip-card.leaving { animation: fade-out 170ms var(--ease) both; }
/* A tip for something on the page never shows over a dialog; one for a
   dialog, a picker or the palette is marked .over and does. */
html.dialog-open .tip-card:not(.over) { visibility: hidden; }
.tip-icon { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent-wash); color: var(--accent-ink); }
.tip-icon .icon { width: 16px; height: 16px; }
.tip-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.tip-title { font-weight: 650; font-size: 13.5px; color: var(--text); }
.tip-text { font-size: 12.5px; line-height: 1.5; color: var(--text2); }
.tip-actions { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.tip-spacer { flex: 1; }
.tip-off { border: 0; background: none; padding: 0; white-space: nowrap; font: inherit; font-size: var(--ui-meta); color: var(--text3); cursor: pointer; }
.tip-off:hover { color: var(--text); text-decoration: underline; }

/* ---- terms of use: asked once, before the guide ---------------------------- */
.dialog-body.terms { max-width: 460px; }
.dialog-body.terms .guide-hero { padding: 4px 0 10px; }
.terms-points { margin: 10px 0 12px; padding-left: 18px; display: grid; gap: 6px; color: var(--text2); line-height: 1.5; }
.dialog-body.terms a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* ---- Sign in with OpenRouter (App.signInPanel) ------------------------------------ */
.signin { display: flex; flex-direction: column; gap: 8px; }
.signin-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.signin .signin-hint { margin: 0; }
.openrouter-facts { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px;
  font-size: var(--ui-small); line-height: 1.5; color: var(--text2); }
.openrouter-facts b { color: var(--text); font-weight: 600; }
.key-paste { border-top: 1px solid var(--border); padding-top: 10px; }
.key-paste > summary { cursor: pointer; font-size: var(--ui-small); color: var(--text2); width: max-content; }
.key-paste > summary:hover { color: var(--text); }
.key-paste-body { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; }
