/* ═══════════════════════════════════════════════════════════════
   THE RITUAL — Settings 2.0
   sv-* namespace: Settings View 2-column layout
═══════════════════════════════════════════════════════════════ */

/* ── Layout ─────────────────────────────────────────────────── */

.sv-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  max-width: 1000px;
  margin: 0 auto;
  align-items: start;
}

/* ── Left Nav ─────────────────────────────────────────────────── */

.sv-nav {
  position: sticky;
  top: 24px;
  padding-top: 4px;
}

.sv-nav-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sv-nav-link {
  display: block;
  padding: 7px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 6px;
  letter-spacing: 0.03em;
  transition: all 0.15s;
  border-left: 2px solid transparent;
}

.sv-nav-link:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

.sv-nav-link.active {
  color: var(--gold);
  background: var(--gold-dim);
  border-left-color: var(--gold);
}

.sv-nav-danger { color: rgba(201,112,112,0.65); }
.sv-nav-danger:hover { color: #c97070; background: rgba(201,112,112,0.08); }
.sv-nav-danger.active { color: #c97070; background: rgba(201,112,112,0.1); border-left-color: #c97070; }

/* ── Content Area ─────────────────────────────────────────────── */

.sv-content {
  min-width: 0;
  padding-bottom: 80px;
}

/* Unsaved-changes banner */
.sv-dirty-banner {
  background: rgba(196,164,107,0.08);
  border: 1px solid rgba(196,164,107,0.25);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.06em;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Section ──────────────────────────────────────────────────── */

.sv-section { margin-bottom: 32px; }
.sv-danger-section { margin-top: 8px; }

.sv-section-title {
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 12px;
}

.sv-danger-title { color: #c97070; }

.sv-section-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
  margin-top: -6px;
}

/* ── Cards ────────────────────────────────────────────────────── */

.sv-card {
  background: var(--navy-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 20px 22px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.sv-card-gap    { margin-top: 12px; }
.sv-card-gap-lg { margin-top: 20px; }

.sv-card-header {
  margin-bottom: 14px;
}

.sv-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: block;
  margin-bottom: 4px;
}

.sv-card-danger {
  border-color: rgba(201,112,112,0.15);
}

/* ── Rows ─────────────────────────────────────────────────────── */

.sv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Auto-space consecutive rows inside a card — removes need for inline margin styles */
.sv-card .sv-row + .sv-row,
.sv-card .sv-row + .sv-col,
.sv-card .sv-col + .sv-row,
.sv-card .sv-col + .sv-divider,
.sv-card .sv-divider + .sv-row,
.sv-card .sv-row + .sv-divider {
  margin-top: 16px;
}

/* Subrow (conditional reveal) needs slightly less gap */
.sv-card .sv-row + .sv-subrow {
  margin-top: 10px;
}

/* Label gap inside a .sv-col block (e.g. Oracle context) */
.sv-col > .sv-row-label { margin-bottom: 8px; }

.sv-row-action { align-items: flex-start; }

.sv-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sv-row-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.sv-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.02em;
}

.sv-hint {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.4;
}

.sv-hint strong { color: var(--stone); font-weight: 500; }
.sv-hint code   { font-family: var(--font-mono, monospace); font-size: 13px; }

.sv-value-readonly {
  font-size: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Sub-row (conditionally hidden) */
.sv-subrow {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.04);
  transition: opacity 0.2s;
}

.sv-subrow-hidden {
  opacity: 0.25;
  pointer-events: none;
}

.sv-divider {
  height: 1px;
  background: rgba(255,255,255,0.05);
  margin: 16px 0;
}

/* ── Inputs ───────────────────────────────────────────────────── */

.sv-input {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 400;
  padding: 10px 13px;
  transition: border-color 0.2s;
  flex-shrink: 0;
  width: 220px;
}

.sv-input:focus { border-color: var(--gold-line); outline: none; }
.sv-input::placeholder { color: var(--text-muted); opacity: 0.5; }

.sv-input-sm  { width: 110px; }
.sv-input-mono { font-family: var(--font-mono, monospace); font-size: 13px; letter-spacing: 0.04em; }

.sv-select {
  padding: 10px 12px;
  background: var(--navy-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  cursor: pointer;
  appearance: auto;
}

.sv-select:focus { border-color: var(--gold-line); outline: none; }

/* Textarea */
.sv-textarea {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
  padding: 12px 14px;
  resize: vertical;
  transition: border-color 0.2s;
  min-height: 100px;
}

.sv-textarea:focus { border-color: var(--gold-line); outline: none; }
.sv-textarea::placeholder { color: var(--text-muted); opacity: 0.45; }

.sv-char-count {
  font-size: 13px;
  color: var(--text-muted);
  opacity: 0.55;
  text-align: right;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

/* ── Toggle ───────────────────────────────────────────────────── */

.sv-toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
}

.sv-toggle input { opacity: 0; width: 0; height: 0; }

.sv-toggle-track {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.08);
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.12);
  transition: all 0.2s;
}

.sv-toggle-track::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--text-muted);
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: all 0.2s;
}

