.account-page {
  --account-ink: #111827;
  --account-secondary: #4b5563;
  --account-muted: #6b7280;
  --account-border: rgba(17, 24, 39, 0.08);
  --account-border-strong: rgba(17, 24, 39, 0.16);
  --account-canvas: #f5f7fb;
  --account-field: #f3f4f6;
  --account-cream: #fff7ed;
  --account-orange: #f59e0b;
  --copy-text: var(--account-ink);
  --copy-text-2: var(--account-secondary);
  --copy-muted: var(--account-muted);
  --copy-border: var(--account-border);
  --copy-border-strong: var(--account-border-strong);
  --copy-cream: var(--account-cream);
  min-height: 100vh;
  margin: 0;
  color: var(--account-ink);
  background: var(--account-canvas);
  font-family: "PingFang SC", "Noto Sans SC", var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  overflow-y: scroll;
}

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

.account-page .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.copy-account {
  position: relative;
}

.account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 80;
  width: 208px;
  max-height: calc(100vh - 82px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--account-border-strong);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 24px rgba(17, 24, 39, 0.08);
  opacity: 0;
  transform: translateY(-6px);
  visibility: hidden;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
}

.account-menu[data-open] {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

.account-menu__item {
  display: flex;
  width: 100%;
  height: 36px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: var(--account-secondary);
  background: transparent;
  cursor: pointer;
  font: inherit;
  line-height: 26px;
  text-align: left;
  text-decoration: none;
}

.account-menu__item:hover {
  color: var(--account-ink);
  background: #f9fafb;
}

.account-menu__item[aria-current="page"] {
  color: var(--account-ink);
  background: #fff4dc;
  font-weight: 600;
}

.account-menu__item svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.account-menu__divider {
  height: 1px;
  margin: 6px 0;
  background: var(--account-border);
}

.account-main {
  min-height: calc(100vh - 57px);
  padding: 40px 24px 64px;
}

.account-main__inner {
  width: 100%;
  margin: 0 auto;
}

.account-main__inner--settings {
  width: min(100%, 760px);
}

.account-heading {
  margin-bottom: 20px;
}

.account-heading h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 32px;
  letter-spacing: 0;
}

.account-heading p {
  margin: 4px 0 0;
  color: var(--account-secondary);
  font-size: 14px;
  line-height: 23px;
}

.account-card {
  padding: 20px;
  border: 1px solid var(--account-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 6px 24px rgba(17, 24, 39, 0.08);
}

.account-card + .account-card {
  margin-top: 16px;
}

.account-card h2 {
  margin: 0 0 16px;
  color: var(--account-secondary);
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  letter-spacing: 0;
}

.account-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.account-section-title span {
  color: var(--account-muted);
  font-size: 13px;
  font-weight: 400;
}

.account-section-title--count {
  gap: 0;
  justify-content: flex-start;
  margin-bottom: 13px !important;
  line-height: 28px !important;
}

.account-count-badge {
  height: 22px;
  margin-left: 8px;
  padding: 2px 10px;
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 9999px;
  color: #c56e00 !important;
  background: rgba(245, 158, 11, 0.12);
  font-size: 12px !important;
  font-weight: 500 !important;
  line-height: 16px;
}

.account-field-group {
  min-width: 0;
}

.account-label {
  display: block;
  margin-bottom: 8px;
  color: var(--account-muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
}

.account-label--required::before {
  margin-right: 3px;
  color: #ef4444;
  content: "*";
}

.account-field,
.account-select,
.account-textarea {
  width: 100%;
  border: 1px solid var(--account-border-strong);
  border-radius: 8px;
  color: var(--account-ink);
  background: var(--account-field);
  outline: none;
  font: inherit;
  font-size: 14px;
}

.account-field,
.account-select {
  height: 45px;
  padding: 10px 14px;
}

.account-select {
  appearance: auto;
}

.account-textarea {
  min-height: 144px;
  padding: 12px 14px;
  line-height: 22px;
  resize: vertical;
}

.account-field:focus,
.account-select:focus,
.account-textarea:focus,
.account-file:focus-within {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.13);
}

.account-field::placeholder,
.account-textarea::placeholder {
  color: var(--account-muted);
}

.account-button,
.account-button--secondary {
  display: inline-flex;
  min-height: 43px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 18px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  color: var(--account-ink);
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  text-decoration: none;
  transition: filter 150ms ease, transform 150ms ease;
}

.account-button {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #ffb623 0%, #ea580c 55%, #fbbf24 100%);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.28);
}

.account-button:hover,
.account-button--secondary:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

.account-button:disabled {
  cursor: default;
  filter: grayscale(0.12);
  opacity: 0.72;
  transform: none;
}

.account-button--danger {
  display: inline-flex;
  min-height: 43px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid #dc2626;
  border-radius: 8px;
  color: #fff;
  background: #dc2626;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
}

.account-button--danger:disabled {
  cursor: default;
  opacity: 0.65;
}

.account-settings-card__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.account-settings-card__heading h2 {
  margin-bottom: 2px;
  color: var(--account-ink);
}

.account-settings-card__heading p {
  margin: 0;
  color: var(--account-muted);
  font-size: 13px;
}

.account-settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.account-settings-form__actions {
  display: flex;
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.account-settings-card--danger {
  border-color: #fecaca;
  box-shadow: none;
}

.account-delete-dialog {
  width: min(calc(100% - 32px), 520px);
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: var(--account-ink);
  background: #fff;
  box-shadow: 0 24px 60px rgba(17, 24, 39, 0.2);
}

.account-delete-dialog::backdrop {
  background: rgba(17, 24, 39, 0.48);
}

.account-delete-dialog__panel {
  display: grid;
  gap: 20px;
  padding: 24px;
}

.account-delete-dialog__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.account-delete-dialog__heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 28px;
}

.account-delete-dialog__heading p {
  margin: 3px 0 0;
  color: var(--account-muted);
  font-size: 13px;
}

.account-delete-dialog__heading > button {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 0;
  border-radius: 6px;
  color: var(--account-muted);
  background: transparent;
  cursor: pointer;
  font-size: 24px;
}

.account-code-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.account-delete-confirm {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--account-secondary);
  font-size: 13px;
  line-height: 21px;
}

