/* Egen kod. Rutinpärm som en pärm med registerflikar: ett papper som går ut över pärmens nederkant, kapitel som flikar i kanten, en rutin öppen som styrt dokument med dokumenthuvud (version, ansvarig, nästa granskning), ändringsmarkering i marginalen, kvittens per anställd och en flik för försenade granskningar. Idén om böcker, kapitel, sidor, versioner och granskning kommer från BookStack (bara idén, ingen kod eller design). Kvittenslistan porterad från affectUI Progress Tracker (Clean), MIT, Copyright (c) 2026 Florian Höller: rubrik med räknare, tunn stapel som växer med scaleX, en rad per person med bock; utan autoplay. affectUIs Clean-mått (13/20 px, hårlinjeskugga, knappar med radie 6 px), Nolmas färger. Referenser i sajt-referenser-ui: Elisavas 75 Challenges via themasterslides-raden (innehållsförteckning med kapitelfärger och prickad linje till sidnummer), react-aria (flikar med piltangenter, Home och End, aria-selected), beautifului Approval Card (granskningsvalet med två knappar), interfaces.rauno.me (fokusring, rörelse under 200 ms, tabular-nums). */
#c-rutiner {
  --rtn-cover: #2A3240;
  --rtn-cover-ink: #FFFFFF;
  --rtn-cover-ink2: rgba(255, 255, 255, 0.76);
  --rtn-page: #FFFDF8;
  --rtn-tab: #E9E5DB;
  --rtn-ink: #1C1B18;
  --rtn-ink2: #3A3833;
  --rtn-mute: #5E5A52;
  --rtn-line: #E8E3D7;
  --rtn-line2: #D7D0C1;
  --rtn-wash: rgba(28, 27, 24, 0.045);
  --rtn-acc: #D9601C;
  --rtn-acc-t: #B4501A;
  --rtn-acc-tint: rgba(217, 96, 28, 0.1);
  --rtn-ok: #3A3833;
  --rtn-ok-tint: rgba(58, 56, 51, 0.08);
  --rtn-solid: #1C1B18;
  --rtn-on-solid: #FFFFFF;
  --rtn-sh: 0 0 0 0.5px rgba(28, 27, 24, 0.08), 0 1px 1px -1px rgba(28, 27, 24, 0.12), 0 1px 2px rgba(28, 27, 24, 0.05);
  --rtn-ease: cubic-bezier(0.22, 1, 0.36, 1);
  box-sizing: border-box;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  container-type: inline-size;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 21px;
  color: var(--rtn-ink);
  text-align: left;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
