:root {
  --bg: #f7f6fb; --card: #ffffff; --ink: #17141f; --muted: #6b6578; --line: #e7e3ef;
  --accent: #7c3aed; --accent-ink: #ffffff; --soft: #f1eafe;
  --warn: #b45309; --warn-soft: #fdf2e3; --danger: #dc2626; --danger-soft: #fdecea;
  --c-inns: #f05a6e; --c-ferd: #7c3aed; --c-kunn: #0891b2;
  --s-til: #059669; --s-sen: #d97706; --s-fra: #dc2626; --s-ikke: #6b7280;
  --glass: rgba(247, 246, 251, .72); --glass-card: rgba(255, 255, 255, .78);
  --grad: linear-gradient(120deg, #960ee7 0%, #ec2397 55%, #fa7670 100%);
  --grad-cool: linear-gradient(120deg, #596aeb 0%, #15cff9 100%);
  --track: linear-gradient(90deg, #fa7670, #ec2397 30%, #a43cf0 55%, #596aeb 78%, #15cff9);
  --radius: 16px; --shadow: 0 1px 2px rgba(23, 20, 31, .05), 0 6px 20px -12px rgba(23, 20, 31, .18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #08070b; --card: #15131b; --ink: #f2eff8; --muted: #a29bb3; --line: #2a2533;
    --accent: #c084fc; --accent-ink: #1a0b2e; --soft: #241a35;
    --warn: #fbbf24; --warn-soft: #2a2213; --danger: #f87171; --danger-soft: #3a1d1d;
    --c-inns: #fb8a7e; --c-ferd: #c084fc; --c-kunn: #22d3ee;
    --s-til: #34d399; --s-sen: #fbbf24; --s-fra: #f87171; --s-ikke: #9ca3af;
    --glass: rgba(8, 7, 11, .66); --glass-card: rgba(21, 19, 27, .72);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -18px rgba(150, 14, 231, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #08070b; --card: #15131b; --ink: #f2eff8; --muted: #a29bb3; --line: #2a2533;
  --accent: #c084fc; --accent-ink: #1a0b2e; --soft: #241a35;
  --warn: #fbbf24; --warn-soft: #2a2213; --danger: #f87171; --danger-soft: #3a1d1d;
  --c-inns: #fb8a7e; --c-ferd: #c084fc; --c-kunn: #22d3ee;
  --s-til: #34d399; --s-sen: #fbbf24; --s-fra: #f87171; --s-ikke: #9ca3af;
  --glass: rgba(8, 7, 11, .66); --glass-card: rgba(21, 19, 27, .72);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -18px rgba(150, 14, 231, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 14px 0 6px; }
p { margin: .4em 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }

/* Layout */
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.top h1 { font-size: 1.15rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .back { font-size: 1.6rem; text-decoration: none; line-height: 1; padding: 0 6px 2px 0; }
.wrap { max-width: 760px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }

#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
#nav a {
  flex: 1; text-align: center; padding: 8px 0 10px; font-size: .75rem; color: var(--muted); text-decoration: none;
}
#nav a .ni { display: grid; place-items: center; height: 26px; }
#nav a .ni svg { width: 24px; height: 24px; transition: transform .2s var(--ease-out, ease); }
#nav a.on { color: var(--accent); font-weight: 600; }

/* Cards and lists */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow);
}
.card + .card, .card + .btn, .btn + .card, .section + .card { margin-top: 12px; }
.card h2 + p { margin-top: 6px; }
.hero { background: var(--soft); border-color: transparent; }
.notice { background: var(--warn-soft); border-color: transparent; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.li {
  display: flex; align-items: center; gap: 10px; padding: 12px 2px; color: inherit; text-decoration: none; min-height: 48px;
}
.li .grow b { display: block; }
.li .chev { color: var(--muted); }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 2px 8px; }
.section-title h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 22px 10px; }

/* Buttons and inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 10px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; min-height: 44px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.small { padding: 6px 10px; min-height: 34px; font-size: .85rem; }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.icon { border: 0; background: transparent; color: var(--muted); font-size: 1.2rem; cursor: pointer; padding: 6px; min-width: 40px; min-height: 40px; }
.link { border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; padding: 4px; }

label.f { display: block; font-size: .85rem; font-weight: 600; margin: 12px 0 4px; }
input[type=text], input[type=date], input[type=time], input[type=password], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }

.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button, .seg a {
  flex: 1; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .85rem; font-weight: 600;
  padding: 8px 6px; border-radius: 8px; cursor: pointer; text-align: center; text-decoration: none;
}
.seg .on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px;
  padding: 6px 12px; font: inherit; font-size: .85rem; cursor: pointer; text-align: left;
}
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip.add::before { content: "+ "; color: var(--accent); font-weight: 700; }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--soft); color: var(--accent); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }

.tabs { display: flex; gap: 4px; overflow-x: auto; margin: -4px -16px 14px; padding: 0 16px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  white-space: nowrap; padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--muted);
  font-weight: 600; font-size: .9rem;
}
.tabs a.on { background: var(--ink); color: var(--bg); }

/* Week */
.week-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.day { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.day:first-of-type { border-top: 0; }
.dh { width: 44px; text-align: center; flex: none; }
.dh span { display: block; font-size: .75rem; color: var(--muted); text-transform: uppercase; }
.dh b { font-size: 1.2rem; }
.day.today .dh b { color: var(--accent); }
.day.today .dh span { color: var(--accent); font-weight: 700; }
.dl { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; justify-content: center; }
.lesson {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  text-decoration: none; color: inherit; background: var(--bg); border: 1px solid var(--line);
}
.lesson .t { font-variant-numeric: tabular-nums; font-weight: 700; font-size: .9rem; }
.lesson .grow { font-size: .9rem; }
.lesson .grow small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson.todo { border-color: var(--accent); }
.lesson.todo .st { color: var(--accent); font-weight: 700; font-size: .8rem; }
.lesson.done .st { color: var(--accent); font-size: .8rem; }
.lesson.future { opacity: .7; }

/* Rating line */
.rate { padding: 8px 0 4px; }
.rate-head { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; gap: 8px; }
.rate-head > span:first-child { color: var(--muted); font-weight: 600; }
.rate-head b { font-size: .9rem; }
.rate-head .x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; padding: 0 0 0 8px; }
.rate input[type=range] { width: 100%; margin: 6px 0 0; accent-color: var(--accent); height: 28px; cursor: pointer; }
.rate input.unset { opacity: .3; filter: grayscale(1); }
.rate.dis { opacity: .35; pointer-events: none; }
.ticks { display: flex; justify-content: space-between; font-size: .68rem; color: var(--muted); padding: 0 2px; }
.lv0 { color: var(--muted); font-weight: 500; }

/* Session form */
.stu .stu-head { display: flex; justify-content: space-between; align-items: center; }
.stu .stu-head b { font-size: 1.05rem; }
.status { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 10px 0 4px; }
.status button {
  border: 1px solid var(--line); background: transparent; color: var(--muted); font: inherit; font-size: .72rem; font-weight: 700;
  padding: 8px 2px; border-radius: 8px; cursor: pointer; text-transform: uppercase; letter-spacing: .02em;
}
.status button.on { color: #fff; }
.status button.on.s-til { background: var(--s-til); border-color: var(--s-til); }
.status button.on.s-sen { background: var(--s-sen); border-color: var(--s-sen); }
.status button.on.s-fra { background: var(--s-fra); border-color: var(--s-fra); }
.status button.on.s-ikke { background: var(--s-ikke); border-color: var(--s-ikke); }
:root[data-theme="dark"] .status button.on, .status button.on { color: var(--bg); }
.stu-note { margin-top: 8px; }
.look summary { cursor: pointer; font-weight: 700; }
.look ul { margin: 0; padding-left: 20px; }
.look li { margin: 3px 0; font-size: .92rem; }
.savebar {
  position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom)); z-index: 15;
  padding: 10px 16px; background: linear-gradient(transparent, var(--bg) 30%);
}
.savebar .btn { max-width: 728px; margin: 0 auto; display: flex; width: 100%; }

/* Student folder */
.stats4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.stats4 b { display: block; font-size: 1.4rem; }
.stats4 span { font-size: .72rem; color: var(--muted); }
.meter { margin: 10px 0 14px; }
.meter .rate-head b { font-size: .95rem; }
.bar { position: relative; height: 6px; border-radius: 3px; background: var(--line); margin: 10px 4px 4px; }
.bar i { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--accent); border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--accent); }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--muted); font-size: 9px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.trend { font-weight: 700; }