.account-delete-confirm input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: #dc2626;
}

.account-form-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #b91c1c;
  background: #fef2f2;
  font-size: 13px;
}

.account-delete-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.account-button svg,
.account-button--secondary svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.library-form {
  display: grid;
  min-height: 75.1px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.library-form .account-button {
  width: 100%;
  min-height: 43px;
  align-self: end;
  padding: 10px 20px;
  line-height: 23.1px;
}

.library-form .account-field-group {
  padding-top: 1.1px;
}

.account-native-file {
  width: 100%;
  height: 46px;
  padding: 8px 14px;
  border: 1px solid var(--account-border-strong);
  border-radius: 8px;
  color: var(--account-ink);
  background: var(--account-field);
  font: inherit;
  font-size: 14px;
  line-height: 23.1px;
}

.account-native-file:focus {
  border-color: var(--account-orange);
  outline: none;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.13);
}

.account-native-file::file-selector-button {
  height: 28px;
  margin: 0 12px 0 0;
  padding: 6px 12px;
  border: 0;
  border-radius: 6px;
  color: var(--account-secondary);
  background: #fff7ed;
  cursor: pointer;
  font-family: "PingFang SC", "Noto Sans SC", var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
}

.account-file {
  display: flex;
  width: 100%;
  height: 45px;
  min-width: 0;
  align-items: center;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--account-field);
  cursor: pointer;
}

.account-file input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.account-file__button {
  display: inline-flex;
  height: 100%;
  flex: 0 0 auto;
  align-items: center;
  padding: 0 14px;
  border-right: 1px solid #e5e7eb;
  color: #374151;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
}

.account-file__name {
  min-width: 0;
  overflow: hidden;
  padding: 0 12px;
  color: #9ca3af;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-note {
  margin: 8px 0 0;
  color: var(--account-muted);
  font-size: 12px;
  line-height: 16px;
}

.library-empty {
  display: grid;
  min-height: 90.5px;
  place-items: center;
  padding: 32px;
  border: 1px dashed var(--account-border-strong);
  border-radius: 12px;
  color: var(--account-muted);
  background: #fff7ed;
  font-size: 14px;
  line-height: 24.5px;
  text-align: center;
}

.library-items,
.work-items {
  display: grid;
  gap: 10px;
}

.media-row {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--account-border);
  border-radius: 8px;
  background: #f9fafb;
}

