html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* Ensure account management panels are spaced consistently from other content */
.hmi-account-section {
    /* Match other panels: 16px vertical spacing, no extra horizontal offset (main provides padding) */
    margin: 16px 0;
}

@media (max-width: 860px) {
    .hmi-account-section {
        margin: 12px 0;
    }
}

/* Visual border for the account list area to separate it from surrounding content */
.hmi-account-table {
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 12px;
    background: rgba(255,255,255,0.02);
}

.hmi-account-table .hmi-panel-header {
    margin: 0 0 12px 0;
}

/* Make the inner table use full width inside the bordered box and keep scrolling behavior */
.hmi-account-table .hmi-table-wrap {
    overflow: auto;
}

/* Make light-theme render the same visual effect as dark mode for the account list */
html[data-theme="light"] .hmi-account-table {
    /* stronger contrast in light theme so the border is visible against white backgrounds */
    background: rgba(255,255,255,0.92) !important;
    border-color: rgba(16,24,40,0.08) !important;
    box-shadow: 0 6px 18px rgba(16,24,40,0.04);
}

/* Make the header divider inside the account table visible (both themes) */
.hmi-account-table .hmi-panel-header {
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 0.25px solid rgba(255,255,255,0.06);
}

/* Light theme: use darker divider so it is visible on white background */
html[data-theme="light"] .hmi-account-table .hmi-panel-header {
    border-bottom-color: rgba(16,24,40,0.08) !important;
}

/* Row dividers inside account list: use cell borders for consistent rendering */
.hmi-account-table .hmi-table {
    border-collapse: collapse;
}

/* Divider between the table header and the first data row */
.hmi-account-table .hmi-table thead th {
    border-bottom: 0.25px solid rgba(255,255,255,0.12);
}

html[data-theme="light"] .hmi-account-table .hmi-table thead th {
    border-bottom-color: rgba(16,24,40,0.12) !important;
}

.hmi-account-table .hmi-table tbody td {
    border-bottom: 0.25px solid rgba(255,255,255,0.08);
    box-shadow: inset 0 -0.25px 0 rgba(255,255,255,0.08);
}

.hmi-account-table .hmi-table tbody tr:last-child td {
    border-bottom: none;
    box-shadow: none;
}

/* Light theme: make the horizontal lines visible on white backgrounds */
html[data-theme="light"] .hmi-account-table .hmi-table tbody td {
    border-bottom-color: rgba(16,24,40,0.10) !important;
    box-shadow: inset 0 -0.25px 0 rgba(16,24,40,0.10) !important;
}

html[data-theme="light"] .hmi-account-table .hmi-table tbody tr:last-child td {
    box-shadow: none !important;
}

/* subtle hover to aid row affordance */
.hmi-account-table .hmi-table tbody tr:hover {
    background: rgba(76,125,255,0.02);
}

/* Removed custom icon font (not needed since inline SVGs are used). */

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA9NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA7MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N7MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "发生错误，请稍后重试。"
    }

.components-reconnect-modal,
.components-reconnect-modal p,
.components-reconnect-modal h1,
.components-reconnect-modal h2,
.components-reconnect-modal h3,
.components-reconnect-modal h4,
.components-reconnect-modal h5,
.components-reconnect-modal h6,
.components-reconnect-modal span,
.components-reconnect-modal div {
    color: #000;
}

/* Make the localized 'Rejoin failed' message render black in dark theme for visibility
   while keeping the default color in light theme. */
.reconnect-failed-black {
    color: inherit;
}

