:root {
  --ink: #183c42; --muted: #60747b; --accent: #16796f; --accent-dark: #105e57;
  --canvas: #f3f7f8; --surface: #fff; --line: #dce6e8; --soft: #e7f3f0;
  --blue: var(--accent); --pale: #edf4f6; --green: #226d4b; --red: #a33542;
  --paper: var(--surface); --bg: var(--canvas);
  font: 16px/1.6 "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  color: var(--ink); background: var(--canvas); font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent-dark); text-underline-offset: .22em; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; }
button, .button {
  display: inline-flex; justify-content: center; align-items: center; gap: .5rem;
  min-height: 44px; padding: .65rem 1.15rem; border: 1px solid var(--accent);
  border-radius: 10px; background: var(--accent); color: white;
  font-weight: 650; cursor: pointer; text-decoration: none; line-height: 1.4;
  transition: background .15s ease, border-color .15s ease;
}
button:hover, .button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button:disabled { opacity: .55; cursor: wait; }
.secondary { background: var(--surface); color: var(--accent-dark); border-color: var(--line); }
.secondary:hover { background: var(--soft); border-color: var(--accent); }
.danger { background: var(--red); border-color: var(--red); }
.danger:hover { background: #822735; border-color: #822735; }
.text-button { background: none; border: 0; color: var(--accent-dark); padding: .3rem 0; font-weight: 500; text-decoration: underline; }
.text-button:hover { background: none; color: var(--ink); }
.site-header {
  display: flex; justify-content: space-between; align-items: center; gap: 1.5rem;
  padding: 1rem max(2rem, calc((100vw - 1376px) / 2)); border-bottom: 1px solid var(--line);
  background: var(--surface); min-height: 82px;
}
.brand { display: inline-flex; align-items: center; gap: 1rem; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.institution-mark { display: block; padding-right: 1rem; border-right: 1px solid var(--line); flex-shrink: 0; }
.kth-logo { display: block; width: 48px; height: auto; }
.brand-text { font-weight: 750; font-size: 1rem; line-height: 1.35; letter-spacing: -.025em; }
.brand-caption { display: block; font-size: .72rem; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-top: .15rem; }
.site-header nav { display: flex; align-items: center; gap: 1.2rem; font-size: .85rem; }
.site-header nav a { text-decoration: none; color: var(--muted); padding: .4rem 0; }
.site-header nav a[aria-current], .site-header nav a:hover { color: var(--accent-dark); }
.site-header nav a[aria-current] { box-shadow: 0 2px var(--accent); }
.site-header nav form { margin: 0; padding-left: 1.2rem; border-left: 1px solid var(--line); }
.site-header .text-button { font-size: inherit; text-decoration: none; color: var(--muted); }
.page { max-width: 1440px; margin: auto; padding: 2rem 2rem 3.5rem; min-height: calc(100vh - 165px); }
.narrow { max-width: 720px; margin-inline: auto; }
.card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1.75rem; margin: 1rem 0; }
h1, h2, h3 { color: var(--ink); font-weight: 650; }
h1 { font-size: clamp(1.8rem, 3.5vw, 2.55rem); line-height: 1.2; letter-spacing: -.045em; margin: .3rem 0 1rem; }
h2 { font-size: 1.35rem; line-height: 1.35; letter-spacing: -.025em; margin: 0 0 1rem; }
h3 { font-size: 1.05rem; line-height: 1.5; }
p { margin: .6rem 0 1rem; }
.muted, .helptext { color: var(--muted); font-size: .875rem; }
.helptext { display: block; margin: .35rem 0 .8rem; }
.eyebrow { font-size: .8rem; color: var(--muted); font-weight: 600; }
.notice, .errorlist { padding: .9rem 1.1rem; border-radius: 10px; background: var(--pale); border: 1px solid #d4e3e8; margin: 1rem 0; font-size: .9rem; }
.error, .errorlist { background: #fff1f2; color: var(--red); border-color: #f0d1d6; }
.success { background: #edf7ef; color: var(--green); border-color: #cce4d4; }
.warning { background: #fff7e8; border-color: #ead5af; color: #77571d; }
.errorlist { list-style: none; }
.badge { display: inline-flex; align-items: center; background: var(--soft); color: var(--accent-dark); border-radius: 6px; padding: .2rem .6rem; font-size: .75rem; font-weight: 600; line-height: 1.5; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin: 1.25rem 0; }
.field { margin: 1.2rem 0; }
label, legend { font-weight: 600; font-size: .9rem; }
label { display: block; margin-bottom: .4rem; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  display: block; width: 100%; max-width: 100%; padding: .75rem .85rem;
  border: 1px solid #bdcdd1; border-radius: 9px; background: var(--surface); color: var(--ink);
}
input::placeholder, textarea::placeholder { color: #6d8289; opacity: 1; }
textarea { min-height: 7rem; resize: vertical; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 1.15rem; height: 1.15rem; flex: none; }
input:disabled, textarea:disabled { background: var(--canvas); }
fieldset { border: 0; padding: 0; margin: 1.4rem 0; min-width: 0; }
legend { margin-bottom: .7rem; }
.choice { display: flex; gap: .75rem; align-items: flex-start; font-weight: 450; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: 10px; margin: .6rem 0; cursor: pointer; }
.choice:hover { background: #f8fbfb; border-color: #acc9c5; }
.choice:has(input:checked) { background: var(--soft); border-color: var(--accent); }
.choice input { margin: .2rem 0 0; }
.inline-check { display: flex; gap: .6rem; align-items: center; font-weight: 450; }
.study-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 1.25rem; }
.question-prompt { font-size: 1.2rem; line-height: 1.6; }
.prose { white-space: pre-wrap; max-width: 75ch; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: white; }
table { border-collapse: collapse; width: 100%; font-size: .875rem; background: white; }
th, td { text-align: left; padding: .95rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; font-weight: 600; background: #f7fafb; color: var(--muted); }
td { overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfc; }
details { border-top: 1px solid var(--line); padding: 1rem 0; }
summary { cursor: pointer; font-weight: 600; }
.site-footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1.3rem max(2rem, calc((100vw - 1376px) / 2)); font-size: .75rem; color: var(--muted); border-top: 1px solid var(--line); }
:focus-visible { outline: 3px solid #437fbd; outline-offset: 3px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; padding: .6rem 1rem; background: white; z-index: 100; border-radius: 8px; }
.skip-link:focus { top: 1rem; }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
code { overflow-wrap: anywhere; font-size: .85em; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8rem; }
form p { margin: 1rem 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
@media (max-width: 720px) {
  .site-header { padding: .9rem 1rem; gap: .7rem; align-items: flex-start; }
  .site-header nav { flex-wrap: wrap; gap: .2rem .85rem; justify-content: flex-end; font-size: .78rem; }
  .site-header nav form { border: 0; padding: 0; }
  .brand { gap: .85rem; }
  .institution-mark { padding-right: .85rem; }
  .kth-logo { width: 40px; }
  .brand-text { font-size: .88rem; } .brand-caption { font-size: .63rem; }
  .page { padding: 1.4rem 1rem 2.5rem; }
  .card, .panel { padding: 1.2rem; border-radius: 12px; }
  .site-footer { padding: 1rem; flex-direction: column; gap: .15rem; }
}
@media (max-width: 480px) {
  .site-header { flex-wrap: wrap; }
  .site-header nav { width: 100%; justify-content: flex-start; gap: .2rem 1.2rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
