/*
 * Surfaces and colour roles, loaded last so every screen takes them from one place.
 * A quiet neutral look (2026-11-22, from the owner's reference screen): white cards on a near-white page, soft
 * grey lines and text, a light sidebar, and ONE blue for action and focus in both themes (never black: the owner
 * rejected black buttons). A chosen tab or switch is a soft grey fill. Colour is otherwise kept for
 * data: status dots, badges, charts. Views take the action colour from --accent / --accent-rgb, never a hex.
 * Dark is navy, never black: deep navy layers, cards one clear step above the page, action in a calm blue.
 * There are only these two looks; sidebar and page colours are no longer offered.
 * Text stays 4.5:1 or more on every surface, in both themes.
 */
:root {
    --canvas: #f7f7f8;
    --surface: #ffffff;
    --surface-sunken: #fafafa;
    --line: #ebebed;
    --line-strong: #d9d9de;
    --divider: #f0f0f2;
    --text: #0a0a0b;
    --text-2: #2e2e33;
    --text-muted: #6b6b76;
    --th-text: #6b6b76;
    --accent: #1e4fa3;
    --accent-rgb: 30 79 163;
    --accent-strong: #173e82;
    --accent-soft: #ededf0;
    /* Every button and chosen tab looks the same (the owner's pick, 2026-11-25, from the Record deposit button):
       a light blue tint, a soft blue edge and blue text */
    --btn-fill: rgb(30 79 163 / .08);
    --btn-fill-hover: rgb(30 79 163 / .15);
    --btn-edge: rgb(30 79 163 / .3);
    --btn-text: #1e4fa3;
    --accent-text: #1e4fa3;
    --row-hover: #fafafa;
    --track: #ebebed;
    --focus-ring: rgb(30 79 163 / .25);
    --field-focus: #9797a3;
    --input-bg: #ffffff;
    --sidebar-bg: #fbfbfc;
    --sidebar-line: #ebebed;
    --sidebar-text: #2e2e33;
    --sidebar-heading: #6b6b76;
    --sidebar-hover: #f0f0f2;
    --sidebar-active-bg: #ededf0;
    --sidebar-active-text: #0a0a0b;
    /* Readable text versions of the status colours (4.5:1 or more on white and on their tints) */
    --success-text: #166534;
    --info-text: #0369a1;
    --error-text: #be123c;
    --warning-text: #b45309;
    --secondary-text: #a21caf;
    --muted-on-canvas: #6b6b76;
    --card-shadow: 0 1px 2px rgb(0 0 0 / .04);
    --card-shadow-hover: 0 2px 4px rgb(0 0 0 / .06), 0 8px 20px rgb(0 0 0 / .06);
}
.dark {
    --canvas: #0b1324;
    --surface: #121c31;
    --surface-sunken: #18243c;
    --line: #25324d;
    --line-strong: #36466a;
    --divider: #1c2740;
    --text: #f3f5f9;
    --text-2: #cdd5e3;
    --text-muted: #94a3bd;
    --th-text: #94a3bd;
    --accent: #356fd6;
    --accent-rgb: 53 111 214;
    --accent-strong: #356fd6;
    --accent-soft: #16274a;
    --btn-fill: rgb(53 111 214 / .16);
    --btn-fill-hover: rgb(53 111 214 / .26);
    --btn-edge: rgb(53 111 214 / .45);
    --btn-text: #9dbdf7;
    --accent-text: #9dbdf7;
    --row-hover: #172238;
    --track: #25324d;
    --focus-ring: rgb(53 111 214 / .4);
    --field-focus: #6d7fa6;
    --input-bg: #0e172a;
    --sidebar-bg: #0d1629;
    --sidebar-line: #25324d;
    --sidebar-text: #cdd5e3;
    --sidebar-heading: #94a3bd;
    --sidebar-hover: #18243c;
    --sidebar-active-bg: #16274a;
    --sidebar-active-text: #9dbdf7;
    --success-text: #4ade80;
    --info-text: #7dd3fc;
    --error-text: #fda4af;
    --warning-text: #fbbf24;
    --secondary-text: #f0abfc;
    --muted-on-canvas: #94a3bd;
    --card-shadow: 0 0 0 1px rgb(157 189 247 / .04), 0 4px 12px rgb(0 0 0 / .3);
    --card-shadow-hover: 0 0 0 1px rgb(157 189 247 / .07), 0 8px 20px rgb(0 0 0 / .4);
}