.sv-toggle input:checked + .sv-toggle-track {
  background: rgba(80,180,100,0.2);
  border-color: #5ab472;
}

.sv-toggle input:checked + .sv-toggle-track::after {
  background: #6dba85;
  transform: translateX(18px);
}

/* ── TF Buttons ───────────────────────────────────────────────── */

.sv-row-tf { align-items: center; }

.sv-tf-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sv-tf-btn {
  padding: 8px 12px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 5px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.15s;
}

.sv-tf-btn:hover  { border-color: var(--gold-line); color: var(--text); }
.sv-tf-btn.active {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold-bright);
}

/* ── Stepper ──────────────────────────────────────────────────── */

.sv-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sv-step-btn {
  width: 30px;
  height: 30px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: var(--gold);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-family: var(--font-sans);
}

.sv-step-btn:hover { background: var(--gold-dim); border-color: var(--gold-line); }

.sv-step-display {
  display: flex;
  align-items: baseline;
  gap: 4px;
  min-width: 60px;
  justify-content: center;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(196,164,107,0.2);
  border-radius: 6px;
  padding: 6px 10px;
}

#sv-buf-val {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 400;
  color: var(--text);
}

.sv-step-unit {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

/* ── Personality Buttons ──────────────────────────────────────── */

.sv-personality-group {
  display: flex;
  gap: 6px;
}

.sv-personality-btn {
  padding: 8px 14px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 5px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.15s;
}

.sv-personality-btn:hover  { border-color: var(--gold-line); color: var(--text); }
.sv-personality-btn.active {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold-bright);
}

/* ── Checklist Grid ───────────────────────────────────────────── */

.sv-cl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sv-cl-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 7px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.sv-cl-row:has(:checked) { border-color: rgba(196,164,107,0.2); }

.sv-cl-check {
  width: 14px;
  height: 14px;
  accent-color: var(--gold);
  flex-shrink: 0;
}

.sv-cl-label {
  font-size: 14px;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  line-height: 1.3;
}

/* ── Discipline Weight Sliders ────────────────────────────────── */

.sv-dw-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sv-dw-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sv-dw-labels {
  flex: 0 0 130px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sv-dw-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  outline: none;
}

.sv-dw-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(196,164,107,0.3);
}

.sv-dw-val {
  flex: 0 0 38px;
  text-align: right;
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--gold-bright);
  line-height: 1;
}

.sv-dw-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sv-dw-total-label {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.5;
}

.sv-dw-total-val {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--gold);
  font-weight: 400;
  transition: color 0.2s;
}

/* ── Symbols / Broker List Rows ───────────────────────────────── */

.sv-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.sv-list-input {
  flex: 1;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 400;
  padding: 10px 13px;
  transition: border-color 0.2s;
}

.sv-list-input:focus { border-color: var(--gold-line); outline: none; }
.sv-list-input::placeholder { color: var(--text-muted); opacity: 0.4; }

.sv-list-remove {
  background: transparent;
  border: 1px solid var(--danger-line);
  border-radius: 4px;
  color: var(--danger-text);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.15s;
  opacity: 0.65;
  flex-shrink: 0;
}

.sv-list-remove:hover { opacity: 1; background: var(--danger-bg); }

.sv-add-btn {
  width: 100%;
  padding: 11px;
  background: transparent;
  border: 1px dashed rgba(196,164,107,0.25);
  border-radius: 6px;
  color: var(--gold);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  opacity: 0.65;
  margin-top: 4px;
}

.sv-add-btn:hover { border-color: var(--gold-line); opacity: 1; background: var(--gold-dim); }

/* ── Extension Status ─────────────────────────────────────────── */

