/* Shared portal appearance. Dark remains the existing default. */
.page > .heading > div { min-width: 0; overflow-wrap: anywhere; }
.account-password-card { margin-bottom: 1rem; }
html :is(.account, .login-theme-control) .theme-switch {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    flex: 0 0 auto; min-height: 36px; width: auto; margin: 0; padding: 5px 3px;
    color: var(--muted); background: transparent; border: 0; border-radius: 7px;
    cursor: pointer; line-height: 1;
}
html :is(.account, .login-theme-control) .theme-switch:hover { background: var(--surface-2); color: var(--text); }
html .theme-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.theme-switch svg { width: 16px; height: 16px; flex-shrink: 0; }
.theme-switch-track { display: block; position: relative; width: 36px; height: 21px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface-2); }
.theme-switch-knob { display: block; position: absolute; left: 2px; top: 2px; width: 15px; height: 15px; border-radius: 50%; background: var(--accent); transform: translateX(15px); }
html[data-theme="light"] .theme-switch-knob { transform: translateX(0); }
html[data-theme="dark"] .theme-switch-moon, html[data-theme="light"] .theme-switch-sun { color: var(--accent); }

html[data-theme="light"] {
    color-scheme: light;
    --bg: #f0f4f3; --surface: #ffffff; --surface-2: #e7eeec; --border: #c4d1cd;
    --text: #192b27; --muted: #536760; --accent: #007d6c; --accent-hover: #006454;
    --danger: #b32939; --button-text: #ffffff;
    --status-active: #007d6c; --status-invited: #8c5c05; --status-disabled: #5d6a66;
    --status-archived: #8b4255; --status-unassigned: #5d6a66;
}
html[data-theme="light"] body { background: radial-gradient(circle at top left, #e0f0e9, var(--bg) 420px); color: var(--text); }
html[data-theme="light"] :is(.card, .login-card, .pigeon-rule-card, .pigeon-rule-column, .user-service-dialog) { background: var(--surface); color: var(--text); border-color: var(--border); }
html[data-theme="light"] :is(.topbar, .user-service-header) { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: 0 1px 0 var(--border), 0 8px 24px rgb(25 43 39 / 6%); }
html[data-theme="light"] :is(.ui-popup, .top-account-dropdown, .product-action-popup) { box-shadow: 0 16px 50px rgb(25 43 39 / 15%); }
html[data-theme="light"] :is(.user-service-dialog, .ui-popup)::backdrop { background: rgb(25 43 39 / 30%); }
html[data-theme="light"] :is(label, .account, .legend-grid code, .top-admin-link, .button-secondary) { color: var(--text); }
html[data-theme="light"] .button-secondary:hover { color: var(--text); background: var(--surface-2); }
html[data-theme="light"] :is(input, select, textarea) { background: var(--surface); color: var(--text); border-color: var(--border); accent-color: var(--accent); }
html[data-theme="light"] :is(input, textarea)::placeholder { color: var(--muted); opacity: 1; }
html[data-theme="light"] :is(.asc-rule-card, .portal-license-group) { border-color: var(--border); }
html[data-theme="light"] :is(.asc-configuration summary, .portal-management-details > summary) { color: var(--accent); background: #e2f2ed; border-color: #85b8aa; border-left-color: var(--accent); }
html[data-theme="light"] :is(.asc-configuration summary:hover, .asc-configuration details[open] > summary) { background: #d2eae1; }
html[data-theme="light"] .portal-dashboard-nav a { background: var(--surface); border-color: var(--border); }
html[data-theme="light"] .portal-dashboard-nav a[aria-current="page"] { color: var(--accent); background: #e2f2ed; }
html[data-theme="light"] :is(.status-toggle-inactive, .status-toggle-inactive:hover) { color: var(--muted); background: var(--surface-2); }
html[data-theme="light"] :is(.alert, .archive-warning, .status-toggle-archived, .pigeon-rule-delete) { color: var(--danger); background: #fff0f1; border-color: #e4a7ae; }
html[data-theme="light"] .feedback-area { background: #e9f5ef; border-color: #85b8aa; }
html[data-theme="light"] .feedback-message { color: #175340 !important; border-left-color: var(--accent) !important; }
html[data-theme="light"] .feedback-message[data-feedback-level="error"] { color: #9a2332 !important; border-left-color: var(--danger) !important; }
html[data-theme="light"] .feedback-copied { color: var(--accent); }
html[data-theme="light"] .asc-status-green { --asc-status-color: #007d6c; }
html[data-theme="light"] .asc-status-orange { --asc-status-color: #8c5c05; }
html[data-theme="light"] .asc-status-red { --asc-status-color: #b32939; }
html[data-theme="light"] .asc-activity-status--ready { color: #007d6c; }
html[data-theme="light"] .asc-activity-status--pending { color: #8c5c05; }
html[data-theme="light"] .asc-activity-status--failed { color: #b32939; }
@media (max-width: 650px) {
    html .topbar { display: flex; flex-wrap: wrap; gap: .5rem; padding: .65rem 1rem; }
    html .topbar .topbar-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; max-width: 100%; }
    html .topbar .account { gap: .45rem; max-width: 100%; }
    html .topbar .top-admin-nav { flex-basis: 100%; flex-wrap: wrap; justify-content: flex-end; }
    html .top-account-trigger > span:first-child { max-width: 8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

.login-card { position: relative; }
.login-theme-control { display: flex; justify-content: flex-end; margin: -.25rem 0 .5rem; }
html .admin-level-switch { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; color: var(--muted); font-size: 10px; text-decoration: none; padding: 4px; border-radius: 7px; }
html .admin-level-switch:hover { background: var(--surface-2); }
.admin-level-switch .theme-switch-track { width: 30px; height: 19px; }
html .admin-level-switch .theme-switch-knob { width: 13px; height: 13px; transform: translateX(0); }
html .admin-level-switch[aria-checked=true] .theme-switch-knob { transform: translateX(11px); }
.admin-level-switch[aria-checked=true] > span:last-child, .admin-level-switch[aria-checked=false] > span:first-child { color: var(--accent); }
@media (max-width: 600px) { .account { flex-wrap: wrap; } }

html[data-level="admin"] { --accent:#ff9f43; --accent-hover:#ffb66d; --accent-rgb:255,159,67; --button-text:#271303; }
html[data-level="admin"][data-theme="light"] { --accent:#b95300; --accent-hover:#934200; --accent-rgb:185,83,0; --button-text:#fff; }
html[data-level="admin"][data-theme="light"] body { background:radial-gradient(circle at top left,#f6e6d7,var(--bg) 420px); }
html[data-level="admin"] .entity-link:hover { color:var(--accent); }
html[data-level="admin"] .feedback-area { border-color:color-mix(in srgb,var(--accent) 45%,var(--border)); background:color-mix(in srgb,var(--accent) 9%,var(--surface)); }
html[data-level="admin"] .feedback-message:not([data-feedback-level="error"]) { color:var(--text) !important; border-left-color:var(--accent) !important; }
html[data-level="admin"] .feedback-area:focus-visible { outline-color:var(--accent); }
html[data-level="admin"] :is(.asc-configuration summary,.portal-management-details>summary) { color:var(--accent); background:color-mix(in srgb,var(--accent) 13%,var(--surface)); border-color:color-mix(in srgb,var(--accent) 45%,var(--border)); border-left-color:var(--accent); }
html[data-level="admin"][data-theme="light"] :is(.asc-configuration summary,.portal-management-details>summary) { color:var(--accent); background:#fff0e2; border-color:#d5a77f; border-left-color:var(--accent); }
html[data-level="admin"][data-theme="light"] :is(.asc-configuration summary:hover,.asc-configuration details[open]>summary) { background:#ffe3c9; }