/* Letter */
.letter-ta { min-height: 380px; font-size: .95rem; }

/* Sheet */
.sheet-bg {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .15s;
}
.sheet {
  background: var(--card); width: 100%; max-width: 620px; max-height: 92vh; overflow: auto;
  border-radius: 18px 18px 0 0; padding: 0 16px calc(20px + env(safe-area-inset-bottom));
}
.sheet-head { position: sticky; top: 0; background: var(--card); display: flex; align-items: center; justify-content: space-between; padding: 14px 0 8px; z-index: 1; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 18px; } }
@keyframes fade { from { opacity: 0; } }

#toast {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: .9rem;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: calc(100% - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.topic-sec ul { margin: 0; padding-left: 20px; }
.topic-sec li { margin: 4px 0; }
.fb { background: var(--bg); border-radius: 10px; padding: 10px 12px; margin-top: 8px; font-size: .92rem; }
.fb b { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 2px; }
.edit-list { list-style: none; margin: 0 0 8px; padding: 0; }
.edit-list li { display: flex; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.edit-list li span { flex: 1; }

#print { display: none; }
@media print {
  body { background: #fff; color: #000; }
  body > *:not(#print) { display: none !important; }
  #print { display: block; font: 12pt/1.5 Georgia, "Times New Roman", serif; padding: 0 8mm; }
  #print h1 { font: 700 18pt/1.2 -apple-system, Helvetica, Arial, sans-serif; margin-bottom: 4pt; }
  #print .meta { font: 10pt Helvetica, Arial, sans-serif; color: #555; margin-bottom: 14pt; }
  #print .chart { max-width: 420px; margin: 4pt 0 14pt; }
  #print .chart text { fill: #555; }
  #print .chart .grid { stroke: #ddd; }
  #print p { margin: 0 0 9pt; }
}

/* Installasjonsveiledning */
.install-mode #nav { display: none; }
.install { padding-top: calc(28px + env(safe-area-inset-top)); padding-bottom: 40px; max-width: 520px; }
.install-head { text-align: center; margin-bottom: 18px; }
.install-head img { border-radius: 18px; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.install-head h1 { font-size: 1.6rem; margin-top: 12px; }
.install-head p { color: var(--muted); margin-top: 4px; }
.install .lead { font-size: 1.02rem; margin: 0 0 14px; }
.steps { margin: 12px 0 4px; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 10px 0 10px 44px; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 9px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; display: grid; place-items: center; font-size: .9rem;
}
.ico { width: 22px; height: 22px; vertical-align: -5px; color: var(--accent); }
.skip { display: block; margin: 22px auto 0; color: var(--muted); text-decoration: underline; }
.syncstatus.warn { color: var(--warn); }

/* Veiledning */
#tour { max-width: 760px; margin: 0 auto; padding: calc(8px + env(safe-area-inset-top)) 16px 0; }
.tourbar { background: var(--soft); border: 1px solid var(--accent); border-radius: var(--radius); padding: 12px 14px; }
.tourbar h3 { margin: 8px 0 2px; }
.tourbar p { margin: 4px 0 10px; }
.tourbar .link { margin-left: 6px; }
.tourbar.slim { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: .9rem; }
.tour-step { color: var(--accent); font-weight: 700; }
.tour-dots { display: flex; gap: 4px; margin-top: 8px; }
.tour-dots i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.tour-dots i.on { background: var(--accent); }
#tour:not([hidden]) + #app .top { padding-top: 10px; }
label.btn.busy { opacity: .5; pointer-events: none; }

/* Egenvurdering */
.student-mode #nav, .student-mode #tour { display: none !important; }
.qrbox { display: flex; justify-content: center; background: #fff; border-radius: 12px; padding: 8px; margin: 6px 0 12px; }
.qrbox svg { width: 100%; max-width: 260px; height: auto; }
.bar i.ev { background: var(--card); border: 3px solid var(--c-inns); box-shadow: none; width: 14px; height: 14px; margin: -7px 0 0 -7px; }
.ev-txt { color: var(--c-inns); font-weight: 600; }
.legend .ev-dot { background: transparent; border: 2px solid var(--c-inns); }
.ev-area { padding: 6px 0 4px; border-top: 1px solid var(--line); }
.ev-area:first-of-type { border-top: 0; }
.ev-jeg { font-style: italic; margin: 6px 0 0; font-size: .95rem; }
.ev-form .chip { font-size: .95rem; padding: 8px 14px; }

.downnote { margin-bottom: 12px; }
.downnote p { margin: 6px 0; }


/* ================= DigiLogg-utseende: farger fra logoen, glass og bevegelse ================= */
body { font-feature-settings: "ss01", "cv11"; }
.top, #nav { background: var(--glass); -webkit-backdrop-filter: saturate(1.8) blur(18px); backdrop-filter: saturate(1.8) blur(18px); }
.top { border-bottom-color: transparent; box-shadow: 0 1px 0 var(--line); }
.top h1 { font-weight: 800; letter-spacing: -.01em; }
#nav { border-top-color: transparent; box-shadow: 0 -1px 0 var(--line); }
#nav a { position: relative; transition: color .2s; }
#nav a.on { color: var(--ink); }
#nav a.on .ni { color: #ec2397; }
#nav a.on .ni svg { transform: translateY(-1px) scale(1.06); stroke-width: 2.3; }
#nav a.on::after { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--grad); }

.btn { transition: transform .12s ease, box-shadow .2s, background .2s; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: var(--grad); border: 0; color: #fff; box-shadow: 0 8px 20px -10px rgba(236, 35, 151, .7); }
.btn.primary:disabled { box-shadow: none; }
.btn.ghost { color: var(--accent); }
.chip.on { background: var(--grad); border-color: transparent; color: #fff; }
.tabs a.on { background: var(--grad); color: #fff; }
.seg .on { box-shadow: 0 1px 3px rgba(0,0,0,.15), inset 0 -2px 0 #ec2397; }
.pill { background: var(--soft); color: var(--accent); }
.hero, .streak { background: linear-gradient(var(--card), var(--card)) padding-box, var(--grad) border-box; border: 1.5px solid transparent; }
.steps li::before { background: var(--grad); color: #fff; }
.lesson.todo { border-color: transparent; background: linear-gradient(var(--bg), var(--bg)) padding-box, var(--grad) border-box; border: 1.5px solid transparent; }
.lesson.todo .st, .lesson.done .st { color: var(--accent); }
.day.today .dh b, .day.today .dh span { color: #ec2397; }
.tourbar { background: var(--soft); border-color: transparent; }
.tour-dots i.on { background: var(--grad); }
.bar i { background: var(--grad); box-shadow: 0 0 0 1px #ec2397; }

/* Nivåfarger på teksten ved glidelinjene */
.lv1 { color: #fa7670; } .lv2 { color: #ec2397; } .lv3 { color: #a43cf0; } .lv4 { color: #596aeb; } .lv5 { color: #0ea5e9; }
:root[data-theme="dark"] .lv5 { color: #15cff9; }

/* Glidelinjer: fargespor, hvit knott med nivåfarge og en liten sprett */
.rate input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; height: 32px; margin: 4px 0 0; accent-color: auto; }
.rate input[type=range]:focus { outline: none; }
.rate input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 99px; background: var(--track); }
.rate input[type=range]::-moz-range-track { height: 8px; border-radius: 99px; background: var(--track); }
.rate input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -9px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 4px var(--thumb, #a43cf0), 0 4px 12px rgba(0,0,0,.3); }
.rate input[type=range]::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 4px var(--thumb, #a43cf0), 0 4px 12px rgba(0,0,0,.3); }
.rate input.unset { opacity: .35; filter: grayscale(1); }
.rate.pop input::-webkit-slider-thumb { animation: pop .3s cubic-bezier(.3, 1.8, .5, 1); }
.rate.pop input::-moz-range-thumb { animation: pop .3s cubic-bezier(.3, 1.8, .5, 1); }
.rate.pop .rate-head b { animation: pop .3s cubic-bezier(.3, 1.8, .5, 1); display: inline-block; }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.28); } 100% { transform: scale(1); } }

/* Elevkort som kan sveipes */
.swipe { position: relative; border-radius: var(--radius); }
.swipe + .swipe { margin-top: 12px; }
.swipe > .stu { position: relative; z-index: 1; touch-action: pan-y; transition: transform .28s cubic-bezier(.2, .9, .3, 1.2); will-change: transform; }
.sw-bg { position: absolute; inset: 0; border-radius: var(--radius); display: flex; justify-content: space-between; align-items: center; padding: 0 20px; font-weight: 800; color: #fff; opacity: 0; transition: opacity .15s; overflow: hidden; }
.sw-bg span { opacity: .55; transition: opacity .15s, transform .15s; }
.swipe.dir-l .sw-bg { opacity: 1; background: var(--s-fra); }
.swipe.dir-r .sw-bg { opacity: 1; background: var(--s-sen); }
.swipe.go-l .sw-l, .swipe.go-r .sw-r { opacity: 1; transform: scale(1.12); }
.swipe.s-fra > .stu, .swipe.s-ikke > .stu { opacity: .72; }
.swipe.wave { animation: wave .45s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes wave { 0% { transform: scale(.96); filter: brightness(1.35); } 60% { transform: scale(1.01); } 100% { transform: none; filter: none; } }

/* Streak på Hjem */
.streak { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.streak .flame { font-size: 1.8rem; animation: flicker 2.4s ease-in-out infinite; }
.streak b { display: block; }
@keyframes flicker { 0%, 100% { transform: rotate(-4deg) scale(1); } 50% { transform: rotate(4deg) scale(1.08); } }

/* Sidene glir inn */
.wrap.enter { animation: enter .24s cubic-bezier(.2, .8, .3, 1); }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }

/* Vinduer (sheets) glir opp og kan dras ned */
.sheet-bg { animation: fade .2s ease; }
.sheet { animation: sheetUp .32s cubic-bezier(.2, .9, .3, 1); transition: transform .25s cubic-bezier(.2, .9, .3, 1); }
.sheet-bg.closing { animation: fadeOut .22s ease forwards; }
.sheet-bg.closing .sheet { transform: translateY(100%); }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; cursor: grab; }
.sheet-head { cursor: grab; touch-action: none; }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes fadeOut { to { opacity: 0; } }
@media (min-width: 700px) { .sheet { animation: sheetIn .25s cubic-bezier(.2, .9, .3, 1); } @keyframes sheetIn { from { opacity: 0; transform: translateY(20px) scale(.98); } } }

/* Grafer som tegnes opp */
.chart polyline.draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1s cubic-bezier(.4, 0, .2, 1) .1s forwards; }
.chart circle { animation: fade .4s ease .7s both; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Toast med sprett */
#toast { transition: opacity .2s, transform .35s cubic-bezier(.3, 1.6, .5, 1); background: var(--ink); }

/* Konfetti */
canvas.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 70; }

/* Åpningsanimasjon */
#splash { position: fixed; inset: 0; z-index: 100; background: #000; display: grid; place-items: center; align-content: center; gap: 14px; transition: opacity .35s ease; }
#splash img { width: 96px; height: 96px; border-radius: 22px; animation: splashIn .7s cubic-bezier(.2, .9, .3, 1.2) both; box-shadow: 0 0 60px rgba(236, 35, 151, .55), 0 0 120px rgba(21, 207, 249, .3); }
#splash span { color: #fff; font-weight: 800; letter-spacing: .02em; font-size: 1.3rem; animation: fade .5s ease .25s both; }
#splash.out { opacity: 0; }
@keyframes splashIn { from { opacity: 0; transform: scale(.7); filter: blur(6px); } }

/* Respekter «Reduser bevegelse» */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .chart polyline.draw { stroke-dashoffset: 0; }
}
@media print {
  .chart polyline.draw { animation: none; stroke-dashoffset: 0; }
  .chart circle { animation: none; }
}

/* ================= Tema, temakarakter og grupper ================= */
.theme-card { display: block; color: inherit; text-decoration: none; }
.theme-card .theme-name { font-size: 1.05rem; }
.chips.mini { margin-top: 8px; gap: 4px; }
.chips.mini .chip { padding: 3px 9px; font-size: .78rem; cursor: default; }
.pill.muted-pill { background: var(--line); color: var(--muted); }
.pill.ok-pill { background: color-mix(in srgb, var(--s-til) 18%, transparent); color: var(--s-til); }
.chip.warn-chip { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.grade-badge { min-width: 38px; text-align: center; padding: 4px 8px; border-radius: 10px; background: var(--soft); color: var(--accent); font-size: .95rem; }
.tg-row { padding: 12px 0; border-top: 1px solid var(--line); }
.tg-row:first-child { border-top: 0; padding-top: 0; }
.tg-note { margin-top: 8px; font-size: .9rem; min-height: 40px; }
.gp { display: flex; gap: 4px; margin-top: 8px; align-items: center; }
.gp button { flex: 1 1 0; min-width: 0; max-width: 46px; padding: 0; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; transition: transform .1s; }
.gp button:active { transform: scale(.92); }
.gp button.on { background: var(--grad); color: #fff; border-color: transparent; }
.gp button.pm.on { background: var(--ink); color: var(--bg); }
.gp button.iv { font-size: .8rem; }
.gp button.iv.on { background: var(--muted); color: var(--bg); }
.gp-sep { width: 6px; }
.grp-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.grp-btns { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.grp-btns button { min-width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.grp-btns button.on { background: var(--grad); color: #fff; border-color: transparent; }
.no-rates .rate { display: none; }
.other-topic { margin-top: 8px; }
.other-topic summary { cursor: pointer; }
.ev-band button { padding: 10px 6px; }
#splash .tag { color: rgba(255,255,255,.6); font-size: .85rem; letter-spacing: .04em; animation: fade .6s ease .9s both; }
#splash img { animation: splashIn .9s cubic-bezier(.2, .9, .3, 1.2) both, glow 2.4s ease-in-out .9s infinite alternate; }
@keyframes glow { from { box-shadow: 0 0 40px rgba(236, 35, 151, .45), 0 0 90px rgba(21, 207, 249, .2); } to { box-shadow: 0 0 80px rgba(236, 35, 151, .7), 0 0 160px rgba(21, 207, 249, .4); transform: scale(1.04); } }

/* ================= Graf, klargjorte timer, grupper i biblioteket ================= */
.chart text.ylab { font-size: 9px; font-weight: 700; }
.lesson.future { opacity: .85; }
.lesson.future .st { color: var(--muted); font-size: .8rem; }
.lesson.planned { border-style: dashed; }
.lesson.planned .st { color: var(--accent); font-size: .8rem; font-weight: 700; }
.sub-avgs { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: .82rem; }
.sport-head { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); margin: 10px 2px 2px; }
.sport-head:first-child { margin-top: 0; }
.sport-group { border-top: 1px solid var(--line); padding: 8px 0; }
.sport-group:first-child { border-top: 0; }
.sport-group summary { cursor: pointer; }
details.older > summary { cursor: pointer; list-style: none; }
details.older > summary::-webkit-details-marker { display: none; }
details.older > summary h2::after { content: " ▾"; }

/* ================= PDF-rapport ================= */
@media print {
  #print.report { font: 10.5pt/1.4 -apple-system, Helvetica, Arial, sans-serif; padding: 0; }
  #print.report .pg { break-after: page; page-break-after: always; padding: 4mm 6mm; }
  #print.report .pg:last-child { break-after: auto; page-break-after: auto; }
  #print.report .ph { display: flex; align-items: center; gap: 8px; font-size: 9pt; color: #666; margin-bottom: 6pt; }
  #print.report .ph img { width: 22px; height: 22px; border-radius: 5px; }
  #print.report h1 { font-size: 18pt; margin: 0 0 2pt; }
  #print.report h2 { font-size: 12pt; margin: 12pt 0 4pt; border-bottom: 1px solid #ccc; padding-bottom: 2pt; }
  #print.report h2 small, #print.report small { font-weight: normal; color: #666; font-size: 8.5pt; }
  #print.report .meta { color: #555; font-size: 9pt; margin: 0 0 8pt; }
  #print.report table { width: 100%; border-collapse: collapse; margin: 4pt 0 6pt; font-size: 9.5pt; }
  #print.report th, #print.report td { border: 1px solid #ddd; padding: 3pt 5pt; text-align: left; vertical-align: top; }
  #print.report th { background: #f3f0fa; font-weight: 700; }
  #print.report td.g { text-align: center; font-weight: 700; white-space: nowrap; }
  #print.report table.cls td, #print.report table.cls th { font-size: 8.5pt; padding: 2pt 3pt; }
  #print.report .kv { margin: 3pt 0; }
  #print.report .kv.small { font-size: 9pt; color: #444; }
  #print.report ul.notes { margin: 2pt 0 0 14pt; padding: 0; font-size: 9pt; }
  #print.report .chart { max-width: 380px; }
  #print.report .legend { font-size: 8pt; }
  #print.report .foot { margin-top: 10pt; font-size: 8pt; color: #888; }
}
.li .grow .yr-line, .li .grow .sub-avgs { display: flex; }
.li .grow .yr-line b, .li .grow .sub-avgs b { display: inline; margin-left: 3px; }
.li .grow .yr-line { gap: 4px; flex-wrap: wrap; }

/* Tale (🎤) */
.mic { border: 0; background: transparent; font-size: 1rem; padding: 2px 6px; border-radius: 999px; cursor: pointer; line-height: 1; }
.mic.rec { background: var(--danger-soft); box-shadow: 0 0 0 2px var(--danger); animation: micpulse 1.2s ease-in-out infinite; }
@keyframes micpulse { 50% { box-shadow: 0 0 0 5px transparent; } }

/* Utvikling: grønn opp, rød ned, grå stabil */
.trend { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .9rem; }
.trend i { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-style: normal; font-size: .95rem; color: #fff; }
.trend.t-up { color: #15803d; } .trend.t-up i { background: #16a34a; }
.trend.t-down { color: var(--danger); } .trend.t-down i { background: var(--danger); }
.trend.t-flat { color: var(--muted); } .trend.t-flat i { background: #9ca3af; }
.trend.t-none { color: var(--muted); font-weight: 500; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .trend.t-up { color: #4ade80; } }
:root[data-theme="dark"] .trend.t-up { color: #4ade80; }

/* Underveisvurdering: høst og vår side om side */
.uv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.uv-col { display: flex; flex-direction: column; gap: 6px; }
.uv-head { font-weight: 700; padding: 0 2px; }
.uv-cell { display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); background: var(--bg); min-height: 64px; }
.uv-cell:active { background: var(--soft); }
.uv-cell b { font-size: .95rem; }
.uv-cell .grade-badge { align-self: flex-start; }
.uv-none { color: var(--muted); font-weight: 500; }
.uv-draft { color: var(--warn); }
.uv-done { color: #15803d; }
:root[data-theme="dark"] .uv-done { color: #4ade80; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .uv-done { color: #4ade80; } }

/* ================= Hjem ================= */
:root { --ease-out: cubic-bezier(.23, 1, .32, 1); --ok: #047857; --ok-soft: #e3f5ec; }
:root[data-theme="dark"] { --ok: #4ade80; --ok-soft: #12261b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --ok: #4ade80; --ok-soft: #12261b; } }

.home-sub { margin: -2px 2px 14px; color: var(--muted); font-size: .92rem; line-height: 1.5; }
.home-sub::first-letter { text-transform: uppercase; }
.home-sub .hs-todo { color: var(--ink); font-weight: 650; }
.home-sub .hs-todo::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ec2397; margin-right: 7px; vertical-align: 1px; }
.home-sub .hs-ok { color: var(--ok); font-weight: 650; display: inline-flex; align-items: center; gap: 5px; }

.week { padding-top: 10px; overflow: hidden; }
.week-head { margin-bottom: 4px; }
.wk-title { text-align: center; display: flex; flex-direction: column; gap: 1px; }
.wk-title b { font-size: 1.05rem; letter-spacing: -.01em; }
.wk-nav { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--accent); transition: background .15s, transform .16s var(--ease-out); -webkit-tap-highlight-color: transparent; }
.wk-nav:active { transform: scale(.92); background: var(--soft); }
@media (hover: hover) and (pointer: fine) { .wk-nav:hover { background: var(--soft); } }
.wk-today { display: block; width: max-content; margin: 0 auto 6px; font-size: .82rem; font-weight: 650; color: var(--accent); text-decoration: none; padding: 4px 12px; border-radius: 999px; background: var(--soft); }

.week .day { padding: 10px 0; }
.week .day.past .dh { opacity: .55; }
.week .day.today { margin: 0 -14px; padding: 10px 14px; background: var(--soft); border-top-color: transparent; }
.week .day.today + .day { border-top-color: transparent; }
.week .day.today .dh span { color: var(--accent); font-weight: 700; text-transform: none; font-size: .72rem; }
.week .day.today .dh b { display: inline-grid; place-items: center; width: 32px; height: 32px; margin-top: 2px; border-radius: 50%; background: var(--grad); color: #fff; font-size: 1.05rem; }
.week .dh b { font-variant-numeric: tabular-nums; }
.week .none { padding: 6px 0; opacity: .8; }

.week .lesson { gap: 12px; padding: 9px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); transition: transform .16s var(--ease-out), background .15s; -webkit-tap-highlight-color: transparent; }
.week .lesson:active { transform: scale(.98); }
.week .day.today .lesson { background: var(--card); }
.week .lesson .t { width: 42px; flex: none; font-size: .92rem; }
.week .lesson .grow { min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: .9rem; }
.week .lesson .lc { display: flex; align-items: center; gap: 6px; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week .lesson .lc::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--cc, var(--accent)); }
.week .lesson .lc .muted { font-weight: 500; }
.week .lesson small { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--muted); font-size: .82rem; line-height: 1.3; white-space: normal; }
.week .lesson .st { flex: none; font-size: .8rem; font-weight: 700; }
.week .lesson.done { background: transparent; }
.week .day.today .lesson.done { background: transparent; border-color: color-mix(in srgb, var(--accent) 18%, transparent); }
.week .lesson.done .t, .week .lesson.done .lc { color: var(--muted); }
.ok-dot { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.week .lesson.todo { background: linear-gradient(var(--card), var(--card)) padding-box, var(--grad) border-box; border: 1.5px solid transparent; }
.week .lesson.todo .st { color: #fff; background: var(--grad); padding: 6px 11px; border-radius: 999px; box-shadow: 0 6px 14px -8px rgba(236, 35, 151, .8); }
.week .lesson.planned .st { color: var(--accent); }
.week .lesson.future { opacity: 1; }
.week .lesson.future .st { color: var(--muted); font-weight: 600; }
.week .lesson.future .t, .week .lesson.future small { color: var(--muted); }
@media (hover: hover) and (pointer: fine) { .week .lesson:hover { background: var(--soft); } .week .lesson.todo:hover { background: linear-gradient(var(--soft), var(--soft)) padding-box, var(--grad) border-box; } }

.streak .flame { animation: none; display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 12px; background: var(--grad); color: #fff; font-size: 0; box-shadow: 0 8px 18px -10px rgba(236, 35, 151, .8); }
.streak b { font-size: 1rem; }

/* Klassefarge: prikk i lister og strek i toppen */
.cdot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--cc, var(--accent)); }
.list .li > .cdot { margin-right: 2px; }
.top.hued { box-shadow: 0 1px 0 var(--line), inset 0 -2px 0 var(--cc); }
.top.hued h1::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--cc); margin-right: 8px; vertical-align: 2px; }
.cname { color: var(--muted); font-weight: 600; }
.cname::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--cc); margin: 0 4px 1px 2px; vertical-align: middle; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 6px; }
.sw { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--cc); cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); transition: transform .16s var(--ease-out), box-shadow .16s; }
.sw:active { transform: scale(.9); }
.sw.on { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--cc); }

/* 1) Nettopp registrert: hakemerket tegnes, raden lyser kort */
.week .lesson.just { animation: justRow 1.6s var(--ease-out) both; }
.week .lesson.just .ok-dot { animation: justDot .5s cubic-bezier(.34, 1.56, .64, 1) .15s both; }
.week .lesson.just .ok-dot path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: drawCheck .45s var(--ease-out) .35s forwards; }
@keyframes justRow { 0%, 35% { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 45%, transparent); } }
@keyframes justDot { from { transform: scale(.5); opacity: 0; } }
@keyframes drawCheck { to { stroke-dashoffset: 0; } }

/* 2) Hele uka er registrert: én rolig glød på kortet */
.streak.celebrate { animation: glow 1.8s var(--ease-out) both; }
.streak.celebrate .flame { animation: flamePop .6s cubic-bezier(.34, 1.56, .64, 1) both; }
@keyframes glow { 0% { box-shadow: 0 0 0 0 rgba(236, 35, 151, .0); } 30% { box-shadow: 0 0 0 6px rgba(236, 35, 151, .18), 0 12px 32px -10px rgba(236, 35, 151, .55); } 100% { box-shadow: 0 0 0 0 rgba(236, 35, 151, 0); } }
@keyframes flamePop { 40% { transform: scale(1.18) rotate(-6deg); } 100% { transform: none; } }

/* 3) Dra ned for å synke */
.ptr { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 58px); z-index: 30; display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px; border-radius: 999px; background: var(--card); color: var(--muted); font-size: .85rem; font-weight: 600; box-shadow: var(--shadow), 0 0 0 1px var(--line); pointer-events: none;
  opacity: var(--p, 0); transform: translate(-50%, calc(var(--p, 0) * 18px - 12px)) scale(calc(.85 + var(--p, 0) * .15)); transition: opacity .25s, transform .3s var(--ease-out); }
.ptr.drag { transition: none; }
.ptr svg { transform: rotate(calc(var(--p, 0) * 300deg)); color: var(--accent); }
.ptr.ready { color: var(--ink); }
.ptr.busy svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
html { overscroll-behavior-y: contain; }

/* 4) Lang-trykk: ingen markering eller systemmeny på timene */
.week .lesson { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.sc-list .sc { width: 100%; background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.sc-i { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--soft); color: var(--accent); margin-right: 4px; }
.sc-i .cdot { width: 12px; height: 12px; }

@media (prefers-reduced-motion: reduce) {
  .week .lesson.just, .week .lesson.just .ok-dot, .streak.celebrate, .streak.celebrate .flame { animation-duration: .01s; }
  .week .lesson.just .ok-dot path { animation: none; stroke-dashoffset: 0; }
}

/* ================= Registrering: kompakte elevkort med knapper 2–6 ================= */
.stu.compact { padding: 12px 12px 10px; }
.stu.compact .stu-head b { font-size: 1rem; }
.stu.compact .stu-head { min-height: 28px; }
.stu.compact .status { margin: 6px 0 0; gap: 4px; }
.stu.compact .status button { padding: 7px 2px; font-size: .78rem; text-transform: none; letter-spacing: 0; white-space: nowrap; border-radius: 9px; transition: transform .16s var(--ease-out), background .15s, color .15s; }
.stu.compact .status button:active { transform: scale(.95); }
.grs { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.gr { display: grid; grid-template-columns: 76px 1fr; align-items: center; gap: 8px; }
.gr-l { font-size: .8rem; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gr-b { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.gr-b button { height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-weight: 700; font-size: .95rem; font-variant-numeric: tabular-nums; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: transform .16s var(--ease-out), background .15s, border-color .15s, color .15s; }
.gr-b button:active { transform: scale(.92); }
.gr-b button.on { background: var(--lv); border-color: var(--lv); color: #fff; box-shadow: 0 6px 14px -8px var(--lv); }
.gr-b button.pop { animation: grPop .32s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes grPop { 40% { transform: scale(1.12); } }
@media (hover: hover) and (pointer: fine) { .gr-b button:not(.on):hover { border-color: var(--lv); } }
.no-rates .grs { display: none; }
.setall .grs { margin-top: 10px; }
.look summary .muted { font-weight: 500; }
@media (prefers-reduced-motion: reduce) { .gr-b button.pop { animation: none; } }
.gr-b button.on[data-l="1"] { color: #3d0d0a; }
.gr-b button.on[data-l="5"] { color: #04313b; }

/* ================= Elevmappa ================= */
.yr-chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 2px 16px; scrollbar-width: none; }
.yr-chips::-webkit-scrollbar { display: none; }
.yr-chips a { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; transition: transform .16s var(--ease-out); }
.yr-chips a:active { transform: scale(.96); }
.yr-chips a b { font-size: .95rem; font-variant-numeric: tabular-nums; }
.yr-chips a span { font-size: .75rem; color: var(--muted); }
.yr-chips a.on { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 8px 18px -10px rgba(236, 35, 151, .7); }
.yr-chips a.on span { color: rgba(255, 255, 255, .85); }
.yr-one { margin: 0 2px 12px; font-weight: 700; }
.uv { margin-top: 0; }

.att-bar { display: flex; gap: 3px; height: 10px; border-radius: 999px; overflow: hidden; background: var(--line); }
.att-bar i { display: block; min-width: 4px; }
.att-bar i.none { flex: 1; background: var(--line); }
.att-bar .s-til, .att-legend .s-til { background: var(--s-til); }
.att-bar .s-sen, .att-legend .s-sen { background: var(--s-sen); }
.att-bar .s-fra, .att-legend .s-fra { background: var(--s-fra); }
.att-bar .s-ikke, .att-legend .s-ikke { background: var(--s-ikke); }
.att-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin-top: 10px; font-size: .85rem; color: var(--muted); }
.att-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.att-legend b { color: var(--ink); font-variant-numeric: tabular-nums; margin-right: 2px; }

.mtr { margin-top: 12px; }
.mtr-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: .9rem; }
.mtr-h b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.mtr-t { position: relative; height: 10px; margin-top: 6px; border-radius: 999px; background: var(--line); }
.mtr-f { position: absolute; left: 0; top: 0; bottom: 0; min-width: 10px; border-radius: 999px; background: var(--lv); }
.mtr-ev { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--card); border: 3px solid var(--c-inns); }
.mtr-scale { display: flex; justify-content: space-between; margin-top: 6px; font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.th-li { align-items: flex-start; }
.th-li .pill.now { font-size: .7rem; padding: 1px 7px; vertical-align: 2px; background: var(--grad); color: #fff; }
.th-note { display: block; margin-top: 6px; padding: 6px 10px; border-radius: 10px; background: var(--bg); font-size: .85rem; line-height: 1.4; }
.grade-badge.empty { background: transparent; color: var(--muted); border: 1px dashed var(--line); }
details.coming { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 8px; }
details.coming summary { cursor: pointer; font-weight: 600; font-size: .9rem; padding: 6px 0; list-style: none; display: flex; align-items: center; gap: 6px; }
details.coming summary::-webkit-details-marker { display: none; }
details.coming summary::before { content: ""; width: 7px; height: 7px; margin: 0 4px 0 2px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .2s var(--ease-out); }
details.coming[open] summary::before { transform: rotate(45deg); }
.sub-avgs .nw { white-space: nowrap; }

/* ================= Temaplan som tidslinje ================= */
.tl-card { padding: 6px 14px 10px; }
.tl-half { margin: 12px 0 4px; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.tl-list { list-style: none; margin: 0; padding: 0; }
.tl a { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 10px 0 10px 26px; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; transition: transform .16s var(--ease-out); }
.tl a:active { transform: scale(.985); }
.tl a::before { content: ""; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.tl:first-child a::before { top: 18px; }
.tl:last-child a::before { bottom: calc(100% - 18px); }
.tl-dot { position: absolute; left: 1px; top: 13px; width: 14px; height: 14px; border-radius: 50%; background: var(--card); border: 2px solid var(--line); z-index: 1; }
.tl.ferdig .tl-dot { background: var(--line); border-color: var(--line); }
.tl.ferdig.ok .tl-dot { background: var(--s-til); border-color: var(--s-til); }
.tl.ferdig.miss .tl-dot { background: var(--warn); border-color: var(--warn); }
.tl.pågår .tl-dot { background: var(--grad); border: 0; width: 16px; height: 16px; left: 0; top: 12px; box-shadow: 0 0 0 4px color-mix(in srgb, #ec2397 18%, transparent); }
.tl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tl-main b { font-size: 1rem; }
.tl.ferdig .tl-main b { font-weight: 600; }
.tl-subs { font-size: .82rem; color: var(--muted); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.tl.pågår .tl-subs { color: var(--ink); opacity: .8; }
.tl.pågår a { margin: 4px -10px; padding: 12px 10px 12px 36px; border-radius: 14px; background: var(--soft); }
.tl.pågår a::before { left: 17px; }
.tl.pågår .tl-dot { left: 10px; top: 15px; }
.tl.pågår .tl-main b { font-size: 1.1rem; }
.tl-prog { display: block; height: 6px; margin: 6px 0 2px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 16%, transparent); overflow: hidden; }
.tl-prog i { display: block; height: 100%; border-radius: 999px; background: var(--grad); }
.tl-r { flex: none; padding-top: 2px; }
.tl-ok { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.tl-when { font-size: .8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.pill.now { background: var(--grad); color: #fff; }

/* Temaside: karakter i nivåfarge, filter for manglende */
.gp button[data-g].on { background: var(--lv); border-color: var(--lv); color: #fff; box-shadow: 0 6px 14px -8px var(--lv); }
.gp button[data-g="1"].on, .gp button[data-g="2"].on { color: #3d0d0a; }
.gp button[data-g="6"].on { color: #04313b; }
#tglist.only-miss .tg-row.has { display: none; }

/* ================= Emner ================= */
.cat-scroll { display: flex; gap: 6px; overflow-x: auto; margin: 10px -16px 0; padding: 2px 16px 4px; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent); mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent); }
.cat-scroll::-webkit-scrollbar { display: none; }
.cat-scroll .chip { flex: none; white-space: nowrap; }
.tp-card { padding: 4px 0; overflow: hidden; }
.tp-card + .tp-card { margin-top: 10px; }
.tp-head { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 14px 4px; }
.tp-head b { font-size: 1rem; }
.tp-list { list-style: none; margin: 0; padding: 0; }
.tp-row { display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 8px 14px; color: inherit; text-decoration: none; border-top: 1px solid var(--line); -webkit-tap-highlight-color: transparent; transition: background .15s; }
.tp-list li:first-child .tp-row { border-top-color: transparent; }
.tp-row:active { background: var(--soft); }
@media (hover: hover) and (pointer: fine) { .tp-row:hover { background: var(--soft); } }
.tp-name { flex: 1; min-width: 0; font-weight: 600; font-size: .95rem; }
.tp-tag { font-size: .72rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tp-used { font-size: .72rem; font-weight: 700; color: var(--ok); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.tp-used::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.tp-row .chev { color: var(--muted); }
.tp-list li:first-child .tp-row { border-top-color: transparent; }
.tp-list + .tp-head { border-top: 6px solid var(--bg); margin-top: 4px; }
.tp-head { padding: 10px 14px 2px; }
.tp-head b { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.chip.on .muted { color: rgba(255, 255, 255, .8); }

/* Ett emne */
.tp-inuse { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; }
.tp-inuse .chip { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); }
.tp-inuse .cdot { width: 8px; height: 8px; }
.look-card h3 { margin-bottom: 4px; }
.look-sec + .look-sec { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.look-sec h4 { display: flex; align-items: center; gap: 8px; margin: 10px 0 6px; color: var(--ink); text-transform: none; letter-spacing: 0; font-size: .92rem; }
.look-sec ul { margin: 0; padding-left: 20px; }
.look-sec li { margin: 4px 0; line-height: 1.4; }
.ad { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.ad-inns { background: var(--c-inns); } .ad-ferd { background: var(--c-ferd); } .ad-kunn { background: var(--c-kunn); }

/* ================= Mer ================= */
.mer-status, .mer-list { padding: 4px 0; overflow: hidden; }
.ms-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; background: none; border: 0; font: inherit; color: inherit; text-align: left; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background .15s; }
.ms-row + .ms-row, .ms-row + .ms-det, .ms-det + .ms-row { border-top: 1px solid var(--line); }
.ms-row:active { background: var(--soft); }
.ms-row .grow { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ms-row .chev { color: var(--muted); }
.ms-i { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--soft); color: var(--accent); }
.ms-i.ok { background: var(--ok-soft); color: var(--ok); }
.ms-i.warn { background: var(--warn-soft); color: var(--warn); }
.warn-txt { color: var(--warn); font-weight: 600; }
.ms-det > summary { list-style: none; }
.ms-det > summary::-webkit-details-marker { display: none; }
.ms-det[open] > summary .chev { transform: rotate(90deg); }
.ms-det > summary .chev { transition: transform .2s var(--ease-out); }
details.mer-more { margin-top: 10px; }
details.mer-more > summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--accent); padding: 6px 0; list-style: none; }
details.mer-more > summary::-webkit-details-marker { display: none; }
details.mer-more > summary::after { content: "›"; display: inline-block; margin-left: 6px; transition: transform .2s var(--ease-out); }
details.mer-more[open] > summary::after { transform: rotate(90deg); }
.danger-zone { padding: 0 2px; }
.danger-zone > summary { color: var(--danger) !important; }
#synccard, #backup { scroll-margin-top: 70px; }
.syncdown:empty { display: none; }

/* ================= Klassesiden ================= */
.tabs-scroll { overflow-x: auto; scrollbar-width: none; margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent); mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent); }
.tabs-scroll::-webkit-scrollbar { display: none; }
.tabs-scroll a { flex: none; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 12px; background: none; border: 0; color: var(--muted); cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background .15s, transform .16s var(--ease-out); }
.btn.icon-btn { width: 38px; min-height: 34px; height: 34px; color: var(--ink); }
.icon-btn:active { transform: scale(.92); background: var(--soft); }
.back-tabs { display: inline-block; margin: 0 2px 12px; color: var(--accent); font-weight: 600; text-decoration: none; }
.btn .ico { width: 18px; height: 18px; margin-right: 6px; vertical-align: -3px; color: inherit; }
.btn:not(.primary) .ico { color: var(--accent); }

.ok-card { padding: 4px 0; overflow: hidden; }
.ok-group + .ok-group { border-top: 6px solid var(--bg); }
.ok-group > summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent; }
.ok-group > summary::-webkit-details-marker { display: none; }
.ok-group > summary .grow { display: flex; flex-direction: column; gap: 1px; }
.ok-group > summary .chev { color: var(--muted); transition: transform .2s var(--ease-out); }
.ok-group[open] > summary .chev { transform: rotate(90deg); }
.ok-list { list-style: none; margin: 0; padding: 0; }
.ok-row { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; transition: background .15s; }
.ok-row:active { background: var(--soft); }
.ok-row .grow { min-width: 0; display: flex; flex-direction: column; }
.ok-row .grow b { font-size: .92rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ok-row .grow .small::first-letter { text-transform: uppercase; }
.ok-date { flex: none; width: 40px; display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.ok-date b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.ok-date span { font-size: .7rem; color: var(--muted); text-transform: uppercase; font-weight: 600; }
.ok-row .chev { color: var(--muted); }
.att-pill { flex: none; font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums; padding: 3px 8px; border-radius: 999px; background: var(--line); color: var(--muted); }
.att-pill.ok { background: var(--ok-soft); color: var(--ok); }
.att-pill.warn { background: var(--warn-soft); color: var(--warn); }

.st-card { padding: 4px 0; overflow: hidden; }
.st-list { list-style: none; margin: 0; padding: 0; }
.st-list li { display: flex; align-items: center; padding-right: 8px; }
.st-list li + li { border-top: 1px solid var(--line); }
.st-row { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 6px 10px 14px; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.st-row:active { background: var(--soft); }
.st-row .grow { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.st-av { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; font-size: .8rem; font-weight: 800; letter-spacing: .02em; color: var(--cc); background: color-mix(in srgb, var(--cc) 16%, transparent); }

/* ================= Underveisvurdering ================= */
.uv-sum { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.uv-state span { font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.uv-state .uv-done { background: var(--ok-soft); color: var(--ok); }
.uv-state .uv-draft { background: var(--warn-soft); color: var(--warn); }
.uv-state .uv-none { background: var(--line); color: var(--muted); }
.rep-area { margin-top: 14px; }
.rep-h { display: flex; justify-content: space-between; align-items: baseline; font-size: .92rem; font-weight: 600; margin-bottom: 6px; }
.rep-h b { font-size: 1.05rem; }
.gr-b.six { grid-template-columns: repeat(6, 1fr); }
.gr-b button.avg { position: relative; }
.gr-b button.avg::after { content: ""; position: absolute; left: 50%; bottom: 4px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: currentColor; opacity: .55; }
.gr-b.six button.on[data-rg="1"], .gr-b.six button.on[data-rg="2"] { color: #3d0d0a; }
.gr-b.six button.on[data-rg="6"] { color: #04313b; }
.rep-f { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; }

/* ================= Egenvurdering (eleven) ================= */
.ev-form .done-chip { opacity: .45; }
.who-picked { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: var(--soft); font-size: 1rem; }
.who-picked b { color: var(--accent); }
.ev-area + .ev-area { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.ev-crit { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; font-size: .82rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.ev-jeg { margin: 2px 0 10px; font-size: 1.05rem; font-style: italic; line-height: 1.4; }
.ev-band { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ev-band button { height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform .16s var(--ease-out), background .15s, color .15s, border-color .15s; }
.ev-band button:active { transform: scale(.95); }
.ev-band button.on { color: #fff; border-color: transparent; box-shadow: 0 8px 18px -10px currentColor; }
.ev-band button.on[data-b="1"] { background: #fa7670; color: #3d0d0a; }
.ev-band button.on[data-b="2"] { background: #a43cf0; }
.ev-band button.on[data-b="3"] { background: #15cff9; color: #04313b; }
#evsend { transition: opacity .2s, transform .16s var(--ease-out); }
#evsend:not(.ready) { opacity: .55; }
.ev-thanks { text-align: center; padding-top: 18vh; }
.ev-thanks h1 { margin: 18px 0 6px; font-size: 1.8rem; }
.ev-check { width: 96px; height: 96px; margin: 0 auto; }
.ev-check svg { width: 100%; height: 100%; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ev-check circle { stroke: var(--ok); stroke-width: 3; stroke-dasharray: 1; stroke-dashoffset: 1; animation: evDraw .6s var(--ease-out) .05s forwards; }
.ev-check path { stroke: var(--ok); stroke-width: 4.5; stroke-dasharray: 1; stroke-dashoffset: 1; animation: evDraw .45s var(--ease-out) .5s forwards; }
@keyframes evDraw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .ev-check circle, .ev-check path { animation: none; stroke-dashoffset: 0; } }

/* ================= Klasser-lista ================= */
.cls-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 14px; color: inherit; text-decoration: none; overflow: hidden; -webkit-tap-highlight-color: transparent; transition: transform .16s var(--ease-out); }
.cls-name::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--cc); margin-right: 8px; vertical-align: 2px; }
.cls-card:active { transform: scale(.985); }
.cls-card.done { opacity: .7; }
.cls-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.cls-name { font-size: 1.4rem; font-weight: 800; letter-spacing: -.01em; color: var(--cc); }
.cls-top .chev { margin-left: auto; color: var(--muted); align-self: center; }
.cls-info { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: var(--muted); }
.cls-info b { color: var(--ink); font-weight: 650; }
.cls-info span::first-letter { text-transform: uppercase; }
.cls-info i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin: 0 8px 1px 1px; vertical-align: middle; }
.ci-now { background: var(--grad); }
.ci-next { background: var(--muted); }
.cls-warn { display: flex; flex-wrap: wrap; gap: 6px; }
.cls-warn span { font-size: .78rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }

/* ================= Timeplan ================= */
.tp-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.tp-day { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.tp-dh { text-align: center; font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding-bottom: 4px; border-bottom: 1px solid var(--line); margin-bottom: 2px; }
.tp-l, .tp-o { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 2px; border-radius: 10px; font: inherit; text-align: center; min-width: 0; }
.tp-l { border: 0; background: var(--cc); color: #fff; cursor: pointer; box-shadow: 0 6px 14px -8px var(--cc); -webkit-tap-highlight-color: transparent; transition: transform .16s var(--ease-out); }
.tp-l:active { transform: scale(.94); }
.tp-l b, .tp-o b { font-size: .85rem; font-variant-numeric: tabular-nums; }
.tp-l span, .tp-o span { font-size: .68rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-l span { opacity: .9; }
.tp-o { border: 1px dashed color-mix(in srgb, var(--cc) 55%, transparent); color: var(--muted); background: transparent; }
.tp-o span { color: var(--cc); font-weight: 700; }
.tp-none { text-align: center; color: var(--line); padding: 8px 0; }
.tp-key { display: inline-flex; align-items: center; gap: 6px; }
.tp-key i { width: 14px; height: 10px; border-radius: 3px; border: 1px dashed var(--muted); }

/* Åpningsanimasjon med partikler */
#splash.pt { display: block; background: #000; transition: opacity .4s ease, background-color 1.1s ease; }
#splash.pt.burst { background-color: rgba(0, 0, 0, 0); }
#splash.pt canvas { position: absolute; inset: 0; }
#splash .sp-txt { position: absolute; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; opacity: 0; transform: translateY(8px); transition: opacity .5s ease, transform .6s cubic-bezier(.23, 1, .32, 1); pointer-events: none; }
#splash .sp-txt b { color: #fff; font-size: 1.5rem; font-weight: 800; letter-spacing: .02em; text-shadow: 0 0 24px rgba(236, 35, 151, .6); }
#splash .sp-txt span { color: rgba(255, 255, 255, .62); font-size: .85rem; letter-spacing: .04em; }
#splash.txt-on .sp-txt { opacity: 1; transform: none; }
#splash.burst .sp-txt { opacity: 0; transform: scale(1.06); transition-duration: .35s; }
#splash .sp-skip { position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 28px); text-align: center; color: rgba(255, 255, 255, .35); font-size: .75rem; letter-spacing: .04em; animation: fade .6s ease 1s both; }
#splash.burst .sp-skip { opacity: 0; transition: opacity .2s; }

/* Lyd i introen */
#splash .sp-sound { position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 64px); transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .08); color: #fff; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: fade .5s ease .4s both; transition: opacity .4s, transform .16s var(--ease-out); }
#splash .sp-sound:active { transform: translateX(-50%) scale(.95); }
#splash .sp-sound.on { opacity: 0; }
#splash.burst .sp-sound { opacity: 0; pointer-events: none; }
.switch-row { display: flex; align-items: center; gap: 12px; margin-top: 16px; cursor: pointer; }
.switch-row .grow { display: flex; flex-direction: column; gap: 2px; }
.switch { -webkit-appearance: none; appearance: none; flex: none; width: 50px; height: 30px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .22s var(--ease-out); }
.switch:checked { background: var(--grad); }
.switch:checked::after { transform: translateX(20px); }

/* ================= Forbedringsrunde: trykkflater, notater, elevnavigasjon, grupper, veiledning ================= */
.mic { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; font-size: 0; color: var(--accent); background: var(--soft); border-radius: 12px; flex: none; }
.mic svg { width: 20px; height: 20px; }
.note-btn { min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--accent); font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer; white-space: nowrap; -webkit-tap-highlight-color: transparent; transition: transform .16s var(--ease-out); }
.note-btn:active { transform: scale(.95); }
.note-btn.has { background: var(--soft); border-color: transparent; }
.stu-note-wrap { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.stu-note-wrap.hidden { display: none; }
.stu-note-wrap .stu-note { flex: 1; min-width: 0; margin: 0; }
.stu.compact .stu-head { min-height: 40px; }
.other-topic summary, .look > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
.tg-note.hidden { display: none; }

.stu-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 12px; }
.stu-nav a { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 10px; max-width: 42%; border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .88rem; -webkit-tap-highlight-color: transparent; transition: transform .16s var(--ease-out); }
.stu-nav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stu-nav a svg { flex: none; color: var(--accent); }
.stu-nav a:active { transform: scale(.96); }
.uv-done svg, .uv-state .uv-done svg { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }

#toast.has-action { pointer-events: auto; display: flex; align-items: center; gap: 14px; }
.toast-undo { border: 1.5px solid currentColor; background: none; color: inherit; font: inherit; font-weight: 800; padding: 5px 14px; border-radius: 999px; cursor: pointer; min-height: 36px; }

.grp-boxes { display: grid; gap: 8px; margin-top: 6px; }
.grp-box { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; background: var(--bg); }
.grp-box.none { border-style: dashed; }
.grp-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.grp-m { display: flex; flex-wrap: wrap; gap: 6px; }
.grp-m .chip { min-height: 36px; }
.grp-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grp-pick .ghost { grid-column: 1 / -1; }

.tourbar.compact { padding: 10px 14px 12px; }
.tb-top { display: flex; align-items: center; gap: 4px; }
.tb-top .link { min-height: 32px; padding: 0 6px; }
.tourbar.compact h3 { margin: 6px 0 0; font-size: 1rem; }
.tb-text { margin: 2px 0 0 !important; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.tb-text.open { display: block; }
.tb-more { margin: 2px 0 0 !important; padding: 2px 0; }
.tb-nav { margin-top: 8px; }

/* ================= Egenvurdering (læreren) ================= */
.ev-prog { margin-top: 8px; }
.ev-prog-t { font-size: .95rem; color: var(--muted); }
.ev-prog-t b { color: var(--ink); font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.ev-prog-b { height: 8px; margin-top: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.ev-prog-b i { display: block; height: 100%; border-radius: 999px; background: var(--grad); transition: width .4s var(--ease-out); }
.ev-tools { margin-top: 6px; }
.ev-tools .btn svg { margin-right: 6px; vertical-align: -3px; }
.ev-ov { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.ev-ov h4 { margin: 0 0 6px; }
.ev-ar { margin-top: 12px; }
.ev-ar-h span { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .92rem; }
.ev-bar { display: flex; gap: 3px; height: 26px; margin-top: 6px; border-radius: 8px; overflow: hidden; }
.ev-bar i { display: grid; place-items: center; min-width: 24px; font-style: normal; font-size: .8rem; font-weight: 800; color: #fff; }
.b1 { background: #fa7670; } .b2 { background: #a43cf0; } .b3 { background: #15cff9; }
.ev-bar i.b1 { color: #3d0d0a; } .ev-bar i.b3 { color: #04313b; }
.ev-leg { display: flex; gap: 12px; margin-top: 4px; font-size: .75rem; color: var(--muted); }
.ev-leg i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.ev-dev { margin: 4px 0 0; }
.ev-list { list-style: none; margin: 4px 0 8px; padding: 0; }
.ev-list li + li { border-top: 1px solid var(--line); }
.ev-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 6px 2px; background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.ev-row .grow { display: flex; flex-direction: column; min-width: 0; }
.ev-row.none { cursor: default; }
.ev-row .chev { color: var(--muted); }
.ev-dots { display: flex; gap: 3px; }
.ev-dots i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-style: normal; font-size: .7rem; font-weight: 800; color: #fff; }
.ev-dots i.b1 { color: #3d0d0a; } .ev-dots i.b3 { color: #04313b; } .ev-dots i.b0 { background: var(--line); color: var(--muted); }
.icon-btn { color: var(--accent); }
.ev-cmp { display: grid; grid-template-columns: 1fr auto auto; gap: 8px 14px; align-items: center; margin-bottom: 8px; }
.ev-cmp > span:first-child { display: block; }
.ev-cmp span { display: inline-flex; align-items: center; gap: 8px; font-size: .92rem; }
.ev-cmp b { justify-self: start; padding: 3px 10px; border-radius: 999px; font-size: .82rem; color: #fff; }
.ev-cmp b.b1 { color: #3d0d0a; } .ev-cmp b.b3 { color: #04313b; } .ev-cmp b.b0 { background: var(--line); color: var(--muted); }
.ev-cmp .tb { font-weight: 700; color: var(--muted); }
.ev-cmp b.lo::after { content: " ↓"; }
.ev-cmp b.hi::after { content: " ↑"; }
.ev-other { margin-top: 10px; }

.ev-full { position: fixed; inset: 0; z-index: 200; background: #fff; color: #17141f; display: grid; place-items: center; padding: 24px; animation: fade .2s ease; }
.ev-full-in { text-align: center; max-width: 900px; }
.ev-full-k { margin: 0; font-weight: 700; color: #7c3aed; letter-spacing: .02em; }
.ev-full h1 { margin: 4px 0 16px; font-size: clamp(1.8rem, 5vw, 3.2rem); }
.ev-full-qr { width: min(70vw, 62vh); aspect-ratio: 1; margin: 0 auto; display: grid; place-items: center; }
.ev-full-qr svg { width: 100%; height: 100%; }
.ev-full-l { margin: 14px 0 4px; color: #6b6578; font-size: clamp(.95rem, 2vw, 1.2rem); }
.ev-full-n { margin: 8px 0 0; font-size: clamp(1.1rem, 2.6vw, 1.6rem); color: #6b6578; }
.ev-full-n b { color: #17141f; font-size: 1.4em; display: inline-block; font-variant-numeric: tabular-nums; }
.ev-full-n b.pop { animation: grPop .4s cubic-bezier(.34, 1.56, .64, 1); }
.ev-full-x { position: absolute; top: calc(env(safe-area-inset-top) + 12px); right: 16px; width: 48px; height: 48px; border-radius: 50%; border: 0; background: #f1eafe; color: #7c3aed; font-size: 1.2rem; cursor: pointer; }
body.noscroll { overflow: hidden; }

/* ---------- Ark og Excel-import ---------- */
.src-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.src-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 76px; padding: 10px 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); font-weight: 600; font-size: 14px; text-align: center; cursor: pointer; transition: transform .12s var(--ease-out), background .15s; -webkit-tap-highlight-color: transparent; }
.src-btn .ico { width: 24px; height: 24px; }
.src-btn:active { transform: scale(.97); }
.src-btn.primary { background: var(--grad); color: #fff; border-color: transparent; }
.src-btn.primary .ico, .btn.primary .ico { color: #fff; }
.src-btn.busy { opacity: .6; pointer-events: none; }
.dur { align-items: center; margin-top: 8px; }
.dur .small { margin-left: 4px; }
.area-intro { margin: 14px 4px 6px; }
.area-h { display: flex; align-items: center; gap: 8px; margin-top: 0; }
.area-h .muted { margin-left: auto; font-weight: 500; }
.sug-box { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.sug-box summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink); list-style: none; display: flex; align-items: center; gap: 6px; min-height: 32px; }
.sug-box summary::-webkit-details-marker { display: none; }
.sug-box summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .2s var(--ease-out); margin: 0 4px 0 2px; }
.sug-box[open] summary::before { transform: rotate(45deg); }
.sug-box .chips { margin-top: 8px; }
.btn .ico { width: 18px; height: 18px; vertical-align: -3px; margin-right: 6px; }
.xi-steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 12px; }
.xi-steps li { flex: 1; display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); white-space: nowrap; }
.xi-steps b { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line); font-size: 12px; }
.xi-steps b svg { width: 12px; height: 12px; }
.xi-steps .on { color: var(--ink); border-color: var(--accent); }
.xi-steps .on b { background: var(--grad); color: #fff; border-color: transparent; }
.xi-steps .done b { background: var(--ok); color: #fff; border-color: transparent; }
.xi-demo { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.xi-demo table { border-collapse: collapse; width: 100%; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.xi-demo th, .xi-demo td { padding: 6px 8px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); text-align: left; white-space: nowrap; }
.xi-demo th { background: var(--bg); font-weight: 600; color: var(--muted); }
.xi-demo tr:last-child td { border-bottom: 0; }
.xi-demo th:last-child, .xi-demo td:last-child { border-right: 0; }
.xi-demo .p, .xi-sw.p { background: #c6efce; color: #14532d; }
.xi-demo .m, .xi-sw.m { background: #ffc7ce; color: #7f1d1d; }
.xi-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0 0; }
.xi-legend span { display: inline-flex; align-items: center; gap: 6px; }
.xi-sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
#xintro.loaded .xi-more { display: none; }
#xintro.loaded label.btn { margin-top: 10px !important; }
.xi-h { margin: 18px 4px 8px; }
.xsheet .switch-row .grow b { font-size: 16px; }
.xsheet .xs-themes { margin-top: 12px; }
.xsheet .xs-themes .chip b { margin-left: 2px; }
.xsheet.off .xs-body { display: none; }
.xsheet.off { opacity: .7; }
#ximport:disabled { opacity: .5; }

/* ---------- AI-forslag ---------- */
.ai-box { min-height: 84px; }
.ai-box textarea { width: 100%; }
.ai-load { display: flex; align-items: center; gap: 6px; padding: 18px 14px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 14px; }
.ai-load span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: aidot 1s var(--ease-out) infinite; }
.ai-load span:nth-child(2) { animation-delay: .15s; } .ai-load span:nth-child(3) { animation-delay: .3s; margin-right: 6px; }
@keyframes aidot { 0%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .ai-load span { animation: none; opacity: .6; } }
.ai-err { color: var(--danger); margin: 8px 0; }
.ai-orig { margin-top: 12px; }
.ai-orig summary { cursor: pointer; font-size: 14px; color: var(--muted); min-height: 32px; display: flex; align-items: center; }
.ai-orig summary { list-style: none; gap: 8px; }
.ai-orig summary::-webkit-details-marker { display: none; }
.ai-orig summary::before { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .2s var(--ease-out); }
.ai-orig[open] summary::before { transform: rotate(45deg); }
.ai-orig p { margin: 6px 0 0; font-size: 14px; color: var(--muted); white-space: pre-wrap; }
