/* Kartlegg v0.99.2 – polished service-themed accents, full-width decorative header ribbons,
   and optional Maritha heart Easter egg.
   All styling is decorative and intentionally excludes clinical escalation/score severity.
*/

/* Clinical-neutral utility surfaces historically retained hard-coded blue palettes.
   These tokens separate decoration from the fixed clinical risk status colors. */
:root[data-service-theme="hospital"]{
 --service-subtle:#eaf3fd;--service-soft:#f3f8fe;--service-control:#fff;--service-unit:#e7f2fe;
 --service-border:#b9d6ef;--service-soft-text:#456680;--service-focus:#8dbff1;
}
:root[data-service-theme="ambulance"]{
 --service-subtle:#303335;--service-soft:#1c1e1f;--service-control:#242729;--service-unit:#383b30;
 --service-border:#62686a;--service-soft-text:#e2e4de;--service-focus:#ffff00;
}
:root[data-service-theme="urgent"]{
 --service-subtle:#115341;--service-soft:#073b30;--service-control:#084d3d;--service-unit:#1a654f;
 --service-border:#367e68;--service-soft-text:#dbf6e9;--service-focus:#ffcc00;
}
:root[data-service-theme="homecare"]{
 --service-subtle:#e2f3ef;--service-soft:#f0faf7;--service-control:#fff;--service-unit:#dff2ec;
 --service-border:#a7d4cc;--service-soft-text:#4a706a;--service-focus:#2b948c;
}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(
 .meta-line,.meta-line label,.meta-line small,
 .chip,.control-wrap,.control-wrap input,.control-wrap select,.unit,
 .choice span,.field-icon,.field:nth-child(3n) .field-icon,.field:nth-child(4n) .field-icon,
 .v081-tool-search,.v081-search-field,
 .isbar-details,.isbar-details summary,.isbar-output,.isbar-inputs textarea,.isbar-inputs input,
 .profile-field input,.profile-field select,
 .history-table th,.history-table tr:hover td,.score-table th,
 .criterion,.criterion summary,.criterion-content,.toolbox summary,
 .v08-timer-display,.v08-duration label,.hc-esas-item,.hc-esas-number,
 .v099-category-heading,.v099-category-count,
 .service-theme-option,.profile-dialog-section,
 .score.neutral,.score.neutral .score-status
){border-color:var(--service-border);}

