/* Settings, the rail's account menu, adding an account, and the preference
   classes the shell puts on <html>.

   The page is a sticky list of its sections beside the sections themselves.
   Each section is a heading and one or more cards on the panel colour, and a
   card is rows of label, note and control. No rules between rows and no
   outlines on cards: spacing and one background step do that work. */

html.ui-v2 .st { --st-gap: 28px; --st-row: 18px; --st-ease: cubic-bezier(0.23, 1, 0.32, 1); display: flex; flex-direction: column; gap: 22px; min-width: 0; padding-bottom: 40px; }
html.ui-v2 .st-head p { margin: 6px 0 0; color: var(--pf-dim); font-size: 13px; }
html.ui-v2 .st-head .pf-h1 { margin: 0; }

html.ui-v2 .st-layout { display: grid; grid-template-columns: 188px minmax(0, 1fr); gap: 40px; align-items: start; }

/* ------------------------------------------------------------ section nav */

html.ui-v2 .st-nav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; }
html.ui-v2 .st-nav a {
  display: flex; align-items: center; height: 36px; padding: 0 12px; border-radius: 9px;
  color: var(--pf-dim); font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background-color 140ms ease, color 140ms ease;
}
html.ui-v2 .st-nav a:hover, html.ui-v2 .st-nav a:focus-visible { background: #16181e; color: var(--pf-text); outline: none; }
html.ui-v2 .st-nav a[aria-current="true"] { background: #1c2133; color: #dfe5ff; font-weight: 580; }

/* --------------------------------------------------------------- sections */

html.ui-v2 .st-body { display: flex; flex-direction: column; gap: 44px; min-width: 0; max-width: 860px; }
html.ui-v2 .st-wait { margin: 0; color: var(--pf-dim); font-size: 13px; }
html.ui-v2 .st-group { display: flex; flex-direction: column; gap: 12px; scroll-margin-top: 16px; }
html.ui-v2 .st-group-head h2 { margin: 0; font-size: 19px; font-weight: 640; letter-spacing: -.02em; outline: none; }
html.ui-v2 .st-group-head p { margin: 5px 0 0; color: var(--pf-dim); font-size: 13px; line-height: 1.55; max-width: 64ch; text-wrap: pretty; }

html.ui-v2 .st-card { display: flex; flex-direction: column; padding: 8px 22px; border-radius: 16px; background: var(--pf-panel); min-width: 0; }
html.ui-v2 .st-card-head { padding: 14px 0 4px; }
html.ui-v2 .st-card-head h3 { margin: 0; font-size: 14px; font-weight: 620; }
html.ui-v2 .st-card-head p { margin: 4px 0 0; color: var(--pf-dim); font-size: 12.5px; line-height: 1.55; max-width: 62ch; text-wrap: pretty; }
html.ui-v2 .st-note { margin: 14px 0 6px; color: var(--pf-dim); font-size: 13px; line-height: 1.6; max-width: 64ch; text-wrap: pretty; }
html.ui-v2 .st-dim { color: var(--pf-dimmer); font-size: 12px; }

html.ui-v2 .st-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); align-items: center; gap: 24px;
  padding: var(--st-row) 0; min-width: 0;
}
html.ui-v2 .st-row-copy { min-width: 0; }
html.ui-v2 .st-row-copy label, html.ui-v2 .st-row-label { display: block; font-size: 13.5px; font-weight: 560; color: var(--pf-text); }
html.ui-v2 .st-row-copy p { margin: 4px 0 0; color: var(--pf-dim); font-size: 12.5px; line-height: 1.55; text-wrap: pretty; }
html.ui-v2 .st-row-control { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; flex-wrap: wrap; }
html.ui-v2 .st-value { color: var(--pf-dim); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }

html.ui-v2 .st-form-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 6px 0 16px; min-height: 36px; flex-wrap: wrap; }
html.ui-v2 .st-form-foot .st-dim { margin-right: auto; }
/* A footer holding only a status line with nothing to say takes no room. */
html.ui-v2 .st-form-foot:not(:has(> :not(.st-status:empty))) { display: none; }
html.ui-v2 a.pf-btn { display: inline-flex; align-items: center; text-decoration: none; }
html.ui-v2 .st-status { font-size: 12.5px; color: var(--pf-dim); margin-right: auto; }
html.ui-v2 .st-row-control .st-status { margin-right: 0; flex-basis: 100%; text-align: right; }
html.ui-v2 .st-status[data-tone="good"] { color: var(--pf-good); }
html.ui-v2 .st-status[data-tone="bad"] { color: var(--pf-bad); }
html.ui-v2 .st-status:empty { display: none; }

