/* BO-HUS indkoebsanalyse.
   Paletten udspringer af bo-hus.dk: #7897ab er sidens topbjaelke, #7a97ab er
   logoets fyldfarve. Til et vaerktoej man laeser tal i hele dagen er den dog
   for lys alene, saa den er suppleret med en dyb variant til baerende flader
   og en klart moerkere tekstfarve, saa tal og etiketter staar skarpt. */
:root {
  --brand:        #7897ab;   /* fra bo-hus.dk */
  --brand-logo:   #7a97ab;
  --brand-mid:    #4f6f80;
  --brand-deep:   #2e4652;   /* baerende flader og overskrifter */
  --brand-ink:    #1d2d36;
  --brand-tint:   #eef3f6;
  --brand-tint-2: #d8e3e9;

  --ink:          #162026;   /* var #333 - for svag paa hvid */
  --ink-2:        #435159;
  --muted:        #5d6c74;
  --faint:        #84949c;

  --line:         #d5dee3;   /* var #e8e8e8 - naesten usynlig */
  --line-soft:    #e6ecef;
  --bg:           #eef1f3;
  --card:         #ffffff;

  --up:           #a3372a;
  --up-bg:        #fbecea;
  --down:         #1f6b41;
  --down-bg:      #e8f3ec;
  --warn:         #8a5d10;
  --warn-bg:      #fbf1dc;

  --radius:       5px;
  --menu-w:       292px;
  --shadow:       0 1px 2px rgba(24, 44, 56, .06), 0 3px 8px rgba(24, 44, 56, .05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Open Sans', -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ---------- topbjaelke ---------- */
header.top {
  background: linear-gradient(180deg, var(--brand-deep) 0%, #395663 100%);
  color: #fff;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 0 rgba(0,0,0,.18), 0 2px 10px rgba(24,44,56,.16);
}
.wordmark { font-weight: 800; font-size: 20px; letter-spacing: .13em; }
.wordmark span { font-weight: 300; opacity: .75; }
.tagline {
  font-size: 12px; font-weight: 400; color: rgba(255,255,255,.82);
  border-left: 1px solid rgba(255,255,255,.28); padding-left: 18px;
}
header.top .spacer { flex: 1; }
.datastamp {
  font-size: 11.5px; color: rgba(255,255,255,.8); font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.logout {
  margin-left: 18px; padding: 6px 13px; font: inherit; font-size: 12px; font-weight: 600;
  color: #fff; background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.32); border-radius: var(--radius); cursor: pointer;
}
.logout:hover { background: rgba(255,255,255,.24); border-color: rgba(255,255,255,.5); }

/* ---------- skelet ---------- */
.shell { display: flex; align-items: flex-start; gap: 22px; padding: 22px; }
main { flex: 1; min-width: 0; }

nav.side {
  width: var(--menu-w);
  flex: 0 0 var(--menu-w);
  position: sticky;
  top: 86px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
nav.side h3 {
  margin: 0;
  padding: 12px 16px;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #fff;
  background: var(--brand-deep);
  font-weight: 700;
}
nav.side .group { padding: 5px 0 10px; border-bottom: 1px solid var(--line-soft); }
nav.side .group:last-child { border-bottom: 0; }
nav.side .label {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--brand-mid); padding: 11px 16px 5px; font-weight: 800;
}

.navitem {
  display: flex; justify-content: space-between; align-items: center; gap: .6rem;
  padding: 9px 16px; cursor: pointer; border-left: 3px solid transparent;
  color: var(--ink-2); font-weight: 600; font-size: 13.5px;
}
.navitem:hover { background: var(--brand-tint); color: var(--brand-ink); }
.navitem.active {
  background: var(--brand-tint);
  border-left-color: var(--brand-deep);
  color: var(--brand-ink);
  font-weight: 700;
}
.navitem .count {
  font-size: 11px; color: var(--muted); font-weight: 600;
  background: var(--brand-tint-2); padding: 1px 7px; border-radius: 9px;
  font-variant-numeric: tabular-nums;
}
.navitem.active .count { background: var(--brand-deep); color: #fff; }
/* Visninger uden tal skal ikke vise en tom pille. */
.navitem .count:empty { display: none; }

nav.side .field { padding: 7px 16px; }
nav.side label.flabel {
  display: block; font-size: 11px; color: var(--muted);
  margin-bottom: 4px; font-weight: 600;
}
input[type=text], select {
  width: 100%; padding: 8px 9px; border: 1px solid var(--line);
  border-radius: var(--radius); font: inherit; font-size: 13px;
  background: #fff; color: var(--ink);
}
input[type=text]:focus, select:focus {
  outline: 2px solid var(--brand-tint-2); border-color: var(--brand-mid);
}
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { accent-color: var(--brand-deep); }

/* ---------- kort ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 18px; overflow: hidden;
  box-shadow: var(--shadow);
}
.card > h2 {
  margin: 0; padding: 14px 18px; font-size: 15px; font-weight: 700;
  color: var(--brand-ink); border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfcfd, #f2f6f8);
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.card > h2 .sub { font-weight: 400; font-size: 12px; color: var(--muted); }
.card .pad { padding: 16px 18px; }

.tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 1px; background: var(--line);
  border-bottom: 1px solid var(--line);
}
.tile { background: var(--card); padding: 14px 18px; }
.tile .v {
  font-size: 21px; font-weight: 700; color: var(--brand-ink);
  font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.tile .k {
  font-size: 10.5px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .08em; margin-top: 3px; font-weight: 700;
}

/* ---------- tabeller ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 9px 12px; font-size: 10.5px; letter-spacing: .07em;
  text-transform: uppercase; color: #fff; background: var(--brand-mid);
  white-space: nowrap; font-weight: 700;
}
thead th.num { text-align: right; }
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:nth-child(even) { background: #fafcfd; }
tbody tr:hover { background: var(--brand-tint); }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { box-shadow: inset 3px 0 0 var(--brand-deep); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vare { font-weight: 700; color: var(--brand-ink); }
.kode {
  font-size: 11px; color: var(--faint); font-family: ui-monospace, Consolas, monospace;
}

.pct.up   { color: var(--up);   font-weight: 700; }
.pct.down { color: var(--down); font-weight: 700; }
.pct.flat { color: var(--faint); }

.flag {
  display: inline-block; font-size: 10px; padding: 2px 7px; border-radius: 9px;
  background: var(--warn-bg); color: var(--warn); font-weight: 800; white-space: nowrap;
  border: 1px solid rgba(138, 93, 16, .22);
}
.muted { color: var(--muted); }
.small { font-size: 12px; }

.note {
  background: var(--warn-bg); border-left: 3px solid var(--warn);
  padding: 11px 14px; font-size: 12.5px; color: #6b4a0e; line-height: 1.6;
  border-radius: 0 var(--radius) var(--radius) 0;
}

button.link {
  background: none; border: 0; color: var(--brand-mid);
  font: inherit; font-weight: 700; cursor: pointer; padding: 0; text-align: left;
}
button.link:hover { color: var(--brand-ink); text-decoration: underline; }
button.link:focus-visible { outline: 2px solid var(--brand-mid); outline-offset: 2px; }

.pager {
  display: flex; gap: 10px; align-items: center; padding: 12px 18px;
  border-top: 1px solid var(--line-soft); background: #fafcfd;
}
.pager button {
  padding: 6px 13px; border: 1px solid var(--line); background: #fff;
  border-radius: var(--radius); cursor: pointer; font: inherit; font-size: 13px;
  font-weight: 600; color: var(--ink-2);
}
.pager button:disabled { opacity: .4; cursor: default; }
.pager button:not(:disabled):hover { border-color: var(--brand-mid); color: var(--brand-ink); }

.loading { padding: 34px; text-align: center; color: var(--muted); }

/* ---------- graf ---------- */
.chartwrap { padding: 8px 10px 14px; overflow-x: auto; }
svg.chart { display: block; width: 100%; height: auto; min-width: 460px; }
svg.chart .grid { stroke: var(--line-soft); stroke-width: 1; }
svg.chart .axis { stroke: var(--line); stroke-width: 1; }
svg.chart .tick { fill: var(--muted); font-size: 10px; }
svg.chart .line { fill: none; stroke: var(--brand-deep); stroke-width: 2.2; stroke-linejoin: round; }
svg.chart .area { fill: var(--brand-deep); opacity: .09; }
svg.chart .dot { fill: #fff; stroke: var(--brand-deep); stroke-width: 1.6; }
svg.chart .dot:hover { fill: var(--brand-deep); }
svg.chart .avg { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 3; }
svg.chart .avglbl { fill: var(--muted); font-size: 9.5px; }

.crumb { padding: 10px 0 6px; font-size: 13px; }

@media (max-width: 950px) {
  .shell { flex-direction: column-reverse; }
  nav.side { width: 100%; flex: 1 1 auto; position: static; }
}
