/* Femfot – gränssnitt
   Sval neutral bas, petrolgrön primärfärg, varselgult endast för prio.
   Statusfärger kommer från databasen via --st. */

:root {
  --bas: #F1F4F3;
  --yta: #FFFFFF;
  --yta-2: #F7F9F8;
  --linje: #D3DBD8;
  --linje-svag: #E4E9E7;
  --text: #17211F;
  --dampad: #5A6763;
  --primar: #1F5C57;
  --primar-mork: #154340;
  --primar-ljus: #E3EFED;
  --varsel: #E4A11B;
  --varsel-ljus: #FDF3DC;
  --fara: #A23B3B;
  --fara-ljus: #F8E8E8;
  --ok: #2E7D50;
  --ok-ljus: #E5F3EA;
  --fokus: #1B6FD1;
  --radie: 6px;
  --radie-liten: 4px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sidomeny: 232px;
  --topp: 56px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bas);
  font-feature-settings: "tnum" 1;
}
a { color: var(--primar); text-underline-offset: 2px; }
a:hover { color: var(--primar-mork); }
:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
code, pre { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: .9em; }
[hidden] { display: none !important; }
.dold { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dampad { color: var(--dampad); }
.hoppa { position: absolute; left: -999px; top: 0; background: var(--yta); padding: .5rem 1rem; z-index: 100; }
.hoppa:focus { left: .5rem; top: .5rem; }

/* ---------- Ramverk ---------- */

body.app {
  display: grid;
  grid-template-columns: var(--sidomeny) minmax(0, 1fr);
  grid-template-rows: var(--topp) 1fr;
  grid-template-areas: "topp topp" "meny innehall";
  min-height: 100vh;
  background: linear-gradient(to right, var(--yta) calc(var(--sidomeny) - 1px), var(--linje) calc(var(--sidomeny) - 1px), var(--linje) var(--sidomeny), var(--bas) var(--sidomeny));
}
.toppen {
  grid-area: topp;
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1rem;
  background: var(--primar-mork);
  color: #fff;
  position: sticky; top: 0; z-index: 20;
}
.logga { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; color: inherit; text-decoration: none; font-size: 1.05rem; letter-spacing: .01em; }
.toppen .logga:hover { color: #fff; }
.logga-ruta {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 5px;
  background: #fff; color: var(--primar-mork); font-weight: 800; font-size: .95rem;
}
.logga.stor { font-size: 1.3rem; color: var(--primar-mork); margin-bottom: 1.5rem; }
.logga.stor .logga-ruta { background: var(--primar); color: #fff; width: 34px; height: 34px; }
.snabbsok { flex: 1; max-width: 520px; }
.snabbsok input {
  width: 100%; height: 36px; border: 0; border-radius: var(--radie);
  padding: 0 .8rem; font: inherit; background: rgba(255,255,255,.12); color: #fff;
}
.snabbsok input::placeholder { color: rgba(255,255,255,.7); }
.snabbsok input:focus { background: #fff; color: var(--text); outline-color: var(--varsel); }
.anvandare { margin-left: auto; display: flex; align-items: center; gap: .9rem; font-size: .9rem; white-space: nowrap; }
.anvandare form { margin: 0; }
.anvandare .lank { color: #fff; }
.menyknapp { display: none; }

.sidomeny {
  grid-area: meny;
  background: var(--yta);
  border-right: 1px solid var(--linje);
  align-self: start;
  padding: 1rem .6rem 2rem;
  position: sticky; top: var(--topp);
  height: calc(100vh - var(--topp));
  overflow-y: auto;
}
.navgrupp + .navgrupp { margin-top: 1.1rem; }
.navgrupp h3 { font-size: .8rem; font-weight: 600; color: var(--dampad); margin: 0 .6rem .3rem; }
.navgrupp ul { list-style: none; margin: 0; padding: 0; }
.navgrupp a {
  display: block; padding: .38rem .6rem; border-radius: var(--radie-liten);
  color: var(--text); text-decoration: none;
}
.navgrupp a:hover { background: var(--yta-2); }
.navgrupp a[aria-current] { background: var(--primar-ljus); color: var(--primar-mork); font-weight: 600; box-shadow: inset 3px 0 0 var(--primar); }

.innehall { grid-area: innehall; min-width: 0; padding: 1.5rem 2rem 4rem; max-width: 1240px; width: 100%; }

/* ---------- Sidhuvud och avsnitt ---------- */

.sidhuvud { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.sidhuvud h1 { margin: 0; }
.knappar { display: flex; gap: .5rem; flex-wrap: wrap; }
.brodsmulor { font-size: .88rem; margin-bottom: .4rem; display: flex; gap: .4rem; flex-wrap: wrap; color: var(--dampad); }
.brodsmulor a { color: var(--dampad); }
.filterrad { margin: .3rem 0 0; color: var(--dampad); }
.markering { display: inline-block; margin: .4rem 0 0; padding: .1rem .5rem; border-radius: var(--radie-liten); background: var(--linje-svag); color: var(--dampad); font-size: .85rem; }

.avsnitt { margin-top: 2rem; }
.avsnittshuvud { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.avsnittshuvud h2 { margin: 0; }
.antal { color: var(--dampad); font-weight: 500; font-size: .9rem; margin-left: .25rem; }

.tomt { background: var(--yta); border: 1px dashed var(--linje); border-radius: var(--radie); padding: 2.5rem 1.5rem; text-align: center; }
.tomt h2 { font-size: 1.15rem; }
.tomt p { color: var(--dampad); margin: 0; }

/* ---------- Knappar ---------- */

.knapp {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 38px; padding: 0 1rem;
  border: 1px solid var(--linje); border-radius: var(--radie);
  background: var(--yta); color: var(--text);
  font: inherit; font-weight: 550; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.knapp:hover { border-color: var(--dampad); color: var(--text); }
.knapp.primar { background: var(--primar); border-color: var(--primar); color: #fff; }
.knapp.primar:hover { background: var(--primar-mork); border-color: var(--primar-mork); }
.knapp.fara { color: var(--fara); border-color: #E2C3C3; }
.knapp.fara:hover { background: var(--fara-ljus); border-color: var(--fara); }
.knapp.liten { min-height: 32px; padding: 0 .7rem; font-size: .88rem; }
.knapp.bred { width: 100%; }
.lank { background: none; border: 0; padding: 0; font: inherit; color: var(--primar); text-decoration: underline; cursor: pointer; }
.lank.fara { color: var(--fara); }

/* ---------- Meddelanden ---------- */

.meddelande { padding: .7rem 1rem; border-radius: var(--radie); margin-bottom: 1rem; border-left: 4px solid var(--ok); background: var(--ok-ljus); }
.meddelande.fel { border-left-color: var(--fara); background: var(--fara-ljus); }

/* ---------- Tabeller ---------- */

.tabellram { position: relative; background: var(--yta); border: 1px solid var(--linje); border-radius: var(--radie); overflow-x: auto; }
table.lista { width: 100%; border-collapse: collapse; }
.lista th, .lista td { padding: .55rem .8rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--linje-svag); }
.lista thead th { font-size: .82rem; font-weight: 600; color: var(--dampad); background: var(--yta-2); border-bottom-color: var(--linje); white-space: nowrap; }
.lista tbody tr:last-child td { border-bottom: 0; }
.lista tbody tr:hover { background: #FAFCFB; }
.lista tfoot th, .lista tfoot td { border-top: 1px solid var(--linje); border-bottom: 0; background: var(--yta-2); }
.lista .tal { text-align: right; white-space: nowrap; }
.lista .datum { white-space: nowrap; }
.radlank { font-weight: 600; }
tr.inaktiv td { color: var(--dampad); }
tr.prio td:first-child { box-shadow: inset 4px 0 0 var(--varsel); }
.prio-markering { display: inline-block; padding: 0 .4rem; border-radius: 3px; background: var(--varsel); color: #2B1E00; font-size: .78rem; font-weight: 700; vertical-align: 2px; }
.lista form { margin: 0; }

.status {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .05rem .5rem .05rem .4rem; border-radius: 3px;
  background: color-mix(in srgb, var(--st) 12%, white);
  color: color-mix(in srgb, var(--st) 80%, black);
  font-size: .83rem; font-weight: 600; white-space: nowrap;
}
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--st); }

.sidnav { display: flex; gap: 1rem; align-items: center; justify-content: flex-end; padding: .7rem .2rem; color: var(--dampad); font-size: .9rem; }

/* ---------- Verktygsrad och filter ---------- */

.verktygsrad { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.verktygsrad input[type=search] { flex: 1 1 280px; }
.verktygsrad select { flex: 0 1 220px; }
.kryss-inline { display: inline-flex; align-items: center; gap: .35rem; font-size: .92rem; white-space: nowrap; }

.statusfilter { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .9rem; }
.statusfilter a {
  display: inline-flex; gap: .4rem; align-items: center;
  padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--linje);
  background: var(--yta); color: var(--text); text-decoration: none; font-size: .88rem;
}
.statusfilter a span { color: var(--dampad); font-size: .82rem; }
.statusfilter a[style]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--st); }
.statusfilter a[aria-current] { background: var(--primar-mork); border-color: var(--primar-mork); color: #fff; }
.statusfilter a[aria-current] span { color: rgba(255,255,255,.75); }

/* ---------- Formulär ---------- */

input, select, textarea {
  font: inherit; color: var(--text);
  border: 1px solid var(--linje); border-radius: var(--radie-liten);
  background: var(--yta); padding: .45rem .6rem; min-height: 38px; width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primar); outline: 2px solid color-mix(in srgb, var(--primar) 25%, transparent); outline-offset: 0; }
input[aria-invalid], select[aria-invalid], textarea[aria-invalid] { border-color: var(--fara); }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primar); margin: 0; }

.formular { max-width: 960px; }
.formular fieldset { min-width: 0; border: 0; border-top: 1px solid var(--linje); margin: 0 0 1.4rem; padding: 1rem 0 0; }
.formular legend { font-weight: 650; font-size: 1.02rem; padding: 0 .5rem 0 0; }
.faltgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem 1.1rem; }
.falt { display: flex; flex-direction: column; gap: .3rem; }
.falt.bred { grid-column: 1 / -1; }
.falt label, .falt .etikett { font-weight: 550; font-size: .9rem; }
.falt.kryss label { display: flex; gap: .5rem; align-items: center; font-weight: 500; }
.falt.kryss { justify-content: flex-end; padding-bottom: .5rem; }
.krav { color: var(--fara); }
.hjalp { font-size: .83rem; color: var(--dampad); margin: 0; }
.fel { font-size: .85rem; color: var(--fara); margin: 0; font-weight: 550; }
.lasvarde { padding: .45rem 0; color: var(--dampad); }
.formknappar { display: flex; gap: .6rem; margin-top: 1.4rem; flex-wrap: wrap; }

/* ---------- Detaljvy ---------- */

.uppgifter {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0; margin: 0;
  background: var(--yta); border: 1px solid var(--linje); border-radius: var(--radie);
}
.uppgifter > div { padding: .7rem 1rem; border-bottom: 1px solid var(--linje-svag); }
.uppgifter > div.bred { grid-column: 1 / -1; }
.uppgifter dt { font-size: .8rem; color: var(--dampad); font-weight: 550; margin-bottom: .1rem; }
.uppgifter dd { margin: 0; overflow-wrap: anywhere; }
.uppgifter.smal { grid-template-columns: 1fr; }
.uppgifter.smal > div { padding: .55rem .9rem; }

.farozon { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--linje); display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }

/* ---------- Arbetsorder ---------- */

.aonr { margin: 0 0 .2rem; font-weight: 600; color: var(--dampad); font-size: .92rem; }
.platsrad { margin: .35rem 0 0; color: var(--dampad); }
.ao-kolumner { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2rem; align-items: start; }
.ao-kolumner aside { position: sticky; top: calc(var(--topp) + 1rem); margin-top: 2rem; }
.lopande { max-width: 70ch; white-space: normal; }

/* Statusrälsen – det enda framträdande elementet: var arbetet befinner sig i flödet. */
.statusrals { background: var(--yta); border: 1px solid var(--linje); border-radius: var(--radie); padding: 1rem 1rem .9rem; }
.statusrals ol { list-style: none; display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin: 0; padding: 0; counter-reset: steg; }
.statusrals li { position: relative; padding-top: 14px; font-size: .8rem; color: var(--dampad); text-align: center; }
.statusrals li::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 8px; border-radius: 2px;
  background: var(--linje-svag);
}
.statusrals li.klar::before { background: color-mix(in srgb, var(--st) 45%, white); }
.statusrals li.nu::before { background: var(--st); height: 10px; top: -1px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--st) 22%, transparent); }
.statusrals li.nu { color: var(--text); font-weight: 700; font-size: .88rem; }
.statusrals li.klar { color: var(--text); }
.statusknappar { display: flex; flex-wrap: wrap; gap: .5rem; margin: .9rem 0 0; padding-top: .9rem; border-top: 1px solid var(--linje-svag); }
.makulerad { margin: 0; color: var(--fara); font-weight: 600; }

