/* =========================================================
   GLOBAL
========================================================= */
body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
}

a {
    color: inherit;
    text-decoration: none;
}

/* =========================================================
   LAYOUT
========================================================= */
.container {
    padding: 16px;
}

h1 {
    margin-bottom: 16px;
}

/* Seksjonstitler */
h2 {
    font-size: 14px;
    font-weight: 500;
    margin: 4px 0 10px 0;
    color: #cbd5f5;
}

/* =========================================================
   CARDS
========================================================= */
.card {
    background: #1e293b;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
}

/* =========================================================
   GRID / ITEMS (brukes andre steder)
========================================================= */
.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.item {
    background: #334155;
    padding: 12px;
    border-radius: 10px;
    text-align: center;
}

.item span {
    display: block;
    font-size: 12px;
    opacity: 0.7;
}

.item strong {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* =========================================================
   LIST / DATA ROWS
========================================================= */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #334155;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 8px;
}

.list-left {
    text-align: left;
}

/* Labels (tekst til venstre) */
.label {
    font-size: 13px;
    opacity: 0.7;
}

/* Verdier */
.value {
    font-size: 16px;
    font-weight: 600;
    color: #e6f3ff;
}

/* Metadata (dato/tid) */
.meta {
    color: #8fbfe8;
    font-size: 0.9em;
}

/* =========================================================
   VALUE ROW (trend + verdi)
========================================================= */
.value-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.trend {
    font-size: 20px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}

.unit-inline {
    font-size: 11px;
    opacity: 0.6;
    margin-left: 2px;
}

/* =========================================================
   TREND COLORS
========================================================= */
.trend-up { color: #22c55e; }
.trend-down { color: #ef4444; }
.trend-flat { color: #94a3b8; }

/* =========================================================
   ANIMATIONS
========================================================= */
.flash {
    animation: flashPulse 0.7s ease;
}

@keyframes flashPulse {
    0% { transform: scale(1); }
    30% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* =========================================================
   DIVIDER
========================================================= */
.divider {
    width: 50%;
    height: 1px;
    margin: 12px auto 16px auto;
    opacity: 0.6;
    background: linear-gradient(
        to right,
        transparent,
        #94a3b8,
        transparent
    );
}

/* =========================================================
   SPARKLINE GRAPH
========================================================= */
.sparkline-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    margin-bottom: 25px;
}

#sparkline {
    width: 100%;
    height: 70px;
}

/* Min / max labels – egen linje over grafen, ikke over canvas */
.sparkline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #cbd5f5;
    opacity: 0.9;
    margin-bottom: 2px;
    pointer-events: none;
}

/* Tooltip ved klikk/tap på et punkt i grafen */
.chart-tooltip {
    position: absolute;
    display: none;
    transform: translate(-50%, -100%);
    background: #0f172a;
    border: 1px solid #38bdf8;
    color: #e6f3ff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: 6px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 5;
}

/* Overlay verdi i graf */
.sparkline-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

/* =========================================================
   CHART CANVAS (flere per side, brukes av graf-sidene)
========================================================= */
.chart-canvas {
    width: 100%;
    height: 90px;
    display: block;
}

.chart-note {
    font-size: 11px;
    opacity: 0.6;
    text-align: center;
    margin: -8px 0 16px 0;
}

/* =========================================================
   RECORD BOXES (brukes andre steder)
========================================================= */
.records-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.record-box {
    flex: 1;
    min-width: 110px;
    background: #1e293b;
    padding: 10px;
    border-radius: 10px;
    text-align: center;
}

.record-box h3 {
    font-size: 12px;
    opacity: 0.7;
}

.unit {
    font-size: 11px;
    opacity: 0.7;
}

.percent {
    font-size: 12px;
    margin-top: 4px;
}

/* Status badges */
.badge {
    margin-top: 5px;
    font-size: 11px;
    background: #22c55e;
    padding: 3px 6px;
    border-radius: 6px;
}

.badge.near {
    background: #f59e0b;
}

/* Highlight states */
.record-new { box-shadow: 0 0 10px #22c55e; }
.record-near { box-shadow: 0 0 8px #f59e0b; }

/* Fallback warning */
.fallback {
    font-size: 11px;
    color: #f87171;
    margin-top: 4px;
}

/* =========================================================
   MENU / NAV
========================================================= */
.menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu a {
    display: block;
    padding: 14px;
    background: #334155;
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
}

.menu a:hover {
    background: #475569;
}

.back {
    display: block;
    margin-top: 20px;
    text-align: center;
    padding: 14px;
    border-radius: 12px;
    background: #334155;
}