/* The 2026-11 look refresh — settings. Every rule starts with body.rf (see refresh-base.css).
   «הגדרות» (#/settings, js/views/settings.js) as approved 11-10: «רחב» (the full content width)
   in the planning colours — white cards, one grey inside, the chosen thing white and raised,
   teal only for what you click. Same parts, same order, every button in its place. */

body.rf {
  --st-btn-line: rgba(14, 28, 48, 0.12);
  --st-icon-shadow: 0 1px 3px rgba(14, 28, 48, 0.12), 0 6px 16px rgba(14, 28, 48, 0.06);
  --st-lift: 0 2px 6px rgba(14, 28, 48, 0.08), 0 8px 20px rgba(14, 28, 48, 0.08);
  --st-thumb-shadow: 0 2px 6px rgba(14, 28, 48, 0.18);
}
[data-theme="dark"] body.rf {
  --st-btn-line: var(--border-strong);
  --st-icon-shadow: var(--shadow-sm);
  --st-lift: var(--shadow-sm);
  --st-thumb-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

/* ===== the page: the full content width ===== */
body.rf .settings-page {
  max-width: none;
}

/* ===== the title: the gear in a raised white square ===== */
body.rf .settings-page .settings-header {
  justify-content: flex-start;
  gap: 14px;
}
body.rf .settings-page .settings-header-icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--rf-card);
  color: var(--text-2);
  box-shadow: var(--st-icon-shadow);
}
body.rf .settings-page .settings-header-icon svg {
  flex: none;
  width: 24px;
  height: 24px;
}
body.rf .settings-page .settings-greeting {
  min-width: 0;
}