/* The page: a canvas the cards stand on */
body, #root, .app-preloader { background-color: var(--canvas) !important; }
body { color: var(--text-2); }
html.sl-on main.main-content > div:first-child { background: var(--canvas) !important; }

/* Cards: white, a hairline edge and a soft lift */
.card {
    background-color: var(--surface);
    border-color: var(--line);
    box-shadow: var(--card-shadow);
    color: var(--text-2);
}
.dark .card { background-color: var(--surface); border-color: var(--line); }

/* Header bar and sidebar sit on their own surfaces */
nav.header { border-bottom: 1px solid var(--line); }

/* Sidebar: a clear active item and a visible hover */
.main-sidebar a.rounded-lg, .main-sidebar button.rounded-lg { transition: background-color .15s ease, color .15s ease; }
.main-sidebar a.rounded-lg:hover { background-color: var(--accent-soft); color: var(--accent-strong); }
.main-sidebar a.bg-primary\/10 { background-color: var(--accent-soft) !important; color: var(--accent-strong) !important; font-weight: 600; }

/* Tables: a quiet sunken head instead of heavy grey, a blue-tinted hover */
table thead th[class*="bg-slate-200"], table thead tr[class*="bg-slate-200"], table thead tr[class*="bg-slate-200"] > th {
    background-color: var(--surface-sunken) !important;
    color: var(--text-2) !important;
    border-bottom: 1px solid var(--line);
}
.dark table thead th[class*="bg-slate-200"], .dark table thead tr[class*="bg-slate-200"], .dark table thead tr[class*="dark:bg-navy-800"] {
    background-color: var(--surface-sunken) !important;
    color: var(--text-muted) !important;
}
.is-hoverable tbody tr { transition: background-color .15s ease; }
.is-hoverable tbody tr:hover, .is-hoverable tbody tr:hover > td { background-color: var(--row-hover) !important; }
table tbody tr { border-color: var(--line); }

/* Fields: a visible edge and the brand focus ring */
.form-input, .form-select, .form-textarea, .form-multiselect { border-color: var(--line-strong); background-color: var(--surface); }
.form-input:hover, .form-select:hover, .form-textarea:hover { border-color: var(--accent); }


/* Muted text never goes lighter than the readable floor; on the canvas it is a step deeper */
.text-slate-400 { color: var(--text-muted) !important; }
.main-content > div:first-child .text-slate-400 { color: var(--muted-on-canvas) !important; }

/* Brand and status colours as text and on their tinted badges: the readable versions */
.text-primary { color: var(--accent-text) !important; }
.text-success { color: var(--success-text) !important; }
.text-info { color: var(--info-text) !important; }
.text-error { color: var(--error-text) !important; }
.text-warning { color: var(--warning-text) !important; }
.text-secondary { color: var(--secondary-text) !important; }
.dark .dark\:text-accent-light { color: var(--accent-text) !important; }

/* Filled primary buttons: one step deeper so the white label reads */
.bg-primary { background-color: var(--accent) !important; }
.bg-primary:hover, .hover\:bg-primary-focus:hover { background-color: var(--accent-strong) !important; }
.dark .bg-primary, .dark .dark\:bg-accent { background-color: var(--accent-strong) !important; }
.dark .text-slate-400, .dark .dark\:text-navy-300 { color: var(--text-muted) !important; }

/* Focus is always visible, in the brand colour */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: .5rem; }

/* Browser surfaces in the palette */
::selection { background: var(--accent-soft); color: inherit; }
* { caret-color: var(--accent); }

/* Numbered step circles on the cards: the readable accent in dark mode too */
.dark .sf-step { color: var(--accent-text) !important; }