:where(.dark, [data-theme="dark"]) #c-rutiner {
  --rtn-cover: #1C1B1A;
  --rtn-cover-ink: #F2F1EE;
  --rtn-cover-ink2: rgba(242, 241, 238, 0.7);
  --rtn-page: #121211;
  --rtn-tab: #252422;
  --rtn-ink: #F2F1EE;
  --rtn-ink2: rgba(242, 241, 238, 0.84);
  --rtn-mute: rgba(242, 241, 238, 0.66);
  --rtn-line: rgba(255, 255, 255, 0.08);
  --rtn-line2: rgba(255, 255, 255, 0.15);
  --rtn-wash: rgba(255, 255, 255, 0.05);
  --rtn-acc: #F08A4B;
  --rtn-acc-t: #F08A4B;
  --rtn-acc-tint: rgba(240, 138, 75, 0.12);
  --rtn-ok: #D9D6CF;
  --rtn-ok-tint: rgba(255, 255, 255, 0.08);
  --rtn-solid: #F2F1EE;
  --rtn-on-solid: #111110;
  --rtn-sh: 0 0 0 0.5px rgba(255, 255, 255, 0.09), 0 1px 2px rgba(0, 0, 0, 0.4);
}
#c-rutiner *, #c-rutiner *::before, #c-rutiner *::after { box-sizing: border-box; }
#c-rutiner [hidden] { display: none !important; }
:where(#c-rutiner) :where(h2, h3, h4, p, ul, ol, table) { margin: 0; padding: 0; }
:where(#c-rutiner) :where(ul, ol) { list-style: none; }
:where(#c-rutiner) button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; text-align: left; }
#c-rutiner :focus-visible { outline: 2px solid var(--rtn-acc); outline-offset: 2px; }
#c-rutiner h2:focus { outline: none; }
#c-rutiner h2:focus-visible { outline: none; }
#c-rutiner .rtn-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Pärmen */
.rtn-binder { position: relative; padding: 0; overflow: hidden; border-radius: 14px; background: var(--rtn-cover); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12), 0 26px 60px -34px rgba(0, 0, 0, 0.5); }
.rtn-cover { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 22px; color: var(--rtn-cover-ink); }
.rtn-cover-t { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.rtn-cover-t b { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.rtn-cover-t span { font-size: 14px; color: var(--rtn-cover-ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rtn-cover-u { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--rtn-cover-ink2); white-space: nowrap; }
.rtn-av-x { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); color: var(--rtn-cover-ink); font-size: 12px; font-weight: 600; }
.rtn-inner { display: grid; grid-template-columns: minmax(0, 1fr) 168px; padding-left: 22px; }
.rtn-sheet { position: relative; background: var(--rtn-page); border-radius: 4px 0 0 0; min-width: 0; }
.rtn-page { padding: 26px 40px 0; min-width: 0; }
.rtn-page:focus { outline: none; }

/* Flikar */
.rtn-tabs { display: flex; flex-direction: column; gap: 6px; padding-top: 18px; }
.rtn-tab { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; margin-left: -1px; padding: 8px 12px 8px 16px; border-radius: 0 8px 8px 0; background: var(--rtn-tab); color: var(--rtn-ink2, var(--rtn-ink)); font-weight: 500; line-height: 18px; transition: transform 140ms var(--rtn-ease), background-color 160ms var(--rtn-ease); }
.rtn-tab::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 2px 2px 0; background: var(--rtn-line2); }
.rtn-tab:hover { transform: translateX(3px); }
.rtn-tab:active { transform: translateX(3px) scale(0.97); }
.rtn-tab[aria-selected="true"]::before { background: var(--rtn-acc); }
.rtn-tab[aria-selected="true"] { color: var(--rtn-ink); background: var(--rtn-page); transform: none; margin-left: -6px; padding-left: 22px; box-shadow: 4px 6px 14px -10px rgba(0, 0, 0, 0.5); }
.rtn-tab em { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--rtn-acc-t); color: #FFFFFF; font-style: normal; font-family: var(--mono); font-size: 12px; }
:where(.dark, [data-theme="dark"]) #c-rutiner .rtn-tab em { color: #111110; }
.rtn-tab em.is-zero { background: var(--rtn-ok-tint); color: var(--rtn-ok); }
.rtn-tab-late { margin-top: 14px; }

/* Sidan */
.rtn-run { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 10px; margin-bottom: 22px; border-bottom: 1px solid var(--rtn-line); font-size: 13px; color: var(--rtn-mute); }
.rtn-crumb { color: var(--rtn-mute); text-decoration: underline; text-decoration-color: var(--rtn-line2); text-underline-offset: 3px; }
.rtn-crumb:hover { color: var(--rtn-ink); }
.rtn-page h2 { text-wrap: balance; font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -0.02em; }
.rtn-lead { margin-top: 8px !important; max-width: 60ch; font-size: 15px; line-height: 23px; color: var(--rtn-ink2); }
.rtn-sec { margin-top: 26px; }
.rtn-sec h3 { display: flex; align-items: center; gap: 10px; padding-bottom: 6px; font-size: 16px; font-weight: 600; }
.rtn-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; background: var(--rtn-wash); font-family: var(--mono); font-size: 12px; color: var(--rtn-mute); }
.rtn-chl:hover { text-decoration: underline; text-underline-offset: 3px; }
.rtn-tocl { display: flex; flex-direction: column; }
.rtn-tocl-big { margin-top: 22px !important; }
.rtn-toc { display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 9px 6px; border-radius: 6px; transition: background-color 140ms var(--rtn-ease); }
.rtn-toc:hover { background: var(--rtn-wash); }
.rtn-toc-n { font-weight: 500; flex: none; max-width: 60%; }
.rtn-toc-l { flex: 1; min-width: 16px; border-bottom: 1.5px dotted var(--rtn-line2); transform: translateY(-4px); }
.rtn-toc-v { flex: none; font-family: var(--mono); font-size: 12px; color: var(--rtn-mute); }
.rtn-due { flex: none; font-size: 13px; color: var(--rtn-mute); min-width: 150px; text-align: right; }
.rtn-late { flex: none; font-size: 13px; color: var(--rtn-acc-t); font-weight: 500; }
.rtn-toc .rtn-late { min-width: 150px; text-align: right; }

.rtn-latel { display: flex; flex-direction: column; margin-top: 22px !important; border-top: 1px solid var(--rtn-line); }
.rtn-latel li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--rtn-line); }
.rtn-latei { display: grid; gap: 2px; min-width: 0; }
.rtn-latei b { font-size: 15px; font-weight: 600; }
.rtn-latei span { font-size: 13px; color: var(--rtn-mute); }
.rtn-latei .rtn-late { color: var(--rtn-acc-t); }
.rtn-empty { margin-top: 22px !important; padding: 16px; border-radius: 8px; background: var(--rtn-ok-tint); color: var(--rtn-ok); }

