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+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* ============ Theme tokens ============ */
:root {
    --surface: #ffffff;
    --surface-shadow: rgba(31, 45, 61, 0.12);
    --surface-shadow-soft: rgba(31, 45, 61, 0.06);
    --border: #eef0f3;
    --border-strong: #e3e6ea;
    --text-primary: #1f2d3d;
    --text-secondary: #6c757d;
    --text-muted: #9aa3af;
    --hover-bg: #f2f5fa;
    --input-bg: #f5f7fa;
    --input-border: #c9ccd1;
    --brand: #2e74b5;
    --brand-hover: #235a8f;

    --icon-blue-bg: #dce8f7; --icon-blue-fg: #2e74b5;
    --icon-green-bg: #dcf1e4; --icon-green-fg: #2f9e5b;
    --icon-amber-bg: #faecd0; --icon-amber-fg: #b9860f;
    --icon-red-bg: #fbdde1; --icon-red-fg: #d9364a;
    --icon-darkred-bg: #f2dbde; --icon-darkred-fg: #8f1f2f;
    --icon-purple-bg: #e8e0f4; --icon-purple-fg: #7952b3;

    --badge-success-bg: #d1e7dd; --badge-success-fg: #0f5132;
    --badge-warning-bg: #fff3cd; --badge-warning-fg: #664d03;
    --badge-failure-bg: #f8d7da; --badge-failure-fg: #842029;

    --whatif-bg: #fff3cd; --whatif-fg: #664d03; --whatif-border: #ffe69c;
    --live-bg: #d1e7dd; --live-fg: #0f5132; --live-border: #a3cfbb;
    --manual-bg: #e8e0f4; --manual-fg: #4b3579; --manual-border: #d4c5ec;

    --signin-bg: #f2f4f8;
    --signin-dot: rgba(46, 116, 181, 0.16);
}

:root[data-theme="dark"] {
    --surface: #16233a;
    --surface-shadow: rgba(0, 0, 0, 0.45);
    --surface-shadow-soft: rgba(0, 0, 0, 0.3);
    --border: #26385a;
    --border-strong: #2c4066;
    --text-primary: #e8edf7;
    --text-secondary: #aab6cc;
    --text-muted: #7f8caa;
    --hover-bg: #1e2f4d;
    --input-bg: #101d33;
    --input-border: #2c4066;
    --brand: #4c8fd1;
    --brand-hover: #6fa5db;

    --icon-blue-bg: rgba(76, 143, 209, 0.18); --icon-blue-fg: #7cb3e6;
    --icon-green-bg: rgba(47, 158, 91, 0.18); --icon-green-fg: #6fcf8f;
    --icon-amber-bg: rgba(185, 134, 15, 0.2); --icon-amber-fg: #e0b23d;
    --icon-red-bg: rgba(217, 54, 74, 0.18); --icon-red-fg: #ea7c8b;
    --icon-darkred-bg: rgba(143, 31, 47, 0.25); --icon-darkred-fg: #e2909d;
    --icon-purple-bg: rgba(121, 82, 179, 0.2); --icon-purple-fg: #b79bdb;

    --badge-success-bg: rgba(47, 158, 91, 0.2); --badge-success-fg: #7fd99b;
    --badge-warning-bg: rgba(185, 134, 15, 0.22); --badge-warning-fg: #e6c877;
    --badge-failure-bg: rgba(217, 54, 74, 0.2); --badge-failure-fg: #ee97a2;

    --whatif-bg: rgba(185, 134, 15, 0.18); --whatif-fg: #e6c877; --whatif-border: rgba(230, 200, 119, 0.3);
    --live-bg: rgba(47, 158, 91, 0.18); --live-fg: #7fd99b; --live-border: rgba(127, 217, 155, 0.3);
    --manual-bg: rgba(121, 82, 179, 0.2); --manual-fg: #cbb6ea; --manual-border: rgba(183, 155, 219, 0.35);

    --signin-bg: #0d1626;
    --signin-dot: rgba(76, 143, 209, 0.16);
}

/* Admin UI shared styles */
body {
    font-family: Calibri, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background: var(--surface);
    min-height: 100vh;
    transition: background 0.2s ease;
}

/* Form controls don't inherit the body font by default in most browsers */
input, select, textarea, button {
    font-family: inherit;
}

/* Shared page chrome - used by both the frontend layout and the admin layout. Full-width /
   full-bleed, not a floating centered card - fills the viewport edge to edge. */
.page {
    display: flex;
    width: 100%;
    min-height: 100vh;
    background: var(--surface);
}