/* ── Palette 1: no grey. The theme's neutral classes take the blue roles ───────────────────────── */
.text-slate-300, .text-slate-400, .text-slate-500 { color: var(--text-muted) !important; }
.text-slate-600, .text-slate-700 { color: var(--text-2) !important; }
.text-slate-800, .text-slate-900, .text-slate-950 { color: var(--text) !important; }
.bg-slate-100, .bg-slate-150 { background-color: var(--surface-sunken) !important; }
.bg-slate-200 { background-color: var(--divider) !important; }
.border-slate-100, .border-slate-150, .border-slate-200 { border-color: var(--line) !important; }
.border-slate-300, .border-slate-400 { border-color: var(--line-strong) !important; }
.hover\:bg-slate-200:hover, .hover\:bg-slate-300\/20:hover, .hover\:bg-slate-300\/30:hover { background-color: var(--sidebar-hover) !important; }
.divide-slate-150 > * + *, .divide-slate-200 > * + * { border-color: var(--divider) !important; }
.dark .dark\:bg-navy-900 { background-color: var(--canvas) !important; }
.dark .dark\:bg-navy-800, .dark .dark\:bg-navy-750, .dark .dark\:bg-navy-700 { background-color: var(--surface) !important; }
.dark .dark\:bg-navy-600, .dark .dark\:bg-navy-500 { background-color: var(--surface-sunken) !important; }
.dark .dark\:text-navy-50, .dark .dark\:text-navy-100 { color: var(--text) !important; }
.dark .dark\:text-navy-200 { color: var(--text-2) !important; }
.dark .dark\:text-navy-300, .dark .dark\:text-navy-400 { color: var(--text-muted) !important; }
.dark .dark\:border-navy-700, .dark .dark\:border-navy-600, .dark .dark\:border-navy-500 { border-color: var(--line) !important; }
.dark .dark\:border-navy-450, .dark .dark\:border-navy-400 { border-color: var(--line-strong) !important; }
.dark .dark\:hover\:bg-navy-300\/20:hover, .dark .dark\:hover\:bg-navy-450:hover { background-color: var(--sidebar-hover) !important; }

/* Text the theme sets on its own */
body, .card, .popper-root > .popper-box { color: var(--text-2); }

/* Table heads: blue-tinted, with their own text colour */
table thead th, table thead tr[class*="bg-slate-200"] > th, table thead th[class*="bg-slate-200"] {
    background-color: var(--surface-sunken) !important;
    color: var(--th-text) !important;
}
table tbody td, table tbody tr { border-color: var(--divider); }

/* Fields */
.form-input, .form-select, .form-textarea, .form-multiselect, .ts-control { background-color: var(--input-bg) !important; border-color: var(--line-strong) !important; color: var(--text) !important; }
.form-input::placeholder, .form-textarea::placeholder, .ts-control input::placeholder { color: var(--text-muted) !important; opacity: .8; }
/* A field being typed in (the owner, 2026-11-29): no blue frame and no glow, only a slightly darker edge. One rule
   for every field of the system, whatever class its page gives it. */
:is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=color]), select, textarea):focus,
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none !important; box-shadow: none !important; border-color: var(--field-focus) !important; }
:is(.ns-group, .sl-group, .ap-group):focus-within { box-shadow: none !important; border-color: var(--field-focus) !important; }
.ap-group:focus-within em { border-color: var(--field-focus) !important; }

/* Sidebar */
.main-sidebar > div { background-color: var(--sidebar-bg) !important; border-color: var(--sidebar-line) !important; }
.main-sidebar a.rounded-lg, .main-sidebar button.rounded-lg { color: var(--sidebar-text); }
.main-sidebar a.rounded-lg:hover, .main-sidebar button.rounded-lg:hover { background-color: var(--sidebar-hover) !important; color: var(--sidebar-active-text) !important; }
.main-sidebar a.bg-primary\/10, .main-sidebar a.dark\:bg-navy-600 { background-color: var(--sidebar-active-bg) !important; color: var(--sidebar-active-text) !important; box-shadow: inset 3px 0 0 var(--accent); }
[dir="rtl"] .main-sidebar a.bg-primary\/10 { box-shadow: inset -3px 0 0 var(--accent); }
.main-sidebar button.uppercase, .main-sidebar div.uppercase { color: var(--sidebar-heading) !important; }
nav.header::before { background-color: var(--sidebar-bg) !important; }
nav.header { border-color: var(--sidebar-line) !important; }