/* Stronger override for reconnect text inside the reconnect modal to beat inline or theme styles */
html[data-theme="dark"] .components-reconnect-modal .reconnect-failed-black,
html[data-theme="dark"] .reconnect-failed-black {
    color: #1f2937 !important;
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

html, body {
    margin: 0;
    min-height: 100%;
    background: #0f1320;
    color: #e8ecff;
}

:root {
    --hmi-sidebar-width: 220px;
    --hmi-sidebar-collapsed-width: 72px;
    --hmi-sidebar-gap: 20px; /* extra gap between sidebar and content */
    --hmi-text-primary: #e8ecff;
    --hmi-text-secondary: #9ca3af;
    --hmi-text-muted: #6b7280;
    --hmi-status-on: #67e29a;
    --hmi-status-off: #4b5563;
}

a {
    color: inherit;
}

.hmi-shell {
    min-height: 100vh;
    display: flex;
    background: radial-gradient(circle at top, #1d2236 0%, #121624 55%, #0f1320 100%);
    color: #e8ecff;
    font-family: Inter, Segoe UI, Arial, sans-serif;
    box-sizing: border-box;
    /* reserve space for the fixed sidebar plus a small visual gap so panels don't touch */
    padding-left: calc(var(--hmi-sidebar-width) + var(--hmi-sidebar-gap));
}

html[data-sidebar-collapsed="true"] .hmi-shell {
    padding-left: calc(var(--hmi-sidebar-collapsed-width) + var(--hmi-sidebar-gap));
}

.hmi-sidebar {
    width: var(--hmi-sidebar-width);
    height: 100vh;
    position: fixed;
    inset: 0 auto 0 0;
    padding: 18px 14px;
    background: rgba(15, 19, 31, 0.82);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow-y: auto;
    z-index: 20;
}

.hmi-sidebar-tools {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

html[data-sidebar-collapsed="true"] .hmi-sidebar-tools {
    width: 100%;
    justify-content: center;
}

html[data-sidebar-collapsed="true"] .hmi-sidebar {
    width: 72px;
    padding-inline: 10px;
}

.hmi-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

html[data-sidebar-collapsed="true"] .hmi-brand {
    width: 100%;
    justify-content: center;
}

.hmi-brand-text {
    display: flex;
    flex-direction: column;
}

.hmi-brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #4c7dff, #7f5dff);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 10px 24px rgba(76, 125, 255, 0.28);
}

.hmi-brand-text strong {
    display: block;
    font-size: 1rem;
}

.hmi-brand-text span {
    display: block;
    margin-top: 2px;
    font-size: 0.78rem;
    color: #8f96b8;
}

html[data-sidebar-collapsed="true"] .hmi-brand-text,
html[data-sidebar-collapsed="true"] .hmi-nav-text {
    display: none;
}

html[data-sidebar-collapsed="false"] .hmi-brand-text,
html[data-sidebar-collapsed="false"] .hmi-nav-text,
html[data-sidebar-collapsed="false"] .hmi-theme-button {
    display: block;
}

.hmi-sidebar-toggle {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: #4c7dff;
    cursor: pointer;
    flex: 0 0 auto;
    font-size: 1.15rem;
    transition: background 0.16s ease, box-shadow 0.16s ease, color 0.12s ease;
}

.hmi-sidebar-toggle .icon-expanded {
    display: none;
}

html[data-sidebar-collapsed="true"] .hmi-sidebar-toggle .icon-collapsed {
    display: inline;
}

html[data-sidebar-collapsed="true"] .hmi-sidebar-toggle .icon-expanded {
    display: none;
}

html[data-sidebar-collapsed="false"] .hmi-sidebar-toggle .icon-collapsed {
    display: none;
}

html[data-sidebar-collapsed="false"] .hmi-sidebar-toggle .icon-expanded {
    display: inline;
}

.hmi-sidebar-toggle:hover {
    background: rgba(76, 125, 255, 0.26);
    box-shadow: 0 8px 20px rgba(76, 125, 255, 0.10);
}

.hmi-sidebar-toggle:focus-visible {
    outline: 2px solid #4c7dff;
    outline-offset: 2px;
    box-shadow: 0 8px 26px rgba(76,125,255,0.14);
}

.hmi-nav {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.hmi-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: #a9afcb;
    background: transparent;
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.hmi-nav-icon {
    width: 20px;
    text-align: center;
    color: #7ea1ff;
    flex: 0 0 auto;
}

/* icon-font class removed — using inline SVGs instead */

.hmi-nav-svg {
    width: 20px;
    height: 20px;
    display: block;
    width: 22px;
    height: 22px;
    stroke: none;
}

/* Make username in the topbar user chip more prominent */
.hmi-user-meta strong {
    font-size: 1.5rem; /* larger */
    font-weight: 600;
    line-height: 1;
    display: block;
}

.hmi-user-meta span {
    font-size: 0.8rem;
    color: #9aa4c7;
}

/* ConfirmDialog / Modal styles (fresh, theme-aware) */
:root {
    --accent: #4c7dff; /* primary accent */
    --accent-2: #7f5dff;
    --modal-bg: rgba(255, 255, 255, 0.06);
    --modal-text: #e8ecff;
    --modal-border: rgba(255,255,255,0.06);
    --backdrop: rgba(8, 12, 20, 0.45);
}

.hmi-modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--backdrop);
    backdrop-filter: blur(14px) saturate(1.18);
    display: grid;
    place-items: center;
    z-index: 2000;
    padding: 20px;
    animation: hmi-fade-in 160ms ease;
}

.hmi-modal {
    width: min(560px, 100%);
    margin: auto;
    background: rgba(18, 22, 36, 0.42);
    backdrop-filter: blur(18px) saturate(1.25);
    color: var(--modal-text);
    border-radius: 12px;
    box-shadow:
        0 22px 50px rgba(2, 6, 23, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255,255,255,0.14);
    overflow: hidden;
    transform: translateY(6px) scale(0.995);
    animation: hmi-pop-in 180ms cubic-bezier(.2,.9,.28,1) forwards;
}

.hmi-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.06);
}

.hmi-modal-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--modal-text);
}

.hmi-modal-body {
    padding: 16px 20px;
    color: var(--modal-text, rgba(232,236,255,0.95));
    font-size: 0.98rem;
    background: rgba(255,255,255,0.02);
}

.hmi-modal-footer {
    padding: 12px 16px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
}