.media-row__details {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.media-row__details strong,
.media-row__details span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-row__details strong {
  font-size: 14px;
  font-weight: 600;
}

.media-row__details span {
  color: var(--account-muted);
  font-size: 12px;
}

.media-row__actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.media-row__actions .account-button--secondary {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.media-row__actions .media-delete {
  color: #b91c1c;
}

.account-page:is([data-account-page="image-library"], [data-account-page="audios"]) .account-heading {
  margin-bottom: 24px;
}

.account-page:is([data-account-page="image-library"], [data-account-page="audios"]) .account-card + .account-card {
  margin-top: 24px;
}

.account-page:is([data-account-page="image-library"], [data-account-page="audios"]) .account-card:nth-of-type(2) {
  min-height: 173.5px;
}

.library-empty svg,
.account-empty svg {
  display: block;
  width: 42px;
  height: 42px;
  margin: 0 auto 10px;
  fill: none;
  stroke: #d1d5db;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.credits-card {
  padding: 24px;
}

.credits-balance {
  color: #f59e0b;
  font-size: 36px;
  font-weight: 700;
  line-height: 44px;
}

.credits-balance small {
  color: #f59e0b;
  font-size: 14px;
  font-weight: 600;
}

.credits-held {
  margin: 4px 0 0;
  color: var(--account-muted);
  font-size: 13px;
  line-height: 20px;
}

.credits-ledger {
  display: grid;
}

.credits-ledger__row {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0;
  border-bottom: 1px solid var(--account-border);
}

.credits-ledger__row:last-child {
  border-bottom: 0;
}

.credits-ledger__content {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.credits-ledger__content strong {
  color: var(--account-ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 22px;
}

.credits-ledger__content span {
  overflow: hidden;
  color: var(--account-muted);
  font-size: 12px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credits-ledger__amount {
  flex: 0 0 auto;
  color: var(--account-secondary);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.credits-ledger__amount[data-positive] {
  color: #d97706;
}

.credits-ledger__amount[data-negative] {
  color: #dc2626;
}

.credits-ledger__empty {
  min-height: 112px;
}

.credits-return {
  margin-top: 24px;
}

.credits-return__button {
  min-height: 43.1px;
  padding: 10px 16px;
  border-color: var(--account-border-strong);
  color: var(--account-secondary);
  background: var(--account-cream);
  font-weight: 500;
  line-height: 23.1px;
}

.credits-copy {
  margin: -8px 0 16px;
  color: var(--account-muted);
  font-size: 14px;
  line-height: 23px;
}

.account-inline-form {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-inline-form .account-field {
  min-width: 0;
  flex: 1;
}

.account-inline-form .account-button,
.account-inline-form .account-button--secondary {
  flex: 0 0 auto;
}

.invite-code {
  margin: 12px 0 0;
  color: var(--account-muted);
  font-size: 13px;
}

.invite-code strong {
  color: var(--account-ink);
  font-weight: 600;
}

.account-rule-note {
  margin: 12px 0 0;
  color: var(--account-muted);
  font-size: 13px;
  line-height: 21px;
}

.account-empty {
  display: grid;
  min-height: 170px;
  place-items: center;
  color: #9ca3af;
  font-size: 14px;
  text-align: center;
}

.account-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 3px;
  border-radius: 8px;
  background: #e9edf3;
}

.account-tabs button {
  min-width: 0;
  height: 39px;
  flex: 1;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: var(--account-secondary);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  white-space: nowrap;
}

.account-tabs button[aria-selected="true"] {
  color: var(--account-ink);
  background: #fff;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.1);
  font-weight: 600;
}

.support-tabs {
  width: 228px;
  background: var(--account-cream);
  box-shadow: inset 0 0 0 1px var(--account-border);
}

.support-tabs button {
  color: var(--account-secondary);
  font-weight: 500;
}

.support-tabs button[aria-selected="true"] {
  color: #fff;
  background: linear-gradient(135deg, #ffb623 0%, #ea580c 55%, #fbbf24 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  font-weight: 500;
}

.account-page[data-account-page="history"] .account-heading {
  margin-bottom: 24px;
}

.history-tabs {
  height: 45.1px;
  gap: 2px;
  margin-bottom: 24px;
  padding: 2px;
  border: 1px solid var(--account-border);
  background: var(--account-cream);
}

.history-tabs button {
  height: 39.1px;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--account-secondary);
  font-size: 14px;
  font-weight: 500;
  line-height: 23.1px;
}

.history-tabs button[aria-selected="true"] {
  color: #fff;
  background: linear-gradient(135deg, #ffb623 0%, #ea580c 55%, #fbbf24 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  font-weight: 500;
}

.history-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-search-field {
  width: 320px;
  max-width: 100%;
  flex: 0 1 320px;
}

.history-refresh {
  min-height: 45.1px;
  flex: 0 0 auto;
  padding: 10px 16px;
  border-color: var(--account-border-strong);
  color: var(--account-secondary);
  background: var(--account-cream);
  font-weight: 500;
  gap: 8px;
  line-height: 23.1px;
}

.history-count {
  display: flex;
  height: 45.1px;
  flex: 0 0 auto;
  align-items: center;
  color: var(--account-muted);
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
}

.history-card > .work-items {
  margin-top: 16px;
}

.history-pagination {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.history-pagination button {
  min-width: 112px;
}

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

.history-empty {
  display: grid;
  min-height: 90.5px;
  margin-top: 0;
  place-items: center;
  padding: 32px;
  border: 1px dashed var(--account-border-strong);
  border-radius: 12px;
  color: var(--account-muted);
  background: var(--account-cream);
  font-size: 14px;
  line-height: 24.5px;
  text-align: center;
}

.support-form {
  display: grid;
  gap: 18px;
}

.feedback-counter {
  margin-top: 5px;
  color: #9ca3af;
  font-size: 12px;
  line-height: 18px;
  text-align: right;
}

.support-submit {
  width: 100%;
  min-height: 47px;
}

.support-contact {
  padding: 12px 0 4px;
  text-align: center;
}

.support-contact h2 {
  margin-bottom: 6px;
}

.support-contact > p {
  margin: 0;
  color: var(--account-muted);
  font-size: 14px;
}

.support-qr {
  display: grid;
  width: 250px;
  height: 250px;
  max-width: 100%;
  place-items: center;
  margin: 24px auto;
  border: 1px dashed #d1d5db;
  border-radius: 10px;
  background: #fafafa;
}

.support-qr__placeholder {
  display: grid;
  width: 200px;
  height: 200px;
  max-width: calc(100% - 32px);
  place-items: center;
  color: #9ca3af;
  background: #fff;
  font-size: 13px;
  line-height: 22px;
}

.support-hours {
  max-width: 620px;
  margin: 0 auto;
  padding: 14px 16px;
  border-radius: 8px;
  color: var(--account-secondary);
  background: #fff7ed;
  font-size: 13px;
  line-height: 22px;
  text-align: left;
}

.account-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  max-width: calc(100% - 40px);
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: #111827;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.account-toast[data-visible] {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .account-main {
    padding: 32px 16px 48px;
  }

  .library-form {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .account-inline-form {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .history-count {
    display: flex;
    align-items: center;
  }
}

@media (max-width: 640px) {
  .account-menu {
    position: fixed;
    top: 64px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .account-heading {
    margin-bottom: 18px;
  }

  .account-card {
    padding: 20px;
  }

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

  .account-settings-card__heading {
    align-items: stretch;
    flex-direction: column;
  }

  .account-settings-card__heading .account-button--danger,
  .account-settings-form__actions .account-button {
    width: 100%;
  }

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

  .account-delete-dialog__actions {
    flex-direction: column-reverse;
  }

  .account-delete-dialog__actions > * {
    width: 100%;
  }

  .account-heading h1 {
    font-size: 24px;
  }

  .credits-card {
    padding: 20px;
  }

  .credits-ledger__row {
    align-items: flex-start;
    gap: 12px;
  }

  .credits-ledger__content span {
    white-space: normal;
  }

  .account-inline-form {
    flex-direction: column;
  }

  .account-inline-form .account-button,
  .account-inline-form .account-button--secondary {
    width: 100%;
  }

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

  .media-row__actions {
    width: 100%;
  }

  .media-row__actions .account-button--secondary {
    flex: 1;
  }

  .account-tabs {
    overflow: visible;
  }

  .account-tabs button {
    min-width: 0;
  }

  .history-search-field {
    min-width: 0;
    flex: 1 1 320px;
  }

  .history-toolbar {
    flex-wrap: nowrap;
  }

  .history-tabs {
    height: auto;
  }

  .history-tabs button {
    height: auto;
    min-height: 39.1px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 23.1px;
    white-space: normal;
  }

  .account-toast {
    right: 16px;
    bottom: 16px;
    left: 16px;
    max-width: none;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .account-menu,
  .account-button,
  .account-button--secondary,
  .account-toast {
    transition: none;
  }
}