/* ===== «מדריך שימוש»: a slim card, the pictures as a fanned stack, the arrow in a circle ===== */
body.rf .settings-page .ug-entry {
  height: 60px;
  margin-bottom: 24px;
  padding: 8px;
  padding-inline-start: 12px;
  border: 0;
  border-radius: 16px;
  background: var(--rf-card);
  box-shadow: var(--rf-shadow);
  transition:
    box-shadow 0.15s ease,
    transform 0.15s ease;
}
body.rf .settings-page .ug-entry:hover {
  transform: translateY(-1px);
  box-shadow: var(--st-lift);
}
body.rf .settings-page .ug-entry:focus-visible {
  box-shadow: var(--shadow-focus);
}
body.rf .settings-page .ug-entry-thumbs {
  display: flex;
  align-items: center;
  width: auto;
  height: 44px;
  padding-inline: 6px 4px;
  border-radius: 0;
  background: none;
  overflow: visible;
}
body.rf .settings-page .ug-entry-thumbs img {
  flex: none;
  width: 52px;
  height: 34px;
  border-radius: 7px;
  object-fit: cover;
  box-shadow:
    0 0 0 2px var(--rf-card),
    var(--st-thumb-shadow);
}
body.rf .settings-page .ug-entry-thumbs img + img {
  margin-inline-start: -30px;
}
body.rf .settings-page .ug-entry-thumbs img:nth-child(1) {
  transform: rotate(5deg);
  z-index: 3;
}
body.rf .settings-page .ug-entry-thumbs img:nth-child(2) {
  transform: translateY(-2px);
  z-index: 2;
}
body.rf .settings-page .ug-entry-thumbs img:nth-child(3) {
  transform: rotate(-5deg);
  z-index: 1;
}
body.rf .settings-page .ug-entry-copy {
  flex-direction: row;
  align-items: baseline;
  gap: 10px;
}
body.rf .settings-page .ug-entry-title {
  flex: none;
  font-size: 14.5px;
}
body.rf .settings-page .ug-entry-sub {
  min-width: 0;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.rf .settings-page .ug-entry-go {
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--rf-grey);
  color: var(--accent);
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
body.rf .settings-page .ug-entry-go svg {
  flex: none;
  width: 14px;
  height: 14px;
}
/* hover: the same light circle, a shade deeper, and the arrow takes a small
   step forward (the user, 11-11: it jumped to a solid dark circle) */
body.rf .settings-page .ug-entry:hover .ug-entry-go {
  background: var(--rf-grey-2);
  color: var(--accent);
}
body.rf .settings-page .ug-entry-go svg {
  transition: transform 0.18s ease;
}
body.rf .settings-page .ug-entry:hover .ug-entry-go svg {
  transform: translateX(-2px);
}
html:not([dir="rtl"]) body.rf .settings-page .ug-entry:hover .ug-entry-go svg {
  transform: translateX(2px);
}

/* ===== a part: the name above, a white card under it ===== */
body.rf .settings-page .settings-section {
  margin-bottom: 24px;
}
body.rf .settings-page .settings-section-head {
  margin-bottom: 12px;
  padding: 0 4px;
}
body.rf .settings-page .card,
body.rf .settings-page .card:hover {
  border: 0;
  border-radius: 16px;
  background: var(--rf-card);
  box-shadow: var(--rf-shadow);
}
body.rf .settings-page .card {
  padding: 12px;
}

/* a white or bordered small button on the grey */
body.rf .settings-page .card .btn-secondary {
  border-color: var(--st-btn-line);
  background: var(--rf-card);
  box-shadow: var(--shadow-xs);
}
body.rf .settings-page .card .btn-secondary:hover:not(:disabled) {
  background: var(--rf-grey);
}
body.rf .settings-page .card .input {
  border-color: var(--st-btn-line);
  background: var(--rf-card);
}

/* ===== «ממשק» | «סביבת רשת» side by side: a grey tile per choice, the options straight on it ===== */
body.rf .settings-page .settings-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
body.rf .settings-page .settings-row > .settings-section {
  min-width: 0;
  margin-bottom: 0;
}
body.rf .settings-page .settings-prefs-card {
  gap: 10px;
  padding: 12px;
}
body.rf .settings-page .settings-pref-row {
  padding: 6px;
  padding-inline-end: 12px;
  border-radius: 14px;
  background: var(--rf-grey);
}
body.rf .settings-page .settings-pref-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
}
body.rf .settings-page .settings-pref-icon {
  flex: none;
  justify-content: center;
  width: 18px;
  color: var(--text-3);
}
body.rf .settings-page .settings-seg {
  padding: 0;
  border: 0;
  background: none;
}
body.rf .settings-page .settings-seg-btn:hover:not(.is-active):not(:disabled) {
  background: var(--rf-grey-2);
}
body.rf .settings-page .settings-seg-btn.is-active {
  background: var(--rf-card);
  box-shadow: var(--rf-raise);
}
body.rf .settings-page .settings-seg-btn:disabled {
  opacity: 0.45;
}

/* ===== «מפתחות AI»: today's tiles, three to a row, grey, no green ===== */
body.rf .settings-page .api-keys-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
body.rf .settings-page .api-key-tile,
body.rf .settings-page .api-key-tile:hover,
body.rf .settings-page .api-key-tile--set,
body.rf .settings-page .api-key-tile--set:hover {
  border: 0;
  border-radius: 14px;
  background: var(--rf-grey);
}
body.rf .settings-page .api-key-tile {
  padding: 12px 13px;
}
body.rf .settings-page .api-key-control {
  margin-top: auto;
}
/* «מוגדר» a white badge with a dark dot; «חסר» a ring */
body.rf .settings-page .api-key-tile-heading .badge {
  gap: 5px;
  height: 20px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--rf-line-2);
  color: var(--text-3);
}
body.rf .settings-page .api-key-tile-heading .badge::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--text-3);
}
body.rf .settings-page .api-key-tile-heading .badge.badge-success {
  background: var(--rf-card);
  box-shadow: none;
  color: var(--text-2);
}
body.rf .settings-page .api-key-tile-heading .badge.badge-success::before {
  background: var(--text-2);
  box-shadow: none;
}
body.rf .settings-page .api-key-secured,
body.rf .settings-page .api-key-secured .ui-icon {
  color: var(--text-2);
}
body.rf .settings-page .api-key-balance {
  border: 0;
  border-radius: 8px;
}
body.rf .settings-page .api-key-balance:not(.api-key-balance--low) {
  background: var(--rf-card);
}
body.rf .settings-page .api-key-topup {
  color: var(--accent);
  font-weight: 600;
}