.radformular { margin-top: .9rem; background: var(--yta); border: 1px solid var(--linje); border-radius: var(--radie); }
.radformular summary { padding: .7rem 1rem; cursor: pointer; font-weight: 600; color: var(--primar); }
.radformular[open] summary { border-bottom: 1px solid var(--linje-svag); }
.radformular form { padding: 1rem; }
.radformular .faltgrid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.radformular .formknappar { margin-top: 1rem; }

.kommentar { display: flex; gap: .5rem; margin-bottom: 1rem; }
.logg { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--linje); }
.logg li { position: relative; padding: .35rem 0 .6rem .8rem; }
.logg li::before { content: ""; position: absolute; left: -1.38rem; top: .75rem; width: 10px; height: 10px; border-radius: 50%; background: var(--yta); border: 2px solid var(--linje); }
.logg time { color: var(--dampad); font-size: .85rem; margin-right: .3rem; }
.loggtext { display: block; margin-top: .15rem; }


/* ---------- Rutiner ---------- */

.markering.liten { margin: 0 0 0 .3rem; padding: 0 .4rem; font-size: .78rem; vertical-align: 1px; }
.schemaruta { background: var(--yta); border: 1px solid var(--linje); border-radius: var(--radie); padding: 1rem; }
.schemahuvud { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.schemahuvud h2 { margin-bottom: .2rem; }
.schemahuvud p { margin: 0; }
.pausform { display: flex; gap: .5rem; align-items: center; margin: 0; }
.pausform input { width: 220px; }

/* Årets veckor som ett band – valda veckor fyllda, aktuell vecka markerad */
.veckorutnat { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(53, minmax(0, 1fr)); gap: 2px; }
.veckorutnat li { height: 30px; display: grid; place-items: end center; padding-bottom: 2px; background: var(--linje-svag); border-radius: 2px; font-size: .62rem; color: var(--dampad); }
.veckorutnat li.vald { background: var(--primar); color: #fff; font-weight: 600; }
.veckorutnat li.text { box-shadow: inset 0 3px 0 var(--varsel); }
.veckorutnat li.nu { outline: 2px solid var(--text); outline-offset: 1px; }
.veckotexter { list-style: none; margin: .8rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; font-size: .9rem; }

.schemafalt .etikett { font-weight: 550; font-size: .9rem; margin: 1rem 0 .4rem; }
.veckoval { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 4px; max-width: 760px; }
.veckoval label { position: relative; }
.veckoval input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.veckoval span { display: grid; place-items: center; height: 36px; border: 1px solid var(--linje); border-radius: var(--radie-liten); background: var(--yta); font-weight: 550; font-size: .9rem; }
.veckoval input:checked + span { background: var(--primar); border-color: var(--primar); color: #fff; }
.veckoval input:focus-visible + span { outline: 3px solid var(--fokus); outline-offset: 2px; }
.veckoknappar { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.veckotextval { margin-top: 1rem; }
.veckotextval summary { cursor: pointer; font-weight: 600; color: var(--primar); }
.veckotextgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .6rem 1rem; margin-top: .6rem; }
.verktygsrad .falt { flex: 0 0 auto; }
.verktygsrad .falt > input, .verktygsrad .falt > select { flex: none; }
.verktygsrad .falt input { width: 110px; }
.verktygsrad:has(.falt) { align-items: flex-end; }


/* ---------- Underhållsplan ---------- */

.filterrutor { align-items: flex-end; }
.filterrutor .falt select { width: auto; min-width: 140px; max-width: 220px; }
.filterrutor .falt input[type=search] { width: 180px; }
.markering.varning { background: var(--varsel-ljus); color: #5A3E00; }

/* Årssummor som staplar – visar var pengarna ligger i tiden */
.uh-summering ol { list-style: none; margin: 0 0 1.2rem; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(84px, 1fr); gap: 4px; overflow-x: auto; }
.uh-summering li { position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 108px; padding: .5rem .6rem; background: var(--yta); border: 1px solid var(--linje); border-radius: var(--radie-liten); overflow: hidden; }
.uh-summering .stapel { position: absolute; left: 0; right: 0; bottom: 0; height: var(--h); background: var(--primar-ljus); z-index: 0; }
.uh-summering .ar, .uh-summering .belopp, .uh-summering .antal { position: relative; z-index: 1; }
.uh-summering .ar { font-size: .82rem; color: var(--dampad); font-weight: 600; }
.uh-summering .belopp { font-weight: 700; font-size: 1rem; white-space: nowrap; }
.uh-summering .antal { font-size: .78rem; color: #5A3E00; }
.uh-summering li.iar { border-color: var(--primar); box-shadow: inset 0 3px 0 var(--primar); }
.uh-summering li.eftersatt { background: var(--varsel-ljus); border-color: #EED7A1; }
.uh-summering li.eftersatt a { display: contents; color: inherit; text-decoration: none; }

.uh-matris th, .uh-matris td { white-space: nowrap; }
.uh-matris td:first-child { white-space: normal; min-width: 240px; }
.uh-matris td:first-child .dampad { display: block; font-size: .84rem; }
.uh-matris .grupprad th { background: var(--yta-2); font-size: .88rem; font-weight: 650; color: var(--text); padding-top: .7rem; }
.uh-matris .iar { background: color-mix(in srgb, var(--primar) 5%, transparent); }
.uh-matris .cell { display: inline-block; padding: .05rem .45rem; border-radius: 3px; background: var(--primar-ljus); color: var(--primar-mork); font-weight: 600; }
.uh-matris .uh-beslutad .cell { background: color-mix(in srgb, #6A5ACD 16%, white); color: #3B2F8F; }
.uh-matris .uh-bestalld .cell { background: color-mix(in srgb, #8A6D3B 16%, white); color: #5B4520; }
.uh-matris .uh-utford .cell { background: var(--ok-ljus); color: #1E5C38; }
.uh-matris .uh-struken td { color: var(--dampad); }
.uh-matris .uh-struken .cell { background: none; text-decoration: line-through; color: var(--dampad); }
.uh-matris td.eftersatt { background: color-mix(in srgb, var(--varsel) 10%, transparent); }
.prio-1 { color: var(--fara); font-weight: 650; }
.prio-2 { color: #8A5A00; font-weight: 600; }

.uh-huvud { background: var(--yta); border: 1px solid var(--linje); border-radius: var(--radie); padding: 1rem; }
.uh-nyckeltal { display: flex; flex-wrap: wrap; gap: 1rem 2.2rem; }
.uh-nyckeltal > div { display: flex; flex-direction: column; gap: .15rem; }
.uh-nyckeltal .etikett { font-size: .8rem; color: var(--dampad); font-weight: 550; }
.uh-nyckeltal strong { font-size: 1.15rem; }
.uh-huvud .statusknappar { align-items: flex-start; }
.uh-huvud .statusknappar form { margin: 0; }
.flytta { position: relative; }
.flytta summary { list-style: none; }
.flytta summary::-webkit-details-marker { display: none; }
.flytta[open] form { position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; width: 300px; background: var(--yta); border: 1px solid var(--linje); border-radius: var(--radie); padding: .9rem; display: flex; flex-direction: column; gap: .7rem; box-shadow: 0 6px 20px rgba(23, 33, 31, .12); }
.ao-koppling { margin: .9rem 0 0; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.kedja { list-style: none; margin: 0 0 .6rem; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.kedja li { display: flex; gap: .4rem; align-items: center; padding: .3rem .6rem; border: 1px solid var(--linje); border-radius: var(--radie-liten); background: var(--yta); }
.kedja li[aria-current] { border-color: var(--primar); box-shadow: inset 0 0 0 1px var(--primar); }


/* ---------- Ekonomi ---------- */

.ekokort { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.ekokort-post { display: flex; flex-direction: column; gap: .15rem; padding: .9rem 1rem; background: var(--yta); border: 1px solid var(--linje); border-radius: var(--radie); color: var(--text); text-decoration: none; }
.ekokort-post:hover { border-color: var(--primar); color: var(--text); }
.ekokort-post .t { font-weight: 600; font-size: .92rem; }
.ekokort-post .n { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.ekokort-post .s { font-weight: 600; color: var(--primar-mork); }
.ekokort-post .txt { font-size: .84rem; color: var(--dampad); }
.ekokort-post.tom .n { color: var(--dampad); }
.ekokort-post[aria-disabled] { pointer-events: none; opacity: .6; }

.faktura header { align-items: flex-start; }
.faktura .avsandare { font-weight: 600; }
.fakturahuvud, .referenser { width: auto !important; border-collapse: collapse; }
.fakturahuvud th, .referenser th { text-align: left; font-weight: 600; padding: .5mm 4mm .5mm 0; }
.fakturahuvud td, .referenser td { padding: .5mm 0; }
.fakturaparter { display: grid; grid-template-columns: 1fr 1fr; gap: 8mm; margin-bottom: 8mm; }
.mottagare { border: 1px solid #999; padding: 4mm; min-height: 28mm; }
.fakturasumma { width: 50% !important; margin: 4mm 0 0 auto; }
.fakturasumma th { text-align: left; font-weight: 500; padding: 1mm 0; }
.fakturasumma td { text-align: right; padding: 1mm 0; }
.fakturasumma .att-betala th, .fakturasumma .att-betala td { font-weight: 700; font-size: 12pt; border-top: 2px solid #000; padding-top: 2mm; }
.fakturafot { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4mm; margin-top: 14mm; padding-top: 3mm; border-top: 1px solid #000; font-size: 9pt; }
.fakturafot span { display: block; color: #555; }


/* ---------- Avtal ---------- */

.lage { display: inline-block; padding: .05rem .5rem; border-radius: 3px; font-size: .84rem; font-weight: 600; white-space: nowrap; }
.lage-ok { background: var(--ok-ljus); color: #1E5C38; }
.lage-bevaka { background: var(--varsel-ljus); color: #5A3E00; }
.lage-utgatt { background: var(--fara-ljus); color: var(--fara); }
.lagerad { margin: .9rem 0 0; padding: .55rem .8rem; border-radius: var(--radie-liten); font-weight: 600; }
.lagerad.lage-ok { display: none; }
.avtal-huvud.varnar { border-color: #EED7A1; box-shadow: inset 4px 0 0 var(--varsel); }
.omfattning { list-style: none; margin: 0 0 .6rem; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.omfattning li { display: flex; gap: 1rem; align-items: center; justify-content: space-between; padding: .5rem .8rem; background: var(--yta); border: 1px solid var(--linje-svag); border-radius: var(--radie-liten); }
.omfattning form { margin: 0; }

/* ---------- Översikt ---------- */

.flodesoversikt ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 0; background: var(--yta); border: 1px solid var(--linje); border-radius: var(--radie); overflow: hidden; }
.flodesoversikt li + li { border-left: 1px solid var(--linje-svag); }
.flodesoversikt a { display: flex; flex-direction: column; padding: .9rem 1rem .8rem; text-decoration: none; color: var(--text); box-shadow: inset 0 4px 0 var(--st); height: 100%; }
.flodesoversikt a:hover { background: var(--yta-2); }
.flodesoversikt .n { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.flodesoversikt .t { color: var(--dampad); font-size: .88rem; }

.bevakning { margin-top: 1rem; background: var(--varsel-ljus); border: 1px solid #EED7A1; border-radius: var(--radie); padding: .8rem 1rem .1rem; }
.bevakning a { color: #5A3E00; }

/* ---------- Inloggning ---------- */

body.utloggad { display: grid; place-items: center; min-height: 100vh; padding: 1rem; background: var(--primar-mork); }
body.utloggad .innehall { padding: 0; max-width: 420px; }
.loginruta { background: var(--yta); border-radius: 8px; padding: 2rem; width: 100%; }
.loginruta.bredare { max-width: 720px; }
body.utloggad .innehall:has(.bredare) { max-width: 720px; }
.loginruta .falt { margin-bottom: 1rem; }
.loginruta .knapp.bred { margin-top: .5rem; }
pre.kod { background: var(--yta-2); border: 1px solid var(--linje); padding: 1rem; overflow-x: auto; border-radius: var(--radie); }

/* ---------- Utskrift ---------- */

body.utskrift { background: #e9eceb; }
body.utskrift .innehall { max-width: 210mm; margin: 0 auto; padding: 1rem; overflow-x: auto; }
.utskriftsverktyg { margin-bottom: 1rem; display: flex; gap: .5rem; }
.blankett { background: #fff; padding: 16mm 14mm; color: #000; font-size: 11pt; }
.blankett header { display: flex; justify-content: space-between; border-bottom: 2px solid #000; padding-bottom: 4mm; margin-bottom: 6mm; }
.blankett header p { margin: 0; }
.blankett .hoger { text-align: right; }
.blankett h1 { font-size: 20pt; margin: 0; }
.blankett h2 { font-size: 14pt; margin: 0 0 3mm; }
.blankett h3 { font-size: 11pt; margin: 6mm 0 2mm; }
.blankett table { width: 100%; border-collapse: collapse; }
.blankett-info th, .blankett-info td { border: 1px solid #999; padding: 2mm 3mm; text-align: left; vertical-align: top; }
.blankett-info th { width: 18%; background: #f2f2f2; font-weight: 600; }
.blankett-rader th, .blankett-rader td { border: 1px solid #999; padding: 2mm 3mm; text-align: left; }
.blankett-rader .tal { text-align: right; }
.blankett-rader .tomrad td { height: 9mm; }
.signatur { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8mm; margin-top: 14mm; }
.signatur div { border-top: 1px solid #000; padding-top: 1.5mm; font-size: 9pt; }

@media print {
  @page { size: A4; margin: 0; }
  body.utskrift { background: #fff; }
  body.utskrift .innehall { padding: 0; max-width: none; }
  .utskriftsverktyg { display: none; }
}

/* ---------- Mobil ---------- */

@media (max-width: 900px) {
  .ao-kolumner { grid-template-columns: minmax(0, 1fr); }
  .ao-kolumner aside { position: static; margin-top: 2rem; }
}

@media (max-width: 760px) {
  body.app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "topp" "innehall"; background: var(--bas); }
  .toppen { gap: .6rem; padding: 0 .75rem; }
  .menyknapp {
    display: inline-flex; align-items: center; height: 34px; padding: 0 .7rem;
    border: 1px solid rgba(255,255,255,.35); border-radius: var(--radie); background: none; color: #fff; font: inherit; font-weight: 600;
  }
  .toppen .logga { font-size: 0; gap: 0; }
  .anvandare span { display: none; }
  .sidomeny {
    position: fixed; top: var(--topp); left: 0; bottom: 0; width: min(300px, 85vw); height: auto;
    transform: translateX(-100%); transition: transform .2s ease; z-index: 15; box-shadow: none;
  }
  .sidomeny.oppen { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .innehall { padding: 1rem 1rem 3rem; }
  h1 { font-size: 1.35rem; }
  .statusrals ol { grid-template-columns: repeat(4, 1fr); row-gap: .7rem; }
  .flodesoversikt ol { grid-template-columns: repeat(4, 1fr); }
  .flodesoversikt li:nth-child(4n+1) { border-left: 0; }
  .flodesoversikt li:nth-child(n+5) { border-top: 1px solid var(--linje-svag); }
  .flodesoversikt a { padding: .7rem .6rem; }
  .flodesoversikt .n { font-size: 1.35rem; }
  .lista th, .lista td { padding: .5rem .55rem; }
  .knapp { min-height: 42px; }
  .kommentar { flex-direction: column; }
  .veckorutnat { grid-template-columns: repeat(14, minmax(0, 1fr)); }
  .pausform { width: 100%; }
  .filterrutor .falt, .filterrutor .falt select, .filterrutor .falt input[type=search] { width: 100%; max-width: none; }
  .flytta[open] form { width: min(300px, 85vw); }
  .pausform input { flex: 1; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
