/* Kartlegg v0.99.1 – service-theme presets.
 * Presets only change appearance. NEWS2/4AT clinical point badges, danger/warning/ok
 * scores, FAST/ABCDE emergency surfaces and escalation messages are NOT recolored.
 * Existing six custom appearance combinations remain intact.
 */

/* High specificity intentionally outranks older dark-mode + accent rules.
   Service-theme data is set by the existing appearance controller in v06.js. */
:root[data-service-theme="hospital"][data-theme][data-accent]{
 color-scheme:light;
 --ink:#002244;--muted:#4d6378;--line:#d5e3f1;--bg:#f3f8fe;--paper:#ffffff;
 --accent:#006edb;--accent-on:#ffffff;--accent-bg:#e6f3ff;--accent-border:#9ac9f8;
 --shadow:0 10px 28px #0022440c;
}
:root[data-service-theme="ambulance"][data-theme][data-accent]{
 color-scheme:dark;
 --ink:#f6f8f8;--muted:#c1cdd0;--line:#4b5054;--bg:#151719;--paper:#242729;
 --accent:#ffff00;--accent-on:#17191b;--accent-bg:#36391b;--accent-border:#bac438;
 --shadow:0 14px 32px #0008;
}
:root[data-service-theme="urgent"][data-theme][data-accent]{
 color-scheme:dark;
 --ink:#f4fff9;--muted:#bfdbd0;--line:#2f7662;--bg:#052e27;--paper:#084d3d;
 --accent:#ffcc00;--accent-on:#07352a;--accent-bg:#365323;--accent-border:#d3af28;
 --shadow:0 14px 30px #001c176b;
}
:root[data-service-theme="homecare"][data-theme][data-accent]{
 color-scheme:light;
 --ink:#203b3e;--muted:#537174;--line:#d9eae6;--bg:#f2faf8;--paper:#ffffff;
 --accent:#117c76;--accent-on:#ffffff;--accent-bg:#e0f5f0;--accent-border:#9dd7ce;
 --shadow:0 10px 26px #0d63590c;
}

/* Standard service surfaces. Respect clinical risk styles by not targeting score
   status subclasses, badges, NEWS2 risk components, or emergency callouts. */
:root[data-service-theme]:not([data-service-theme="custom"]) body{background:var(--bg);color:var(--ink)}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.header,.sidebar,.section,.field,.toolbox,.score.neutral,.profile-dialog,.profile-dialog-head,.clinical-tool-dialog,.tool-modal-head,.v08-dialog,.v08-dialog-head,.theme-switch,.dialog-head){
 background:var(--paper);color:var(--ink);border-color:var(--line);
}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.toolbox,.section,.field){box-shadow:var(--shadow)}
:root[data-service-theme]:not([data-service-theme="custom"]) .nav{color:var(--ink)}
:root[data-service-theme]:not([data-service-theme="custom"]) .nav:hover{background:var(--accent-bg)}
:root[data-service-theme]:not([data-service-theme="custom"]) .nav:is(.active,[aria-current="page"]){background:var(--accent-bg);color:var(--accent)}
:root[data-service-theme]:not([data-service-theme="custom"]) .logo{background:var(--accent);color:var(--accent-on);box-shadow:0 5px 18px var(--accent-border)}
:root[data-service-theme]:not([data-service-theme="custom"]) .brand-small{background:var(--accent-bg);color:var(--accent)}
:root[data-service-theme]:not([data-service-theme="custom"]) .avatar{background:var(--accent-bg);color:var(--accent)}
:root[data-service-theme]:not([data-service-theme="custom"]) .sidebar-bottom{background:var(--accent-bg);border-color:var(--accent-border);color:var(--ink)}
:root[data-service-theme]:not([data-service-theme="custom"]) .sidebar-bottom p{color:var(--muted)}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.btn-primary,.hc-launch,.tool-launch){background:var(--accent);border-color:var(--accent);color:var(--accent-on)}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.btn-secondary,.btn-inline,.theme-switch,.tool-field select,.hc-field input,.hc-field select,.pall-search){background:var(--paper);color:var(--ink);border-color:var(--line)}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.v099-category-button,.hc-tab,.abcde-v099-tab,.times-v091-tab,.pall-topic,.v08-body-result-card){background:var(--paper);color:var(--ink);border-color:var(--line)}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.v099-category-button[aria-pressed=true],.hc-tab[aria-selected=true],.abcde-v099-tab[aria-selected=true],.times-v091-tab[aria-selected=true],.pall-topic[aria-pressed=true]){background:var(--accent-bg);border-color:var(--accent);color:var(--accent)}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.v099-category-count,.v099-category-heading,.times-v091-panel,.hc-skuv-panel){color:var(--ink);border-color:var(--line)}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.times-v091-panel,.hc-skuv-panel,.v08-timer-display,.v08-formula-guide){background:var(--bg)}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.hc-result-row,.times-v091-sources,.pall-section){border-color:var(--line)}
:root[data-service-theme]:not([data-service-theme="custom"]) .toolbox .tool-tag:not(.soon){background:var(--accent-bg);color:var(--accent)}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.tool-result,.hc-output,.v08-body-results){background:var(--accent-bg);border-color:var(--accent-border)}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.v08-timer-track,.v08-metric-track){background:var(--line)}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(.v08-timer-track span,.v08-timer-tap,.times-v091-reference){border-color:var(--accent)}
:root[data-service-theme]:not([data-service-theme="custom"]) :is(a,button,input,select,textarea):focus-visible{outline-color:var(--accent);outline-offset:2px}
:root[data-service-theme]:not([data-service-theme="custom"]) input[type=range],
:root[data-service-theme]:not([data-service-theme="custom"]) input[type=checkbox],
:root[data-service-theme]:not([data-service-theme="custom"]) input[type=radio]{accent-color:var(--accent)}