.sidebar {
    width: 290px;
    flex-shrink: 0;
    background: var(--surface);
    padding: 1.25rem 0.75rem;
    border-right: 1px solid var(--border);
    transition: width 0.15s ease;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 76px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.25rem 0.75rem 1.25rem 0.75rem;
    gap: 0.5rem;
}

.sidebar.collapsed .sidebar-header {
    flex-direction: column;
    gap: 0.6rem;
    padding-left: 0;
    padding-right: 0;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

.sidebar-toggle:hover {
    background: var(--hover-bg);
}

.sidebar-toggle .flipped {
    transform: rotate(180deg);
}

.sidebar.collapsed .nav-menu a,
.sidebar.collapsed .sidebar-footer a {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.sidebar.collapsed .nav-menu a span,
.sidebar.collapsed .sidebar-footer a span {
    display: none;
}

.app-title {
    font-weight: 700;
    font-size: 1.15rem;
    padding: 0.25rem 0.75rem 1.25rem 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
}

.app-title small {
    display: block;
    font-weight: 500;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.sidebar .nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sidebar .nav-menu a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    font-size: 0.92rem;
}

.sidebar .nav-menu a:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.sidebar .nav-menu a.active {
    background: var(--brand);
    color: white;
    font-weight: 600;
}

.nav-group-header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    font: inherit;
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
}

.nav-group-header span {
    flex: 1;
}

.nav-group-header svg {
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.nav-group-header .flipped {
    transform: rotate(180deg);
}

.nav-group-children {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding-left: 0.9rem;
    margin: 0.1rem 0 0.4rem;
}

.sidebar-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    font-size: 0.92rem;
}

/* The sidebar rail is permanently dark navy, independent of the light/dark content toggle -
   matches the reference design. Only the main content area (topbar/cards/tables) follows
   the theme toggle. */
.sidebar {
    background: #16233a;
    border-right: 1px solid #223252;
}

.sidebar .app-title small {
    color: #7f8caa;
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #aab6cc;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
}

.sidebar .nav-menu a {
    color: #aab6cc;
}

.sidebar .nav-menu a:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
}

.sidebar .nav-menu a.active {
    background: var(--brand);
    color: white;
}

.nav-group-header {
    color: #aab6cc;
}

.nav-group-header:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer a {
    color: #aab6cc;
}

.sidebar-footer a:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #ffffff;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Right-hand collapsible change log - mirrors the left sidebar's collapse mechanic */
.changelog-panel {
    width: 340px;
    flex-shrink: 0;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: width 0.15s ease;
    overflow: hidden;
}

.changelog-panel.collapsed {
    width: 56px;
}

.changelog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    gap: 0.5rem;
}

.changelog-panel.collapsed .changelog-header {
    justify-content: center;
    padding: 1.1rem 0.5rem;
}

.changelog-header h3 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.changelog-panel.collapsed .changelog-header h3,
.changelog-panel.collapsed .changelog-body {
    display: none;
}

.changelog-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 1.25rem;
}

.changelog-entry {
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
}

.changelog-entry:last-child {
    border-bottom: none;
}

