/* ==========================================================================
   Synthrun Mail — settings surface
   Material 3 grouped cards on the Yahoo-inspired system.
   ========================================================================== */

body {
  min-height: 100vh;
  background: var(--bg);
  overflow-x: hidden;
}

/* Embedded beside the mailbox: the mail shell's header is the one top bar. */
html.settings-embedded nav {
  display: none;
}

/* ── Top app bar ───────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  transition: background var(--dur-2) var(--ease);
}

.nav-logo:hover {
  background: var(--brand-soft);
}

.nav-logo svg {
  width: 22px;
  height: 22px;
  stroke: var(--brand);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-title {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

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

.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}

.theme-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.theme-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

.user-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  max-width: 200px;
  padding: 0 8px 0 4px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
}

.user-chip:hover {
  background: var(--surface-3);
}

.user-avatar {
  width: 28px;
  height: 28px;
  font-size: 11px;
  background: var(--brand);
  color: var(--on-brand);
}

.user-chip-email {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip-caret {
  width: 14px;
  height: 14px;
  stroke: var(--muted);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  flex-shrink: 0;
}

.user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 200px;
  display: none;
  z-index: 120;
  transform-origin: top right;
}

.user-menu.show {
  display: block;
  animation: scale-in var(--dur-2) var(--ease-out);
}

.user-menu-item {
  font-weight: 500;
}

.user-menu-item svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Page shell ────────────────────────────────────────────── */
main.content {
  max-width: 780px;
  margin: 0 auto;
  padding: 28px 20px 72px;
}

.settings-pane {
  display: none;
}

.settings-pane.active {
  display: block;
  animation: fade-in var(--dur-2) var(--ease);
}

.section {
  margin-bottom: 28px;
}

.section-header {
  margin-bottom: 16px;
}