/* Override older v0.3/v0.5 explicit blue backgrounds, including highly specific dark rules. */
:root[data-service-theme]:not([data-service-theme="custom"]) .meta-line{
 background:var(--service-subtle);color:var(--ink);
}
:root[data-service-theme]:not([data-service-theme="custom"]) .meta-line label{color:var(--ink)}
:root[data-service-theme]:not([data-service-theme="custom"]) .meta-line small{color:var(--service-soft-text)}
:root[data-service-theme]:not([data-service-theme="custom"]) .meta-line input{
 background:var(--service-control);border:1px solid var(--service-border);color:var(--ink);
 color-scheme:inherit;
}
:root[data-service-theme]:not([data-service-theme="custom"]) .chip{
 background:var(--accent-bg);border:1px solid var(--accent-border);color:var(--accent);
}
:root[data-service-theme]:not([data-service-theme="custom"]) .field .control-wrap{
 background:var(--service-control);border-color:var(--service-border);
}
:root[data-service-theme]:not([data-service-theme="custom"]) .field .control-wrap input,
:root[data-service-theme]:not([data-service-theme="custom"]) .field .control-wrap select{
 background:transparent!important;color:var(--ink);border:0;
}
:root[data-service-theme]:not([data-service-theme="custom"]) .field .unit{
 background:var(--service-unit);color:var(--ink);border-left:1px solid var(--service-border);
}
:root[data-service-theme]:not([data-service-theme="custom"]) .field .hint{color:var(--muted)}
:root[data-service-theme]:not([data-service-theme="custom"]) .field .field-icon,
:root[data-service-theme]:not([data-service-theme="custom"]) .field:nth-child(3n) .field-icon,
:root[data-service-theme]:not([data-service-theme="custom"]) .field:nth-child(4n) .field-icon{
 background:var(--accent-bg);color:var(--accent);
}
:root[data-service-theme]:not([data-service-theme="custom"]) .field .control-wrap:focus-within{
 outline:2px solid var(--service-focus);outline-offset:1px;
}
:root[data-service-theme]:not([data-service-theme="custom"]) .field:focus-within{
 border-color:var(--service-focus);box-shadow:0 0 0 2px var(--accent-bg);
}
:root[data-service-theme]:not([data-service-theme="custom"]) .choice span{
 color:var(--ink);background:var(--service-control);border-color:var(--service-border);
}
:root[data-service-theme]:not([data-service-theme="custom"]) .choice input:checked+span{
 color:var(--accent);background:var(--accent-bg);border-color:var(--accent-border);
}
:root[data-service-theme]:not([data-service-theme="custom"]) .choice input:focus-visible+span{
 outline:3px solid var(--service-focus);outline-offset:2px;
}
:root[data-service-theme]:not([data-service-theme="custom"]) .v081-tool-search{
 background:var(--paper);border-color:var(--service-border);
}
:root[data-service-theme]:not([data-service-theme="custom"]) .v081-search-field{
 background:var(--service-soft);border-color:var(--service-border);
}
:root[data-service-theme]:not([data-service-theme="custom"]) #homeToolQuery{color:var(--ink)!important}
:root[data-service-theme]:not([data-service-theme="custom"]) .v081-search-results{
 background:var(--paper);border-color:var(--service-border);
}
:root[data-service-theme]:not([data-service-theme="custom"]) .v081-tool-result{
 color:var(--ink);background:var(--paper);
}
:root[data-service-theme]:not([data-service-theme="custom"]) .v081-tool-result:hover,
:root[data-service-theme]:not([data-service-theme="custom"]) .v081-tool-result:focus-visible{
 color:var(--ink);background:var(--accent-bg);
}
:root[data-service-theme]:not([data-service-theme="custom"]) .toolbox{
 background:var(--paper);color:var(--ink);
}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.toolbox summary,.toolbox ul,.criterion summary){
 color:var(--ink);
}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.criterion,.criterion-content){
 background:var(--paper);border-color:var(--line);
}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.history-table th,.score-table th){
 background:var(--service-subtle);color:var(--ink);
}
:root[data-service-theme]:not([data-service-theme="custom"]) .history-table tr:hover td{
 background:var(--service-subtle);
}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.isbar-output,.script-paper,.spoken-script){
 background:var(--service-soft);color:var(--ink);border-color:var(--service-border);
}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.isbar-details,.isbar-inputs input,.isbar-inputs textarea){
 background:var(--service-control);color:var(--ink);border-color:var(--service-border);
}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.profile-field input,.profile-field select){
 background:var(--service-control);color:var(--ink);border-color:var(--service-border);
}
:root[data-service-theme]:not([data-service-theme="custom"]) .profile-status{color:var(--accent)}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.service-theme-option,.appearance-options label){
 background:var(--service-control);color:var(--ink);border-color:var(--service-border);
}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.service-theme-option:has(input:checked),.appearance-options label:has(input:checked)){
 background:var(--accent-bg);color:var(--ink);border-color:var(--accent);
}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.detail-button,.btn-isbar){
 background:var(--accent-bg);color:var(--accent);border-color:var(--accent-border);
}
/* Non-alert, neutral score only. Clinical warning/danger/ok continue to use invariant colors. */
:root[data-service-theme]:not([data-service-theme="custom"]) .score.neutral{
 background:var(--service-soft);border-color:var(--service-border);
}
:root[data-service-theme]:not([data-service-theme="custom"]) .score.neutral .score-status{
 background:var(--service-subtle);color:var(--ink);
}
/* Keep clinical severity states and emergency banners as-is. */
:root[data-service-theme]:not([data-service-theme="custom"]) .score:is(.warning,.danger,.ok){box-shadow:none}

/* A thin *full width* upper ribbon gives each preset its own professional visual identity. */
.header{isolation:isolate}
@media(min-width:771px){.header{position:relative}}
.header .theme-top-ribbon{
 position:absolute;top:0;left:0;right:0;height:11px;pointer-events:none;
 overflow:hidden;z-index:6;display:none;contain:paint;
}
:root[data-service-theme]:not([data-service-theme="custom"]) .header .theme-top-ribbon{display:block}
:root[data-service-theme="hospital"] .theme-top-ribbon{
 background:#002244;
 border-bottom:1px solid #0077ee;
}
/* A slim ECG trace, drawn as repeating decorative SVG. */
:root[data-service-theme="hospital"] .theme-top-ribbon::before{
 content:"";display:block;height:100%;width:100%;
 background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='116' height='11' viewBox='0 0 116 11'%3E%3Cpath d='M0 6H32L37 3L41 9L45 1L49 6H116' fill='none' stroke='%2349aaff' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E");
 background-repeat:repeat-x;background-position:top left;opacity:.94;
}
/* Norwegian ambulance-like green and silver reflective checker band, inspired rather
   than copying any protected insignia or misleading emergency vehicle marking. */