.changelog-desc {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.changelog-meta {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.25rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 2.5rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    background: var(--input-bg);
    border-radius: 10px;
    padding: 0.5rem 0.9rem;
    width: 320px;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.search-kbd {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0.1rem 0.4rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.icon-button {
    position: relative;
    display: inline-flex;
    color: var(--text-secondary);
    padding: 0.4rem;
    border-radius: 8px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.icon-button:hover {
    background: var(--hover-bg);
}

.badge-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #d9364a;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 999px;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--brand);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.sign-out-link {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-decoration: none;
}

.sign-out-link:hover {
    color: #d9364a;
}

.whatif-banner {
    background: var(--whatif-bg);
    color: var(--whatif-fg);
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    border-bottom: 1px solid var(--whatif-border);
}

.live-banner {
    background: var(--live-bg);
    color: var(--live-fg);
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    border-bottom: 1px solid var(--live-border);
}

.manual-banner {
    background: var(--manual-bg);
    color: var(--manual-fg);
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    border-bottom: 1px solid var(--manual-border);
}

.content {
    padding: 2rem 2.5rem;
    overflow-x: auto;
    color: var(--text-primary);
    max-width: 1700px;
}

/* ============ Wiki ============ */
.wiki-content {
    max-width: 900px;
    line-height: 1.6;
}

.wiki-content h2 {
    margin-top: 2.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    scroll-margin-top: 1rem;
}

.wiki-content h2:first-of-type {
    border-top: none;
    margin-top: 1.5rem;
}

.wiki-content h3 {
    margin-top: 1.75rem;
    scroll-margin-top: 1rem;
}

.wiki-content h4 {
    margin-top: 1.25rem;
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
}

.wiki-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0 1.25rem;
    font-size: 0.9rem;
}

.wiki-content table th, .wiki-content table td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.wiki-content table th {
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.wiki-content code {
    background: var(--input-bg);
    padding: 0.05rem 0.35rem;
    border-radius: 4px;
    font-size: 0.88em;
}

.wiki-content p, .wiki-content li {
    color: var(--text-primary);
}

.wiki-toc {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 2px 10px var(--surface-shadow-soft);
    padding: 1.25rem 1.75rem;
    margin-bottom: 2rem;
}

.wiki-toc h2 {
    margin-top: 0 !important;
    border-top: none !important;
    font-size: 1rem;
}

.wiki-toc ol {
    columns: 2;
    column-gap: 2rem;
    padding-left: 1.2rem;
    margin: 0;
}

.wiki-toc li {
    break-inside: avoid;
    margin-bottom: 0.35rem;
}

.wiki-toc a {
    color: var(--text-primary);
    text-decoration: none;
}

.wiki-toc a:hover {
    color: var(--brand);
    text-decoration: underline;
}

.wiki-callout {
    border-radius: 10px;
    padding: 0.85rem 1.1rem;
    margin: 1rem 0;
    font-size: 0.9rem;
    border-left: 4px solid var(--border-strong);
    background: var(--hover-bg);
}

.wiki-callout strong:first-child {
    display: block;
    margin-bottom: 0.25rem;
}

.wiki-callout-tip {
    border-left-color: var(--live-border);
    background: var(--live-bg);
    color: var(--live-fg);
}

.wiki-callout-warning {
    border-left-color: var(--whatif-border);
    background: var(--whatif-bg);
    color: var(--whatif-fg);
}

.wiki-callout-danger {
    border-left-color: var(--badge-failure-fg);
    background: var(--badge-failure-bg);
    color: var(--badge-failure-fg);
}

/* ============ Sign-in screen ============ */
.signin-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 2rem 1rem;
    background-color: var(--signin-bg);
    background-image: radial-gradient(circle, var(--signin-dot) 1.6px, transparent 1.6px);
    background-size: 26px 26px;
}

.signin-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 24px 48px var(--surface-shadow), 0 2px 8px var(--surface-shadow-soft);
    padding: 2.5rem 2.25rem 2rem;
    text-align: center;
    box-sizing: border-box;
}

.signin-logo {
    height: 40px;
    margin-bottom: 1.75rem;
}

.signin-card h1 {
    font-size: 1.35rem;
    margin: 0 0 0.6rem;
    color: var(--text-primary);
}

.signin-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 1.75rem;
    line-height: 1.5;
}

.signin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--brand);
    background: var(--brand);
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    box-sizing: border-box;
    transition: background 0.15s ease;
}

.signin-btn:hover {
    background: var(--brand-hover);
}

.signin-footer {
    margin-top: 2rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.admin-table th, .admin-table td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-strong);
}

.admin-table th {
    background: var(--input-bg);
    font-weight: 600;
}

.btn {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border-radius: 4px;
    border: 1px solid var(--brand);
    background: var(--brand);
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    margin: 0 0.5rem 0.5rem 0;
}

.btn:hover {
    background: var(--brand-hover);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border-color: var(--input-border);
}

/* A toggle-style button (e.g. Sync Control's Run State / Write Mode pickers) that reflects
   the currently-selected option - distinct from :disabled, since these stay clickable so an
   unsaved choice can still be changed before Save. */
.btn-toggle-selected {
    box-shadow: 0 0 0 2px var(--text-primary) inset;
    font-weight: 700;
}

.btn-secondary:hover {
    background: var(--hover-bg);
}

/* For a genuinely destructive, immediate action (e.g. confirming a log clear) - distinct from
   "Remove" buttons elsewhere, which just stage a removal that's reversible until Save. */
.btn-danger {
    background: var(--badge-failure-bg);
    color: var(--badge-failure-fg);
    border-color: var(--badge-failure-fg);
}

