/* Shared theme tokens. Page-specific colour adapters are in theme-colors.css. */
html[data-theme="light"] {
    color-scheme: light;
    --theme-bg: #f5f7fb;
    --theme-surface: #ffffff;
    --theme-soft: #edf2f8;
    --theme-text: #17263c;
    --theme-muted: #52637a;
    --theme-border: #cdd8e6;
    --theme-overlay: rgba(23, 38, 60, .06);
    --theme-focus: #2563eb;
    --jl-brand-dark: #0f7490;
}
html[data-theme="dark"] {
    color-scheme: dark;
    --theme-bg: #08111f;
    --theme-surface: #101e32;
    --theme-soft: #172940;
    --theme-text: #edf3fc;
    --theme-muted: #acbdd3;
    --theme-border: #34465f;
    --theme-overlay: rgba(237, 243, 252, .06);
    --theme-focus: #67e8f9;
    --jl-brand-dark: #67e8f9;
}
html[data-theme] body {
    color: var(--theme-text) !important;
    background: radial-gradient(circle at 10% 0%, rgba(6,182,212,.07), transparent 32%), var(--theme-bg) !important;
    --bs-body-color: var(--theme-text);
    --bs-body-bg: var(--theme-bg);
    --bs-border-color: var(--theme-border);
    --bs-secondary-color: var(--theme-muted);
    --bs-tertiary-bg: var(--theme-soft);
}
html[data-theme] .app-main { background: transparent !important; }
html[data-theme="dark"] .jl-crest { background: #fff; border-radius: 12px; padding: 6px; }
.jurni-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    padding: 9px;
    border: 1px solid var(--theme-border);
    border-radius: 12px;
    background: var(--theme-surface);
    color: var(--theme-text);
    cursor: pointer;
}
.jurni-theme-toggle:hover { background: var(--theme-soft); }
.jurni-theme-toggle:focus-visible { outline: 3px solid var(--theme-focus); outline-offset: 3px; }
.jurni-theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.jurni-theme-sun { display: none; }
html[data-theme="dark"] .jurni-theme-sun { display: block; }
html[data-theme="dark"] .jurni-theme-moon { display: none; }
.app-topbar-right { gap: .5rem; }
html[data-theme] :is(.form-control, .form-select, .swal2-input, .swal2-textarea) {
    background-color: var(--theme-surface) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-border) !important;
}
html[data-theme] :is(input, textarea)::placeholder { color: var(--theme-muted) !important; opacity: 1; }
html[data-theme] :is(.form-control, .form-select):disabled,
html[data-theme] :is(.form-control, .form-select)[readonly] { background-color: var(--theme-soft) !important; }
html[data-theme] :is(.modal-content, .dropdown-menu, .swal2-popup, .swal2-validation-message) {
    background: var(--theme-surface) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-border) !important;
}
/* This Bootstrap version predates built-in data-bs-theme support. */
html[data-theme] :is(.card, .list-group-item, .input-group-text, .page-link) {
    background-color: var(--theme-surface) !important;
    color: var(--theme-text) !important;
    border-color: var(--theme-border) !important;
}
html[data-theme] :is(.card-header, .card-footer, .page-link:hover) { background-color: var(--theme-soft) !important; }
html[data-theme] .form-check-input:not(:checked) { background-color: var(--theme-surface); border-color: var(--theme-border); }
html[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
html[data-theme] :is(.swal2-title, .swal2-html-container, .dropdown-item) { color: var(--theme-text) !important; }
html[data-theme] :is(.dropdown-item:hover, .dropdown-item:focus) { background: var(--theme-soft) !important; }
html[data-theme] .table {
    --bs-table-bg: var(--theme-surface);
    --bs-table-color: var(--theme-text);
    --bs-table-border-color: var(--theme-border);
    --bs-table-striped-bg: var(--theme-overlay);
    --bs-table-striped-color: var(--theme-text);
    --bs-table-hover-bg: var(--theme-soft);
    --bs-table-hover-color: var(--theme-text);
}
html[data-theme] .table > :not(caption) > * > * {
    color: var(--theme-text) !important;
    background-color: var(--theme-surface) !important;
    border-color: var(--theme-border) !important;
}
html[data-theme] .table-striped > tbody > tr:nth-of-type(odd) > *,
html[data-theme] .table-hover > tbody > tr:hover > * { background-color: var(--theme-soft) !important; }
html[data-theme] :is(.text-body, .link-dark) { color: var(--theme-text) !important; }
html[data-theme] .text-secondary { color: var(--theme-muted) !important; }
html[data-theme] .text-muted { color: var(--theme-muted) !important; }
html[data-theme] :is(.bg-light, .bg-white) { background-color: var(--theme-surface) !important; }
html[data-theme] .text-dark { color: var(--theme-text) !important; }
html[data-theme] .border { border-color: var(--theme-border) !important; }
@media (max-width: 575px) {
    .jl-nav-inner { flex-wrap: wrap; }
    .jl-nav-actions { flex-wrap: wrap; gap: .5rem; }
}
@media print {
    .jurni-theme-toggle { display: none !important; }
    html[data-theme] {
        --theme-bg: white; --theme-surface: white; --theme-soft: #f3f4f6;
        --theme-text: #111827; --theme-muted: #475569; --theme-border: #cbd5e1;
    }
}
