:root {
  --navy: #0B2545; --navy-2: #13315C; --blue: #1E5BB8; --blue-d: #174A99; --sky: #4C9BFF;
  --bg: #EEF4FB; --card: #FFFFFF; --ink: #0B2545; --muted: #4A6A93; --line: #E3ECF7; --tint: #E3EEFB; --chip: #DCE7F5;
  --pale: #CFE0F7; --pale-2: #A9C7EE;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: "Inter", system-ui, -apple-system, "SF Pro Text", sans-serif;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { min-height: 100vh; }
a { color: var(--blue); }
button { font: inherit; cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- topp ---------- */
.top { position: sticky; top: 0; z-index: 10; background: var(--navy); color: #fff; padding: calc(var(--safe-t) + 14px) 20px 0; }
.top .sub { font-size: 13px; color: var(--pale-2); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.top h1 { margin: 2px 0 0; font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.top .row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.icon-btn { background: transparent; border: 0; color: var(--pale); padding: 10px; margin: -10px -10px -10px 0; border-radius: 10px; min-width: 44px; min-height: 44px; }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
nav.tabs { display: flex; gap: 6px; padding: 12px 0 12px; }
nav.tabs a { flex: 1; text-align: center; padding: 10px 0; border-radius: 10px; color: var(--pale); font-size: 14px; font-weight: 600; text-decoration: none; }
nav.tabs a.on { background: #fff; color: var(--navy); font-weight: 700; }

main { padding: 16px 16px calc(var(--safe-b) + 72px); display: flex; flex-direction: column; gap: 12px; max-width: 640px; margin: 0 auto; }
.back { align-self: flex-start; color: var(--blue); font-size: 14px; font-weight: 700; text-decoration: none; padding: 4px 0; }

.card { background: var(--card); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.card.tight { padding: 8px 16px; gap: 0; }
.label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.big { font-size: 28px; font-weight: 800; }
.blue { color: var(--blue); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { border-radius: 16px; padding: 16px; text-decoration: none; display: flex; flex-direction: column; gap: 4px; background: var(--card); color: var(--ink); }
.tile.blue-bg { background: var(--blue); color: #fff; }
.tile.blue-bg .label { color: var(--pale); }
.tile.blue-bg .small { color: #E3EEFB; }

.live-card { background: var(--navy); color: #fff; border: 2px solid var(--sky); border-radius: 16px; padding: 16px; text-decoration: none; display: flex; flex-direction: column; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 4px; background: var(--sky); display: inline-block; }
.live-card .label { color: #8FC1FF; display: flex; align-items: center; gap: 8px; }
.btn { display: block; text-align: center; background: var(--sky); color: var(--navy); font-weight: 700; font-size: 15px; padding: 13px 16px; border-radius: 12px; text-decoration: none; border: 0; }
.btn.ghost { background: #fff; border: 1px solid #B9CCE6; color: var(--blue); }

.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; }
.card.tight .list-row:first-child { border-top: 0; }
.list-row .t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list-row .name { font-size: 15px; font-weight: 600; }
.list-row .time { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }

.seg { display: flex; background: var(--chip); border-radius: 10px; padding: 3px; }
.seg button { flex: 1; border: 0; background: transparent; color: #3B5578; font-weight: 600; font-size: 13px; padding: 9px 10px; border-radius: 8px; }
.seg .segl { flex: 1; text-align: center; text-decoration: none; color: #3B5578; font-weight: 600; font-size: 13px; padding: 9px 10px; border-radius: 8px; }
.seg .segl.on { background: #fff; color: var(--navy); font-weight: 700; }
.seg button.on { background: #fff; color: var(--navy); font-weight: 700; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pill { border: 1px solid #B9CCE6; background: #fff; color: var(--blue); font-weight: 600; font-size: 13px; padding: 9px 12px; border-radius: 10px; }

.pers { background: var(--card); border-radius: 14px; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; border: 2px solid transparent; }
.pers.open { border-color: var(--blue); }
.pers .head { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: none; border: 0; padding: 0; text-align: left; color: var(--ink); width: 100%; }
.pers dl { margin: 0; display: grid; grid-template-columns: 96px 1fr; row-gap: 4px; font-size: 13px; }
.pers dt { color: var(--muted); }
.pers dd { margin: 0; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 5px; background: var(--tint); color: var(--blue); vertical-align: middle; }
.tag.new { background: var(--blue); color: #fff; }

.hero { background: var(--blue); color: #fff; border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.hero .k { font-size: 13px; color: var(--pale); font-weight: 600; }
.hero .box { background: var(--blue-d); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.hero .box .k { font-size: 12px; }
.hero .box .v { font-size: 18px; font-weight: 800; }

.bar { height: 8px; background: var(--chip); border-radius: 4px; overflow: hidden; }
.bar > div { height: 8px; background: var(--blue); border-radius: 4px; }
.bar.ok > div { background: #1F8A5B; }

.rank-me { display: flex; align-items: center; gap: 12px; padding: 10px; margin: 4px -10px; background: var(--tint); border-radius: 10px; }
.cutline { display: flex; align-items: center; gap: 8px; padding: 10px 0 6px; font-size: 12px; font-weight: 700; color: var(--blue); }
.cutline span { flex: 1; height: 2px; background: var(--blue); }
.nr { width: 26px; font-size: 14px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }

table.cmp { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.cmp th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); text-align: right; padding: 8px 0; }
table.cmp th:first-child, table.cmp td:first-child { text-align: left; }
table.cmp td { padding: 12px 0; border-top: 1px solid var(--line); text-align: right; font-weight: 700; }
table.cmp td:first-child { font-weight: 600; }

.chart svg { width: 100%; height: auto; display: block; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.err { background: #FFF1F0; color: #8A1F11; border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.foot { font-size: 12px; color: var(--muted); padding: 4px 4px 0; }

/* ---------- innlogging ---------- */
.login { min-height: 100vh; background: var(--navy); color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 32px; gap: 28px; }
.login h1 { margin: 0; font-size: 34px; font-weight: 800; }
.login form { display: flex; flex-direction: column; gap: 14px; max-width: 420px; }
.login label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--pale); }
.login input { font-size: 16px; padding: 14px; border-radius: 12px; border: 1px solid #3B5D8C; background: var(--navy-2); color: #fff; }
.login button { margin-top: 6px; border: 0; background: var(--sky); color: var(--navy); font-weight: 700; font-size: 16px; padding: 15px; border-radius: 12px; }
.login .err { max-width: 420px; }