.hmi-button {
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    border: 0;
    min-width: 76px;
    transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.hmi-button-muted {
    background: transparent;
    color: rgba(150,170,200,0.95);
    border: 1px solid rgba(255,255,255,0.04);
}

.hmi-button-primary {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    color: white;
    box-shadow: 0 8px 20px rgba(76,125,255,0.14);
}

.hmi-button-danger {
    background: linear-gradient(90deg,#ff7a7a,#ffb199);
    color: white;
}

.hmi-button:hover { transform: translateY(-2px); }

.hmi-button:focus {
    outline: 3px solid rgba(76,125,255,0.12);
    outline-offset: 2px;
}

@keyframes hmi-fade-in { from { opacity: 0 } to { opacity: 1 } }
@keyframes hmi-pop-in { to { transform: translateY(0) scale(1) } }

/* Light theme overrides */
html[data-theme="light"] {
    --accent: #3b82f6;
    --accent-2: #60a5fa;
    --modal-bg: rgba(255, 255, 255, 0.72);
    --modal-text: #0f1724;
    --modal-border: rgba(16,24,40,0.06);
    --backdrop: rgba(240, 244, 255, 0.7);
}

/* Use a semi-transparent "glass" modal in light theme to keep the fresh translucent look */
html[data-theme="light"] .hmi-modal {
    background: var(--modal-bg);
    backdrop-filter: blur(18px) saturate(1.25);
    color: var(--modal-text);
    border-color: rgba(16,24,40,0.10);
    box-shadow:
        0 18px 40px rgba(16,24,40,0.08),
        inset 0 1px 0 rgba(255,255,255,0.5);
}

html[data-theme="dark"] .hmi-modal {
    background: rgba(18, 22, 36, 0.42);
    backdrop-filter: blur(18px) saturate(1.25);
    border-color: rgba(255,255,255,0.14);
}

/* Improve contrast for modal body text in light theme */
html[data-theme="light"] .hmi-modal-body {
    color: #172034; /* stronger dark text */
}

html[data-theme="light"] .hmi-modal-header,
html[data-theme="light"] .hmi-modal-footer {
    background: rgba(255,255,255,0.12);
}

html[data-theme="light"] .hmi-button-muted {
    color: #55607a;
    border-color: rgba(16,24,40,0.06);
}


.hmi-nav-svg path,
.hmi-nav-svg rect,
.hmi-nav-svg circle {
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.hmi-nav-item:hover .hmi-nav-svg path,
.hmi-nav-item:hover .hmi-nav-svg rect,
.hmi-nav-item:hover .hmi-nav-svg circle {
    transform: translateY(-2px);
    opacity: 1;
}

/* Make all nav SVG shapes follow the text color so icons stay consistent */
.hmi-nav-svg {
    color: inherit;
}

.hmi-nav-svg path,
.hmi-nav-svg rect,
.hmi-nav-svg circle {
    fill: currentColor !important;
}

.hmi-nav-text {
    white-space: nowrap;
}

html[data-sidebar-collapsed="true"] .hmi-nav-item {
    justify-content: center;
    padding: 11px;
}

html[data-sidebar-collapsed="false"] .hmi-nav-item {
    justify-content: flex-start;
}

html[data-sidebar-collapsed="true"] .hmi-nav-icon {
    margin: 0;
}

.hmi-nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    transform: scale(1.04);
}

.hmi-nav-item.active {
    background: rgba(255, 255, 255, 0.06);
    color: #4c7dff; /* selected color (blue) */
    transform: scale(1.04);
}

/* Ensure selected nav item stays blue across theme-specific overrides */
html .hmi-nav-item.active,
html[data-theme="light"] .hmi-nav-item.active {
    color: #4c7dff !important;
}

/* Force-fill SVG shapes and text inside active nav item to the selected blue */
.hmi-nav-item.active .hmi-nav-svg path,
.hmi-nav-item.active .hmi-nav-svg rect,
.hmi-nav-item.active .hmi-nav-svg circle,
.hmi-nav-item.active .hmi-nav-text {
    color: #4c7dff !important;
    fill: #4c7dff !important;
}

.hmi-nav-item:active {
    transform: scale(0.98);
}

.hmi-main {
    flex: 1;
    width: 100%;
    margin-left: 0;
    padding: 82px 22px 22px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

html[data-sidebar-collapsed="true"] .hmi-main {
    width: 100%;
    margin-left: 0;
}

/* Small visual gap so the content panels don't touch the sidebar edge */
.hmi-main > * {
    margin-left: 0;
}

.hmi-shell-content {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

.hmi-footer {
    margin-top: auto;
    padding: 18px 0 4px;
    text-align: center;
    font-size: 0.78rem;
    color: #8f96b8;
    letter-spacing: 0.2px;
}

html[data-theme="light"] .hmi-footer {
    color: #64748b;
}

.hmi-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.hmi-page-meta {
    display: flex;
    flex-direction: column;
}

.hmi-page-title {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.hmi-page-subtitle {
    margin-top: 4px;
    font-size: 0.85rem;
    color: #8f96b8;
}

.hmi-topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    position: fixed;
    top: 18px;
    right: 22px;
    z-index: 1000;
}

.hmi-topbar-actions .hmi-user-chip {
    margin-left: 6px;
}

/* Shell user chip layout: avatar left, details center, logout right */
.hmi-topbar-actions .hmi-user-chip {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 12px;
    white-space: nowrap;
}

.hmi-topbar-actions .hmi-user-avatar {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    width: 24px;
    height: auto;
}

.hmi-topbar-actions .hmi-user-summary {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    gap: 12px;
    white-space: nowrap;
}

.hmi-topbar-actions .hmi-user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
    align-self: center;
}

.hmi-topbar-actions .hmi-logout-button {
    margin-left: auto;
    flex: 0 0 auto;
    align-self: center;
}

.hmi-pill {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(72, 211, 114, 0.14);
    color: #9ef0b6;
    font-size: 0.8rem;
    font-weight: 600;
}

.hmi-pill,
.hmi-theme-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.hmi-theme-button {
    display: inline-flex;
}

.hmi-pill-soft {
    background: rgba(255, 255, 255, 0.06);
    color: #d4d9ee;
}

.hmi-cards,
.hmi-grid {
    display: grid;
    gap: 16px;
}

.hmi-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.hmi-grid.two-col {
    grid-template-columns: 1fr 1fr;
}

.hmi-grid.split-wide {
    grid-template-columns: 1fr 1fr;
}

/* 所有区块容器统一底部间距，与上下区块保持一致 */
.hmi-cards,
.hmi-grid,
section.hmi-panel {
    margin-bottom: 16px;
}

.hmi-panel,
.hmi-stat-card {
    background: rgba(31, 36, 55, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(10px);
}

.hmi-stat-card {
    padding: 18px;
    min-height: 132px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hmi-stat-head {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #aab0ce;
    font-size: 0.82rem;
}

.hmi-icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-weight: 700;
}

.hmi-stat-value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.2px;
}

.hmi-stat-foot {
    color: #95a0bf;
    font-size: 0.8rem;
}

.accent-blue .hmi-icon { background: linear-gradient(135deg, #4c7dff, #7d8cff); }
.accent-green .hmi-icon { background: linear-gradient(135deg, #2dbf8a, #53d17d); }
.accent-orange .hmi-icon { background: linear-gradient(135deg, #ff9a52, #ff6f61); }
.accent-yellow .hmi-icon { background: linear-gradient(135deg, #ffd24d, #ffb84d); }
.accent-red .hmi-icon { background: linear-gradient(135deg, #ff5f6d, #ff7b7b); }
.accent-purple .hmi-icon { background: linear-gradient(135deg, #9c7bff, #6e74ff); }

.hmi-panel {
    padding: 18px;
}

.hmi-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.hmi-panel-header h2 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}

.hmi-tag {
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.72rem;
    color: #aeb4d0;
}

.hmi-tag.danger {
    background: rgba(255, 89, 89, 0.12);
    color: #ff8e8e;
}

.hmi-overview {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(180px, 0.7fr);
    gap: 16px;
    align-items: stretch;
}

.hmi-chart-box {
    min-height: 240px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(76, 125, 255, 0.08), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 14px;
}

.hmi-chart-title {
    font-size: 0.84rem;
    color: #b7bdd8;
    margin-bottom: 14px;
}

.hmi-chart-placeholder {
    height: calc(100% - 30px);
    display: flex;
    align-items: end;
    gap: 12px;
    padding: 10px 6px 4px;
}

.hmi-bar {
    flex: 1;
    border-radius: 12px 12px 4px 4px;
    background: linear-gradient(180deg, rgba(94, 140, 255, 0.95), rgba(94, 140, 255, 0.25));
    box-shadow: 0 10px 20px rgba(72, 109, 255, 0.16);
}

.hmi-kpi-list,
.hmi-status-list,
.hmi-alarm-list,
.hmi-report-grid,
.hmi-config-grid {
    display: grid;
    gap: 10px;
}

.hmi-kpi-item,
.hmi-status-item,
.hmi-alarm-item,
.hmi-report-item,
.hmi-config-item {
    border-radius: 14px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.hmi-kpi-item span,
.hmi-report-item span,
.hmi-config-item span {
    display: block;
    color: #98a0bf;
    font-size: 0.78rem;
    margin-bottom: 6px;
}

.hmi-kpi-item strong,
.hmi-report-item strong,
.hmi-config-item strong {
    font-size: 1.15rem;
}

.hmi-status-item,
.hmi-alarm-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.hmi-status-item.ok .hmi-status-value { color: #67e29a; }
.hmi-status-item.warn .hmi-status-value { color: #ffc15a; }
.hmi-status-item.alarm .hmi-status-value { color: #ff7b7b; }

.hmi-table-wrap {
    overflow: auto;
}

.hmi-table {
    width: 100%;
    border-collapse: collapse;
}

.hmi-table th,
.hmi-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.82rem;
}

.hmi-table th {
    color: #96a0c0;
    font-weight: 600;
}

.hmi-table td {
    color: #edf0ff;
}

.devices-module-grid {
    align-items: start;
}

.devices-metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.devices-connection-card {
    background: linear-gradient(180deg, rgba(76, 125, 255, 0.12), rgba(255, 255, 255, 0.04));
}

.devices-status-grid,
.devices-command-grid {
    display: grid;
    gap: 10px;
}

.devices-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.devices-command-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.devices-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.devices-action-grid .hmi-button {
    width: 100%;
    min-height: 48px;
}

@media (max-width: 980px) {
    .devices-metric-grid,
    .devices-status-grid,
    .devices-command-grid,
    .devices-action-grid {
        grid-template-columns: 1fr;
    }
}

.hmi-log-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
    gap: 12px;
    align-items: end;
}

.hmi-log-setting {
    display: grid;
    gap: 8px;
}

.hmi-log-setting span {
    color: #98a0bf;
    font-size: 0.78rem;
}

.hmi-log-number {
    width: 100%;
    max-width: 180px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #edf0ff;
}

.hmi-log-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.hmi-log-summary {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #b8c1df;
    font-size: 0.84rem;
    line-height: 1.6;
}

.hmi-log-table-wrap {
    overflow: auto;
    max-height: 62vh;
}

.hmi-log-preview,
.hmi-log-empty {
    margin-top: 10px;
    color: #d8def5;
    font-size: 0.88rem;
    line-height: 1.6;
}

.hmi-log-empty {
    color: #9da6c7;
}

.hmi-log-number:focus {
    outline: 2px solid rgba(76, 125, 255, 0.25);
    outline-offset: 2px;
}

@media (max-width: 1200px) {
    .hmi-log-toolbar {
        grid-template-columns: 1fr;
    }

    .hmi-log-actions {
        justify-content: flex-start;
    }
}

html[data-theme="light"] .hmi-log-number {
    background: rgba(255, 255, 255, 0.9);
    color: #172034;
    border-color: rgba(16,24,40,0.08);
}

html[data-theme="light"] .hmi-log-summary,
html[data-theme="light"] .hmi-log-preview {
    background: rgba(255, 255, 255, 0.9);
    color: #172034;
    border-color: rgba(16,24,40,0.08);
}

html[data-theme="light"] .hmi-log-empty {
    color: #5c6782;
}

.hmi-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    background: rgba(255, 255, 255, 0.06);
    color: #d7defa;
}

.hmi-badge.good { background: rgba(103, 226, 154, 0.16); color: #85efac; }  /* 运行日志：绿色（正常状态） */
.hmi-badge.info { background: rgba(96, 165, 250, 0.16); color: #93c5fd; }  /* 操作日志：蓝色（用户操作） */
.hmi-badge.warn { background: rgba(255, 193, 90, 0.18); color: #ffd27a; }  /* 警告日志：黄色（可恢复的警告） */
.hmi-badge.alarm { background: rgba(255, 89, 89, 0.18); color: #ff9090; }  /* 报警日志：红色（需立即处理） */

.hmi-bar-row {
    height: 220px;
    display: flex;
    align-items: end;
    gap: 12px;
    padding: 10px 6px 4px;
}

.hmi-switch-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.hmi-switch-card {
    border-radius: 14px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.hmi-switch-card strong {
    display: block;
    margin-bottom: 6px;
}

.hmi-switch-card span {
    color: #98a0bf;
    font-size: 0.78rem;
}

.bar-1 { height: 32%; }
.bar-2 { height: 56%; }
.bar-3 { height: 44%; }
.bar-4 { height: 72%; }
.bar-5 { height: 58%; }
.bar-6 { height: 84%; }
.bar-7 { height: 66%; }

@media (max-width: 1200px) {
    .hmi-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hmi-grid.two-col,
    .hmi-grid.split-wide,
    .hmi-overview {
        grid-template-columns: 1fr;
    }

    .hmi-switch-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .hmi-shell {
        flex-direction: column;
        padding-left: 0;
    }

    .hmi-sidebar {
        width: 100%;
        height: auto;
        position: static;
        inset: auto;
        overflow: visible;
    }

    .hmi-main {
        width: 100%;
        margin-left: 0;
        padding: 14px;
    }

    html[data-sidebar-collapsed="true"] .hmi-main {
        width: 100%;
        margin-left: 0;
    }

    .hmi-cards {
        grid-template-columns: 1fr;
    }

    .hmi-topbar {
        flex-direction: column;
        align-items: start;
        gap: 12px;
    }

    .hmi-topbar-actions {
        position: static;
        z-index: auto;
    }
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.hmi-theme-switch {
    display: inline-flex;
    padding: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    gap: 4px;
}

.hmi-theme-button {
    border: 0;
    background: transparent;
    color: #aab0ce;
    font-size: 0.95rem;
    font-weight: 600;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    cursor: pointer;
}

.hmi-theme-button.active,
html[data-theme="light"] .hmi-theme-button[data-theme="light"],
html[data-theme="dark"] .hmi-theme-button[data-theme="dark"] {
    background: rgba(76, 125, 255, 0.22);
    color: #ffffff;
}

/* Top-right user chip layout */
.hmi-topbar-actions .hmi-user-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.hmi-topbar-actions .hmi-user-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 32px;
    height: auto;
    align-self: center;
}

.hmi-avatar-svg {
    width: 20px;
    height: 20px;
    display: block;
    color: #fff;
}

/* Make avatar SVG paths follow currentColor so we can theme them */
.hmi-user-chip .hmi-avatar-svg {
    color: #4c7dff; /* blue foreground for both admin and user avatars */
}
.hmi-user-chip .hmi-avatar-svg path {
    fill: currentColor !important;
}

.hmi-topbar-actions .hmi-user-meta {
    grid-area: meta;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    line-height: 1.05;
}

.hmi-user-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    margin: 0;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
}

.hmi-user-status.online {
    background: rgba(103, 226, 154, 0.16);
    color: #85efaf;
}

.hmi-user-status.offline {
    background: rgba(255, 193, 90, 0.18);
    color: #ffd27a;
}

.hmi-topbar-actions .hmi-user-meta strong {
    font-size: 1.2rem;
    line-height: 1;
}

.hmi-topbar-actions .hmi-user-meta span {
    font-size: 0.64rem;
    line-height: 1;
}

.hmi-topbar-actions .hmi-logout-button {
    margin-left: auto;
    align-self: center;
}

/* Styled logout button: pill with subtle hover/focus effects */
.hmi-topbar-actions .hmi-logout-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 8px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    background: transparent;
    color: inherit;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, color 0.14s ease;
    box-shadow: none;
    align-self: center;
}

.hmi-topbar-actions .hmi-logout-button::before {
    content: none;
}

.hmi-logout-icon {
    width: 15px;
    height: 15px;
    display: block;
    flex: 0 0 auto;
    color: currentColor;
}

.hmi-logout-icon path {
    fill: currentColor;
}

.hmi-topbar-actions .hmi-logout-button:hover {
    transform: translateY(-2px);
    background: linear-gradient(90deg, rgba(76,125,255,0.12), rgba(127,93,255,0.06));
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(76,125,255,0.12);
}

.hmi-topbar-actions .hmi-logout-button:active {
    transform: translateY(0) scale(0.98);
}

.hmi-topbar-actions .hmi-logout-button:focus-visible {
    outline: 2px solid rgba(76,125,255,0.22);
    outline-offset: 2px;
}

/* Light theme variant */
html[data-theme="light"] .hmi-topbar-actions .hmi-logout-button {
    border-color: rgba(16,24,40,0.08);
    background: rgba(16,24,40,0.04);
    color: #172034;
}

html[data-theme="light"] .hmi-topbar-actions .hmi-logout-button:hover {
    background: rgba(76,125,255,0.12);
    color: #fff;
}

.hmi-theme-button:focus-visible {
    outline: 2px solid #4c7dff;
    outline-offset: 2px;
}

html[data-theme="light"] {
    color-scheme: light;
    --hmi-text-primary: #172034;
    --hmi-text-secondary: #5b6782;
    --hmi-text-muted: #8b95a5;
    --hmi-status-on: #18794e;
    --hmi-status-off: #9ca3af;
}

html[data-theme="dark"] {
    color-scheme: dark;
}

html[data-theme="light"] body {
    background: #eef3fb;
    color: #172034;
}

html[data-theme="light"] .hmi-shell {
    background: radial-gradient(circle at top, #ffffff 0%, #edf2fb 55%, #e5ebf6 100%);
    color: #172034;
}

html[data-theme="light"] .hmi-sidebar {
    background: rgba(255, 255, 255, 0.78);
    border-right-color: rgba(16, 24, 40, 0.08);
}

/* Make the sidebar toggle visually distinct in light mode so it doesn't blend
   into the sidebar background. Use a subtle darker tint and stronger icon color. */
html[data-theme="light"] .hmi-sidebar-toggle {
    background: rgba(16, 24, 40, 0.06);
    color: #4c7dff; /* blue foreground for toggle in light theme */
}

html[data-theme="light"] .hmi-sidebar-toggle:hover {
    background: rgba(16, 24, 40, 0.16);
    box-shadow: 0 6px 18px rgba(76,125,255,0.08);
}

html[data-theme="light"] .hmi-sidebar-toggle:focus-visible {
    outline: 2px solid #4c7dff;
    outline-offset: 2px;
    box-shadow: 0 8px 26px rgba(76,125,255,0.12);
}

html[data-theme="light"] .hmi-brand-text span,
html[data-theme="light"] .hmi-footer-sub,
html[data-theme="light"] .hmi-page-subtitle,
html[data-theme="light"] .hmi-page-meta,
html[data-theme="light"] .hmi-stat-head,
html[data-theme="light"] .hmi-stat-foot,
html[data-theme="light"] .hmi-kpi-item span,
html[data-theme="light"] .hmi-config-item span,
html[data-theme="light"] .hmi-report-item span,
html[data-theme="light"] .hmi-table th,
html[data-theme="light"] .hmi-badge,
html[data-theme="light"] .hmi-status-item,
html[data-theme="light"] .hmi-nav-item {
    color: #5b6782;
}

html[data-theme="light"] .hmi-user-status {
    background: rgba(16, 24, 40, 0.06);
    color: #172034;
}

html[data-theme="light"] .hmi-user-status.online {
    background: rgba(103, 226, 154, 0.16);
    color: #18794e;
}

html[data-theme="light"] .hmi-user-status.offline {
    background: rgba(255, 193, 90, 0.18);
    color: #9a6700;
}

html[data-theme="light"] .hmi-nav-item:hover,
html[data-theme="light"] .hmi-nav-item.active {
    background: rgba(76, 125, 255, 0.10);
    color: #172034;
}

html[data-theme="light"] .hmi-sidebar-footer,
html[data-theme="light"] .hmi-pill-soft,
html[data-theme="light"] .hmi-kpi-item,
html[data-theme="light"] .hmi-status-item,
html[data-theme="light"] .hmi-alarm-item,
html[data-theme="light"] .hmi-report-item,
html[data-theme="light"] .hmi-config-item,
html[data-theme="light"] .hmi-chart-box {
    background: rgba(255, 255, 255, 0.76);
    border-color: rgba(16, 24, 40, 0.08);
}

html[data-theme="light"] .hmi-panel,
html[data-theme="light"] .hmi-stat-card {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(16, 24, 40, 0.08);
    box-shadow: 0 16px 30px rgba(16, 24, 40, 0.08);
}

html[data-theme="light"] .hmi-theme-switch {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(16, 24, 40, 0.08);
}

html[data-theme="light"] .hmi-theme-button {
    color: #4b5874;
}

html[data-theme="light"] .hmi-theme-button[data-theme="light"] {
    color: #ffffff;
}

html[data-theme="light"] .hmi-table td,
html[data-theme="light"] .hmi-page-title,
html[data-theme="light"] .hmi-panel-header h2,
html[data-theme="light"] .hmi-brand-text strong,
html[data-theme="light"] .hmi-footer-title,
html[data-theme="light"] .hmi-stat-value,
html[data-theme="light"] .hmi-kpi-item strong,
html[data-theme="light"] .hmi-report-item strong,
html[data-theme="light"] .hmi-config-item strong {
    color: #172034;
}

html[data-theme="light"] .hmi-tag,
html[data-theme="light"] .hmi-pill-soft,
html[data-theme="light"] .hmi-badge {
    background: rgba(16, 24, 40, 0.06);
}

/* 浅色模式下日志徽章颜色 */
html[data-theme="light"] .hmi-badge.good { background: rgba(34, 197, 94, 0.12); color: #16a34a; }  /* 运行日志：深绿色 */
html[data-theme="light"] .hmi-badge.info { background: rgba(59, 130, 246, 0.12); color: #2563eb; }  /* 操作日志：深蓝色 */
html[data-theme="light"] .hmi-badge.warn { background: rgba(245, 158, 11, 0.12); color: #d97706; }  /* 警告日志：深黄色 */
html[data-theme="light"] .hmi-badge.alarm { background: rgba(239, 68, 68, 0.12); color: #dc2626; }  /* 报警日志：深红色 */

html[data-theme="light"] .hmi-pill {
    background: rgba(72, 211, 114, 0.14);
    color: #18794e;
}

/* Authentication / login screen */
.hmi-auth-loading,
.hmi-login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.hmi-auth-loading-card,
.hmi-login-panel {
    width: min(1120px, 100%);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(18, 22, 36, 0.82);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(18px);
}

.hmi-auth-loading-card {
    max-width: 420px;
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.hmi-auth-loading-card strong,
.hmi-auth-loading-card span {
    display: block;
}

.hmi-auth-loading-card span {
    margin-top: 4px;
    color: #98a0bf;
    font-size: 0.84rem;
}

.hmi-auth-spinner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-top-color: #4c7dff;
    animation: hmi-spin 0.8s linear infinite;
}

.hmi-login-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
    overflow: hidden;
}

.hmi-login-hero {
    padding: 34px;
    background: radial-gradient(circle at top, rgba(76, 125, 255, 0.25), rgba(18, 22, 36, 0.1));
}

.hmi-login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.hmi-login-mark {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #4c7dff, #7f5dff);
    box-shadow: 0 14px 30px rgba(76, 125, 255, 0.28);
}

.hmi-login-brand strong {
    display: block;
    font-size: 1.15rem;
}

.hmi-login-brand span {
    display: block;
    margin-top: 3px;
    color: #9ea6c8;
    font-size: 0.84rem;
}

.hmi-login-hero h1 {
    margin: 0 0 10px;
    font-size: 2.2rem;
}

.hmi-login-hero p {
    margin: 0 0 24px;
    color: #b7bdd8;
    max-width: 42ch;
    line-height: 1.7;
}

.hmi-login-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hmi-login-badges span {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #dfe5ff;
    font-size: 0.8rem;
}

.hmi-login-card {
    padding: 30px;
    background: rgba(255, 255, 255, 0.04);
    border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.hmi-login-message {
    min-height: 24px;
    margin-bottom: 14px;
    font-size: 0.88rem;
    color: #9ea6c8;
}

.hmi-login-message.success { color: #7ee1a0; }
.hmi-login-message.error { color: #ff9090; }

.hmi-login-form {
    display: grid;
    gap: 14px;
}

.hmi-login-form label {
    display: grid;
    gap: 8px;
}

.hmi-login-field-set {
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
}

.hmi-login-field-row {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 0 14px;
}

.hmi-login-field-row + .hmi-login-field-row {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.hmi-login-field-label {
    color: #c4cade;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.hmi-login-field-input {
    width: 100%;
    border: 0;
    background: transparent;
    color: #edf0ff;
    outline: none;
    min-width: 0;
    padding: 0;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

.hmi-login-input {
    width: 100%;
    border: 0;
    background: transparent;
    color: #edf0ff;
    outline: none;
    min-width: 0;
    padding: 0;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

.hmi-login-field-input::placeholder {
    color: #8f96b8;
}

.hmi-login-input::placeholder {
    color: #8f96b8;
}

.hmi-login-field-input:focus {
    border: 0;
    box-shadow: none;
}

.hmi-login-input:focus {
    border: 0;
    box-shadow: none;
}

.hmi-login-field-input:-webkit-autofill,
.hmi-login-field-input:-webkit-autofill:hover,
.hmi-login-field-input:-webkit-autofill:focus,
.hmi-login-input:-webkit-autofill,
.hmi-login-input:-webkit-autofill:hover,
.hmi-login-input:-webkit-autofill:focus {
    -webkit-text-fill-color: inherit;
    transition: background-color 9999s ease-in-out 0s;
    box-shadow: 0 0 0 1000px transparent inset;
    caret-color: #4c7dff;
}

/* Actions (login / register / reset) */
.hmi-login-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: center;
    margin-top: 8px;
}

.hmi-login-submit {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    background: transparent;
    color: inherit;
    font-weight: 700;
    cursor: pointer;
}

.hmi-login-submit.primary {
    background: linear-gradient(90deg, #4c7dff, #7f5dff);
    color: #fff;
    border-color: transparent;
}

.hmi-login-submit.secondary {
    background: rgba(255,255,255,0.04);
    color: inherit;
}

.hmi-login-note {
    margin-top: 8px;
    font-size: 0.82rem;
    color: #98a0bf;
    line-height: 1.5;
}

.hmi-login-note.success {
    color: #7ee1a0;
}

.hmi-login-note.error {
    color: #ff9090;
}

.hmi-account-layout {
    display: grid;
    grid-template-columns: minmax(320px, 0.82fr) minmax(0, 1.18fr);
    gap: 16px;
    align-items: start;
}

.hmi-account-form,
.hmi-account-table {
    display: grid;
    gap: 12px;
}

.hmi-account-select {
    /* visual: transparent fill, visible border, clear text */
    background-color: transparent !important;
    color: #edf0ff !important;
    border: 1px solid rgba(255,255,255,0.12);
    outline: none;
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 8px;
    -moz-appearance: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    background-image: none !important;
    background-repeat: no-repeat !important;
    /* ensure no native caret is visible across browsers */
    background-position: right center !important;
}

/* Hide native dropdown arrow in various engines */
.hmi-account-select::-ms-expand { display: none; }
.hmi-account-select::-webkit-inner-spin-button { display: none; }
.hmi-account-select::-webkit-search-decoration { display: none; }

/* dark theme: keep select transparent but ensure options are readable */
html[data-theme="dark"] .hmi-account-select {
    border-color: rgba(255,255,255,0.14);
    color: #edf0ff;
}

html[data-theme="dark"] .hmi-account-select option {
    background-color: rgba(18,22,36,0.98); /* dark popup where supported */
    color: #edf0ff;
}

/* Ensure native option rows don't inherit the arrow image or repeat it */
.hmi-account-select option,
select.hmi-account-select option {
    background-image: none !important;
    background-repeat: no-repeat !important;
    background-size: auto !important;
}

/* Add subtle border and padding for select to increase contrast and hit target */
.hmi-account-select:focus {
    outline: 2px solid rgba(76,125,255,0.18);
    outline-offset: 2px;
}

.hmi-account-actions,
.hmi-account-row-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.hmi-account-button {
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    padding: 8px 12px;
    background: rgba(255,255,255,0.04);
    color: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.hmi-account-button.primary {
    background: linear-gradient(90deg, #4c7dff, #7f5dff);
    color: #fff;
    border-color: transparent;
}

.hmi-account-button.secondary {
    background: rgba(255,255,255,0.04);
}

.hmi-account-button.ghost {
    background: transparent;
}

.hmi-account-button.danger {
    color: #ff8e8e;
    border-color: rgba(255, 89, 89, 0.18);
}

.hmi-account-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(76, 125, 255, 0.10);
}

.hmi-account-table .hmi-table tr.editing td {
    background: rgba(76, 125, 255, 0.08);
}

.hmi-role-select {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.hmi-role-card {
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 14px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    color: #edf0ff;
    text-align: left;
    cursor: pointer;
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.hmi-role-card strong {
    display: block;
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.hmi-role-card span {
    display: block;
    color: #98a0bf;
    font-size: 0.78rem;
    line-height: 1.4;
}

.hmi-role-card:hover {
    transform: translateY(-1px);
    border-color: rgba(76, 125, 255, 0.34);
    box-shadow: 0 10px 22px rgba(76, 125, 255, 0.10);
}

.hmi-role-card.active {
    background: linear-gradient(135deg, rgba(76, 125, 255, 0.22), rgba(127, 93, 255, 0.14));
    border-color: rgba(76, 125, 255, 0.52);
    box-shadow: 0 12px 28px rgba(76, 125, 255, 0.18);
    color: #ffffff;
    transform: translateY(-1px) scale(1.01);
}

.hmi-role-card.active span {
    color: rgba(255, 255, 255, 0.78);
}

.hmi-role-card:focus-visible {
    outline: 2px solid #4c7dff;
    outline-offset: 2px;
}

@media (max-width: 640px) {
    .hmi-login-actions {
        grid-template-columns: 1fr;
    }
}

.hmi-login-link {
    border: 0;
    background: transparent;
    padding: 0;
    color: #4c7dff;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.hmi-login-link:hover {
    text-decoration: underline;
}

.hmi-password-field {
    display: contents;
}

.hmi-password-input {
    caret-color: #4c7dff;
}

.hmi-password-input:focus {
    outline: none;
}


.hmi-password-actions {
    position: static;
    transform: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.hmi-password-visibility {
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #98a0bf;
    cursor: pointer;
    padding: 0;
    flex: 0 0 auto;
}

.hmi-password-visibility:hover {
    color: #4c7dff;
    background: rgba(76, 125, 255, 0.10);
}

.hmi-password-eye {
    width: 16px;
    height: 16px;
    display: block;
}

.hmi-login-field-row input::-ms-reveal,
.hmi-login-field-row input::-ms-clear {
    display: none;
}

.hmi-remember-row {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
    white-space: nowrap;
}

.hmi-remember-row input {
    width: 16px;
    height: 16px;
    margin: 0;
    flex: 0 0 auto;
}

.hmi-remember-row span {
    line-height: 1;
}

.hmi-login-link {
    border: 0;
    background: transparent;
    padding: 0;
    color: #4c7dff;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .hmi-password-actions {
        gap: 6px;
    }

    .hmi-login-link {
        font-size: 0.78rem;
    }

    .hmi-account-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    .hmi-login-panel {
        grid-template-columns: 1fr;
    }

    .hmi-login-card {
        border-left: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }
}

@media (max-width: 640px) {
    .hmi-login-page,
    .hmi-auth-loading {
        padding: 12px;
    }

    .hmi-login-hero,
    .hmi-login-card {
        padding: 20px;
    }

    .hmi-role-select,
    .hmi-login-actions {
        grid-template-columns: 1fr;
    }

    .hmi-user-chip {
        width: auto;
        justify-content: flex-start;
        border-radius: 16px;
    }
}

/* Login page theme adaptation */
.hmi-login-page {
    background: radial-gradient(circle at top, #1d2236 0%, #121624 55%, #0f1320 100%);
    color: #e8ecff;
}

html[data-theme="light"] .hmi-login-page {
    background: radial-gradient(circle at top, #ffffff 0%, #edf2fb 55%, #e5ebf6 100%);
    color: #172034;
}

html[data-theme="light"] .hmi-auth-loading-card,
html[data-theme="light"] .hmi-login-panel {
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(16, 24, 40, 0.08);
    box-shadow: 0 24px 60px rgba(16, 24, 40, 0.10);
}

html[data-theme="light"] .hmi-login-hero {
    background: radial-gradient(circle at top, rgba(76, 125, 255, 0.12), rgba(255, 255, 255, 0.12));
}

html[data-theme="light"] .hmi-login-card {
    background: rgba(255, 255, 255, 0.78);
    border-left-color: rgba(16, 24, 40, 0.08);
}

html[data-theme="light"] .hmi-login-field-set {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(16, 24, 40, 0.18);
    box-shadow: 0 10px 24px rgba(16, 24, 40, 0.08);
}

html[data-theme="light"] .hmi-login-field-row + .hmi-login-field-row {
    border-top-color: rgba(16, 24, 40, 0.08);
}

html[data-theme="light"] .hmi-login-brand span,
html[data-theme="light"] .hmi-login-hero p,
html[data-theme="light"] .hmi-login-message,
html[data-theme="light"] .hmi-login-note,
html[data-theme="light"] .hmi-login-field-label,
html[data-theme="light"] .hmi-login-form label > span,
html[data-theme="light"] .hmi-remember-row,
html[data-theme="light"] .hmi-role-card span,
html[data-theme="light"] .hmi-user-meta span,
html[data-theme="light"] .hmi-auth-loading-card span {
    color: #5b6782;
}

html[data-theme="light"] .hmi-login-brand strong,
html[data-theme="light"] .hmi-login-hero h1,
html[data-theme="light"] .hmi-role-card strong,
html[data-theme="light"] .hmi-user-meta strong,
html[data-theme="light"] .hmi-auth-loading-card strong {
    color: #172034;
}

html[data-theme="light"] .hmi-login-badges span,
html[data-theme="light"] .hmi-logout-button,
html[data-theme="light"] .hmi-login-submit.secondary,
html[data-theme="light"] .hmi-account-button.secondary,
html[data-theme="light"] .hmi-account-button.ghost {
    background: rgba(16, 24, 40, 0.06);
    color: #172034;
    border-color: rgba(16, 24, 40, 0.08);
}

html[data-theme="light"] .hmi-login-field-input {
    background: transparent;
    color: #172034;
    border-color: rgba(16, 24, 40, 0.16);
}

html[data-theme="light"] .hmi-login-field-input::placeholder {
    color: #9aa4bf;
}

html[data-theme="light"] .hmi-login-link {
    color: #4c7dff;
}

/* Light theme: make account select readable (white background, dark text, darker arrow) */
html[data-theme="light"] .hmi-account-select {
    background-color: #ffffff !important;
    color: #172034 !important;
    border-color: rgba(16,24,40,0.12) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23172034' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") !important;
}

html[data-theme="light"] .hmi-account-select option {
    background-color: #ffffff;
    color: #172034;
}

html[data-theme="light"] .hmi-password-visibility {
    color: #74809a;
}

html[data-theme="light"] .hmi-password-visibility:hover {
    background: rgba(76, 125, 255, 0.08);
}

html[data-theme="light"] .hmi-login-submit.secondary,
html[data-theme="light"] .hmi-role-card {
    background: rgba(16, 24, 40, 0.04);
    color: #172034;
    border-color: rgba(16, 24, 40, 0.08);
}

html[data-theme="light"] .hmi-role-card.active,
html[data-theme="light"] .hmi-login-submit.primary {
    background: linear-gradient(135deg, rgba(76, 125, 255, 0.18), rgba(127, 93, 255, 0.10));
    border-color: rgba(76, 125, 255, 0.44);
    box-shadow: 0 12px 24px rgba(76, 125, 255, 0.12);
    color: #172034;
}
