/* Shared theme tokens keep company settings and authentication aligned with the editor and public site. */
* { box-sizing: border-box; }
/* Give short account pages the visible height of the window so the footer can sit below the form. */
body { margin: 0; min-width: 320px; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font-ui); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; }
.account-topbar { min-height: 64px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 28px; border-bottom: 1px solid var(--line); background: var(--bg); }
.account-brand { display: flex; gap: 10px; align-items: center; color: var(--text); text-decoration: none; font-weight: 760; letter-spacing: -.02em; }
.account-brand span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); }
.account-topbar nav { display: flex; align-items: center; gap: 18px; }
.account-topbar nav a, .account-topbar nav button { color: var(--muted); text-decoration: none; border: 0; background: none; cursor: pointer; }
.account-topbar nav a:hover, .account-topbar nav button:hover { color: var(--text); }
.account-topbar nav form { margin: 0; }
.account-shell { width: min(1120px, calc(100% - 32px)); margin: 48px auto; }
.auth-shell { width: min(460px, calc(100% - 32px)); margin-top: 8vh; }
.account-card { min-width: 0; padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
h1, h2 { margin: 0; letter-spacing: -.03em; }
h1 { font-size: clamp(30px, 5vw, 44px); }
h2 { font-size: 21px; }
.account-hint { color: var(--muted); }
.auth-card form, .invite-card form { display: grid; gap: 14px; margin-top: 24px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 650; }
/* Selects and their form actions use the account input height, independent of native select sizing. */
:root { --account-field-height: 44px; }
input, select, textarea { width: 100%; min-height: var(--account-field-height); padding: 10px 12px; color: var(--text); border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); }
select { height: var(--account-field-height); }
/* Match existing editor controls, including hover, placeholder, and disabled feedback. */
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:hover, select:hover, textarea:hover { border-color: var(--line-hover); }
/* A full-width, resizable PEM control keeps key replacement usable without exposing any stored value back to the page. */
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
button, .link-action { min-height: 40px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: var(--panel-2); cursor: pointer; text-decoration: none; }
button:hover:not(:disabled), .link-action:hover { border-color: var(--line-hover); background: var(--surface-hover); }
button:disabled { opacity: .42; cursor: not-allowed; }
.primary-action { width: 100%; min-height: 46px; border-color: var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 800; }
/* Match the invitation and MCP actions to the selects and inputs on their forms. */
.invite-card .primary-action, .mcp-settings button { min-height: var(--account-field-height); }
.primary-action:hover:not(:disabled) { border-color: var(--accent-hover); background: var(--accent-hover); }
/* Reserve the pink-to-purple accent for Subscribe and keep the dark label readable on hover. */
.primary-action.subscribe-action { border-color: transparent; background: linear-gradient(100deg, #f4a4da, #bda4ff); }
.primary-action.subscribe-action:hover:not(:disabled) { border-color: transparent; background: linear-gradient(100deg, #ffc0e8, #d2bcff); }
.link-action { display: grid; place-items: center; margin-top: 22px; }
.auth-switch { margin: 20px 0 0; color: var(--muted); text-align: center; }
.errorlist, .form-errors { margin: 0; color: var(--danger); font-size: 12px; }
.company-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
/* Use the company page width for two compact columns rather than leaving the key below a narrow card. */
.credentials-card { width: 100%; margin-bottom: 20px; }
.credential-form { display: grid; gap: 24px; margin-top: 24px; }
/* Stretch the PEM control to the combined height of the two ID fields, independent of its intrinsic row count. */
.credential-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.credential-ids { display: grid; gap: 16px; }
.credential-private-key { display: flex; flex-direction: column; min-width: 0; }
.credential-private-key textarea { flex: 1 1 0; height: 0; min-height: 44px; }
/* Keep file import beside the existing key, with the same compact layout and a visible drop target. */
.credential-key-inputs { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.credential-key-inputs .credential-private-key { flex: 1; }
.credential-file-hint { margin: 0; color: var(--muted); font-size: 12px; }
.credential-file-input { min-width: 0; padding: 7px; font-size: 12px; }
.credential-file-input::file-selector-button { margin-right: 10px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); background: var(--panel); font: inherit; cursor: pointer; }
.credential-private-key textarea.is-file-dragover { border-color: var(--accent); outline: 1px solid var(--accent); }
/* Keep setup instructions next to the final action, with Save aligned to the right edge of the key field. */
.credential-footer { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 24px; }
.credential-help { max-width: 76ch; color: var(--muted); font-size: 12px; }
.credential-help h3 { margin: 0; color: var(--text); font-size: 13px; font-weight: 650; }
.credential-help ol { margin: 8px 0 0; padding-left: 18px; }
.credential-help li + li { margin-top: 4px; }
.credential-help a { text-underline-offset: 3px; }
.credential-form .primary-action { width: fit-content; max-width: 100%; }
.connection-badge { padding: 5px 9px; border-radius: 20px; color: var(--muted); background: var(--panel-2); font-size: 11px; }
/* Readiness is intentionally binary; the UI never reveals even a partial Apple key identifier. */
.connection-badge.ready { color: var(--positive); }
.company-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); gap: 20px; }
.card-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.count-badge { min-width: 28px; padding: 4px 8px; border-radius: 20px; color: var(--accent); background: var(--panel-2); text-align: center; }
.member-list { display: grid; gap: 8px; }
.member-row { display: grid; grid-template-columns: minmax(160px, 1fr) auto auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.member-row div { min-width: 0; }
.member-row strong, .member-row small { display: block; overflow: hidden; text-overflow: ellipsis; }
.member-row small { color: var(--muted); }
.member-row form { display: flex; gap: 7px; margin: 0; }
/* The role selector belongs to the compact action row, so it lines up with Save and Remove. */
.member-row :is(select, button) { height: 40px; min-height: 40px; padding-block: 0; }
.danger-link { color: var(--danger); }
.pending-card { margin-top: 20px; }
.created-link { margin-top: 18px; }
.created-link input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.company-switcher { display: flex; flex-wrap: wrap; gap: 8px; }
.company-switcher form { margin: 0; }
.messages p { padding: 10px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.empty-state { color: var(--muted); }
/* Personal settings follow the existing account grid; long configuration lines scroll inside the control on phones. */
.user-settings-shell { max-width: 960px; }
.user-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 20px; }
/* Stack compact preferences and give the remaining days more weight than their label. */
.user-settings-preferences { display: grid; gap: 20px; }
.subscription-remaining { display: flex; align-items: baseline; gap: 8px; margin-bottom: 0; }
.subscription-remaining strong { font-size: 28px; line-height: 1; font-variant-numeric: tabular-nums; }
.settings-form { display: grid; gap: 16px; margin-top: 24px; }
.settings-section { margin-top: 20px; }
.account-language-options { display: flex; flex-wrap: wrap; gap: 8px; }
.account-language-options button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.account-topbar nav { flex-wrap: wrap; }
.account-topbar nav a[aria-current="page"] { color: var(--text); }
.password-help, .mcp-steps { color: var(--muted); font-size: 13px; }
.password-help summary, .mcp-publishing summary { cursor: pointer; color: var(--text); }
.password-help ul { padding-left: 20px; }
/* Show the translated Django policy immediately when the shared language switch updates the document language. */
html[lang="ru"] .password-help [lang="en"], html:not([lang="ru"]) .password-help [lang="ru"] { display: none; }
.mcp-steps { padding-left: 20px; }
.mcp-steps li + li { margin-top: 10px; }
.mcp-settings p, .mcp-steps li { overflow-wrap: anywhere; }
.mcp-config { display: block; width: 100%; line-height: 1.6; white-space: pre; overflow: auto; }
/* Group setup, legacy credentials and connected clients with spacing; long names must also fit a phone. */
.mcp-publishing, .mcp-manual, .mcp-connections { margin-top: 24px; }
/* Large local brand marks let users recognize their tool before seeing any URL or configuration. */
.mcp-tool-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
.mcp-settings .mcp-tool { display: flex; align-items: center; gap: 20px; min-height: 122px; padding: 24px; border: 0; text-align: left; background: var(--panel-2); }
.mcp-tool strong, .mcp-tool small { display: block; }
.mcp-tool strong { font-size: 20px; letter-spacing: -.02em; }
.mcp-tool small { margin-top: 5px; color: var(--muted); font-size: 13px; }
.mcp-tool[aria-expanded="true"] { background: color-mix(in srgb, var(--accent) 16%, var(--panel)); }
.mcp-brand { display: block; flex: 0 0 48px; width: 48px; height: 48px; mask: var(--mcp-icon) center / contain no-repeat; background: currentColor; }
.mcp-brand-codex { --mcp-icon: url("icons/codex.svg"); }
.mcp-brand-claude { --mcp-icon: url("icons/claude.svg"); color: #d48769; }
/* Only the selected guide is expanded; spacing and surface color group steps without separator lines. */
.mcp-guide { min-width: 0; margin-top: 20px; padding: 24px; border-radius: 10px; background: var(--panel-2); }
.mcp-guide h3 { margin: 0 0 20px; font-size: 22px; letter-spacing: -.02em; }
.mcp-guide h3:focus { outline: none; }
.mcp-settings .mcp-steps { color: var(--text); font-size: 14px; line-height: 1.65; }
.mcp-settings .mcp-steps li + li { margin-top: 20px; }
.mcp-steps li > p { margin: 0 0 10px; }
.mcp-try { margin: 24px 0 16px; font-weight: 650; }
.mcp-other { margin-top: 24px; padding: 20px 24px; background: var(--panel-2); border-radius: 10px; }
.mcp-other summary strong { font-size: 16px; }
.mcp-other summary > span { display: block; margin: 6px 0 0 17px; color: var(--muted); font-size: 13px; }
.mcp-other > .mcp-steps { margin-top: 24px; }
.mcp-copy-field { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; margin-top: 12px; }
.mcp-copy-field label { flex-basis: 100%; }
.mcp-copy-field input { flex: 1; min-width: 0; }
.mcp-copy-field textarea { line-height: 1.7; font-size: 12px; }
.mcp-copy-field input, .mcp-copy-field textarea { background: var(--panel); }
.mcp-field-status { font-size: 12px; }
.mcp-tool:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.mcp-settings summary { cursor: pointer; }
.mcp-settings pre { overflow: auto; padding: 14px; background: var(--panel-2); border-radius: 9px; font-size: 12px; }
.mcp-connection { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-top: 16px; padding: 16px; background: var(--panel-2); border-radius: 9px; }
.mcp-connection > div { min-width: 0; overflow-wrap: anywhere; }
.mcp-connection p { margin-bottom: 0; }
.mcp-connection form { margin: 0; }
.mcp-authorization { max-width: 640px; }
.mcp-client-id { overflow-wrap: anywhere; }
.mcp-actions { display: flex; gap: 12px; }
.mcp-actions .primary-action { width: auto; flex: 1; }
/* Keep recognizable icons and complete instructions on narrow phones without horizontal page scrolling. */
@media (max-width: 600px) {
    .mcp-settings .mcp-tool { padding: 18px 12px; flex-direction: column; align-items: flex-start; gap: 14px; }
    .mcp-tool strong { font-size: 17px; }
    .mcp-tool small { font-size: 12px; }
    .mcp-brand { flex-basis: 40px; width: 40px; height: 40px; }
    .mcp-guide, .mcp-other { padding: 18px 14px; }
    .mcp-copy-field input { flex-basis: 100%; }
}
@media (max-width: 640px) { .user-settings-grid { grid-template-columns: minmax(0, 1fr); } }
/* Keep long company names and touch actions within the viewport instead of widening the whole account page. */
.company-heading h1 { overflow-wrap: anywhere; }
/* Stack the same fields and instructions on phones, where side-by-side IDs and a PEM key would be too narrow. */
@media (max-width: 640px) {
    .credential-fields, .credential-footer { grid-template-columns: minmax(0, 1fr); }
    .credential-private-key textarea { flex: none; height: 144px; }
    .credential-form .primary-action { width: 100%; }
}
/* Preserve vertical padding when company navigation wraps onto a second line on phones. */
@media (max-width: 780px) { .company-grid { grid-template-columns: 1fr; } .member-row { grid-template-columns: 1fr; } .company-heading { align-items: start; flex-direction: column; } .account-topbar { padding: 12px 16px; } }
