/* Appearance affects presentation only; clinical risk colors stay unchanged. */
:root,[data-palette=glacier]{--ks-accent:#245f88;--ks-deep:#18384f;--ks-muted:#526b7e;--ks-tint:#c5e2f1;--ks-wash:#eff6fb;--ks-halo:#bddcea;--ks-edge:#aacbdf;--ks-rgb:77,133,167}
[data-palette=sage]{--ks-accent:#3d674c;--ks-deep:#263f31;--ks-muted:#546d5d;--ks-tint:#d2e5d3;--ks-wash:#f1f6ee;--ks-halo:#bdcfb8;--ks-edge:#adc6ad;--ks-rgb:81,121,83}
[data-palette=lavender]{--ks-accent:#6b4f92;--ks-deep:#3f3158;--ks-muted:#70637f;--ks-tint:#e1d5f2;--ks-wash:#f6f2fb;--ks-halo:#cfc0e8;--ks-edge:#c5b1dc;--ks-rgb:122,92,166}
[data-palette=sakura]{--ks-accent:#97516b;--ks-deep:#583545;--ks-muted:#80616e;--ks-tint:#f3d6e0;--ks-wash:#fcf2f5;--ks-halo:#edc4d0;--ks-edge:#dfb1c1;--ks-rgb:168,97,124}
[data-palette=champagne]{--ks-accent:#805f33;--ks-deep:#493b2c;--ks-muted:#766b58;--ks-tint:#eddfc4;--ks-wash:#faf6ee;--ks-halo:#e1cfac;--ks-edge:#d3c09d;--ks-rgb:147,116,66}
[data-palette=stone]{--ks-accent:#526565;--ks-deep:#303e40;--ks-muted:#637272;--ks-tint:#d9e1de;--ks-wash:#f2f5f3;--ks-halo:#c4d0cd;--ks-edge:#b7c5c1;--ks-rgb:99,119,116}
:root[data-palette]{color-scheme:light;--ink:var(--ks-deep);--ink2:var(--ks-deep);--muted:var(--ks-muted);--sub:var(--ks-muted);--brand:var(--ks-accent);--bg:var(--ks-wash);--line:rgba(var(--ks-rgb),.22);--line2:var(--ks-wash);--card:rgba(255,255,255,.76);--card2:var(--ks-wash);--ks-glass:rgba(255,255,255,.69);--ks-blur:12px;--ks-saturation:120%;--ks-shadow:0 8px 30px rgba(var(--ks-rgb),.09);--ks-sheen:linear-gradient(130deg,rgba(255,255,255,.35),rgba(255,255,255,0));--ks-outline:rgba(255,255,255,.88)}
:root[data-texture=soft]{--ks-glass:rgba(255,255,255,.83);--ks-blur:28px;--ks-saturation:90%;--ks-shadow:0 14px 40px rgba(var(--ks-rgb),.12);--ks-sheen:linear-gradient(145deg,rgba(255,255,255,.22),rgba(255,255,255,.07));--ks-outline:rgba(255,255,255,.95)}
:root[data-texture=glow]{--ks-glass:rgba(255,255,255,.54);--ks-blur:22px;--ks-saturation:155%;--ks-shadow:0 12px 40px rgba(var(--ks-rgb),.17),inset 0 1px 0 #fff,inset 0 -1px 0 rgba(255,255,255,.65);--ks-sheen:linear-gradient(125deg,rgba(255,255,255,.80),rgba(255,255,255,.06) 43%,rgba(var(--ks-rgb),.09) 74%,rgba(255,255,255,.65));--ks-outline:rgba(255,255,255,.92)}
html[data-palette] body{min-height:100vh;background:radial-gradient(ellipse at 8% 8%,var(--ks-tint),transparent 52%),radial-gradient(ellipse at 93% 78%,var(--ks-halo),transparent 48%),var(--ks-wash);background-attachment:fixed;color:var(--ks-deep)}
html[data-palette] .card,html[data-palette] body>header,html[data-palette] .editorbar,html[data-palette] .appbar,html[data-palette] .cloud-actions{background:var(--ks-sheen),var(--ks-glass);backdrop-filter:blur(var(--ks-blur)) saturate(var(--ks-saturation));-webkit-backdrop-filter:blur(var(--ks-blur)) saturate(var(--ks-saturation));border-color:var(--ks-outline);box-shadow:var(--ks-shadow)}
html[data-palette] .card{border-radius:20px}
html[data-palette] input:not(.bad):not([type=checkbox]):not([type=radio]):not([type=submit]),html[data-palette] select:not(.bad),html[data-palette] textarea:not(.bad){background-color:rgba(255,255,255,.8);border-color:var(--ks-edge)}
html[data-palette] :is(input,select,textarea,button,a,summary):focus-visible{outline:2px solid var(--ks-accent);outline-offset:3px}
html[data-palette] .notice,html[data-palette] .pill,html[data-palette] .secondary{background:var(--ks-tint);color:var(--ks-accent)}
html[data-palette] .table-wrap table{background:rgba(255,255,255,.64)}
html[data-palette] .table-wrap th{background:var(--ks-wash)}
/* Self-contained controls also work inside Django's administration layout. */
.ks-appearance{position:fixed;right:24px;bottom:22px;z-index:1000;font:14px/1.5 -apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;color:var(--ks-deep)}
.ks-appearance>summary{display:flex;align-items:center;gap:9px;list-style:none;cursor:pointer;padding:11px 18px;background:rgba(255,255,255,.92);border:1px solid var(--ks-edge);border-radius:40px;box-shadow:0 6px 24px rgba(var(--ks-rgb),.15);font-weight:600;color:var(--ks-accent)}
.ks-appearance>summary::-webkit-details-marker{display:none}.ks-appearance>summary span{font-size:20px;line-height:1}
.ks-theme-panel{position:absolute;right:0;bottom:58px;width:370px;max-width:calc(100vw - 32px);max-height:calc(100dvh - 115px);overflow:auto;background:rgba(255,255,255,.96);backdrop-filter:blur(30px);-webkit-backdrop-filter:blur(30px);border:1px solid white;border-radius:22px;padding:22px;box-shadow:0 18px 65px rgba(var(--ks-rgb),.24);box-sizing:border-box}
.ks-theme-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}.ks-theme-heading h2{font-size:18px;font-weight:700;color:var(--ks-deep);margin:0 0 4px;padding:0;background:none;letter-spacing:0}.ks-theme-heading p{font-size:12px;color:var(--ks-muted);margin:0}
.ks-appearance button{width:auto;min-height:38px;margin:0;box-shadow:none;transform:none;letter-spacing:0;text-transform:none;font:inherit;cursor:pointer;border-radius:11px;box-sizing:border-box;color:var(--ks-deep);border:1px solid var(--ks-edge);background:rgba(255,255,255,.8);padding:9px 7px}
.ks-appearance [data-theme-close]{min-width:30px;min-height:30px;padding:0;border:0;background:var(--ks-wash);font-size:23px;color:var(--ks-muted)}
.ks-appearance fieldset{border:0;padding:0;margin:22px 0 0;min-width:0;background:none;box-shadow:none}.ks-appearance legend{font-size:12px;font-weight:700;color:var(--ks-muted);padding:0;margin-bottom:9px;float:none;width:auto}
.ks-palette-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.ks-palette-grid button{display:flex;flex-direction:column;align-items:center;gap:7px;font-size:12px;white-space:nowrap;padding:12px 5px}.ks-palette-grid i{display:block;width:29px;height:29px;border-radius:50%;background:linear-gradient(145deg,#ffffffaa,transparent),var(--swatch);box-shadow:inset 0 1px 2px #fff,0 3px 7px #0000000a}
.ks-texture-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.ks-texture-grid button{font-size:13px;padding:12px 5px}.ks-texture-grid small{display:block;color:var(--ks-muted);font-size:10px;margin-top:4px}
.ks-appearance button[aria-pressed=true]{border-color:var(--ks-accent);background:var(--ks-wash);box-shadow:0 0 0 1px var(--ks-accent);color:var(--ks-accent);font-weight:700}
.ks-appearance button:hover{border-color:var(--ks-accent);background:var(--ks-wash)}.ks-theme-bottom{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:20px}.ks-theme-bottom span{font-size:12px;color:var(--ks-accent)}.ks-theme-bottom button{border:0;background:var(--ks-tint);color:var(--ks-accent);font-size:12px;padding:8px 12px}.ks-theme-note{font-size:11px!important;line-height:1.5;color:var(--ks-muted);margin:13px 0 0!important;padding:0}
@supports not (backdrop-filter:blur(1px)){html[data-palette] .card,html[data-palette] body>header,html[data-palette] .editorbar{background:#fff}}
@media(max-width:600px){.ks-appearance{right:16px;bottom:16px}.ks-theme-panel{padding:18px;width:350px}html[data-palette] body>header{flex-wrap:wrap}footer{padding-bottom:65px}}
@media print{html[data-palette] body{background:white!important;color:#111!important}.ks-appearance,.cloud-actions{display:none!important}html[data-palette] .card{background:white!important;backdrop-filter:none!important;box-shadow:none!important}}

/* The same appearance entry is visible in navigation, including before sign-in. */
.ks-appearance--header{position:static;right:auto;bottom:auto;flex-shrink:0;text-transform:none;letter-spacing:normal}
.ks-appearance--header>summary{padding:8px 13px;font-size:13px;white-space:nowrap;box-shadow:none}
.ks-appearance--header .ks-theme-panel{top:calc(100% + 10px);bottom:auto;right:24px;max-height:calc(100dvh - 150px);text-align:left}
.site-header .ks-theme-panel{right:max(24px,calc((100vw - 1092px)/2))}
.cloud-actions{position:relative;z-index:100}.cloud-actions>.ks-appearance--header{margin-left:auto}
#header .ks-appearance--header{margin-left:8px}
@media(max-width:760px){.ks-appearance--header .ks-theme-panel{right:16px;max-width:calc(100vw - 32px);max-height:calc(100dvh - 195px)}.ks-appearance--header>summary{padding:7px 11px}}