.section-title {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.section-eyebrow {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.section-desc {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.crumbs button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.crumbs button:hover {
  color: var(--brand);
}

.crumb-sep {
  color: var(--subtle);
}

.crumb-here {
  color: var(--text);
}

/* ── Overview list ──────────────────────────────────────────── */
.settings-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 13px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-2) var(--ease);
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-row:hover {
  background: var(--surface-3);
}

.settings-row:active {
  background: var(--surface-4);
}

.settings-row:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.settings-row-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  flex-shrink: 0;
}

.settings-row-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-row-text {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.settings-row-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.settings-row-desc {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-row-chevron {
  width: 18px;
  height: 18px;
  stroke: var(--subtle);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  transition: transform var(--dur-2) var(--ease-out), stroke var(--dur-2) var(--ease);
}

.settings-row:hover .settings-row-chevron {
  transform: translateX(2px);
  stroke: var(--brand);
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}

.card-pad {
  padding: 16px 18px;
}

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

.card-left {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.card-avatar {
  width: 42px;
  height: 42px;
  font-size: 13px;
  background: var(--brand);
  color: var(--on-brand);
}

.card-info {
  flex: 1;
  min-width: 0;
}

.card-label {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.card-value {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: break-word;
  word-break: break-word;
}

.card-hint {
  margin-top: 2px;
  color: var(--subtle);
  font-size: 11.5px;
  line-height: 1.45;
}

.card-detail {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

/* ── Forms ─────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label,
.form-label-sm {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.form-input {
  max-width: 400px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--surface-3);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: background var(--dur-2) var(--ease),
    border-color var(--dur-2) var(--ease),
    box-shadow var(--dur-2) var(--ease);
}

.form-input:hover {
  background: var(--surface-4);
}

.form-input:focus {
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand);
}

.form-input::placeholder {
  color: var(--subtle);
}

textarea.form-input {
  min-height: 110px;
  line-height: 1.65;
  resize: vertical;
}

select.form-input {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236B6B70' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}

.hint {
  color: var(--muted);
  font-size: 12px;
}

/* ── Switches ──────────────────────────────────────────────── */
.toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  border-radius: var(--r-pill);
  background: var(--surface-4);
  transition: background var(--dur-2) var(--ease);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  bottom: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: transform var(--dur-3) var(--ease-out);
}

.toggle input:checked + .toggle-slider {
  background: var(--brand);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(16px);
}

.toggle input:focus-visible + .toggle-slider {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.toggle-sm {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle-sm input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.toggle-sm .slider {
  position: absolute;
  inset: 0;
  border-radius: var(--r-pill);
  background: var(--surface-4);
  transition: background var(--dur-2) var(--ease);
}

.toggle-sm .slider::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: transform var(--dur-3) var(--ease-out);
}

.toggle-sm input:checked + .slider {
  background: var(--brand);
}

.toggle-sm input:checked + .slider::after {
  transform: translateX(14px);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.toggle-label {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  user-select: none;
}

.setting-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

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

.status-dot.on {
  background: var(--success);
}

.status-dot.off {
  background: var(--subtle);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 0;
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 700;
}

.badge-green {
  background: var(--success-soft);
  color: var(--success);
}

/* ── QR / 2FA ──────────────────────────────────────────────── */
.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.qr-box img {
  image-rendering: pixelated;
}

.qr-secret {
  max-width: 280px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
  word-break: break-all;
}

/* ── Modals ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--scrim);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.open {
  display: flex;
  animation: fade-in var(--dur-2) var(--ease);
}

.modal {
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  border: 0;
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-4);
  animation: rise-in var(--dur-3) var(--ease-out);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-title {
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.modal-close:hover {
  background: var(--surface-3);
  color: var(--text);
}

.modal-close svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.modal-body {
  padding: 18px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
}

/* ── Sessions ──────────────────────────────────────────────── */
.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.session-item:last-child {
  border-bottom: 0;
}

.session-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  flex-shrink: 0;
}

.session-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

.session-name {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.session-meta {
  margin-top: 2px;
  color: var(--subtle);
  font-size: 11px;
}

.empty-state {
  padding: 32px 20px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ── Labels and rules ──────────────────────────────────────── */
.label-color-picker {
  display: flex;
  gap: 6px;
}

.label-color-opt {
  width: 26px;
  height: 26px;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}

.label-color-opt:hover {
  transform: scale(1.08);
}

.label-color-opt.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text);
}

.rule-list {
  display: flex;
  flex-direction: column;
}

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

.rule-row:last-child {
  border-bottom: 0;
}

.rule-enabled {
  flex-shrink: 0;
}

.rule-type {
  min-width: 54px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.rule-value {
  flex: 1;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rule-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.rule-label .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rule-actions {
  display: flex;
  gap: 2px;
}

.rule-actions button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}

.rule-actions button:hover {
  background: var(--surface-3);
  color: var(--text);
}

.rule-actions .del:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.rule-create {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.rule-create .form-input {
  max-width: none;
}

.rule-match {
  min-width: 24px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

/* ── Auto-reply ────────────────────────────────────────────── */
.compose-area {
  min-height: 150px;
  font-family: var(--font);
  line-height: 1.65;
  resize: vertical;
}

.char-count {
  margin-top: 4px;
  color: var(--subtle);
  font-size: 12px;
  text-align: right;
}

.date-range {
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-range .sep {
  color: var(--muted);
  font-size: 13px;
}

.reply-preview {
  margin-top: 6px;
  padding: 14px 16px;
  border-left: 3px solid var(--brand);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.reply-preview .preview-subject {
  margin-bottom: 6px;
  color: var(--text);
  font-weight: 700;
}

.reply-preview .preview-body {
  color: var(--text-2);
}

.reply-preview .preview-foot {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--subtle);
  font-size: 12px;
}

.ar-editor-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.ar-tab-btn {
  position: relative;
  padding: 10px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.ar-tab-btn:hover {
  color: var(--text);
}

.ar-tab-btn.active {
  color: var(--brand);
}

.ar-tab-btn.active::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: var(--r-pill);
  background: var(--brand);
}

.ar-code-pane {
  display: none;
}

.ar-code-pane.active {
  display: block;
}

.ar-preview-pane {
  display: none;
  width: 100%;
  height: 260px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #ffffff;
}

.ar-preview-pane.active {
  display: block;
}

/* ── Loading ───────────────────────────────────────────────── */
.skeleton-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  transition: opacity 0.4s var(--ease), visibility 0.4s var(--ease);
}

.skeleton-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-loader {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  user-select: none;
}

.loader-spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: transparent;
  animation: mail-loader-rotate 1.5s linear infinite;
  z-index: 0;
}

@keyframes mail-loader-rotate {
  0% {
    transform: rotate(90deg);
    box-shadow:
      0 1px 1px 0 #fff inset,
      0 3px 5px 0 var(--brand) inset,
      0 4px 4px 0 var(--brand-press) inset;
  }
  50% {
    transform: rotate(270deg);
    background: var(--brand-soft);
    box-shadow:
      0 1px 1px 0 rgba(255, 255, 255, 0.85) inset,
      0 3px 5px 0 var(--brand-hover) inset,
      0 4px 4px 0 var(--brand-press) inset;
  }
  100% {
    transform: rotate(450deg);
    box-shadow:
      0 1px 1px 0 #fff inset,
      0 3px 5px 0 var(--brand) inset,
      0 4px 4px 0 var(--brand-press) inset;
  }
}

.loader-words {
  display: flex;
  align-items: flex-start;
  gap: 1px;
  line-height: 1.3;
  z-index: 1;
}

.split-char {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}

.split-char-inner {
  display: inline-block;
  will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
  .split-char {
    overflow: visible;
  }
}

/* ── Toast ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 400;
  max-width: 340px;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  background: #323232;
  color: #ffffff;
  box-shadow: var(--shadow-3);
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(12px);
  transition: opacity var(--dur-2) var(--ease), transform var(--dur-3) var(--ease-out);
}

html[data-theme="dark"] .toast,
body[data-theme="dark"] .toast {
  background: #E8EAED;
  color: #1D1D1F;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: var(--danger);
  color: #ffffff;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  nav {
    height: 58px;
    padding: 0 12px;
  }

  .nav-title {
    display: none;
  }

  .user-chip-email,
  .user-chip-caret {
    display: none;
  }

  .user-chip {
    min-width: 42px;
    padding: 0 5px;
  }

  main.content {
    padding: 24px 16px 80px;
  }

  .card-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .card-pad {
    padding: 18px;
  }

  .section-title {
    font-size: 20px;
  }

  .form-input {
    max-width: none;
  }

  .modal {
    max-width: 100%;
  }

  .date-range {
    flex-direction: column;
    align-items: stretch;
  }

  .rule-create {
    flex-direction: column;
    align-items: stretch;
  }

  .rule-match {
    text-align: left;
  }
}

/* ── Split view ─────────────────────────────────────────────── */
.settings-split {
  max-width: 560px;
}

.settings-split.is-split {
  max-width: 1080px;
}

.settings-page-head {
  margin-bottom: 20px;
}

.settings-page-head .section-eyebrow {
  display: none;
}

.settings-split-grid {
  display: block;
}

.settings-split-grid.is-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.settings-nav {
  min-width: 0;
}

.settings-split-grid.is-split .settings-nav {
  position: sticky;
  top: 84px;
}

/* The selected section lives in one card, with hairline rows. */
.settings-detail {
  display: none;
  padding: 22px 24px 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}

.settings-split-grid.is-split .settings-detail {
  display: block;
  animation: rise-in var(--dur-3) var(--ease-out);
}

.settings-detail-head {
  margin-bottom: 20px;
}

.settings-detail-title {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.settings-detail-desc {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.settings-back {
  display: none;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  padding: 6px 12px 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.settings-back svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-detail .settings-pane {
  display: none;
}

.settings-detail .settings-pane.is-active {
  display: block;
}

.settings-detail .section {
  margin: 0;
}

.settings-detail .section-header {
  display: none;
}

.settings-detail .card {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.settings-detail .card-pad {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.settings-detail .card:first-child .card-pad:first-child {
  padding-top: 0;
  border-top: 0;
}

.settings-detail .card + .card {
  margin-top: 4px;
}

.settings-detail .form-input {
  max-width: 100%;
}

.settings-row.is-active {
  background: var(--brand-soft);
}

.settings-row.is-active .settings-row-title {
  color: var(--brand);
}

.settings-row.is-active .settings-row-icon {
  background: var(--brand);
  color: var(--on-brand);
}

.settings-row.is-active .settings-row-chevron {
  transform: rotate(90deg);
  stroke: var(--brand);
}

@media (max-width: 900px) {
  .settings-split.is-split {
    max-width: 100%;
  }

  .settings-split-grid.is-split {
    grid-template-columns: 1fr;
  }

  .settings-split-grid.is-split .settings-nav {
    display: none;
  }

  .settings-back {
    display: inline-flex;
  }

  .settings-detail {
    padding: 18px;
  }
}

/* ── Desktop: the settings surface fills a 16:9 frame ──────────
   The list is a drawer on the left, the options fill the rest of
   the viewport, and each column scrolls on its own so the page
   itself never scrolls. */
@media (min-width: 901px) {
  main.content.settings-split {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
    padding-bottom: 20px;
    overflow: hidden;
  }

  .settings-split.is-split {
    max-width: 1200px;
  }

  .settings-page-head {
    flex: 0 0 auto;
    margin-bottom: 16px;
  }

  .settings-split-grid {
    flex: 1 1 auto;
    min-height: 0;
  }

  .settings-split-grid.is-split {
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 20px;
    height: 100%;
  }

  .settings-nav {
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding-right: 6px;
  }

  .settings-detail {
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  /* While the drawer scrolls, keep the open row reachable. */
  .settings-nav .settings-list {
    margin-bottom: 8px;
  }
}

/* ── Accent picker ──────────────────────────────────────────── */
.accent-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.accent-swatch {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-2) var(--ease);
}

.accent-swatch:hover {
  transform: scale(1.1);
}

.accent-swatch.active {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--swatch);
}