/* Knappar */
.rtn-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 14px; border-radius: 6px; font-size: 13px; font-weight: 500; white-space: nowrap; transition: transform 140ms var(--rtn-ease), background-color 160ms var(--rtn-ease), opacity 160ms; }
.rtn-btn:active:not(:disabled) { transform: scale(0.97); }
.rtn-btn:disabled { opacity: 0.55; cursor: default; }
.rtn-btn-p { background: var(--rtn-solid); color: var(--rtn-on-solid); }
.rtn-btn-s { background: var(--rtn-page); box-shadow: var(--rtn-sh), inset 0 0 0 1px var(--rtn-line2); }
.rtn-btn-s:hover:not(:disabled) { background: var(--rtn-wash); }

/* Rutin */
.rtn-review { display: grid; gap: 10px; margin-bottom: 22px; padding: 14px 16px; border-radius: 8px; background: var(--rtn-acc-tint); box-shadow: inset 3px 0 0 var(--rtn-acc); }
.rtn-review p { color: var(--rtn-ink2); }
.rtn-review b { color: var(--rtn-ink); }
.rtn-review-a { display: flex; flex-wrap: wrap; gap: 8px; }
.rtn-chg { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; min-height: 28px; padding: 0 8px 0 4px; border-radius: 6px; font-size: 13px; color: var(--rtn-ink2); }
.rtn-chg:hover { background: var(--rtn-wash); }
.rtn-chg i { position: relative; width: 26px; height: 16px; border-radius: 8px; background: var(--rtn-line2); transition: background-color 160ms var(--rtn-ease); }
.rtn-chg i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #FFFFFF; transition: transform 160ms var(--rtn-ease); }
.rtn-chg[aria-pressed="true"] i { background: var(--rtn-acc); }
.rtn-chg[aria-pressed="true"] i::after { transform: translateX(10px); }
.rtn-doc { margin-top: 12px; max-width: 64ch; }
.rtn-doc h4 { margin-top: 18px !important; font-size: 14px; font-weight: 600; }
.rtn-doc > p { margin-top: 4px !important; color: var(--rtn-ink2); }
.rtn-steps { counter-reset: s; margin-top: 6px !important; display: grid; gap: 8px; }
.rtn-steps li { position: relative; counter-increment: s; padding-left: 30px; color: var(--rtn-ink2); }
.rtn-steps li::before { content: counter(s) "."; position: absolute; left: 4px; top: 0; font-family: var(--mono); font-size: 13px; color: var(--rtn-mute); }
.rtn-chnote { display: none; font-style: normal; }
.rtn-doc.is-ch .is-changed::after { content: ""; position: absolute; left: -16px; top: 2px; bottom: 2px; width: 3px; border-radius: 2px; background: var(--rtn-acc); }
.rtn-doc.is-ch .is-changed > span { background: var(--rtn-acc-tint); box-decoration-break: clone; -webkit-box-decoration-break: clone; border-radius: 2px; color: var(--rtn-ink); }
.rtn-doc.is-ch .rtn-chnote { display: block; margin-top: 2px; font-size: 12px; color: var(--rtn-acc-t); }
.rtn-hist { margin-top: 20px; font-size: 13px; }
.rtn-hist summary { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; cursor: pointer; color: var(--rtn-ink2); font-weight: 500; list-style: none; }
.rtn-hist summary::-webkit-details-marker { display: none; }
.rtn-hist summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 160ms var(--rtn-ease); margin-right: 4px; }
.rtn-hist[open] summary::before { transform: rotate(45deg); }
.rtn-hist ul { display: grid; gap: 4px; padding: 6px 0 0 16px !important; color: var(--rtn-mute); }
.rtn-hist b { color: var(--rtn-ink); font-weight: 500; }

