/* Account controls are isolated from tool forms and the legacy connection dialog. */
.account-dialog {
  width: min(760px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #dce2eb;
  border-radius: 12px;
  background: #fff;
  color: #24344d;
  box-shadow: 0 20px 80px #172b4d26;
}
.account-dialog[data-view="auth"] { width: min(460px, calc(100vw - 32px)); }
.account-dialog[data-view="billing"] { width: min(900px, calc(100vw - 32px)); }
.account-dialog::backdrop { background: #14263e66; backdrop-filter: blur(3px); }
.account-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; border-bottom: 1px solid #e5eaf1; background: #fff; }
.account-header h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.3px; }
.account-dialog #account-close { display: grid; place-items: center; width: 40px; height: 40px; min-height: 40px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: #617087; }
.account-dialog #account-close:hover { background: #f1f4f8; color: #24344d; }
#account-content { min-width: 0; padding: 24px; }
.account-dialog h2 { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.4; letter-spacing: -.3px; color: #24344d; }
.account-dialog h3 { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.5; color: #34445d; }
.account-dialog p { margin: 0; color: #65738a; font-size: 14px; line-height: 1.5; }
.account-message { margin: 20px 24px 0; padding: 12px 14px; border: 1px solid #d8e5fb; border-radius: 8px; background: #f4f7fd; color: #3c5a83; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.account-message.error { border-color: #f0d6d7; background: #fff5f5; color: #a13943; }

/* A single 44px control size, without generic dialog widths or margins. */
.account-dialog .account-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: auto; min-width: 0; min-height: 44px; margin: 0; padding: 11px 16px; border: 1px solid transparent; border-radius: 7px; font-size: 14px; font-weight: 500; line-height: 20px; text-align: center; text-decoration: none; white-space: nowrap; }
.account-dialog .account-button-primary { border-color: #365eda; background: #365eda; color: #fff; }
.account-dialog .account-button-primary:hover:not(:disabled) { border-color: #294bc1; background: #294bc1; }
.account-dialog .account-button-secondary { border-color: #d9e0ea; background: #fff; color: #42536d; }
.account-dialog .account-button-secondary:hover:not(:disabled) { border-color: #c7d2e2; background: #f7f9fc; }
.account-dialog .account-button-danger { border-color: #e7d7da; background: #fff; color: #a34852; }
.account-dialog .account-button-danger:hover:not(:disabled) { border-color: #e2bdc2; background: #fff5f5; }
.account-dialog .account-button:disabled { opacity: .5; cursor: not-allowed; }
.account-dialog .account-button .icon { width: 16px; height: 16px; }
.account-field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; margin: 0; }
.account-field > span { color: #40516b; font-size: 13px; font-weight: 500; line-height: 20px; }
.account-field input, .account-secret-controls input { display: block; box-sizing: border-box; width: 100%; min-width: 0; height: 44px; margin: 0; padding: 10px 12px; border: 1px solid #ced7e4; border-radius: 7px; background: #fff; color: #24344d; font: inherit; font-size: 14px; line-height: 22px; box-shadow: none; }
.account-field input::placeholder { color: #8a97ab; }
.account-field input:focus, .account-secret-controls input:focus { border-color: #5b7cdd; outline: 3px solid #e8eefd; outline-offset: 0; }
.account-field input:disabled { border-color: #e1e6ed; background: #f7f9fc; color: #8a97ab; cursor: not-allowed; }
.account-form { display: grid; gap: 20px; min-width: 0; margin: 0; }
.account-auth { padding: 4px 0 0; }
.account-auth h2 { margin-bottom: 24px; }
.account-auth .account-form > .account-button { width: 100%; margin-top: 4px; }
.account-auth-links { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.account-link-button { display: inline-flex; align-items: center; min-height: 36px; margin: 0; padding: 5px 0; border: 0; background: transparent; color: #365eda; font-size: 13px; font-weight: 500; line-height: 20px; }
.account-link-button:hover { text-decoration: underline; }

.account-tabs { display: flex; align-items: center; gap: 4px; width: fit-content; max-width: 100%; margin: 0 0 28px; padding: 4px; border: 1px solid #e6eaf1; border-radius: 9px; background: #f6f8fb; }
.account-tabs button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; margin: 0; padding: 9px 15px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #69778d; font-size: 14px; font-weight: 500; line-height: 20px; white-space: nowrap; }
.account-tabs button.active { border-color: #dce3ef; background: #fff; color: #365eda; box-shadow: 0 1px 2px #1b355609; }
.account-tabs button:hover:not(.active):not(:disabled) { color: #34445d; background: #edf1f7; }
.account-panel { min-width: 0; }
.account-loading { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; min-height: 200px; color: #7c889c; font-size: 13px; text-align: center; }
.account-loading-spinner { width: 20px; height: 20px; border: 2px solid #e2e8f4; border-top-color: #6a85cc; border-radius: 50%; animation: account-spin .7s linear infinite; }
@keyframes account-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .account-loading-spinner { animation: none; } }
.account-section-title { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.account-count { padding: 4px 9px; border: 1px solid #e2e8f0; border-radius: 6px; background: #f8fafc; color: #65738a; font-size: 12px; font-variant-numeric: tabular-nums; }
.account-person { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 14px; margin-bottom: 24px; }
.account-avatar { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid #dde5f8; border-radius: 10px; background: #edf2ff; color: #5270ad; font-size: 18px; font-weight: 600; }
.account-person-info { min-width: 0; }
.account-person h2 { font-size: 16px; }
.account-person p { margin-top: 4px; font-size: 13px; overflow-wrap: anywhere; }
.account-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 28px; padding: 14px 16px; border: 1px solid #e1e7f0; border-radius: 8px; background: #f8fafc; color: #34445d; font-size: 14px; }
.account-summary strong { color: #6a7890; font-size: 12px; font-weight: 500; text-transform: capitalize; }
.account-usage { margin-bottom: 28px; }
.account-usage h3 { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.account-usage h3 span { color: #7c889c; font-size: 12px; font-weight: 400; }
.account-quota { margin-top: 20px; }
.account-quota > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #52617a; font-size: 13px; }
.account-quota strong { color: #5f6f87; font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.account-quota progress { display: block; width: 100%; height: 6px; appearance: none; margin: 10px 0 0; overflow: hidden; border: 0; border-radius: 3px; background: #edf1f7; accent-color: #5478d8; }
.account-quota progress::-webkit-progress-bar { background: #edf1f7; }
.account-quota progress::-webkit-progress-value { background: #5478d8; }
.account-quota progress::-moz-progress-bar { background: #5478d8; }
.account-dialog .account-limit-note { margin-top: 12px; color: #6a7890; font-size: 12px; }
.account-password { padding-top: 20px; border-top: 1px solid #e5eaf1; }
.account-password > summary { padding: 4px 0; color: #52617a; font-size: 13px; font-weight: 500; cursor: pointer; }
.account-password form { max-width: 390px; padding-top: 20px; }
.account-password .account-button { justify-self: start; }
.account-editor-access { margin-bottom: 24px; padding-top: 20px; border-top: 1px solid #e5eaf1; }
.account-editor-access > summary { color: #52617a; font-size: 13px; font-weight: 500; cursor: pointer; }
.account-editor-access > summary span { float: right; color: #7c889c; font-size: 12px; font-weight: 400; }
.account-editor-access ul { display: grid; gap: 12px; margin: 20px 0 8px; padding: 0; list-style: none; }
.account-editor-access li { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: #52617a; font-size: 13px; }
.account-editor-access strong { font-size: 12px; font-weight: 400; }
.account-editor-access strong.included { color: #52775f; }
.account-editor-access strong.locked { color: #8d97a8; }
.account-editor-access p { margin-top: 8px; font-size: 12px; }

.account-key-create { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; margin: 0 0 24px; }
.account-key-create > .account-button { min-width: 132px; }
.account-key-create + .account-limit-note { margin: -12px 0 24px; }
.account-secret { margin-bottom: 24px; padding: 16px; border: 1px solid #d4e0fa; border-radius: 8px; background: #f4f7ff; }
.account-secret-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-top: 8px; }
.account-secret-controls input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
.account-secret p { margin-top: 8px; color: #6a7d9d; font-size: 12px; }
.account-key-list { display: grid; gap: 0; margin: 0; padding: 0; border-top: 1px solid #e5eaf1; list-style: none; }
.account-key-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 20px; padding: 20px 0; border-bottom: 1px solid #e5eaf1; }
.account-key-info { min-width: 0; }
.account-key-info strong { display: block; margin-bottom: 6px; color: #34445d; font-size: 14px; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.account-key-info code { display: block; color: #65738a; font-size: 12px; line-height: 1.5; }
.account-key-info small { display: block; margin-top: 6px; color: #8792a4; font-size: 12px; line-height: 1.5; }
.account-key-row > .account-button { min-height: 36px; padding: 7px 12px; font-size: 12px; }
.account-empty { padding: 28px 12px; color: #7c889c; font-size: 14px; text-align: center; }
.account-docs-link { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin-top: 12px; color: #57719d; font-size: 12px; }
.account-docs-link:hover { color: #365eda; text-decoration: underline; }
.account-docs-link .icon { width: 14px; height: 14px; }
.account-setup { padding: 4px 0 20px; }
.account-setup p { margin: 12px 0; }
.account-setup a { color: #365eda; font-size: 14px; }

.account-billing-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.account-test-mode { display: inline-flex; align-items: center; padding: 3px 7px; border: 1px solid #ead5a8; border-radius: 5px; background: #fff9eb; color: #86652b; font-size: 11px; font-weight: 500; line-height: 16px; }
.account-plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; gap: 14px; }
.account-plan { display: flex; flex-direction: column; min-width: 0; padding: 20px 18px; border: 1px solid #dee5ef; border-radius: 9px; background: #fff; }
.account-plan.current { border-color: #9aafe8; background: #f9faff; }
.account-plan h3 { margin-bottom: 16px; font-size: 16px; }
.account-dialog .account-plan-price { margin: 0 0 22px; color: #24344d; font-size: 29px; font-weight: 600; line-height: 1.2; letter-spacing: -1px; }
.account-plan-price span { display: block; margin-top: 6px; color: #7c889c; font-size: 12px; font-weight: 400; letter-spacing: 0; }
.account-plan-quotas { display: grid; gap: 9px; margin-bottom: 16px; color: #65738a; font-size: 12px; line-height: 1.5; }
.account-dialog .account-plan-editor { margin-bottom: 8px; color: #425b8a; font-size: 12px; font-weight: 500; }
.account-dialog .account-plan-features { min-height: 40px; margin: 0 0 24px; color: #52617a; font-size: 12px; line-height: 1.65; }
.account-plan > .account-button { width: 100%; margin-top: auto; padding-inline: 8px; }
.account-dialog .account-price-note { margin-top: 16px; color: #7c889c; font-size: 12px; }
.account-invoices { margin-top: 28px; padding-top: 24px; border-top: 1px solid #e5eaf1; }
.account-invoices h3 { margin-bottom: 8px; }
.account-invoices > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid #e5eaf1; color: #52617a; font-size: 13px; }
.account-invoices > div > span { min-width: 0; overflow-wrap: anywhere; }
.account-invoices small { display: block; margin-top: 6px; color: #8792a4; font-size: 12px; }
.account-invoices .account-button { min-height: 36px; padding: 7px 12px; font-size: 12px; }
.account-hold { margin-bottom: 24px; padding: 12px 14px; border: 1px solid #ead9ba; border-radius: 7px; background: #fff9ed; color: #8b6935; font-size: 13px; line-height: 1.5; }
.account-hold .account-link-button { color: #8b6935; }

@media (max-width: 650px) {
  .account-dialog, .account-dialog[data-view] { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); border-radius: 10px; }
  .account-header { padding: 12px 16px; }
  #account-content { padding: 20px 16px; }
  .account-message { margin: 16px 16px 0; }
  .account-tabs { width: 100%; gap: 2px; margin-bottom: 24px; }
  .account-tabs button { flex: 1; padding: 8px; font-size: 13px; }
  .account-person { grid-template-columns: 40px minmax(0, 1fr); gap: 12px; }
  .account-avatar { width: 40px; height: 40px; }
  .account-person > .account-button { grid-column: 2; justify-self: start; }
  .account-key-create { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .account-key-create > .account-button { width: 100%; }
  .account-key-row { gap: 12px; }
  .account-secret { padding: 12px; }
  .account-secret-controls { gap: 8px; }
  .account-secret-controls .account-button { padding-inline: 12px; }
  .account-field input, .account-secret-controls input { font-size: 16px; }
  .account-section-title > .account-button { min-height: 40px; padding: 9px 12px; font-size: 12px; }
  .account-plan-grid { grid-template-columns: minmax(0, 1fr); }
  .account-plan { padding: 20px; }
  .account-plan-price span { display: inline; margin-left: 6px; }
  .account-dialog .account-plan-features { min-height: 0; }
}