.btn-danger:hover {
    filter: brightness(0.95);
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success { background: var(--badge-success-bg); color: var(--badge-success-fg); }
.badge-warning { background: var(--badge-warning-bg); color: var(--badge-warning-fg); }
.badge-failure { background: var(--badge-failure-bg); color: var(--badge-failure-fg); }

.empty-state {
    color: var(--text-secondary);
    font-style: italic;
    padding: 1rem 0;
}

.stat-strip {
    display: flex;
    align-items: center;
    background: var(--surface);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 10px var(--surface-shadow-soft);
    flex-wrap: wrap;
    row-gap: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1 1 auto;
    min-width: 150px;
}

a.stat-item {
    text-decoration: none;
    color: inherit;
    border-radius: 10px;
    padding: 0.35rem;
    margin: -0.35rem;
    transition: background 0.15s ease;
}

a.stat-item:hover {
    background: var(--hover-bg);
}

.stat-divider {
    width: 1px;
    align-self: stretch;
    background: var(--border);
    margin: 0 1.25rem;
}

.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-blue { background: var(--icon-blue-bg); color: var(--icon-blue-fg); }
.icon-green { background: var(--icon-green-bg); color: var(--icon-green-fg); }
.icon-amber { background: var(--icon-amber-bg); color: var(--icon-amber-fg); }
.icon-red { background: var(--icon-red-bg); color: var(--icon-red-fg); }
.icon-darkred { background: var(--icon-darkred-bg); color: var(--icon-darkred-fg); }
.icon-purple { background: var(--icon-purple-bg); color: var(--icon-purple-fg); }

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.dashboard-columns {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    align-items: stretch;
    margin-bottom: 1.5rem;
}

.panel {
    background: var(--surface);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    flex: 1 1 380px;
    min-width: 320px;
    box-shadow: 0 2px 10px var(--surface-shadow-soft);
    color: var(--text-primary);
}

.panel h2 {
    margin-top: 0;
    font-size: 1.05rem;
}

.panel h3 {
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
}

.panel ol, .panel ul {
    padding-left: 1.3rem;
}

.panel ol li ul {
    margin-top: 0.3rem;
    list-style-type: disc;
}

.panel code {
    background: var(--input-bg);
    padding: 0.05rem 0.35rem;
    border-radius: 4px;
    font-size: 0.85em;
}

.panel-chart {
    flex: 2 1 480px;
}

.panel-progress {
    flex: 1 1 300px;
    background: linear-gradient(160deg, var(--brand) 0%, #1c4d7c 100%);
    color: white;
}

.panel-progress h2 {
    color: white;
    margin-bottom: 0.2rem;
}

.progress-badge {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    margin-bottom: 0.6rem;
}

.progress-sub {
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    margin-top: 0;
}

.progress-list {
    list-style: none;
    margin: 1rem 0 0 0;
    padding: 0;
}

.progress-list li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.75);
}

.progress-list li.done {
    color: white;
}

.chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    padding: 2.5rem 1rem;
    gap: 0.5rem;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    height: 130px;
    padding-top: 1rem;
}

.bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
}

.bar {
    width: 100%;
    max-width: 34px;
    background: var(--brand);
    border-radius: 6px 6px 2px 2px;
}

.bar-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.activity-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}

.activity-list li:last-child {
    border-bottom: none;
}

.activity-message {
    flex: 1;
    color: var(--text-primary);
}

.activity-time {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.form-row {
    margin-bottom: 0.8rem;
}

.form-row label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.2rem;
    color: var(--text-primary);
}

.form-row input[type=text], .form-row input[type=password], .form-row input[type=number], .form-row select {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    min-width: 280px;
    background: var(--surface);
    color: var(--text-primary);
}

.scope-box {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    min-height: 2rem;
    padding: 0.4rem;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    background: var(--surface);
    min-width: 340px;
    max-width: 480px;
}

.scope-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.4rem 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: normal;
    font-family: inherit;
    background: var(--badge-success-bg);
    color: var(--badge-success-fg);
}

.scope-chip-remove {
    border: none;
    background: none;
    color: inherit;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    padding: 0 0.15rem;
    opacity: 0.75;
}

.scope-chip-remove:hover {
    opacity: 1;
}

.debug-console {
    margin-top: 1rem;
    background: #0d1420;
    border: 1px solid #223252;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    max-height: 420px;
    overflow-y: auto;
}

.debug-step {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.debug-step:last-child {
    border-bottom: none;
}

.debug-step-label {
    font-family: Calibri, sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin-bottom: 0.2rem;
}

.debug-step pre {
    margin: 0;
    font-family: 'Cascadia Code', 'Consolas', 'SFMono-Regular', Menlo, monospace;
    font-size: 0.8rem;
    white-space: pre-wrap;
    word-break: break-word;
    color: #c7d0e0;
}

.debug-step-info .debug-step-label { color: #7cb3e6; }
.debug-step-success .debug-step-label { color: #7fd99b; }
.debug-step-warning .debug-step-label { color: #e6c877; }
.debug-step-failure .debug-step-label { color: #ee97a2; }

.greeting-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.greeting-sub {
    color: var(--text-secondary);
    margin: 0.15rem 0 1.25rem 0;
    font-size: 0.9rem;
}