/* ===== «שרת רינדור»: two low halves ===== */
body.rf .settings-page .render-tile,
body.rf .settings-page .render-tile--ok,
body.rf .settings-page .render-tile--warn {
  min-height: 0;
  padding: 12px 14px;
  border: 0;
  border-radius: 14px;
  background: var(--rf-grey);
}
/* the state: «פעיל», the version and «סנכרן שרת» on one row; the rest under it */
body.rf .settings-page .render-tile--status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  align-content: start;
  gap: 8px;
}
body.rf .settings-page .render-tile--status > * {
  grid-column: 1 / -1;
  min-width: 0;
}
body.rf .settings-page .render-tile--status > .render-tile-top {
  grid-row: 1;
  grid-column: 1;
}
body.rf .settings-page .render-tile--status > .render-server-meta {
  grid-row: 1;
  grid-column: 2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.rf .settings-page .render-tile--status > .render-tile-foot {
  grid-row: 1;
  grid-column: 3;
  margin: 0;
  padding: 0;
  border: 0;
}
body.rf .settings-page .render-tile--status .render-tile-label {
  display: none;
}
body.rf .settings-page .render-tile--status .badge {
  gap: 5px;
  height: 20px;
  padding: 0 8px;
  border: 0;
}
body.rf .settings-page .render-tile--status .badge:not(.badge-warning) {
  background: var(--rf-card);
  color: var(--text-2);
}
body.rf .settings-page .render-tile--status .badge.badge-success::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-2);
}
body.rf .settings-page .render-server-meta {
  color: var(--text-3);
}
body.rf .settings-page .render-cap-plain {
  height: 23px;
  padding: 0 8px;
  border: 0;
  background: var(--rf-card);
}
/* the connection: the field names beside the fields, «שמור ובדוק» beside the token */
body.rf .settings-page .render-tile--connect {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  gap: 8px;
}
body.rf .settings-page .render-tile--connect > * {
  grid-column: 1 / -1;
  min-width: 0;
}
body.rf .settings-page .render-tile--connect > .render-tile-top {
  display: none;
}
body.rf .settings-page .render-tile--connect > .render-field {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
body.rf .settings-page .render-tile--connect > .render-field + .render-field {
  grid-column: 1;
}
body.rf .settings-page .render-tile--connect > .render-tile-actions {
  grid-column: 2;
  align-self: center;
  margin: 0;
}
body.rf .settings-page .render-field-label {
  flex: none;
  width: 36px;
}
body.rf .settings-page .render-field .input {
  flex: 1;
  min-width: 0;
}

/* ===== «שימוש ועלויות»: the times at the side, the kinds over the list =====
   The same panel shows in «עלויות הפרויקט» (the window from the ⋮ beside a
   project's name, .project-usage), so every rule below dresses both. */
body.rf :is(.settings-page, .project-usage) .usage-card {
  gap: 12px;
}
body.rf .modal .project-usage-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
body.rf .project-usage .project-usage-old {
  display: block;
  margin-top: 2px;
}
body.rf :is(.settings-page, .project-usage) .usage-body {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
body.rf :is(.settings-page, .project-usage) .usage-side {
  min-width: 0;
}
body.rf :is(.settings-page, .project-usage) .usage-times {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  border-radius: 14px;
  background: var(--rf-grey);
}
body.rf :is(.settings-page, .project-usage) .usage-time {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 11px;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--text-2);
  text-align: start;
  cursor: pointer;
}
body.rf :is(.settings-page, .project-usage) .usage-time:hover:not(.is-active) {
  background: var(--rf-grey-2);
}
body.rf :is(.settings-page, .project-usage) .usage-time:focus-visible,
body.rf :is(.settings-page, .project-usage) .usage-kind:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
body.rf :is(.settings-page, .project-usage) .usage-time .ui-icon {
  flex: none;
  color: var(--text-3);
}
body.rf :is(.settings-page, .project-usage) .usage-time-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
}
body.rf :is(.settings-page, .project-usage) .usage-time-count {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
}
body.rf :is(.settings-page, .project-usage) .usage-time-cost {
  flex: none;
  width: 56px;
  font-size: 12px;
  color: var(--text-3);
  text-align: left;
  white-space: nowrap;
}
body.rf :is(.settings-page, .project-usage) .usage-time.is-active {
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 12px 14px;
  background: var(--rf-card);
  box-shadow: var(--rf-raise);
  color: var(--text);
  cursor: default;
}
body.rf :is(.settings-page, .project-usage) .usage-time-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
body.rf :is(.settings-page, .project-usage) .usage-time.is-active .ui-icon {
  color: var(--accent);
}
body.rf :is(.settings-page, .project-usage) .usage-time-total {
  font-size: 26px;
  font-weight: 700;
  line-height: 28px;
  letter-spacing: -0.7px;
  color: var(--text);
}
body.rf :is(.settings-page, .project-usage) .usage-time-sub {
  font-size: 12px;
  color: var(--text-3);
}
body.rf :is(.settings-page, .project-usage) .usage-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
body.rf :is(.settings-page, .project-usage) .usage-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
body.rf :is(.settings-page, .project-usage) .usage-kinds {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  min-width: 0;
  padding: 3px;
  border-radius: 12px;
  background: var(--rf-grey);
}
body.rf :is(.settings-page, .project-usage) .usage-kind {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 6px 14px;
  border: 0;
  border-radius: 9px;
  background: none;
  font: inherit;
  color: var(--text-2);
  text-align: start;
  cursor: pointer;
}
body.rf :is(.settings-page, .project-usage) .usage-kind:hover:not(.is-active) {
  background: var(--rf-grey-2);
}
body.rf :is(.settings-page, .project-usage) .usage-kind b {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 16px;
  color: var(--text);
}
body.rf :is(.settings-page, .project-usage) .usage-kind small {
  font-size: 11px;
  line-height: 14px;
  color: var(--text-3);
  white-space: nowrap;
}
body.rf :is(.settings-page, .project-usage) .usage-kind.is-active {
  background: var(--rf-card);
  box-shadow: var(--rf-raise);
}
body.rf :is(.settings-page, .project-usage) .usage-model {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-inline-start: auto;
}
body.rf :is(.settings-page, .project-usage) .usage-model-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  white-space: nowrap;
}
body.rf :is(.settings-page, .project-usage) .usage-filter-select {
  width: 131px;
  height: 32px;
  margin: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background-color: var(--rf-grey);
  font-size: 12px;
  color: var(--text-2);
}
body.rf :is(.settings-page, .project-usage) .usage-table-wrap {
  min-width: 0;
  padding: 6px;
  border-radius: 14px;
  background: var(--rf-grey);
  overflow-x: auto;
}
body.rf :is(.settings-page, .project-usage) .usage-table-wrap .usage-empty {
  padding: 24px 0;
  border-radius: 10px;
  background: var(--rf-card);
}
body.rf :is(.settings-page, .project-usage) .usage-history {
  border-radius: 10px;
  overflow: hidden;
  background: var(--rf-card);
  font-size: 12px;
  color: var(--text-3);
}
body.rf :is(.settings-page, .project-usage) .usage-history th {
  padding: 6px 10px;
  background: var(--rf-card);
  border-bottom: 1px solid var(--rf-line);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: none;
  letter-spacing: 0;
}
body.rf :is(.settings-page, .project-usage) .usage-history-row td {
  padding: 7px 10px;
  border-bottom-color: var(--rf-line);
  white-space: nowrap;
}
body.rf :is(.settings-page, .project-usage) .usage-history-row:last-child td {
  border-bottom: 0;
}
body.rf :is(.settings-page, .project-usage) .usage-history-row:hover td {
  background: var(--rf-grey);
}
body.rf :is(.settings-page, .project-usage) .usage-day-row .usage-day-header {
  padding: 8px 10px 4px;
  background: var(--rf-card);
  border-bottom: 1px solid var(--rf-line);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: none;
  letter-spacing: 0;
}
body.rf :is(.settings-page, .project-usage) .usage-type {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-2);
}
body.rf :is(.settings-page, .project-usage) .usage-type .ui-icon {
  color: var(--text-3);
}
body.rf :is(.settings-page, .project-usage) .usage-td-model {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
body.rf :is(.settings-page, .project-usage) .usage-td-detail {
  font-size: 12px;
  color: var(--text-3);
}
body.rf :is(.settings-page, .project-usage) .usage-cost-cell {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
body.rf :is(.settings-page, .project-usage) .usage-footer {
  padding-top: 0;
  border-top: 0;
}
body.rf :is(.settings-page, .project-usage) .usage-footer .btn-ghost {
  border-color: var(--st-btn-line);
  background: var(--rf-card);
  box-shadow: var(--shadow-xs);
  color: var(--text);
}
body.rf :is(.settings-page, .project-usage) .usage-footer .btn-ghost:hover:not(:disabled) {
  background: var(--rf-grey);
}

/* ===== «נתונים»: two low halves, the buttons at the far side ===== */
body.rf .settings-page .data-tile,
body.rf .settings-page .data-tile--danger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px 12px;
  min-height: 0;
  padding: 12px 14px;
  border: 0;
  border-radius: 14px;
  background: var(--rf-grey);
}
body.rf .settings-page .data-tile > .data-tile-top,
body.rf .settings-page .data-tile > .data-tile-desc {
  grid-column: 1;
}
body.rf .settings-page .data-tile > .data-tile-actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  flex-wrap: nowrap;
  margin: 0;
}
body.rf .settings-page .data-tile-top {
  justify-content: flex-start;
  align-items: baseline;
}
body.rf .settings-page .data-tile-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}
body.rf .settings-page .data-tile-note {
  font-size: 11.5px;
}
body.rf .settings-page .data-tile-desc {
  flex: none;
  line-height: 17px;
}
body.rf .settings-page .data-delete-btn {
  border-color: var(--st-btn-line);
  background: var(--rf-card);
  box-shadow: var(--shadow-xs);
  color: var(--red);
}
body.rf .settings-page .data-delete-btn:hover:not(:disabled) {
  background: var(--rf-danger-soft);
  color: var(--red);
}