/* ----------------------------------------------------------------- inputs */

html.ui-v2 .st-input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1px solid transparent; background: #171920; color: var(--pf-text);
  font: inherit; font-size: 13.5px;
  transition: border-color 140ms ease, background-color 140ms ease;
}
html.ui-v2 .st-input::placeholder { color: var(--pf-dimmer); }
html.ui-v2 .st-input:hover { background: #1b1d25; }
html.ui-v2 .st-input:focus { outline: none; border-color: rgba(141, 162, 255, .55); background: #1b1d25; }
html.ui-v2 .st-input:disabled { color: var(--pf-dim); background: #121318; cursor: not-allowed; }

html.ui-v2 .st-select { position: relative; display: block; width: 100%; }
html.ui-v2 .st-select::after {
  content: ''; position: absolute; right: 14px; top: 50%; width: 6px; height: 6px; margin-top: -5px;
  border-right: 1.7px solid var(--pf-dim); border-bottom: 1.7px solid var(--pf-dim); transform: rotate(45deg); pointer-events: none;
}
html.ui-v2 .st-select select {
  appearance: none; width: 100%; height: 40px; padding: 0 36px 0 12px; border-radius: 10px;
  border: 1px solid transparent; background: #171920; color: var(--pf-text); font: inherit; font-size: 13.5px; cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}
html.ui-v2 .st-select select:hover { background: #1b1d25; }
html.ui-v2 .st-select select:focus { outline: none; border-color: rgba(141, 162, 255, .55); }
html.ui-v2 .st-select select:disabled { color: var(--pf-dim); cursor: not-allowed; }

/* A segment: one choice of a few, the chosen one lifted onto the accent. */
html.ui-v2 .st-segment { display: inline-flex; gap: 3px; padding: 3px; border-radius: 11px; background: #171920; }
html.ui-v2 .st-segment button {
  height: 32px; padding: 0 13px; border: 0; border-radius: 8px; background: transparent;
  color: var(--pf-dim); font: inherit; font-size: 12.5px; font-weight: 540; white-space: nowrap; cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}
html.ui-v2 .st-segment button:hover { color: var(--pf-text); }
html.ui-v2 .st-segment button:focus-visible { outline: none; color: var(--pf-text); background: #20232c; }
html.ui-v2 .st-segment button[aria-checked="true"] { background: #262c44; color: #e3e8ff; }

/* A switch, as a rounded rectangle rather than a capsule. The knob slides on
   transform only. */
html.ui-v2 .st-switch {
  position: relative; width: 44px; height: 26px; padding: 0; border: 0; border-radius: 8px;
  background: #23262f; cursor: pointer; transition: background-color 140ms ease;
}
html.ui-v2 .st-switch span {
  position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 6px;
  background: #9aa0b3; transition: transform 140ms var(--st-ease), background-color 140ms ease;
}
html.ui-v2 .st-switch[aria-checked="true"] { background: var(--v2-accent); }
html.ui-v2 .st-switch[aria-checked="true"] span { transform: translateX(18px); background: #0b0d14; }
html.ui-v2 .st-switch:focus-visible { outline: none; background: #2d3140; }
html.ui-v2 .st-switch[aria-checked="true"]:focus-visible { background: #a9b8ff; }

html.ui-v2 .st-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none;
  color: var(--v2-accent); font: inherit; font-size: 13px; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: color 140ms ease;
}
html.ui-v2 .st-link:hover, html.ui-v2 .st-link:focus-visible { color: #ccd5ff; outline: none; }

/* --------------------------------------------------------------- identity */

html.ui-v2 .st-identity { flex-direction: row; align-items: center; gap: 18px; padding: 20px 22px; }
html.ui-v2 .st-identity-face .pf-avatar { width: 64px; height: 64px; border-radius: 18px; font-size: 20px; }
html.ui-v2 .st-identity-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
html.ui-v2 .st-identity-copy b { font-size: 17px; font-weight: 640; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.ui-v2 .st-identity-copy span { color: var(--pf-dim); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.ui-v2 .st-identity-copy .st-dim { font-size: 12px; }

/* ---------------------------------------------------------------- accounts */

.pf-acct {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  width: 100%; min-height: 54px; padding: 8px 10px; border: 0; border-radius: 12px;
  background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: background-color 140ms ease;
}
button.pf-acct:hover, button.pf-acct:focus-visible { background: #181a21; outline: none; }
button.pf-acct:disabled { opacity: .6; cursor: progress; }
.pf-acct-face {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: #1f2436; color: #d6ddff; font-size: 13px; font-weight: 650;
}
.pf-acct-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pf-acct-copy b { font-size: 13.5px; font-weight: 580; color: #eef0f7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-acct-copy span { font-size: 12px; color: rgba(255, 255, 255, .55); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-acct-go { font-size: 12.5px; color: #8da2ff; font-weight: 540; }
.pf-acct.is-current { cursor: default; }

html.ui-v2 .st-accounts { padding-top: 12px; }
html.ui-v2 .st-accounts .pf-acct { margin: 0 -10px; width: calc(100% + 20px); }
html.ui-v2 .st-account-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
html.ui-v2 .st-account-line .pf-acct { margin-right: 0; width: calc(100% + 10px); }

/* ------------------------------------------------------------------ merge */

html.ui-v2 .st-merge-preview { padding: 4px 0 10px; }
html.ui-v2 .st-merge-line { margin: 0 0 10px; font-size: 13.5px; color: var(--pf-dim); }
html.ui-v2 .st-merge-line b { color: var(--pf-text); font-weight: 600; }
html.ui-v2 .st-merge-list { list-style: none; margin: 0 0 10px; padding: 12px 16px; border-radius: 12px; background: #121318; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 24px; }
html.ui-v2 .st-merge-list li { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--pf-dim); }
html.ui-v2 .st-merge-list b { color: var(--pf-text); font-weight: 600; font-variant-numeric: tabular-nums; }
html.ui-v2 .st-merge-preview .st-dim { margin: 6px 0 0; line-height: 1.55; font-size: 12.5px; text-wrap: pretty; }

/* --------------------------------------------------------------- keyboard */

html.ui-v2 .st-keys { margin: 0; padding: 6px 0 16px; display: flex; flex-direction: column; gap: 12px; }
html.ui-v2 .st-keys div { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 12px; }
html.ui-v2 .st-keys dt { margin: 0; }
html.ui-v2 .st-keys dd { margin: 0; color: var(--pf-dim); font-size: 13px; }
html.ui-v2 .st-keys kbd {
  display: inline-grid; place-items: center; min-width: 30px; height: 26px; padding: 0 8px; border-radius: 7px;
  background: #1d2029; color: #d4d8e6; font: inherit; font-size: 12px; font-weight: 600;
}

/* --------------------------------------------------------- account menu */

html.ui-v2 .pf-account-row { padding: 6px; gap: 6px; }
html.ui-v2 .pf-account-open {
  display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; padding: 3px; border: 0; border-radius: 9px;
  background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: background-color 140ms ease;
}
html.ui-v2 .pf-account-open:hover, html.ui-v2 .pf-account-open:focus-visible { background: #20232c; outline: none; }
html.ui-v2 .pf-account-open .pf-avatar { flex: 0 0 auto; }
html.ui-v2 .pf-account-caret { display: grid; place-items: center; margin-left: auto; color: #8a90a2; }
html.ui-v2 .pf-account-caret svg { width: 16px; height: 16px; }
html.ui-v2 .pf-compact .pf-account-caret { display: none; }

html.ui-v2 .pf-account-menu {
  position: fixed; inset: auto auto 92px 14px; margin: 0; width: 236px; padding: 6px;
  border: 0; border-radius: 14px; background: #1a1c24; color: var(--pf-text);
  transform-origin: bottom left;
  opacity: 0; transform: translateY(4px) scale(.98);
  transition: opacity 170ms var(--st-ease, ease), transform 170ms cubic-bezier(0.23, 1, 0.32, 1), overlay 170ms allow-discrete, display 170ms allow-discrete;
}
html.ui-v2 .pf-account-menu:popover-open { opacity: 1; transform: none; }
@starting-style { html.ui-v2 .pf-account-menu:popover-open { opacity: 0; transform: translateY(4px) scale(.98); } }
html.ui-v2 .pf-compact .pf-account-menu { left: 10px; width: 250px; }
html.ui-v2 .pf-am-label { margin: 6px 10px 6px; font-size: 11px; color: var(--pf-dimmer); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.ui-v2 .pf-am-label b { color: var(--pf-dim); font-weight: 560; }
html.ui-v2 .pf-am-others:not(:empty) { padding-bottom: 4px; margin-bottom: 4px; }
html.ui-v2 .pf-am-others .pf-acct { min-height: 46px; padding: 6px 8px; grid-template-columns: 30px minmax(0, 1fr); }
html.ui-v2 .pf-am-others .pf-acct-face { width: 30px; height: 30px; border-radius: 9px; font-size: 12px; }
html.ui-v2 .pf-am-others .pf-acct:hover, html.ui-v2 .pf-am-others .pf-acct:focus-visible { background: #252833; }
html.ui-v2 .pf-am-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px; border: 0; border-radius: 9px;
  background: transparent; color: #d9dcea; font: inherit; font-size: 13px; text-align: left; cursor: pointer; white-space: nowrap;
  transition: background-color 140ms ease, color 140ms ease;
}
html.ui-v2 .pf-am-item svg { width: 17px; height: 17px; color: #aab0c2; flex: 0 0 auto; }
html.ui-v2 .pf-am-item:hover, html.ui-v2 .pf-am-item:focus-visible { background: #252833; color: #ffffff; outline: none; }

/* ------------------------------------------------------ add an account */

.pf-add-account {
  width: min(400px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 18px;
  background: #15171d; color: #eef0f7; font-family: var(--font-sans, 'Geist', sans-serif);
}
.pf-add-account::backdrop { background: rgba(4, 5, 8, .72); }
.pf-add-account-form { display: flex; flex-direction: column; padding: 26px; }
.pf-add-account h2 { margin: 0 0 12px; font-size: 19px; font-weight: 650; letter-spacing: -.02em; }
.pf-add-account-form > p { margin: 8px 0 18px; color: rgba(255, 255, 255, .6); font-size: 13px; line-height: 1.55; text-wrap: pretty; }
.pf-add-account label { margin: 10px 0 6px; font-size: 12.5px; font-weight: 560; color: rgba(255, 255, 255, .8); }
.pf-add-account input {
  height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid transparent; background: #1d2029; color: #fff; font: inherit; font-size: 14px;
}
.pf-add-account input:focus { outline: none; border-color: rgba(141, 162, 255, .55); }
.pf-add-account-error { min-height: 18px; margin: 12px 0 0; color: #ff8f8f; font-size: 12.5px; }
.pf-add-account-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }

/* The sign-in dialog's accounts, above the form. */
.login-accounts { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 6px; text-align: left; }
.login-accounts[hidden] { display: none; }
.login-accounts-label, .login-accounts-or { margin: 6px 0 4px; font-size: 12px; color: rgba(255, 255, 255, .5); }
.login-accounts-or { margin-top: 12px; text-align: center; }
.login-accounts .pf-acct:hover, .login-accounts .pf-acct:focus-visible { background: rgba(255, 255, 255, .06); }

/* ------------------------------------------------------ preference classes */

/* Compact: more of each page on screen, from spacing alone. */
html.ui-v2.pf-density-compact .pf-body { padding: 22px 24px; }
html.ui-v2.pf-density-compact .ph { gap: 16px; }
html.ui-v2.pf-density-compact .ph-grid { gap: 10px; }
html.ui-v2.pf-density-compact .ph-cell, html.ui-v2.pf-density-compact .pf-panel { padding: 16px 18px; }
html.ui-v2.pf-density-compact .pf-nav { height: 38px; min-height: 38px; margin: 1px 0; }
html.ui-v2.pf-density-compact .pf-navigation-group { margin-bottom: 14px; }
html.ui-v2.pf-density-compact .pf-topbar { height: 56px; }
html.ui-v2.pf-density-compact .intel-row { min-height: 40px; padding-top: 5px; padding-bottom: 5px; }
html.ui-v2.pf-density-compact .st { --st-row: 13px; }
html.ui-v2.pf-density-compact .st-body { gap: 34px; }

/* Keep still: every transition and animation in the workspace finishes at
   once, whatever the device asks for. */
html.pf-reduce-motion *, html.pf-reduce-motion *::before, html.pf-reduce-motion *::after {
  transition-duration: 0s !important; transition-delay: 0s !important;
  animation-duration: 0s !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
  scroll-behavior: auto !important;
}
html.pf-reduce-motion::view-transition-group(*), html.pf-reduce-motion::view-transition-old(*), html.pf-reduce-motion::view-transition-new(*) { animation: none !important; }

/* -------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  html.ui-v2 .st-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  /* The section list becomes one line that scrolls sideways, pinned under the bar. */
  html.ui-v2 .st-nav {
    flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 4px;
    position: sticky; top: -1px; z-index: 2; padding: 8px 0; margin: -8px 0 0; background: var(--pf-canvas, #050506);
  }
  html.ui-v2 .st-nav::-webkit-scrollbar { display: none; }
  html.ui-v2 .st-nav a { flex: 0 0 auto; }
  html.ui-v2 .st-group { scroll-margin-top: 64px; }
}
@media (max-width: 700px) {
  html.ui-v2 .st-row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  html.ui-v2 .st-row-control { justify-content: flex-start; }
  html.ui-v2 .st-row-control .st-status { text-align: left; }
  html.ui-v2 .st-card { padding: 6px 16px; }
  html.ui-v2 .st-identity { flex-wrap: wrap; padding: 16px; }
  html.ui-v2 .st-segment { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  html.ui-v2 .st-switch span, html.ui-v2 .st-segment button { transition: none; }
  html.ui-v2 .pf-account-menu { transform: none; transition: opacity 170ms ease, overlay 170ms allow-discrete, display 170ms allow-discrete; }
  @starting-style { html.ui-v2 .pf-account-menu:popover-open { transform: none; } }
}
/* Hung out by its own padding, so the face lines up with the form's labels. */
.login-accounts .pf-acct { margin: 0 -10px; width: calc(100% + 20px); }

/* --------------------------------------------------------------- pictures */

html.ui-v2 .st-pictures { padding-bottom: 6px; }
/* Fourteen in two even rows of seven, so none is left alone on a row. */
html.ui-v2 .st-picture-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 72px)); gap: 10px; padding: 8px 0 12px; }
html.ui-v2 .st-picture, html.ui-v2 .st-picture-wait {
  position: relative; display: block; aspect-ratio: 1; width: 100%; padding: 0; border: 0; border-radius: 14px;
  overflow: hidden; background: #171920; cursor: pointer;
  transition: transform 140ms cubic-bezier(0.23, 1, 0.32, 1);
}
html.ui-v2 .st-picture-wait { cursor: default; }
html.ui-v2 .st-picture .pf-face { position: absolute; inset: 0; border-radius: inherit; }
/* The chosen one is lifted onto the accent: a solid fill behind it rather than
   a ring round it. */
html.ui-v2 .st-picture[aria-checked="true"] { background: var(--v2-accent); padding: 3px; }
html.ui-v2 .st-picture[aria-checked="true"] .pf-face { inset: 3px; border-radius: 11px; }
html.ui-v2 .st-picture-none { display: grid; place-items: center; color: var(--pf-dim); font-size: 18px; font-weight: 650; }
html.ui-v2 .st-picture-none[aria-checked="true"] { color: #0b0d14; }
html.ui-v2 .st-picture:focus-visible { outline: none; transform: translateY(-2px); }
@media (hover: hover) and (pointer: fine) { html.ui-v2 .st-picture:hover { transform: translateY(-2px); } }

/* ------------------------------------------------------------ preset faces */

.pf-face { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; background: var(--tint, #26324d); }
.pf-face img { position: absolute; max-width: none; height: auto; aspect-ratio: 1; }
/* The avatar tile sizes its own photo to fill it; a preset's image is the
   crop's size instead, so the tile's rule must not reach it. */
html.ui-v2 .pf-avatar .pf-face img, html.ui-v2 .pf-acct-face .pf-face img, html.ui-v2 .pf-team-face .pf-face img { height: auto; object-fit: fill; }
.pf-avatar.has-preset > b { visibility: hidden; }
.pf-avatar { position: relative; overflow: hidden; }
.pf-avatar.has-photo .pf-face { display: none; }
.pf-acct-face { position: relative; overflow: hidden; }
html.ui-v2 .pf-team-face { position: relative; overflow: hidden; }
/* Seven across on every width, so the fourteen tiles are always two full rows. */
@media (max-width: 640px) {
  html.ui-v2 .st-picture-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
}

/* Deleting the account sits apart, in its own card, below everything else. */
html.ui-v2 .st-danger .st-row-label { color: var(--pf-bad); }