.sv-ext-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.sv-ext-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sv-ext-dot-on  { background: #6dba85; box-shadow: 0 0 6px rgba(109,186,133,0.5); }
.sv-ext-dot-off { background: rgba(255,255,255,0.15); }

/* ── Small Buttons ────────────────────────────────────────────── */

.sv-btn-sm {
  padding: 9px 14px !important;
  font-size: 13px !important;
  white-space: nowrap;
  flex-shrink: 0;
}

.sv-btn-warn {
  background: transparent !important;
  color: #c97070 !important;
  border: 1px solid rgba(201,112,112,0.3) !important;
  box-shadow: none !important;
}

.sv-btn-warn:hover {
  background: rgba(201,112,112,0.08) !important;
  border-color: rgba(201,112,112,0.6) !important;
  transform: none !important;
}

/* ── Danger Buttons ───────────────────────────────────────────── */

.sv-danger-btn {
  padding: 9px 14px;
  background: transparent;
  border: 1px solid rgba(201,112,112,0.35);
  border-radius: 6px;
  color: #c97070;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.sv-danger-btn:hover   { background: rgba(201,112,112,0.1); border-color: rgba(201,112,112,0.7); }
.sv-danger-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.sv-danger-btn-hard {
  background: rgba(201,112,112,0.08);
  border-color: rgba(201,112,112,0.5);
}

.sv-danger-btn-hard:hover { background: rgba(201,112,112,0.18); }

/* ── Import Panel ─────────────────────────────────────────────── */

.sv-import-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sv-strategy-group {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.sv-strategy-opt {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  flex: 1;
  min-width: 120px;
}

.sv-strategy-opt:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(196,164,107,0.2);
}

.sv-strategy-opt input[type="radio"] {
  margin-top: 2px;
  accent-color: var(--gold);
  flex-shrink: 0;
}

.sv-strategy-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text-muted);
  transition: color 0.15s;
}

.sv-strategy-opt input:checked + .sv-strategy-label { color: var(--text); }

.sv-strategy-label strong { font-size: 14px; font-weight: 600; letter-spacing: 0.04em; }
.sv-strategy-label small  { font-size: 13px; opacity: 0.65; }

.sv-import-panel-hint { margin-bottom: 12px; }

.sv-import-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sv-import-cancel-dim { opacity: 0.5; }
.sv-import-cancel-dim:hover { opacity: 1; }

.sv-import-status {
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-muted);
}

/* ── Save Row ─────────────────────────────────────────────────── */

.sv-save-row {
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
  margin-top: -8px;
}

.sv-save-btn {
  min-width: 180px;
}

/* ── Nav Save Button (sticky left nav) ──────────────────────── */

.sv-nav-save {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 10px 12px;
  background: var(--gold-dim);
  border: 1px solid var(--gold-line);
  border-radius: 8px;
  color: var(--gold);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.sv-nav-save:hover {
  background: rgba(196,164,107,0.22);
  border-color: var(--gold);
  color: var(--gold-bright);
}

/* ── Nav-away Modal ───────────────────────────────────────────── */

/* Modal is appended to document.body (not inside the settings container),
   so position: fixed centres correctly against the viewport. */
.sv-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  animation: fadeInBg 0.15s ease;
}

@keyframes fadeInBg {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.sv-modal {
  background: var(--navy-card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 380px;
  width: calc(100% - 40px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: scaleIn 0.15s ease;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

.sv-modal-msg {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.5;
}

.sv-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Shared: btn-secondary (used across settings + journal-import) ─ */

.btn-secondary {
  padding: 11px 18px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 7px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-secondary:hover {
  border-color: rgba(196,164,107,0.4);
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

.btn-secondary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── Responsive ───────────────────────────────────────────────── */

/* Tablet — collapse left nav to top scrollable */
@media (max-width: 1023px) {
  .sv-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .sv-nav {
    position: static;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .sv-nav-inner {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 4px;
    padding-bottom: 4px;
  }

  .sv-nav-link {
    white-space: nowrap;
    border-left: none;
    border-bottom: 2px solid transparent;
    border-radius: 5px 5px 0 0;
    padding: 6px 10px;
    font-size: 13px;
  }

  .sv-nav-link.active { border-left-color: transparent; border-bottom-color: var(--gold); }
  .sv-nav-danger.active { border-bottom-color: #c97070; }
}

/* Mobile */
@media (max-width: 767px) {
  .sv-layout { gap: 16px; }

  .sv-nav { display: none; } /* hide nav on small mobile — scroll freely */

  .sv-card { padding: 16px; }

  .sv-row  {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .sv-row-action { flex-direction: row; align-items: center; }

  .sv-input      { width: 100%; }
  .sv-input-sm   { width: 100px; }

  .sv-tf-group      { justify-content: flex-start; }
  .sv-personality-group { flex-wrap: wrap; }

  .sv-cl-grid { grid-template-columns: 1fr; }

  .sv-dw-labels { flex: 0 0 100px; }

  .sv-save-row { justify-content: stretch; }
  .sv-save-btn { width: 100%; }
}