/* ===== narrower screens: fewer side by side ===== */
@media (max-width: 1240px) {
  body.rf .settings-page .api-keys-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 1080px) {
  body.rf :is(.settings-page, .project-usage) .usage-body {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 860px) {
  body.rf .settings-page .settings-row,
  body.rf .settings-page .render-grid,
  body.rf .settings-page .data-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 640px) {
  body.rf .settings-page .api-keys-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  body.rf .settings-page .ug-entry-sub {
    display: none;
  }
}

/* ── fewer layers (the user, 11-11: «סלט עם הניגודיות» in «הגדרות») ──
   It was page → white card → tinted tile → white field: four steps. Now the
   sections of tiles («מפתחות AI», «שרת רינדור») have no card of their own:
   page → white tiles (a soft shadow) → tinted fields. «ממשק» / «סביבת רשת»
   keep their white card with the tinted rows — also two steps. */
body.rf .settings-page .card:has(> .api-keys-grid),
body.rf .settings-page .card:has(.render-tile),
body.rf .settings-page .card:has(> .api-keys-grid):hover,
body.rf .settings-page .card:has(.render-tile):hover {
  padding: 0;
  background: transparent;
  box-shadow: none;
}
body.rf .settings-page .api-key-tile,
body.rf .settings-page .api-key-tile:hover,
body.rf .settings-page .api-key-tile--set,
body.rf .settings-page .api-key-tile--set:hover,
body.rf .settings-page .render-tile {
  background: var(--rf-card);
  box-shadow: var(--rf-shadow);
}
body.rf .settings-page .api-key-tile .input,
body.rf .settings-page .render-tile .input {
  border-color: transparent;
  background: var(--rf-grey);
}
body.rf .settings-page .api-key-tile .input:focus,
body.rf .settings-page .render-tile .input:focus {
  border-color: var(--accent);
  background: var(--rf-card);
}