/* Preserve the preset identity on dark-mode fields that legacy dark CSS hardcodes. */
:root[data-service-theme="ambulance"][data-theme=dark] :is(input:not([type=radio]):not([type=checkbox]):not([type=range]),select,textarea),
:root[data-service-theme="urgent"][data-theme=dark] :is(input:not([type=radio]):not([type=checkbox]):not([type=range]),select,textarea){
 background:var(--paper);color:var(--ink);border-color:var(--line);
}
:root[data-service-theme="ambulance"][data-theme=dark] :is(input,textarea)::placeholder,
:root[data-service-theme="urgent"][data-theme=dark] :is(input,textarea)::placeholder{color:var(--muted);opacity:1}

/* Prehospital and legevakt must keep intentionally striking neon/yellow primary CTAs.
   Clinical warning/urgent colors stay independent of the selected accent. */
:root[data-service-theme="ambulance"] .btn-primary,
:root[data-service-theme="urgent"] .btn-primary{font-weight:850;box-shadow:0 3px 15px var(--accent-border)}
:root[data-service-theme="ambulance"] .btn-primary:hover,
:root[data-service-theme="urgent"] .btn-primary:hover{filter:brightness(1.06)}
:root[data-service-theme="hospital"] .header{border-bottom:2px solid var(--accent-border)}
:root[data-service-theme="homecare"] .sidebar-bottom{background:#e6f4ec;border-color:#b5d7cd}
:root[data-service-theme="homecare"] .header{border-bottom:2px solid #b4dcd5}

/* Presets live inside the profile drawer – never consume space above NEWS2. */
.service-theme-options{border:0;border-top:1px solid var(--line);margin:22px 0 0;padding:18px 0 0;min-width:0}
.service-theme-options legend{font-size:13px;font-weight:850;color:var(--ink);padding:0 8px 0 0}
.service-theme-intro{font-size:12px;line-height:1.55;margin:1px 0 12px;color:var(--muted)}
.service-theme-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
.service-theme-option{display:grid;grid-template-columns:18px 35px minmax(0,1fr);grid-template-rows:auto auto;align-items:center;column-gap:8px;row-gap:2px;min-height:74px;border:1px solid var(--line);border-radius:12px;padding:10px 9px;background:var(--paper);color:var(--ink);cursor:pointer}
.service-theme-option:has(input:checked){border:2px solid var(--accent);background:var(--accent-bg);padding:9px 8px}
.service-theme-option input{grid-column:1;grid-row:1/3;width:16px;height:16px;margin:0;accent-color:var(--accent)}
.service-theme-preview{grid-column:2;grid-row:1/3;display:block;width:35px;height:44px;border-radius:7px;border:1px solid #0002;background:linear-gradient(155deg,var(--preview-base) 0 66%,var(--preview-highlight) 67% 100%);position:relative;box-shadow:0 2px 8px #0002}
.service-theme-preview::after{content:"";position:absolute;left:5px;right:5px;top:7px;height:3px;border-radius:2px;background:var(--preview-highlight);box-shadow:0 8px 0 var(--preview-highlight)}
.service-theme-label{grid-column:3;grid-row:1;font-size:12px;font-weight:850;line-height:1.2}
.service-theme-option small{grid-column:3;grid-row:2;font-size:10px;color:var(--muted);line-height:1.4}
.service-theme-option:focus-within{outline:3px solid var(--accent-border);outline-offset:1px}
@media(max-width:480px){
 .service-theme-grid{grid-template-columns:1fr}
 .service-theme-option{min-height:62px}
}
@media(prefers-reduced-motion:reduce){.service-theme-option{transition:none!important;animation:none!important}}