/* Tracks, progress and skeletons */
.progress, [class*="bg-slate-150"].rounded-full, .skeleton { background-color: var(--track) !important; }

/* Scrollbars */
* { scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar-thumb { background-color: var(--line-strong) !important; }

/* ── Appearance: each user's sidebar colour and page background (Profile menu › Appearance) ─────────
   <html data-sidebar="white|navy|royal|teal|dark" data-bg="soft|white|ice|sky|mint">. Every text stays 4.5:1 or more. */
html[data-sidebar="white"]:not(.dark) {
    --sidebar-bg: #fbfbfc; --sidebar-line: #ebebed; --sidebar-text: #2e2e33; --sidebar-heading: #6b6b76;
    --sidebar-hover: #f0f0f2; --sidebar-active-bg: #ededf0; --sidebar-active-text: #0a0a0b;
}
html[data-sidebar="navy"] {
    --sidebar-bg: #0f1b33; --sidebar-line: #1d2c4d; --sidebar-text: #d6deeb; --sidebar-heading: #8fa0bc;
    --sidebar-hover: #1a2a4a; --sidebar-active-bg: #ffffff; --sidebar-active-text: #0f1b33; --sidebar-bar: #ffffff;
}
html[data-sidebar="royal"] {
    --sidebar-bg: #1d4ed8; --sidebar-line: #3d68e2; --sidebar-text: #ffffff; --sidebar-heading: #e3ecfd;
    --sidebar-hover: #2a5ae4; --sidebar-active-bg: #ffffff; --sidebar-active-text: #1d4ed8; --sidebar-bar: #0b1f44;
}
html[data-sidebar="teal"] {
    --sidebar-bg: #0f3d4a; --sidebar-line: #1d5564; --sidebar-text: #e0f2f5; --sidebar-heading: #a6d4dd;
    --sidebar-hover: #17505f; --sidebar-active-bg: #dce8fd; --sidebar-active-text: #0b1f44; --sidebar-bar: #2563eb;
}
html[data-sidebar="dark"] {
    --sidebar-bg: #0b1220; --sidebar-line: #1e2a40; --sidebar-text: #c3d6f7; --sidebar-heading: #8fb0e0;
    --sidebar-hover: #16213a; --sidebar-active-bg: #172554; --sidebar-active-text: #bfdbfe; --sidebar-bar: #3b82f6;
}
/* Richer sidebar colours: deep enough for white text (4.5:1 or more), soft rather than bright */
html[data-sidebar="purple"] {
    --sidebar-bg: #4c1d95; --sidebar-line: #5b2ba8; --sidebar-text: #f1eaff; --sidebar-heading: #d6c4fb;
    --sidebar-hover: #5a27a8; --sidebar-active-bg: #ede9fe; --sidebar-active-text: #4c1d95; --sidebar-bar: #c4b5fd;
}
html[data-sidebar="wine"] {
    --sidebar-bg: #7f1d3a; --sidebar-line: #93294a; --sidebar-text: #ffe8ef; --sidebar-heading: #f9c2d2;
    --sidebar-hover: #8f2546; --sidebar-active-bg: #ffe4ec; --sidebar-active-text: #7f1d3a; --sidebar-bar: #fda4af;
}
html[data-sidebar="emerald"] {
    --sidebar-bg: #065f46; --sidebar-line: #0d7055; --sidebar-text: #e3fbf1; --sidebar-heading: #a7e9cf;
    --sidebar-hover: #0a6c50; --sidebar-active-bg: #d1fae5; --sidebar-active-text: #065f46; --sidebar-bar: #6ee7b7;
}
html[data-sidebar="amber"] {
    --sidebar-bg: #6b3410; --sidebar-line: #7d4217; --sidebar-text: #fff1e0; --sidebar-heading: #f6d3a8;
    --sidebar-hover: #7a3e15; --sidebar-active-bg: #fef3c7; --sidebar-active-text: #6b3410; --sidebar-bar: #fcd34d;
}
html[data-sidebar="ocean"] {
    --sidebar-bg: #075985; --sidebar-line: #0d6a9c; --sidebar-text: #e6f6ff; --sidebar-heading: #b3e0f8;
    --sidebar-hover: #0b6593; --sidebar-active-bg: #e0f2fe; --sidebar-active-text: #075985; --sidebar-bar: #7dd3fc;
}
/* On a coloured sidebar every text follows its colour; the active item and the headings keep theirs */
html:is([data-sidebar="navy"], [data-sidebar="royal"], [data-sidebar="teal"], [data-sidebar="dark"], [data-sidebar="purple"], [data-sidebar="wine"], [data-sidebar="emerald"], [data-sidebar="amber"], [data-sidebar="ocean"]) .main-sidebar > div { color: var(--sidebar-text); }
html:is([data-sidebar="navy"], [data-sidebar="royal"], [data-sidebar="teal"], [data-sidebar="dark"], [data-sidebar="purple"], [data-sidebar="wine"], [data-sidebar="emerald"], [data-sidebar="amber"], [data-sidebar="ocean"]) .main-sidebar :is(span, p, h2, i, svg, div:not(.uppercase), input)[class*="text-"] { color: inherit !important; }
html:is([data-sidebar="navy"], [data-sidebar="royal"], [data-sidebar="teal"], [data-sidebar="dark"], [data-sidebar="purple"], [data-sidebar="wine"], [data-sidebar="emerald"], [data-sidebar="amber"], [data-sidebar="ocean"]) .main-sidebar :is(a, button).rounded-lg:not(.bg-primary\/10) { color: var(--sidebar-text) !important; }
html:is([data-sidebar="navy"], [data-sidebar="royal"], [data-sidebar="teal"], [data-sidebar="dark"], [data-sidebar="purple"], [data-sidebar="wine"], [data-sidebar="emerald"], [data-sidebar="amber"], [data-sidebar="ocean"]) .main-sidebar :is(a, button).rounded-lg:not(.bg-primary\/10):hover { background-color: var(--sidebar-hover) !important; color: var(--sidebar-text) !important; }
html:is([data-sidebar="navy"], [data-sidebar="royal"], [data-sidebar="teal"], [data-sidebar="dark"], [data-sidebar="purple"], [data-sidebar="wine"], [data-sidebar="emerald"], [data-sidebar="amber"], [data-sidebar="ocean"]) .main-sidebar a.bg-primary\/10 { box-shadow: inset 3px 0 0 var(--sidebar-bar); }
html:is([data-sidebar="navy"], [data-sidebar="royal"], [data-sidebar="teal"], [data-sidebar="dark"], [data-sidebar="purple"], [data-sidebar="wine"], [data-sidebar="emerald"], [data-sidebar="amber"], [data-sidebar="ocean"])[dir="rtl"] .main-sidebar a.bg-primary\/10 { box-shadow: inset -3px 0 0 var(--sidebar-bar); }
html:is([data-sidebar="navy"], [data-sidebar="royal"], [data-sidebar="teal"], [data-sidebar="dark"], [data-sidebar="purple"], [data-sidebar="wine"], [data-sidebar="emerald"], [data-sidebar="amber"], [data-sidebar="ocean"]) .main-sidebar :is([class*="border-slate"], [class*="border-navy"], .border-b, .border-t) { border-color: var(--sidebar-line) !important; }
html:is([data-sidebar="navy"], [data-sidebar="royal"], [data-sidebar="teal"], [data-sidebar="dark"], [data-sidebar="purple"], [data-sidebar="wine"], [data-sidebar="emerald"], [data-sidebar="amber"], [data-sidebar="ocean"]) .main-sidebar input { background: transparent !important; }
html:is([data-sidebar="navy"], [data-sidebar="royal"], [data-sidebar="teal"], [data-sidebar="dark"], [data-sidebar="purple"], [data-sidebar="wine"], [data-sidebar="emerald"], [data-sidebar="amber"], [data-sidebar="ocean"]) .main-sidebar input::placeholder { color: var(--sidebar-heading) !important; opacity: 1; }

/* Page backgrounds (light mode only: dark mode keeps its own dark page) */
html[data-bg="white"]:not(.dark) { --canvas: #ffffff; --muted-on-canvas: #6b6b76; }
html[data-bg="soft"]:not(.dark) { --canvas: #f7f7f8; }
html[data-bg="sky"]:not(.dark) { --canvas: #d9ebfb; }
html[data-bg="mint"]:not(.dark) { --canvas: #dcf1ec; }
html[data-bg="ice"]:not(.dark) { --canvas: #e9e5f8; }
html[data-bg="sand"]:not(.dark) { --canvas: #f3ead9; }

/* A dark page colour in the light theme: only the page behind the content turns dark; cards, menus and
   pop-ups stay light, and what sits directly on the page (title, subtitle, breadcrumb) turns light to stay readable */
html[data-bg="midnight"]:not(.dark) { --canvas: #0b1220; }
html[data-bg="navynight"]:not(.dark) { --canvas: #0e1a33; }
html[data-bg="ocean"]:not(.dark) { --canvas: #0a2230; }
html[data-bg="indigo"]:not(.dark) { --canvas: #15133a; }
html:is([data-bg="midnight"], [data-bg="navynight"], [data-bg="ocean"], [data-bg="indigo"]):not(.dark) {
    --muted-on-canvas: #b9cdf0;
}
html:is([data-bg="midnight"], [data-bg="navynight"], [data-bg="ocean"], [data-bg="indigo"]):not(.dark) main.main-content > div:first-child { background: var(--canvas) !important; }
html:is([data-bg="midnight"], [data-bg="navynight"], [data-bg="ocean"], [data-bg="indigo"]):not(.dark) main.main-content > .ph h2 { color: #f1f5ff !important; }
html:is([data-bg="midnight"], [data-bg="navynight"], [data-bg="ocean"], [data-bg="indigo"]):not(.dark) main.main-content > .ph :is(p, .ph-crumbs, .ph-crumbs [aria-current], .ph-sep) { color: #c9d8f3 !important; }
html:is([data-bg="midnight"], [data-bg="navynight"], [data-bg="ocean"], [data-bg="indigo"]):not(.dark) main.main-content > .ph .ph-crumbs a { color: #9ec5ff !important; }

/* ── The page you are on: a tab of the page's own colour, joined to the page (rounded only on the outer side,
      reaching the sidebar's edge, with small inward curves above and below where it meets the page) ───────── */
html .main-sidebar a.bg-primary\/10[class] {
    position: relative; overflow: visible;
    background-color: var(--tab-bg, var(--canvas)) !important; color: var(--tab-text, var(--accent-strong)) !important;
    box-shadow: none !important; font-weight: 600;
    margin-inline-end: -.75rem; border-start-end-radius: 0; border-end-end-radius: 0; border-start-start-radius: .7rem; border-end-start-radius: .7rem;
}
html .main-sidebar a.bg-primary\/10[class] :is(span, i, svg, div) { color: inherit !important; }
html .main-sidebar a.bg-primary\/10[class]::before, html .main-sidebar a.bg-primary\/10[class]::after {
    content: ''; position: absolute; inset-inline-end: 0; width: .7rem; height: .7rem; pointer-events: none;
}
html .main-sidebar a.bg-primary\/10[class]::before { bottom: 100%; background: radial-gradient(circle at 0 0, transparent .7rem, var(--tab-bg, var(--canvas)) calc(.7rem + .5px)); }
html .main-sidebar a.bg-primary\/10[class]::after { top: 100%; background: radial-gradient(circle at 0 100%, transparent .7rem, var(--tab-bg, var(--canvas)) calc(.7rem + .5px)); }
html[dir="rtl"] .main-sidebar a.bg-primary\/10[class]::before { background: radial-gradient(circle at 100% 0, transparent .7rem, var(--tab-bg, var(--canvas)) calc(.7rem + .5px)); }
html[dir="rtl"] .main-sidebar a.bg-primary\/10[class]::after { background: radial-gradient(circle at 100% 100%, transparent .7rem, var(--tab-bg, var(--canvas)) calc(.7rem + .5px)); }
/* The white sidebar: the tab is soft blue so it still stands out from the white sidebar */
html[data-sidebar="white"] { --tab-bg: var(--accent-soft); }
html[data-sidebar="white"] .main-sidebar a.bg-primary\/10[class]::before, html[data-sidebar="white"] .main-sidebar a.bg-primary\/10[class]::after { display: none; }
html[data-sidebar="white"] .main-sidebar a.bg-primary\/10[class] { margin-inline-end: 0; border-radius: .7rem; }
/* In dark mode the tab text uses the light accent (readable on the dark page) */
html.dark { --tab-text: var(--accent-text); }
/* Coloured sidebars meet the page without a line, so the tab joins it */
html:is([data-sidebar="navy"], [data-sidebar="royal"], [data-sidebar="teal"], [data-sidebar="dark"], [data-sidebar="purple"], [data-sidebar="wine"], [data-sidebar="emerald"], [data-sidebar="amber"], [data-sidebar="ocean"]) .main-sidebar > div { border-inline-end-color: transparent !important; }

/* ── Floating sidebar: a rounded panel 10px off the screen edges, the page showing around it (tablet and up) ── */
@media (min-width: 768px) {
    html[data-sidebar] .main-sidebar { top: 10px; bottom: 10px; height: auto; left: 10px; right: auto; }
    html[data-sidebar][dir="rtl"] .main-sidebar { left: auto; right: 10px; }
    html[data-sidebar] .main-sidebar > div { border-radius: 16px; overflow: hidden; border-width: 0 !important; box-shadow: 0 4px 16px rgb(11 31 68 / .08); }
    /* Around the panel the page shows, not the sidebar colour (the top bar's backdrop runs behind the sidebar) */
    html[data-sidebar] nav.header::before { background-color: var(--canvas) !important; }
    html[data-sidebar] .main-content { margin-left: calc(var(--main-sidebar-width) + 20px) !important; margin-right: 0 !important; }
    html[data-sidebar][dir="rtl"] .main-content { margin-right: calc(var(--main-sidebar-width) + 20px) !important; margin-left: 0 !important; }
    html[data-sidebar] nav.header { width: calc(100% - var(--main-sidebar-width) - 20px) !important; }
    /* The top bar floats too: a rounded card 10px off the top, its sides in line with the page's cards and its top with the sidebar's.
       It ends where it always did (61px), so everything that sticks under it stays in place; a page-coloured
       ring hides what scrolls past in the gap. */
    html[data-sidebar] nav.header {
        top: 10px; height: 51px; width: calc(100% - var(--main-sidebar-width) - 20px - 2 * var(--margin-x)) !important; right: var(--margin-x); left: auto;
        border: 0 !important; border-radius: 16px; background: var(--surface);
        box-shadow: 0 4px 16px rgb(11 31 68 / .08), 0 0 0 10px var(--canvas);
    }
    html[data-sidebar][dir="rtl"] nav.header { right: auto; left: var(--margin-x); }
    html[data-sidebar] nav.header::before { display: none; }
    html[data-sidebar] nav.header .header-container { border-radius: 16px; background: transparent !important; }
}

/* Dark page backgrounds: the whole dark set, each tinted to its page (cards one step lighter). Midnight is the usual dark. */
html.dark[data-bg="navynight"] { --canvas: #0e1a33; --surface: #14244a; --surface-sunken: #1a2c56; --line: #22355f; --line-strong: #2f4677; --divider: #1b2b52; --row-hover: #1c2d55; --input-bg: #0f1d3a; --track: #22355f; }
html.dark[data-bg="ocean"] { --canvas: #0a2230; --surface: #0f2e40; --surface-sunken: #14384d; --line: #1b4459; --line-strong: #285a72; --divider: #153a4e; --row-hover: #16394d; --input-bg: #0b2636; --track: #1b4459; }
html.dark[data-bg="indigo"] { --canvas: #15133a; --surface: #1d1b4d; --surface-sunken: #24225b; --line: #2e2b6b; --line-strong: #3d3a85; --divider: #26245c; --row-hover: #27255e; --input-bg: #17153f; --track: #2e2b6b; }

html:is([data-bg="midnight"], [data-bg="navynight"], [data-bg="ocean"], [data-bg="indigo"]):not(.dark) nav.header .header-container { background-color: var(--surface); }

/* The dark top bar is the card colour, not the theme's own navy */
html.dark .is-header-blur nav.header .header-container, html.dark nav.header .header-container { background-color: var(--surface) !important; }
