/* === SETTINGS === */
.settings-main {
  padding-top: 56px;
  min-height: 100vh;
}

.settings-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 32px 80px;
}

/* Page header */
.settings-page-header {
  padding: 40px 0 20px;
}

.settings-page-title {
  font-family: var(--mono);
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
}

/* Disclaimer banner */
.disclaimer-banner {
  background: var(--bg-card);
  border: 1px solid var(--bg-border);
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.disclaimer-icon {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--fg-dim);
  line-height: 1.4;
  flex-shrink: 0;
}

.disclaimer-text {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-dim);
  line-height: 1.6;
}

/* Section card */
.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--bg-border);
  margin-bottom: 20px;
  overflow: hidden;
}

.settings-section-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--bg-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
}

.section-tag {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--fg-dim);
  border: 1px solid var(--bg-border);
  padding: 3px 8px;
  letter-spacing: 0.08em;
}

/* Model weights */
.weights-body {
  padding: 20px;
}

.weights-note {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-dim);
  margin-bottom: 20px;
  line-height: 1.6;
}

.weight-row {
  display: grid;
  grid-template-columns: 180px 1fr 52px;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.weight-name {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-muted);
}

/* Range slider */
.weight-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: var(--bg-border);
  outline: none;
  cursor: pointer;
}

.weight-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 0;
  background: var(--fg);
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--fg-dim);
}

.weight-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 0;
  background: var(--fg);
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--fg-dim);
}

.weight-value {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--fg);
  text-align: right;
  min-width: 36px;
}

.weights-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--bg-border);
  margin-top: 4px;
}

.weights-total-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.weights-total-value {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--fg-muted);
}

.weights-total-value--ok { color: var(--fg); }

/* Threshold section */
.threshold-body {
  padding: 20px;
}

.threshold-row {
  display: grid;
  grid-template-columns: 160px 1fr 80px;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.threshold-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-muted);
}

.threshold-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: var(--bg-border);
  outline: none;
  cursor: pointer;
}

.threshold-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 0;
  background: var(--fg);
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--fg-dim);
}

.threshold-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 0;
  background: var(--fg);
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--fg-dim);
}

.threshold-input {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--bg-border);
  color: var(--fg);
  padding: 6px 10px;
  text-align: center;
  width: 64px;
}

.threshold-input:focus { border-color: var(--fg-dim); outline: none; }

.threshold-preview {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-dim);
  margin-top: 4px;
  min-height: 16px;
}

/* Save / reset */
.settings-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--bg-border);
}

.btn-save {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--fg);
  color: var(--bg);
  border: none;
  padding: 8px 18px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-save:hover { opacity: 0.85; }

.btn-reset {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: none;
  color: var(--fg-dim);
  border: 1px solid var(--bg-border);
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-reset:hover { color: var(--fg-muted); border-color: var(--fg-dim); }

/* Data sources */
.ds-body {
  padding: 16px 20px;
}

.ds-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--bg-border);
}

.ds-row:last-child { border-bottom: none; }

.ds-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ds-name {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg);
  font-weight: 500;
}

.ds-status {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-dim);
  letter-spacing: 0.05em;
}

.ds-status--connected { color: var(--fg-muted); }

.ds-connect-btn {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: none;
  border: 1px solid var(--bg-border);
  color: var(--fg-dim);
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.ds-connect-btn:hover { color: var(--fg); border-color: var(--fg-dim); }

@media (max-width: 600px) {
  .settings-container { padding: 0 16px 60px; }
  .weight-row { grid-template-columns: 1fr 52px; }
  .weight-name { display: none; }
  .threshold-row { grid-template-columns: 1fr 64px; }
  .threshold-label { display: none; }
}

/* API key section (settings-api.ejs) */
.apikey-body {
  padding: 20px;
}

.apikey-empty {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.6;
}

.apikey-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--bg-border);
}

.apikey-row:last-child { border-bottom: none; }

.apikey-meta {
  border-bottom: none;
  padding-top: 6px;
}

.apikey-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  min-width: 110px;
}

.apikey-masked {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--bg-border);
  padding: 6px 12px;
  letter-spacing: 0.05em;
  user-select: all;
  flex: 1;
}

.apikey-mini-btn {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: none;
  border: 1px solid var(--bg-border);
  color: var(--fg-dim);
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.apikey-mini-btn:hover { color: var(--fg); border-color: var(--fg-dim); }

.apikey-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-muted);
}

.apikey-plaintext-row { padding-top: 14px; }

.apikey-plaintext {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--fg-dim);
  padding: 12px 14px;
  user-select: all;
  flex: 1;
  word-break: break-all;
  letter-spacing: 0.04em;
}

.apikey-banner {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--fg);
  color: var(--bg);
  padding: 10px 14px;
  margin-bottom: 4px;
}