.account-settings-page,
.account-settings-page *,
.account-settings-page *::before,
.account-settings-page *::after {
  box-sizing: border-box;
}

.account-settings-view {
  min-height: 560px;
  padding: 34px clamp(16px, 4vw, 40px) 72px;
}

.account-settings-view[hidden],
.account-settings-card[hidden] {
  display: none !important;
}

body.is-settings-view .workspace-head {
  display: none;
}

body.account-settings-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  color: var(--text, var(--color-text-primary, #15181d));
  background: var(--bg, var(--color-canvas, #f7f7f8));
  font-family: var(--font-sans, Inter, "Segoe UI", sans-serif);
}

body.account-settings-page > .app-shell {
  width: 100%;
  flex: 1 0 auto;
}

body.account-settings-page .px-footer {
  margin-top: 0;
}

.account-settings-shell {
  width: min(100%, 920px);
  margin: 0 auto;
}

.account-settings-heading {
  margin-bottom: 24px;
}

.account-settings-heading > small,
.account-settings-card__heading > small {
  display: block;
  margin-bottom: 5px;
  color: var(--muted, var(--color-text-muted, #687386));
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.account-settings-heading h1 {
  margin: 0;
  color: var(--text, var(--color-text-primary, #15181d));
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1.05;
  text-wrap: balance;
}

.account-settings-heading p {
  max-width: 620px;
  margin: 12px 0 0;
  color: var(--muted, var(--color-text-muted, #687386));
  font-size: 13px;
  line-height: 1.55;
  text-wrap: pretty;
}

.account-settings-layout {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}

.account-settings-nav {
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line, var(--color-border-subtle, #dde2e8));
  border-radius: 15px;
  background: var(--surface, var(--color-surface, #fff));
  box-shadow: 0 10px 28px rgba(17, 24, 39, .07);
}

.account-settings-nav button {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 0;
  border-radius: 999px;
  color: var(--text, var(--color-text-primary, #15181d));
  background: transparent;
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.account-settings-nav button:hover {
  background: var(--surface-2, var(--color-surface-raised, #f2f4f7));
}

.account-settings-nav button.is-active {
  color: #fff;
  background: #111214;
}

.account-settings-nav button:focus-visible,
.account-settings-card button:focus-visible,
.account-settings-card input:focus-visible,
.account-settings-card select:focus-visible,
.account-history-item:focus-visible {
  outline: 2px solid var(--focus-ring, #4361ee);
  outline-offset: 2px;
}

.account-settings-panels {
  min-width: 0;
}

.account-settings-card {
  min-height: 220px;
  padding: 24px;
  border: 1px solid var(--line, var(--color-border-subtle, #dde2e8));
  border-radius: 16px;
  color: var(--text, var(--color-text-primary, #15181d));
  background: var(--surface, var(--color-surface, #fff));
  box-shadow: 0 14px 34px rgba(17, 24, 39, .08);
}

.account-settings-card__heading {
  margin-bottom: 20px;
}

.account-settings-card__heading h2 {
  margin: 0;
  color: inherit;
  font-size: 21px;
  line-height: 1.2;
  text-wrap: balance;
}

.account-settings-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.account-settings-form--stacked {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.account-settings-form--stacked label:first-child {
  grid-column: 1 / -1;
}

.account-settings-form label,
.account-settings-email label,
.account-settings-preferences label {
  display: grid;
  min-width: 0;
  gap: 7px;
  color: inherit;
  font-size: 11px;
  font-weight: 700;
}

.account-settings-card input,
.account-settings-card select {
  width: 100%;
  min-height: 39px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong, var(--color-border-strong, #cbd2dc));
  border-radius: 9px;
  color: var(--text, var(--color-text-primary, #15181d));
  background: var(--surface, var(--color-surface, #fff));
  font: inherit;
  font-size: 12px;
  font-weight: 500;
}

.account-settings-card input[readonly] {
  color: var(--muted, var(--color-text-muted, #687386));
  background: var(--surface-2, var(--color-surface-raised, #f2f4f7));
  cursor: default;
}

.account-settings-primary,
.account-plan-row button {
  min-height: 39px;
  padding: 9px 15px;
  border: 1px solid #111214;
  border-radius: 999px;
  color: #fff;
  background: #111214;
  font: inherit;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
}

.account-settings-primary:hover:not(:disabled) {
  background: #2a2c30;
}

.account-settings-primary:disabled,
.account-plan-row button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.account-settings-email {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-top: 16px;
}

.account-settings-verified {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  align-self: end;
  padding: 6px 10px;
  border-radius: 999px;
  color: #087452;
  background: rgba(8, 116, 82, .1);
  font-size: 10px;
  font-weight: 800;
}

.account-settings-verified.is-unverified {
  color: #9a5b00;
  background: rgba(176, 105, 0, .1);
}

.account-settings-message {
  margin: 14px 0 0;
  color: #087452;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.45;
  text-wrap: pretty;
}

.account-settings-message.is-error {
  color: var(--color-error, #b42318);
}

.account-settings-preferences {
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
}

.account-settings-preferences .pxds-select-trigger {
  min-height: 39px;
  border-radius: 9px;
}

.account-history-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.account-history-item {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line, var(--color-border-subtle, #dde2e8));
  border-radius: 12px;
  color: inherit;
  background: var(--surface-2, var(--color-surface-raised, #f2f4f7));
  text-align: left;
  cursor: pointer;
}

.account-history-item.is-available:hover {
  border-color: color-mix(in srgb, var(--accent, #13866f) 55%, var(--line, #dde2e8));
}

.account-history-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
  background: var(--surface-3, #e7ebf0);
}

.account-history-item > .account-history-item__copy {
  display: grid;
  gap: 3px;
  padding: 10px;
}

.account-history-item:not(.is-available) {
  cursor: default;
}

.account-history-item__status-visual {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  padding: 18px;
  overflow: hidden;
  color: var(--muted, var(--color-text-muted, #687386));
  background: linear-gradient(145deg, #f8f9fb, #eef1f5);
  text-align: center;
}

.account-history-item__status-mark {
  position: relative;
  width: 27px;
  height: 27px;
  display: block;
  border: 3px solid currentColor;
  border-radius: 50%;
  opacity: .75;
}

.account-history-item.is-running .account-history-item__status-mark {
  border-right-color: transparent;
  animation: account-history-spin 1.15s linear infinite;
}

.account-history-item.is-failed .account-history-item__status-mark::before,
.account-history-item.is-failed .account-history-item__status-mark::after,
.account-history-item.is-timed-out .account-history-item__status-mark::before {
  content: '';
  position: absolute;
  width: 11px;
  height: 2px;
  margin: 10px 0 0 5px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(45deg);
}

.account-history-item.is-failed .account-history-item__status-mark::after {
  transform: rotate(-45deg);
}

.account-history-item.is-timed-out .account-history-item__status-mark::before {
  width: 8px;
  margin: 11px 0 0 11px;
  transform: rotate(-90deg);
  transform-origin: left center;
}

.account-history-item__status-visual small {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.account-history-item__status-visual strong {
  max-width: 185px;
  white-space: normal;
  font-size: 10px;
  line-height: 1.35;
}

.account-history-item__status-visual em {
  padding: 4px 8px;
  border-radius: 999px;
  color: inherit;
  background: color-mix(in srgb, currentColor 9%, transparent);
  font-size: 9px;
  font-style: normal;
  font-weight: 750;
}

.account-history-item__status-visual em.is-returned {
  color: #08745c;
  background: #e5f6f0;
}

.account-history-item.is-queued .account-history-item__status-visual,
.account-history-item.is-running .account-history-item__status-visual {
  color: #176c83;
  background: linear-gradient(145deg, #f3fafb, #eaf4f7);
}

.account-history-item.is-failed .account-history-item__status-visual {
  color: #a93636;
  background: linear-gradient(145deg, #fff8f8, #fbecec);
}

.account-history-item.is-timed-out .account-history-item__status-visual {
  color: #9b5d13;
  background: linear-gradient(145deg, #fffaf2, #f9eedc);
}

@keyframes account-history-spin {
  to { transform: rotate(360deg); }
}

.account-history-item strong,
.account-history-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-history-item strong {
  font-size: 11px;
}

.account-history-item small {
  color: var(--muted, var(--color-text-muted, #687386));
  font-size: 10px;
}

.account-settings-empty {
  grid-column: 1 / -1;
  min-height: 170px;
  display: grid;
  place-items: center;
  padding: 24px;
  border: 1px dashed var(--line-strong, var(--color-border-strong, #cbd2dc));
  border-radius: 12px;
  color: var(--muted, var(--color-text-muted, #687386));
  text-align: center;
}

.account-settings-empty span {
  display: block;
  max-width: 360px;
  margin-top: 5px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
}

.account-history-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.account-history-pagination[hidden] {
  display: none;
}

.account-history-pagination button {
  min-width: 82px;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong, #cbd2dc);
  border-radius: 9px;
  color: var(--text, #16191e);
  background: var(--surface, #fff);
  font: inherit;
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
}

.account-history-pagination button:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent, #13866f) 55%, var(--line-strong, #cbd2dc));
}

.account-history-pagination button:disabled {
  opacity: .45;
  cursor: default;
}

.account-history-pagination span {
  min-width: 80px;
  color: var(--muted, #687386);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.account-plan-row,
.account-plan-credits,
.account-plan-payment {
  padding: 17px 0;
  border-top: 1px solid var(--line, var(--color-border-subtle, #dde2e8));
}

.account-plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 0;
  border-top: 0;
}

.account-plan-row div,
.account-plan-credits,
.account-plan-payment {
  display: grid;
  gap: 5px;
}

.account-plan-row small,
.account-plan-credits small,
.account-plan-payment small {
  color: var(--muted, var(--color-text-muted, #687386));
  font-size: 10px;
  font-weight: 650;
}

.account-plan-row strong,
.account-plan-credits > strong,
.account-plan-payment strong {
  font-size: 13px;
}

.account-plan-row p,
.account-plan-credits p,
.account-plan-payment p {
  margin: 0;
  color: var(--muted, var(--color-text-muted, #687386));
  font-size: 10px;
  line-height: 1.45;
}

.account-plan-row button {
  border-color: var(--line-strong, var(--color-border-strong, #cbd2dc));
  color: var(--muted, var(--color-text-muted, #687386));
  background: transparent;
}

.account-plan-meter {
  width: 100%;
  height: 7px;
  margin: 7px 0 1px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3, #e4e8ed);
}

.account-plan-meter span {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--accent, #13866f);
  transform: scaleX(var(--account-credit-scale, 0));
  transform-origin: left center;
  transition: transform 160ms ease-out;
}

html[data-theme="dark"] .account-settings-nav,
html[data-theme="dark"] .account-settings-card {
  border-color: #303a4b;
  background: #111722;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .22);
}

html[data-theme="dark"] .account-settings-nav button.is-active,
html[data-theme="dark"] .account-settings-primary {
  border-color: #f3f5f8;
  color: #111214;
  background: #f3f5f8;
}

html[data-theme="dark"] .account-settings-nav button:hover:not(.is-active),
html[data-theme="dark"] .account-history-item,
html[data-theme="dark"] .account-settings-card input[readonly] {
  background: #18202d;
}

html[data-theme="dark"] .account-settings-card input,
html[data-theme="dark"] .account-settings-card select {
  border-color: #3b4659;
  color: #f3f5f8;
  background: #0d131d;
}

html[data-theme="dark"] .account-history-item {
  border-color: #354055;
}

html[data-theme="dark"] .account-history-item__status-visual {
  background: linear-gradient(145deg, #151d29, #101721);
}

html[data-theme="dark"] .account-history-item.is-queued .account-history-item__status-visual,
html[data-theme="dark"] .account-history-item.is-running .account-history-item__status-visual {
  color: #73cde1;
  background: linear-gradient(145deg, #11232a, #101b24);
}

html[data-theme="dark"] .account-history-item.is-failed .account-history-item__status-visual {
  color: #ff9a9a;
  background: linear-gradient(145deg, #2a171b, #20141a);
}

html[data-theme="dark"] .account-history-item.is-timed-out .account-history-item__status-visual {
  color: #efbd78;
  background: linear-gradient(145deg, #2a2115, #201a13);
}

html[data-theme="dark"] .account-history-item__status-visual em.is-returned {
  color: #75d8b9;
  background: rgba(53, 181, 141, .13);
}

html[data-theme="dark"] .account-history-pagination button {
  border-color: #3b4659;
  color: #f3f5f8;
  background: #18202d;
}

@media (max-width: 760px) {
  .account-settings-view {
    padding: 22px 0 52px;
  }

  .account-settings-layout {
    grid-template-columns: 1fr;
  }

  .account-settings-nav {
    grid-template-columns: repeat(5, max-content);
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .account-settings-nav button {
    text-align: center;
  }

  .account-history-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .account-settings-card {
    padding: 18px;
  }

  .account-settings-form,
  .account-settings-form--stacked,
  .account-settings-preferences,
  .account-settings-email {
    grid-template-columns: 1fr;
  }

  .account-settings-form--stacked label:first-child {
    grid-column: auto;
  }

  .account-settings-primary {
    width: 100%;
  }

  .account-settings-verified {
    justify-self: start;
  }

  .account-history-grid {
    grid-template-columns: 1fr;
  }

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

@media (prefers-reduced-motion: reduce) {
  .account-plan-meter span {
    transition: none;
  }

  .account-history-item.is-running .account-history-item__status-mark {
    animation: none;
  }
}