/* Kvittens: porterad från affectUI Progress Tracker (Clean) */
.rtn-kv { margin-top: 26px; padding: 4px 0 0; border-top: 1px solid var(--rtn-line); }
.rtn-kv-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: 16px; }
.rtn-kv-h h3 { font-size: 15px; font-weight: 600; }
.rtn-kv-c { font-family: var(--mono); font-size: 13px; color: var(--rtn-mute); }
.rtn-kv-c b { color: var(--rtn-ink); font-weight: 500; }
.rtn-bar { position: relative; height: 4px; margin-top: 10px; border-radius: 2px; background: var(--rtn-line); overflow: hidden; }
.rtn-bar span { position: absolute; inset: 0; background: var(--rtn-ok); transform-origin: left; transition: transform 200ms var(--rtn-ease); }
.rtn-kv-a { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.rtn-kv-me { font-size: 13px; color: var(--rtn-ok); font-weight: 500; }
.rtn-ackl { display: grid; margin-top: 6px !important; max-width: 560px; }
.rtn-ackw { max-height: 204px; overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 48px), transparent); }
.rtn-ackw.is-open { max-height: none; -webkit-mask-image: none; mask-image: none; padding-bottom: 20px; }
.rtn-more { margin-left: auto; min-height: 34px; padding: 0 8px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--rtn-ink2); text-decoration: underline; text-decoration-color: var(--rtn-line2); text-underline-offset: 3px; }
.rtn-more:hover { color: var(--rtn-ink); }
.rtn-meta { margin-top: 6px !important; font-size: 13px; color: var(--rtn-mute); text-wrap: pretty; }
.rtn-fel { margin-top: 18px !important; font-size: 13px; color: var(--rtn-ink2); }
.rtn-fel b { font-weight: 600; color: var(--rtn-ink); }
.rtn-ack { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 0.5px solid var(--rtn-line); }
.rtn-check { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1.2px var(--rtn-line2); }
.rtn-check svg { width: 16px; height: 16px; fill: none; stroke: var(--rtn-on-solid); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.rtn-ack.is-done .rtn-check { background: var(--rtn-ok); box-shadow: none; }
.rtn-ack.is-done .rtn-check svg { opacity: 1; stroke: var(--rtn-page); }
:where(.dark, [data-theme="dark"]) #c-rutiner .rtn-ack.is-done .rtn-check svg { stroke: #111110; }
.rtn-ack-n { display: grid; min-width: 0; }
.rtn-ack-n b { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rtn-ack-n span { font-size: 12px; line-height: 16px; color: var(--rtn-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rtn-ack-s { font-size: 13px; color: var(--rtn-mute); text-align: right; }
.rtn-ack:not(.is-done) .rtn-ack-s { color: var(--rtn-acc-t); }
.rtn-ack.is-me .rtn-ack-n b { color: var(--rtn-ink); }

@media (prefers-reduced-motion: reduce) {
  #c-rutiner *, #c-rutiner *::before, #c-rutiner *::after { transition-duration: 0ms !important; }
}

@container (max-width: 900px) {
  .rtn-inner { grid-template-columns: minmax(0, 1fr) 140px; }
}
@container (max-width: 640px) {
  .rtn-cover { padding: 12px 14px; }
  .rtn-cover-u span:last-child { display: none; }
  .rtn-inner { display: flex; flex-direction: column; padding: 0 0 0 10px; }
  .rtn-tabs { order: -1; flex-direction: row; gap: 4px; padding: 0 4px; overflow-x: auto; scrollbar-width: none; }
  .rtn-tab { flex: none; min-height: 40px; margin: 0; padding: 8px 12px; border-radius: 8px 8px 0 0; white-space: nowrap; }
  .rtn-tab::before { left: 8px; right: 8px; top: 0; bottom: auto; width: auto; height: 3px; border-radius: 0 0 2px 2px; }
  .rtn-tab:hover, .rtn-tab:active { transform: none; }
  .rtn-tab[aria-selected="true"] { margin: 0; padding-left: 12px; box-shadow: none; }
  .rtn-tab-late { margin-top: 0; }
  .rtn-sheet { border-radius: 4px 0 0 0; }
  .rtn-page { padding: 16px 16px 0; }
  .rtn-run { flex-direction: column; gap: 2px; margin-bottom: 16px; }
  .rtn-page h2 { font-size: 23px; line-height: 29px; }
  .rtn-toc-n { max-width: none; flex: 1 1 100%; }
  .rtn-toc-l { display: none; }
  .rtn-due, .rtn-toc .rtn-late { min-width: 0; text-align: left; }
  .rtn-latel li { flex-direction: column; align-items: flex-start; gap: 10px; }
  .rtn-doc.is-ch .is-changed::after { left: -10px; }
  .rtn-ack-n span { display: none; }
  .rtn-ackw { max-height: 170px; }
  .rtn-steps { gap: 6px; }
  .rtn-cover-t { flex-direction: row; gap: 8px; }
}

/* Ikoner: kontur 1,5 px oavsett skala (BRIEF7) */
#c-rutiner svg :is(path, circle, rect, line, polyline, polygon) { vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
