account-widget {
    --initial-width: 420px;
    --initial-height: 420px;

    position: fixed;
    top: calc(50% - var(--initial-height) / 2);
    left: calc(50% - var(--initial-width) / 2);
    width: var(--initial-width);
    height: var(--initial-height);
    margin: 0;
}

account-widget[popover]:popover-open {
    visibility: visible;
}

/* ************************************************** */
/* #region ACTIVATOR                                  */
/* ************************************************** */

:has(account-widget[popover]:popover-open) button[data-action="open-account-popover"] {
    background-color: var(--bg-color-hover);
    color: var(--text-color-hover);
    text-decoration: underline;
}

/* #endregion */

/* ************************************************** */
/* #region AUTOSAVE INDICATOR                         */
/* ************************************************** */

/* The words come from JS (account-utils.js) so screen readers can read them. CSS only does the look. */
.autosave-indicator {
    margin-left: auto;
    opacity: 0;
}

.autosave-indicator:is([data-state="saving"], [data-state="saved"], [data-state="error"]) {
    opacity: 1;
}

.autosave-indicator[data-state="error"],
.autosave-indicator[data-state="auth"] {
    background-color: red;
    color: white;
}

/* #endregion */

/* ************************************************** */
/* #region TAB CONTENT                                */
/* ************************************************** */

account-widget .tab-content {
    overflow: hidden;
}

/* #endregion */

/* ************************************************** */
/* #region SECTION - GENERAL                          */
/* ************************************************** */

.account-section {
    width: 100%;
    height: 100%;
    overflow: auto;
}

.account-section-info-container {
    padding: 0.5em;
}

.account-section-title {
    margin-bottom: 0.25em;
    padding-inline: 0.5em;
    font-weight: 600;
}

.account-section-options {
    display: flex;
    flex-direction: column;
    padding-block: 0.5em;
}

.account-option-description {
    margin-bottom: 0.5em;
}

/* #endregion */

/* ************************************************** */
/* #region PROVIDER ROWS (LLMs + Compute)             */
/* ************************************************** */

/* Both tabs build rows with renderProviderRow() in account-utils.js, so one set of rules covers both. */

.key-icon {
    align-self: center;
    margin-left: 0.5em;
}

/* Key icon only shows once every box is filled in */
.provider-row:not([data-complete]) .key-icon {
    display: none;
}

/* Wrong-format key (setCustomValidity in account-llms.js) */
.provider-row .text-input-container:has(input:invalid) {
    border-color: var(--error-color, #d33);
}

.test-connection-container {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.provider-test.menu-item {
    width: fit-content;
    padding-inline: 0.125em;
}

.provider-test .menu-item-label {
    flex: unset;
}

/* Shown next to the disabled Test button for providers we can't check (testable: false) */
.provider-test-note {
    font-size: 0.8rem;
    color: var(--text-color-muted, var(--text-color));
}

/* Nothing to say → invisible. NOT display:none: it's a live region, so it must stay on the page or screen readers miss the next message. */
.provider-test-status:not([data-state]) {
    opacity: 0;
}

/*
.provider-test-status[data-state="valid"] {
    color: var(--success-color, #2a2);
} */

/* Something's wrong and the user has to fix it */
.provider-test-status:is([data-state="invalid"], [data-state="auth"], [data-state="offline"]) {
    background-color: red;
    color: white;
}

/* Not the user's fault — wait, or can't tell */
.provider-test-status:is([data-state="rateLimited"], [data-state="providerDown"], [data-state="timeout"], [data-state="unreachable"], [data-state="unknown"]) {
    color: var(--warning-color, #e90);
}

/* "Log in" link after "Session expired!" — default link blue is hard to read on the dark pill */
.provider-test-status a {
    color: inherit;
    text-decoration: underline;
}

/* #endregion */

/* ************************************************** */
/* #region SECTION - ACCOUNT                          */
/* ************************************************** */

#account-page-account-tab-content .account-section {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#account-page-account-tab-content .account-section-options {
    flex: 1;
    gap: 0.25em;
    padding-inline: 0.5em;
}

.change-password-message {
    display: none;
}

.change-password-message.active {
    display: block;
}

/* #endregion */

/* ************************************************** */
/* #region SECTION - DATA STORAGE                     */
/* ************************************************** */

.storage-modes {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
    padding: 0.5em;
}

.storage-mode.current { border-color: currentColor; }
.storage-status { margin: 8px 0; }
.storage-folder { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; }
.storage-msg { margin-top: 10px; min-height: 1.4em; }

/* #endregion */

/* ************************************************** */
/* #region SECTION - COMPUTE                          */
/* ************************************************** */

#account-page-compute-tab-content .summary-label {
    justify-content: space-between;
}

/* "(Default)" next to the row picked as default */
#compute-providers-container .details-wrapper:has([name="compute-default-target"]:checked) .summary-label::after {
    content: "(Default)";
    font-size: 0.875em;
}

/* Cloud / Local picker — same look as the Storage tab's radios */
.account-section-compute-modes {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
    padding: 0.5em;
}

:is([data-id="compute-cloud-options"], [data-id="compute-local-options"]) {
    display: flex;
    flex-direction: column;
}

[data-id="compute-local-options"] .account-option-description {
    padding-inline: 0.5em;
}

/* Local has no row — the Local radio IS the default, so it gets the "(Default)" tag */
.compute-mode:has(input[value="local"]:checked) .menu-item-label::after {
    content: "(Default)";
}

/* Show only the box that matches the checked Cloud / Local radio */
#account-page-compute-tab-content:has(input[name="compute-mode"][value="local"]:checked) [data-id="compute-cloud-options"],
#account-page-compute-tab-content:has(input[name="compute-mode"][value="cloud"]:checked) [data-id="compute-local-options"] {
    display: none;
}

/* #endregion */

/* Account → Stats (account-stats.js) */
.stats-toolbar {
    display: flex;
    align-items: center;
    gap: 1em;
}

.stats-updated,
.stats-caption,
.stats-note {
    opacity: 0.7;
    font-size: 0.9em;
}

.stats-section {
    margin-bottom: 1.5em;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-block: 0.5em;
}

.stats-table th,
.stats-table td {
    padding: 0.25em 0.5em;
    border-bottom: var(--border-width, 1px) solid var(--border-color, #ddd);
    text-align: left;
}

.stats-table .stats-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.stats-table .stats-total td {
    font-weight: bold;
}




.synthesist-clash-detail { font-size: 0.9em; opacity: 0.8; margin: 0.2em 0 0 1em; }