:root[data-service-theme="ambulance"] .theme-top-ribbon{
 height:12px;border-bottom:2px solid #1f7c46;
 background:
  repeating-conic-gradient(from 90deg,#288447 0 25%,#d1d9d8 0 50%) 0 0 / 42px 12px;
}
/* Urgent care: vivid yellow triage hazard cue against clinical deep green. */
:root[data-service-theme="urgent"] .theme-top-ribbon{
 height:11px;border-bottom:2px solid #ffcc00;
 background:repeating-linear-gradient(112deg,#ffcc00 0 16px,#0d513f 16px 24px,#ffcc00 24px 39px);
}
/* Home care: little roadway with centre markings and a small discreet car. */
:root[data-service-theme="homecare"] .theme-top-ribbon{
 height:12px;border-block:1px solid #83c7b6;
 background:
  repeating-linear-gradient(90deg,transparent 0 42px,#e5f8ed 42px 59px,transparent 59px 99px) center 5px / 100% 2px no-repeat,
  linear-gradient(#39877b,#22776e);
}
:root[data-service-theme="homecare"] .theme-top-ribbon::after{
 content:"🚗";position:absolute;right:clamp(16px,5vw,65px);top:-3px;font-size:13px;line-height:14px;
 filter:saturate(.8);
}

/* Easter egg: the heart row overlays the normal service ribbon, without changing
   NEWS2 or other clinical color semantics. */
:root[data-maritha-mode="on"] .header .theme-top-ribbon{
 display:block!important;height:16px;border:0!important;
 background-color:#692943!important;
 background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='52' height='16' viewBox='0 0 52 16'%3E%3Cpath d='M13 11 C8 7 6 4 8 2 C10 0 13 2 13 4 C14 1 18 0 20 2 C23 6 16 10 13 12 Z' fill='%23ffbfd2'/%3E%3Cpath d='M39 11 C35 8 31 4 33 2 C35 0 39 2 39 4 C41 1 45 0 47 3 C48 7 42 10 39 12 Z' fill='%23ff6eab'/%3E%3C/svg%3E")!important;
 background-repeat:repeat-x!important;background-size:52px 16px!important;
 box-shadow:0 2px 12px #ee6ca255!important;
}
:root[data-maritha-mode="on"] .header .theme-top-ribbon::before,
:root[data-maritha-mode="on"] .header .theme-top-ribbon::after{display:none!important}
:root[data-maritha-mode="on"] .header .logo{
 box-shadow:0 0 0 2px #f7a4c35e,0 0 19px #f263a578;
}
:root[data-maritha-mode="on"] .profile-trigger{
 border:2px solid #f99abe;box-shadow:0 0 0 3px #fcabc329;
}
.maritha-popup{
 position:fixed;inset:0;margin:auto;width:min(420px,calc(100vw - 28px));
 max-height:90dvh;overflow:auto;border:1px solid #f39fbe;border-radius:20px;
 background:linear-gradient(145deg,#fff9fc,#ffe7f0);color:#612c43;
 padding:25px 24px 20px;box-shadow:0 20px 65px #19060d88;
}
.maritha-popup::backdrop{background:#0a152aa6;backdrop-filter:blur(3px)}
.maritha-popup-emoji{text-align:center;font-size:32px;letter-spacing:7px;line-height:1.5}
.maritha-popup h2{text-align:center;font-size:24px;margin:12px 0 8px;letter-spacing:-.03em}
.maritha-popup p{text-align:center;font-size:13px;line-height:1.65;margin:8px 0;color:#7a4359}
.maritha-popup button{
 width:100%;min-height:46px;margin-top:17px;border:0;border-radius:11px;
 background:#a93468;color:#fff;font:inherit;font-weight:800;font-size:14px;
}
.maritha-popup button:hover{background:#922658}
.maritha-popup button:focus-visible{outline:3px solid #ef8bb6;outline-offset:3px}
@media(max-width:480px){
 .header .theme-top-ribbon{height:9px}
 :root[data-maritha-mode="on"] .header .theme-top-ribbon{height:13px;background-size:42px 13px!important}
 .maritha-popup{padding:20px 17px}
}
@media(prefers-reduced-motion:reduce){.header .theme-top-ribbon,.maritha-popup *{animation:none!important;transition:none!important}}


/* Profile theme-picker previews show miniature versions of the themed header strips. */
.service-theme-option .service-theme-preview::before{
 content:"";position:absolute;top:0;left:0;right:0;height:7px;border-radius:6px 6px 0 0;z-index:1;
 background:var(--preview-highlight);
}
.service-theme-option[data-service-option="hospital"] .service-theme-preview::before{
 background-color:#002244;
 background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='7' viewBox='0 0 29 7'%3E%3Cpath d='M0 4H8L10 2L12 6L14 1L17 4H29' fill='none' stroke='%2349aaff' stroke-width='1'/%3E%3C/svg%3E");
}
.service-theme-option[data-service-option="ambulance"] .service-theme-preview::before{
 background:repeating-conic-gradient(from 90deg,#24884b 0 25%,#d0d9d7 0 50%) 0 0/14px 7px;
}
.service-theme-option[data-service-option="urgent"] .service-theme-preview::before{
 background:repeating-linear-gradient(115deg,#ffcc00 0 8px,#12503e 8px 12px);
}
.service-theme-option[data-service-option="homecare"] .service-theme-preview::before{
 background:
  repeating-linear-gradient(90deg,transparent 0 10px,#e3f7ec 10px 16px,transparent 16px 29px) center center/100% 1px no-repeat,
  #2b887d;
}
.service-theme-option:has(input:checked){
 box-shadow:0 0 0 2px var(--accent-bg),0 6px 16px #122c4415;
}
.service-theme-option:hover{
 box-shadow:0 4px 14px #122c441b;
}
@media(prefers-reduced-motion:reduce){
 .service-theme-option:hover,.service-theme-option:has(input:checked){transition:none}
}
