/* Account-private homepage themes. The theme controller maps these aliases
   onto the existing vNext palette so the candidate keeps one visual system. */
:root {
  --yf-page-bg: var(--canvas);
  --yf-surface: var(--paper);
  --yf-surface-soft: var(--warm);
  --yf-primary: var(--cobalt);
  --yf-primary-soft: var(--cobalt-soft);
  --yf-text: var(--ink);
  --yf-muted: var(--muted);
  --yf-border: var(--line);
  --yf-border-strong: var(--line-strong);
  --yf-accent: #e5a84b;
  --yf-page-fill: var(--yf-page-bg);
  --yf-sidebar-fill: var(--yf-surface);
  --yf-surface-fill: var(--yf-surface);
  --yf-surface-soft-fill: var(--yf-surface-soft);
  --yf-primary-fill: var(--yf-primary);
}

body {
  background: var(--yf-page-fill, var(--yf-page-bg));
  color: var(--yf-text);
}

.topbar { background: var(--yf-sidebar-fill, var(--yf-surface)); }
.wordmark-mark,
.primary-action,
.route-cta,
.row-action { background: var(--yf-primary-fill, var(--yf-primary)); border-color: var(--yf-primary); }
.primary-nav a::after,
.eyebrow-rule,
.stage-marker,
.block-label,
.companion-kicker,
.route-eyebrow { color: var(--yf-primary); background-color: var(--yf-primary); }
.primary-nav a:hover,
.primary-nav a:focus-visible,
.text-button,
.minor-button,
.footer-link,
.access-trigger:hover,
.access-trigger:focus-visible,
.access-trigger[aria-expanded="true"],
.route-cta,
.row-action { color: var(--yf-primary); }
.primary-action,
.route-cta,
.row-action { color: #fff; }
.primary-action:hover,
.primary-action:focus-visible,
.route-cta:hover,
.route-cta:focus-visible,
.row-action:hover,
.row-action:focus-visible { background: color-mix(in srgb, var(--yf-primary) 86%, #000); }
.text-button:hover,
.text-button:focus-visible,
.minor-button:hover,
.minor-button:focus-visible,
.user-menu-item:hover,
.user-menu-item:focus-visible,
.access-menu-panel a:hover,
.access-menu-panel a:focus-visible,
.attach-button:hover,
.attach-button:focus-visible,
.mode-trigger:hover,
.mode-trigger:focus-visible,
.mode-trigger[aria-expanded="true"] { background: var(--yf-primary-soft); }
.composer,
.route-panel,
.quick-item,
.user-menu,
.access-menu-panel,
.companion-bubble,
.history-card { background: var(--yf-surface-fill, var(--yf-surface)); border-color: var(--yf-border); }
.route-content:nth-of-type(even) { background: var(--yf-surface-fill, var(--yf-surface)); }
.route-content,
.hero { background: var(--yf-page-fill, var(--yf-page-bg)); }
.note-index { color: var(--yf-accent); }
.hero-brand-dot { background: var(--yf-accent); }
body[data-companion-visual="line"] .companion-bubble { border-color: color-mix(in srgb, var(--yf-accent) 42%, var(--yf-border)); }
.composer-status.is-success { color: var(--success); }
.composer-status.is-error { color: var(--danger); }

.theme-toggle {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--yf-border-strong);
  border-radius: 7px;
  background: transparent;
  color: var(--yf-primary);
  transition: background-color .16s ease, border-color .16s ease, transform .16s ease;
}
.theme-toggle:hover,
.theme-toggle:focus-visible,
.theme-toggle[aria-expanded="true"] {
  border-color: var(--yf-primary);
  background: var(--yf-primary-soft);
  transform: translateY(-1px);
}
.theme-toggle svg { width: 24px; height: 24px; }

.theme-panel {
  position: fixed;
  top: auto;
  right: auto;
  left: calc(var(--sidebar-width, 232px) + 16px);
  bottom: 16px;
  z-index: 48;
  width: min(360px, calc(100vw - 32px));
  max-height: min(690px, calc(100dvh - 96px));
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--yf-border);
  border-radius: 14px;
  background: var(--yf-surface);
  color: var(--yf-text);
  box-shadow: 0 18px 46px rgba(20, 23, 28, .18);
}
.theme-panel[hidden] { display: none; }
.theme-panel-head,
.theme-section-head,
.theme-save-row,
.theme-saved-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.theme-panel-head { padding-bottom: 12px; border-bottom: 1px solid var(--yf-border); }
.theme-panel-head strong { font-size: 14px; font-weight: 650; }
.theme-panel-head small { display: block; margin-top: 2px; color: var(--yf-muted); font-size: 10px; }
.theme-close {
  width: 27px;
  height: 27px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--yf-muted);
  font-size: 18px;
  line-height: 1;
}
.theme-close:hover,
.theme-close:focus-visible { border-color: var(--yf-border); background: var(--yf-primary-soft); color: var(--yf-text); }
.theme-section { padding-top: 14px; }
.theme-section + .theme-section { border-top: 1px solid var(--yf-border); margin-top: 14px; }
.theme-section-head { margin-bottom: 9px; }
.theme-section-head strong { font-size: 11px; font-weight: 650; }
.theme-section-head span { color: var(--yf-muted); font-size: 10px; }
.theme-preset-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.theme-preset {
  min-width: 0;
  padding: 7px 5px 6px;
  border: 1px solid var(--yf-border);
  border-radius: 8px;
  background: transparent;
  color: var(--yf-text);
  text-align: left;
}
.theme-preset:hover,
.theme-preset:focus-visible,
.theme-preset.is-active { border-color: var(--yf-primary); background: var(--yf-primary-soft); }
.theme-preset .theme-swatch { height: 23px; display: flex; overflow: hidden; border-radius: 5px; }
.theme-preset .theme-swatch i { flex: 1; display: block; }
.theme-preset span { display: block; overflow: hidden; margin-top: 5px; color: var(--yf-muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.theme-color-grid { display: grid; gap: 7px; }
.theme-color-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; }
.theme-color-row label { color: var(--yf-muted); font-size: 11px; }
.theme-color-control { display: inline-flex; align-items: center; gap: 5px; }
.theme-color-input { width: 28px; height: 26px; padding: 1px; border: 1px solid var(--yf-border); border-radius: 5px; background: var(--yf-surface); cursor: pointer; }
.theme-color-value { width: 79px; min-height: 27px; padding: 3px 6px; border: 1px solid var(--yf-border); border-radius: 5px; background: var(--yf-surface); color: var(--yf-text); font: 10px/1 var(--mono); text-transform: uppercase; }
.theme-color-value:focus { border-color: var(--yf-primary); outline: 2px solid color-mix(in srgb, var(--yf-primary) 22%, transparent); outline-offset: 1px; }
.theme-hint { margin: 9px 0 0; color: var(--yf-muted); font-size: 10px; line-height: 1.5; }
.theme-contrast { margin: 8px 0 0; color: var(--yf-muted); font-size: 10px; }
.theme-contrast.is-good { color: var(--success); }
.theme-contrast.is-warn { color: var(--danger); }
.theme-save-row { align-items: stretch; margin-top: 10px; }
.theme-save-section {
  position: sticky;
  bottom: -16px;
  z-index: 2;
  margin-inline: -16px;
  padding: 14px 16px 16px;
  background: var(--yf-surface);
  box-shadow: 0 -8px 16px color-mix(in srgb, var(--yf-surface) 82%, transparent);
}
.theme-name-input { min-width: 0; flex: 1; min-height: 32px; padding: 5px 8px; border: 1px solid var(--yf-border); border-radius: 6px; background: var(--yf-surface); color: var(--yf-text); font-size: 11px; }
.theme-name-input:focus { border-color: var(--yf-primary); outline: 2px solid color-mix(in srgb, var(--yf-primary) 22%, transparent); outline-offset: 1px; }
.theme-save-button,
.theme-secondary-button { min-height: 32px; padding: 0 10px; border: 1px solid var(--yf-primary); border-radius: 6px; background: var(--yf-primary); color: #fff; font-size: 11px; }
.theme-secondary-button { border-color: var(--yf-border); background: transparent; color: var(--yf-primary); }
.theme-save-button:disabled { cursor: not-allowed; opacity: .45; }
.theme-saved-list { display: grid; gap: 5px; }
.theme-saved-item { min-height: 35px; padding: 6px 7px; border: 1px solid var(--yf-border); border-radius: 6px; background: color-mix(in srgb, var(--yf-surface-soft) 45%, transparent); }
.theme-saved-name { min-width: 0; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.theme-saved-actions { display: inline-flex; gap: 4px; }
.theme-saved-actions button { min-height: 24px; padding: 0 6px; border: 1px solid var(--yf-border); border-radius: 4px; background: var(--yf-surface); color: var(--yf-primary); font-size: 10px; }
.theme-saved-actions button:hover,
.theme-saved-actions button:focus-visible { border-color: var(--yf-primary); background: var(--yf-primary-soft); }
.theme-status { min-height: 16px; margin: 9px 0 0; color: var(--yf-muted); font-size: 10px; line-height: 1.5; }
.theme-status.is-error { color: var(--danger); }
.theme-status.is-success { color: var(--success); }

/* Keep the account theme expressive without letting a saturated custom color
   turn the navigation rail into a flat neon block. The rail uses the user's
   surface tones, while navigation states use a soft tint and rounded targets. */
.topbar {
  background: var(--yf-sidebar-fill, var(--yf-surface));
}
.primary-nav { gap: 5px; }
.primary-nav a {
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--yf-muted);
  transition: background-color .16s ease, color .16s ease, box-shadow .16s ease;
}
.primary-nav a:hover,
.primary-nav a:focus-visible {
  background: color-mix(in srgb, var(--yf-primary) 9%, var(--yf-surface));
  color: var(--yf-text);
}
.primary-nav a.is-active {
  background: color-mix(in srgb, var(--yf-primary) 13%, var(--yf-surface));
  color: var(--yf-text);
  box-shadow: inset 3px 0 var(--yf-primary);
}
.sidebar-collapse-button,
.theme-toggle,
.account-nav #loginBtn,
.access-trigger {
  border-radius: 11px;
}
.sidebar-collapse-button,
.theme-toggle {
  background: color-mix(in srgb, var(--yf-primary) 7%, var(--yf-surface));
  border-color: color-mix(in srgb, var(--yf-primary) 34%, var(--yf-border));
}
.sidebar-collapse-button:hover,
.sidebar-collapse-button:focus-visible,
.theme-toggle:hover,
.theme-toggle:focus-visible,
.theme-toggle[aria-expanded="true"] {
  background: color-mix(in srgb, var(--yf-primary) 13%, var(--yf-surface));
}

/* Material choices stay compact so the editor still feels like a small wardrobe. */
.theme-material-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.theme-material {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 6px;
  border: 1px solid var(--yf-border);
  border-radius: 10px;
  background: transparent;
  color: var(--yf-text);
  text-align: left;
}
.theme-material:hover,
.theme-material:focus-visible,
.theme-material.is-active {
  border-color: var(--yf-primary);
  background: var(--yf-primary-soft);
}
.theme-material-swatch {
  display: block;
  height: 27px;
  border: 1px solid color-mix(in srgb, var(--yf-border-strong) 60%, transparent);
  border-radius: 7px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28);
}
.theme-material-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}
.theme-material-copy strong {
  overflow: hidden;
  font-size: 10px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.theme-material-copy small {
  overflow: hidden;
  color: var(--yf-muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.theme-direction-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 9px;
}
.theme-direction-row label {
  color: var(--yf-muted);
  font-size: 10px;
}
.theme-direction-select {
  min-height: 29px;
  padding: 0 8px;
  border: 1px solid var(--yf-border);
  border-radius: 8px;
  background: var(--yf-surface);
  color: var(--yf-text);
  font-size: 10px;
}
.theme-direction-select:focus-visible {
  border-color: var(--yf-primary);
  outline: 2px solid color-mix(in srgb, var(--yf-primary) 22%, transparent);
  outline-offset: 1px;
}
.theme-hex-toggle {
  min-height: 25px;
  padding: 0 6px;
  border: 1px solid var(--yf-border);
  border-radius: 999px;
  background: transparent;
  color: var(--yf-muted);
  font: 9px/1 var(--mono);
  letter-spacing: .02em;
}
.theme-hex-toggle:hover,
.theme-hex-toggle:focus-visible,
.theme-hex-toggle.is-open {
  border-color: var(--yf-primary);
  background: var(--yf-primary-soft);
  color: var(--yf-primary);
}
.theme-color-value[hidden] { display: none; }

/* The supplied brand asset is dark ink. Give it a quiet light plaque whenever
   a dark preset would otherwise make the mark disappear into the sidebar. */
body[data-theme-logo-contrast="plate"] .wordmark {
  padding: 7px 9px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 5px 14px rgba(0, 0, 0, .16);
}
body[data-theme-logo-contrast="plate"] .wordmark-logo {
  filter: none;
}

@media (max-width: 720px) {
  .theme-panel {
    position: fixed;
    top: auto;
    right: 16px;
    bottom: 16px;
    left: 16px;
    width: auto;
    max-height: min(76dvh, 600px);
    border-radius: 16px;
  }
  .theme-preset-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .theme-material-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle { transition: none; }
}
