/* Shared palette. Theme preference is applied before the first paint by theme.js. */
:root {
    color-scheme: light;
    /* Light counterpart of the REGOS blue palette. */
    --app-bg: #f5f6fa;
    --app-surface: #ffffff;
    --app-surface-alt: #edeff6;
    --app-hover: #dce3f0;
    --app-text: #333a54;
    --app-muted: #57617b;
    --app-border: #e4e8f0;
    --app-field-border: #909ab2;
    --app-field: #ffffff;
    --app-link: #265fb0;
    --app-focus: #3677cc;
    --app-selected-bg: #e2e8f5;
    --app-selected-text: #333a54;
    --app-selection-bg: #333a54;
    --app-selection-text: #ffffff;
    --app-primary: #327332;
    --app-primary-hover: #286628;
    --app-success: #226543;
    --app-success-bg: #e3f2e9;
    --app-info: #275e9f;
    --app-info-bg: #e6effb;
    --app-warning: #805411;
    --app-warning-bg: #fff4db;
    --app-warning-border: #dfbd79;
    --app-danger: #b83440;
    --app-danger-bg: #fff0f1;
    --app-danger-border: #edb5bc;
    --app-danger-action: #b83440;
    --app-danger-action-hover: #982733;
    --app-on-action: #ffffff;
    --app-shadow: none;
    --app-floating-shadow: 0 12px 40px rgb(51 58 84 / 14%), 0 2px 8px rgb(51 58 84 / 6%);
    --app-radius: 16px;
    --app-control-radius: 12px;
    --app-inset-radius: 16px;
    --app-badge-radius: 8px;
    --app-pill-radius: 9999px;
    --app-focus-ring: 2px solid var(--app-focus);
    --app-focus-offset: 3px;
    --app-transition: 140ms ease;
    --app-disabled-opacity: .65;
}
:root[data-theme="dark"] {
    color-scheme: dark;
    /* Preserve the original REGOS blue palette in dark mode. */
    --app-bg: #333a54;
    --app-surface: #1d2235;
    --app-surface-alt: #2a3147;
    --app-hover: #414e6b;
    --app-text: #ffffff;
    --app-muted: #b4c1d4;
    --app-border: #343c53;
    --app-field-border: #74849b;
    --app-field: #333a54;
    --app-link: #a4c9ff;
    --app-focus: #a4c9ff;
    --app-selected-bg: #2a3147;
    --app-selected-text: #ffffff;
    --app-selection-bg: #a4c9ff;
    --app-selection-text: #1d2235;
    --app-primary: #327332;
    --app-primary-hover: #286628;
    --app-success: #91e1b3;
    --app-success-bg: #223e33;
    --app-info: #bad6ff;
    --app-info-bg: #293e5b;
    --app-warning: #f3d28e;
    --app-warning-bg: #3c3527;
    --app-warning-border: #847047;
    --app-danger: #ffabb3;
    --app-danger-bg: #432a34;
    --app-danger-border: #8a5260;
    --app-floating-shadow: 0 12px 40px rgb(0 0 0 / 28%), 0 2px 8px rgb(0 0 0 / 12%);
}
html { background: var(--app-bg); }
.app-shell {
    background: var(--app-bg);
    color: var(--app-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
.app-shell [x-cloak], .app-shell [hidden] { display: none !important; }
.site-header { min-height: 88px; padding: 20px 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.site-header > :last-child { flex-shrink: 0; }
.site-header svg.regos-logo { width: 124px; height: 40px; }
.regos-logo { color: var(--app-text); max-width: 100%; }
.theme-toggle, .sidebar-toggle { width: 42px; height: 42px; align-items: center; justify-content: center; border-radius: 50%; flex-shrink: 0; }
.theme-toggle { display: inline-flex; border: 0; background: transparent; color: var(--app-muted); }
.theme-toggle:hover:not(:disabled), .sidebar-toggle:hover:not(:disabled) { background: var(--app-hover); }
.theme-toggle svg { width: 21px; height: 21px; }
.theme-picker { position: relative; flex-shrink: 0; }
.theme-toggle svg { display: none; }
[data-theme-preference="system"] .theme-icon-system,
[data-theme-preference="light"] .theme-icon-sun,
[data-theme-preference="dark"] .theme-icon-moon { display: block; }
.theme-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 50; min-width: 180px; padding: 6px; border: 0; border-radius: var(--app-inset-radius); background: var(--app-surface); color: var(--app-text); box-shadow: var(--app-floating-shadow); }
.theme-menu button { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 12px; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.theme-menu button + button { margin-top: 4px; }
.theme-menu button:hover:not(:disabled), .theme-menu button:focus-visible { background: var(--app-hover); }
.theme-menu button[aria-checked="true"] { background: var(--app-selected-bg); color: var(--app-selected-text); }
.theme-menu button::after { content: ''; width: 16px; flex-shrink: 0; }
.theme-menu button[aria-checked="true"]::after { content: '\2713'; }
.profile-frame { display: flex; min-height: calc(100svh - 88px); width: 100%; }
.profile-sidebar { flex: 0 0 256px; width: 256px; padding: 12px 12px 32px; }
.profile-main { flex: 1; min-width: 0; padding: 32px 40px 80px; }
.profile-content { width: 100%; max-width: var(--app-width-wide); margin-inline: auto; }
.profile-content > :where(div, section, form) { margin-inline: auto; }
.profile-page-title { font-size: clamp(24px, 2.3vw, 28px); line-height: 1.35; font-weight: 600; letter-spacing: -.015em; text-align: center; margin: 0 0 32px !important; overflow-wrap: anywhere; }
.profile-navigation nav { display: grid; gap: 6px; }
.profile-navigation nav > * { margin: 0 !important; }
.profile-navigation nav > a, .profile-navigation nav > form > button {
    min-height: 48px; padding: 12px 16px; gap: 12px; border-radius: var(--app-control-radius); font-size: 14px; line-height: 1.4; font-weight: 500;
}
.profile-navigation nav > a > i, .profile-navigation nav > form > button > i { flex-shrink: 0; width: 24px; text-align: center; font-size: 18px; }
.profile-navigation nav > a:hover, .profile-navigation nav > form > button:hover:not(:disabled) { background: var(--app-hover); }
.profile-navigation nav > a.bg-regos-middle-dark { background: var(--app-selected-bg) !important; color: var(--app-selected-text); box-shadow: none; }
.profile-navigation nav > a.bg-regos-middle-dark i { color: inherit; }
.profile-drawer-panel { width: min(300px, 86vw); overflow-y: auto; flex-shrink: 0; }
.profile-drawer .profile-navigation { margin-inline: -8px; }
.auth-shell { display: flex; flex-direction: column; min-height: 100svh; }
.auth-content { display: flex; flex: 1; flex-direction: column; align-items: center; width: 100%; padding: 32px 24px; }
.app-version { color: var(--app-muted); font-size: 11px; line-height: 1.5; font-weight: 400; letter-spacing: .02em; overflow-wrap: anywhere; }
.profile-sidebar > .app-version { margin: 24px 12px 0; }
.profile-drawer-panel > .app-version { padding-top: 24px; flex-shrink: 0; }
.auth-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px max(24px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); color: var(--app-muted); font-size: 12px; }
.auth-content h1, .auth-content h2 { font-weight: 600; line-height: 1.35; letter-spacing: -.015em; }
/* Existing Razor views use these utility colors. Map neutral colors to the palette
   while retaining the meaning of action, warning and error colors. */
.app-shell :is(.text-white, .text-regos-white, .text-gray-100, .text-gray-200, .text-gray-800) { color: var(--app-text); }
.app-shell :is(.text-gray-300, .text-gray-400, .text-gray-500, .text-gray-600), .app-shell [class~="text-white/35"] { color: var(--app-muted); }
.app-shell :is(.text-blue-200, .text-blue-300, .text-blue-500) { color: var(--app-link); }
.app-shell :is(.text-red-100, .text-red-200, .text-red-300, .text-red-400, .text-red-500, .text-red-600, .text-red-700, .text-red-800) { color: var(--app-danger); }
.app-shell :is(.text-green-300, .text-green-400, .text-green-500, .text-green-600, .text-green-700, .text-green-900, .text-emerald-200, .text-emerald-600) { color: var(--app-success); }
.app-shell :is(.text-yellow-200, .text-yellow-300, .text-yellow-400) { color: var(--app-warning); }
.app-shell :is(.bg-gray-800, .bg-gray-900) { background-color: var(--app-surface); }
.app-shell :is(.bg-gray-50, .bg-gray-100, .bg-gray-200, .bg-gray-500, .bg-gray-600, .bg-gray-700),
.app-shell [class~="bg-gray-800/60"], .app-shell [class~="bg-gray-900/30"], .app-shell [class~="bg-gray-900/40"], .app-shell [class~="bg-gray-900/70"] { background-color: var(--app-surface-alt); }
.app-shell :is(.border-gray-100, .border-gray-200, .border-gray-300, .border-gray-400, .border-gray-500, .border-gray-600, .border-gray-700, .border-gray-800, .border-white),
.app-shell [class~="border-white/10"] { border-color: var(--app-border); }
.app-shell :is(.border-green-300, .border-green-500, .border-emerald-500, [class~="border-emerald-500/40"]) { border-color: var(--app-success); }
.app-shell :is(.border-red-300, .border-red-500) { border-color: var(--app-danger); }
.app-shell :is(.hover\:bg-gray-50, .hover\:bg-gray-100, .hover\:bg-gray-200, .hover\:bg-gray-500, .hover\:bg-gray-600, .hover\:bg-gray-700, .hover\:bg-gray-800, .hover\:bg-gray-900, .hover\:bg-regos-dark):hover:not(:disabled) { background-color: var(--app-hover); }
.app-shell :is(a, button).hover\:bg-regos-dark:hover:not(:disabled) { background-color: var(--app-hover) !important; }
.app-shell :is(.hover\:text-white, .hover\:text-gray-200, .hover\:text-gray-500):hover { color: var(--app-text); }
.app-shell :is(.divide-gray-700, .divide-gray-800) > :not([hidden]) ~ :not([hidden]) { border-color: var(--app-border); }
.app-shell :is(.bg-red-50, .bg-red-100), .app-shell [class~="bg-red-500/10"] { background-color: var(--app-danger-bg); color: var(--app-danger); border-color: var(--app-danger-border); }
.app-shell .bg-green-100 { background-color: var(--app-success-bg); color: var(--app-success); }
.app-shell :is(.bg-regos-dark, .bg-regos-middle-dark).rounded-lg,
.app-shell :is(.bg-regos-dark, .bg-regos-middle-dark).rounded-xl,
.app-shell :is(.bg-regos-dark, .bg-regos-middle-dark).rounded-2xl { border-radius: var(--app-radius); }
/* Legacy inset borders belong to decorative panels and secondary actions. */
.app-shell .btn-regos-inner-border { box-shadow: none !important; }
.app-shell :is(button, a):is(.rounded, .rounded-md, .rounded-lg, .rounded-xl):not(.rounded-full) { border-radius: var(--app-control-radius); }
.app-shell :is(div, section).border:is(.rounded, .rounded-lg) { border-radius: var(--app-control-radius); }
.app-shell :is(.btn-regos-submit, .bg-blue-500, .bg-blue-600, .bg-green-500, .bg-green-600, .bg-emerald-500, .bg-emerald-600) { background-color: var(--app-primary); color: var(--app-on-action); }
.app-shell :is(button, a, input):is(.btn-regos-submit, .bg-blue-500, .bg-blue-600, .bg-green-500, .bg-green-600, .bg-emerald-500, .bg-emerald-600):hover:not(:disabled) { background-color: var(--app-primary-hover); color: var(--app-on-action); }
.app-shell :is(.bg-red-500, .bg-red-600, .bg-red-700) { background-color: var(--app-danger-action); color: var(--app-on-action); }
.app-shell :is(button, a):is(.bg-red-500, .bg-red-600, .bg-red-700):hover:not(:disabled) { background-color: var(--app-danger-action-hover); color: var(--app-on-action); }
.app-shell :is(.hover\:bg-red-50, [class~="hover:bg-red-500/10"]):hover:not(:disabled) { background-color: var(--app-danger-bg); color: var(--app-danger); }
.app-shell :is(.hover\:text-red-100, .hover\:text-red-200, .hover\:text-red-400, .hover\:text-red-500, .hover\:text-red-700):hover:not(:disabled) { color: var(--app-danger); }
.app-shell .hover\:text-blue-200:hover { color: var(--app-link); }
.app-shell .hover\:text-yellow-200:hover { color: var(--app-warning); }
.app-shell .hover\:border-gray-300:hover { border-color: var(--app-field-border); }
.app-shell .btn-regos-cancel { color: var(--app-text); }
.app-shell :is(button, a, summary, [tabindex]):focus-visible { outline: var(--app-focus-ring); outline-offset: var(--app-focus-offset); }
.app-shell input:is([type="checkbox"], [type="radio"]):focus-visible { outline: var(--app-focus-ring); outline-offset: var(--app-focus-offset); box-shadow: none; }
.app-shell :is(button, input, textarea, select):disabled { opacity: var(--app-disabled-opacity); cursor: not-allowed; }
.app-shell input:is([type="checkbox"], [type="radio"]) { accent-color: var(--app-primary); }
.app-shell label { line-height: 1.5; }
.app-shell :is(.btn-regos-submit, .btn-regos-cancel, .btn-regos-outline) { min-height: 44px; min-width: 0; overflow-wrap: normal; border-radius: var(--app-control-radius); }
.app-shell .password-toggle { color: var(--app-muted); border-radius: var(--app-control-radius); }
.app-shell .password-toggle:hover { color: var(--app-text); }
.app-shell #langButton { min-height: 42px; padding: 8px 12px; background: transparent; color: var(--app-muted); border: 0; box-shadow: none; }
.app-shell #langButton svg { fill: currentColor; }
.app-shell #langButton:hover:not(:disabled) { background: var(--app-hover); }
.app-shell #langMenu, .app-shell #notificationBellDropdown, .app-shell .account-menu { background: var(--app-surface); border: 0; border-radius: var(--app-inset-radius); box-shadow: var(--app-floating-shadow); max-width: calc(100vw - 32px); }
.app-shell :is(.theme-toggle, #langButton, #notificationBellButton):is(:hover, [aria-expanded="true"]) { color: var(--app-text); background: var(--app-hover); }
.app-shell .account-toggle { border: 0; box-shadow: none; }
.app-shell .account-toggle:hover { opacity: .85; }
.app-shell .account-shelf-row { background: var(--app-surface-alt); border: 0; }
.app-shell #langMenu { padding: 6px; }
.app-shell #langMenu > button { border-radius: var(--app-control-radius); }
.app-shell #notificationBellBadge { color: #fff; }
.app-shell .bg-black.bg-opacity-50 .fa-camera { color: #fff; }
.security-page, .device-flow { margin-inline: auto; max-width: 100%; }
.device-flow { padding-right: 0; }
.device-flow-confirmation, .device-flow-result { width: 100%; margin-inline: auto; }
.security-panel, .security-device, .device-flow-panel { border: 0; border-radius: var(--app-radius); box-shadow: var(--app-shadow); }
.security-metrics { gap: 0; border: 0; border-radius: var(--app-radius); background: var(--app-surface); overflow: hidden; }
.security-metric { padding: 24px; gap: 16px; border-radius: 0; background: transparent; }
.security-metric + .security-metric { border-left: 1px solid var(--app-border); }
.security-metric > .security-link { border-top: 0; padding-top: 0; margin-left: 40px; }
.security-page .security-metric:focus-visible { outline-offset: -3px; }
.security-panel { padding: 24px; }
.security-icon, .device-flow-icon { background: var(--app-info-bg); color: var(--app-info); }
.security-metric .security-icon { width: 28px; height: 28px; font-size: 22px; background: transparent; color: var(--app-muted); }
.security-metric-heading { gap: 12px; }
.security-metric-heading > div { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: 12px; }
.security-metric-heading p { grid-column: 1 / -1; }
.security-metric .security-count { font-size: 24px; line-height: 1.2; }
.security-event { margin-top: 0; padding: 20px 8px; border-radius: 0; }
.app-shell .security-metric:is(:hover, :focus-visible) { background: var(--app-hover); }
.app-shell .security-metric:is(:hover, :focus-visible) .security-icon { color: var(--app-link); }
.security-status-row .security-badge.is-success { padding-inline: 0; background: transparent; }
.security-badge { border-radius: var(--app-badge-radius); }
.security-button, .device-flow-button, .device-flow-input { border-radius: var(--app-control-radius); }
.security-button { min-height: 40px; }
.device-flow-code-check, .device-flow-account { border-radius: var(--app-inset-radius); }
.device-flow-methods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.profile-home { gap: 12px; padding-top: 8px; }
.profile-home > h1 { font-weight: 600; letter-spacing: -.015em; overflow-wrap: anywhere; }
/* These bundled glyphs are white; keep product photos and third-party logos intact. */
:root:not([data-theme="dark"]) .profile-home img[src^="/images/icon/"] { filter: brightness(0) opacity(.75); }
/* Shared states also cover utilities used by dynamically rendered notifications. */
.app-shell ::selection { background: var(--app-selection-bg); color: var(--app-selection-text); }
.app-shell :is(button, a, input, select, textarea, summary) {
    transition: background-color var(--app-transition), color var(--app-transition), border-color var(--app-transition), box-shadow var(--app-transition);
}
.app-shell :is(div, section, article, form):is(.bg-regos-dark, .bg-regos-middle-dark, .bg-gray-800, .bg-gray-900):is(.rounded, .rounded-lg, .rounded-xl, .rounded-2xl):where(:not(.account-menu, #langMenu, #notificationBellDropdown)) { border-radius: var(--app-radius); }
.app-shell :is(.rounded-full) { border-radius: var(--app-pill-radius); }
.app-shell :is(.shadow, .shadow-sm, .shadow-md, .shadow-lg, .shadow-xl, .shadow-2xl):where(:not(.btn-regos-inner-border, .account-menu, #langMenu, #notificationBellDropdown)) { box-shadow: var(--app-shadow); }
.app-shell :is(.hover\:shadow-md, .hover\:shadow-lg):hover { box-shadow: var(--app-shadow); }
.app-shell :is(.theme-toggle, #notificationBellButton, .password-toggle):hover:not(:disabled) { background-color: var(--app-hover); }
.app-shell .account-selected { background: var(--app-selected-bg); color: var(--app-selected-text); border-radius: var(--app-control-radius); }
.app-shell .account-choice:hover:not(:disabled) { background: var(--app-hover); }
/* Shelf rows clip their children; draw keyboard focus inside the selected row. */
.app-shell .account-choice:focus-visible { outline-offset: -3px; }
.app-shell .security-device > summary { border-radius: var(--app-radius); transition: background-color var(--app-transition); }
.app-shell .security-device > summary:hover { background: var(--app-hover); }
.app-shell .security-device[open] > summary { border-radius: var(--app-radius) var(--app-radius) 0 0; }
.app-shell .security-device-content { border-radius: 0; background: transparent; border-top: 1px solid var(--app-border); }
.app-shell .device-flow-scopes li { border-radius: var(--app-badge-radius); }
.app-shell .digit-box { background: var(--app-field); border-color: var(--app-field-border); border-radius: var(--app-control-radius); }
.app-shell .auth-submitting :is(button, input, textarea, select) { cursor: wait; }
@media (max-width: 1100px) {
    .profile-main { padding-inline: 24px; }
    .security-metrics, .device-flow-methods { grid-template-columns: 1fr; }
    .security-metric + .security-metric { border-left: 0; border-top: 1px solid var(--app-border); }
}
@media (max-width: 767px) {
    .site-header { min-height: 76px; padding: 16px; gap: 8px; flex-wrap: wrap; }
    .site-header > :last-child { gap: 8px; margin-left: auto; }
    .site-header svg.regos-logo { width: 94px; height: 32px; }
    .sidebar-toggle { display: inline-flex; }
    .profile-main { padding: 20px 16px 60px; }
    .profile-page-title { margin-bottom: 24px !important; }
    .auth-content { padding: 20px 16px; }
    .security-panel, .security-metric { padding: 20px; }
    .theme-toggle { width: 38px; height: 38px; }
    .app-shell #langButton { min-height: 38px; padding-inline: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    .app-shell *, .app-shell *::before, .app-shell *::after { scroll-behavior: auto !important; transition-duration: 0s !important; }
}
