/* Komplement till Pico CSS. Färgroller för grafer enligt referenspaletten (ljust/mörkt läge). */
:root {
  --serie-1: #2a78d6;  /* EP totalt */
  --serie-2: #eb6834;  /* EP fjärrvärme */
  --serie-3: #1baf7a;  /* EP el */
  --text-2: #52514e;
  --rutnat: #e6e5e0;
  --ok: #1a7f37;
  --over: #c62828;
  --varning: #9a6700;
  --pico-font-size: 95%;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --serie-1: #3987e5;
    --serie-2: #d95926;
    --serie-3: #199e70;
    --text-2: #c3c2b7;
    --rutnat: #34332f;
    --ok: #4ac26b;
    --over: #ff7b72;
    --varning: #d29922;
  }
}
:root[data-theme="dark"] {
  --serie-1: #3987e5;
  --serie-2: #d95926;
  --serie-3: #199e70;
  --text-2: #c3c2b7;
  --rutnat: #34332f;
  --ok: #4ac26b;
  --over: #ff7b72;
  --varning: #d29922;
}

main.container-fluid, header.container-fluid { max-width: 1400px; }
.sidhuvud { border-bottom: 1px solid var(--pico-muted-border-color); margin-bottom: 1rem; }
.sidhuvud .logga { text-decoration: none; }
.anvandare { color: var(--pico-muted-color); }
form.inline { margin: 0; }
button.liten, [role="button"].liten, .liten { padding: 0.3rem 0.7rem; font-size: 0.85rem; }

.rubrikrad { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem 1rem; margin-bottom: 0.5rem; }
.rubrikrad h1, .rubrikrad h2, .rubrikrad hgroup { margin-bottom: 0; }
.knappar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.knappar > * { margin-bottom: 0; width: auto; }
section { margin-top: 2rem; }

.tabellram { overflow-x: auto; }
th.tal, td.tal { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
input.tal { text-align: right; font-variant-numeric: tabular-nums; }
table.kompakt th, table.kompakt td { padding: 0.35rem 0.5rem; font-size: 0.9rem; }
td.uppskattat { font-style: italic; color: var(--pico-muted-color); }

.smal { max-width: 40rem; }
.falt-grupper { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 0 2rem; }
.obl { color: var(--over); }
.falt-fel { color: var(--over) !important; }
.kryss { margin-bottom: 1rem; }

.felruta, .okruta { padding: 0.6rem 1rem; border-radius: var(--pico-border-radius); border-left: 4px solid; }
.felruta { border-color: var(--over); background: color-mix(in srgb, var(--over) 10%, transparent); }
.varningsruta { padding: 0.6rem 1rem; border-radius: var(--pico-border-radius); border-left: 4px solid var(--varning); background: color-mix(in srgb, var(--varning) 10%, transparent); margin-bottom: 1rem; }
.okruta { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.anteckning { white-space: pre-line; color: var(--pico-muted-color); }

.inloggning { max-width: 24rem; margin: 3rem auto; }

/* Status och flaggor: ikon + text, färg är bara förstärkning. */
.status { font-weight: 600; white-space: nowrap; }
.status.ok { color: var(--ok); }
.status.over { color: var(--over); }
.status.ingen { color: var(--pico-muted-color); font-weight: normal; }
.flaggor { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; font-size: 0.85rem; color: var(--pico-muted-color); }
.flaggor li { list-style: none; margin: 0; }
.flaggor .varning { color: var(--varning); }
.period { margin-bottom: 0.75rem; }
.period .status { margin-left: 0.75rem; }

.nyckeltal { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; margin-bottom: 0.75rem; }
.nyckeltal article { margin: 0; padding: 0.8rem 1rem; }
.nyckeltal small { color: var(--pico-muted-color); }
.nyckeltal .stort { font-size: 2.4rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.nyckeltal .mellan { font-size: 1.6rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }

.graf { position: relative; height: 22rem; margin: 0; }

/* Inmatningstabell */
table.inmatning th, table.inmatning td { padding: 0.2rem 0.3rem; vertical-align: middle; }
table.inmatning thead th { font-size: 0.8rem; line-height: 1.2; vertical-align: bottom; }
table.inmatning .storhet { font-weight: 600; }
table.inmatning tbody th { white-space: nowrap; font-weight: normal; }
table.inmatning input { margin: 0; padding: 0.25rem 0.4rem; height: auto; min-width: 6.5rem; font-size: 0.9rem; }
table.inmatning input.kalla-imd { border-left: 3px solid var(--serie-1); }
table.inmatning input.kalla-thingsboard { border-left: 3px solid var(--serie-3); }
.ej-i-bruk { display: block; text-align: center; color: var(--pico-muted-color); }
.saknade { columns: 2 20rem; font-size: 0.9rem; }

/* Pico gör knappar i formulär fullbreda – i knappraden ska de ligga bredvid varandra. */
form .knappar > button, form .knappar > [role="button"] { width: auto; margin-bottom: 0; }
form .knappar { margin-top: 1rem; }
fieldset > legend { font-weight: 600; margin-bottom: 0.5rem; }

.roller dt { font-weight: 600; margin-top: 0.5rem; }
.roller dd { margin: 0 0 0 1rem; color: var(--pico-muted-color); }
details.smal { margin-top: 2rem; }
.varning { color: var(--varning); }
#stationsforslag { margin-top: 1rem; }
.felruta ul, .varningsruta ul { margin-bottom: 0; }

/* Användarlista */
table.anvandarlista td { vertical-align: middle; padding: 0.3rem 0.4rem; }
table.anvandarlista input[type=text], table.anvandarlista select { margin: 0; padding: 0.3rem 0.5rem; height: auto; min-width: 10rem; }
table.anvandarlista tr.inaktiv td { opacity: 0.6; }
table.anvandarlista details { margin: 0; }
.inline-rad { display: flex; gap: 0.4rem; margin: 0.4rem 0 0; }
.inline-rad input { margin: 0; padding: 0.3rem 0.5rem; height: auto; }
a.anvandare { color: var(--pico-muted-color); }
