:root {
  color-scheme: dark;
  --ink: #f4f7ef;
  --muted: #9eb0b7;
  --subtle: #6f838b;
  --bg: #0b141a;
  --surface: #101c24;
  --surface-2: #152630;
  --surface-3: #1b303b;
  --line: rgba(218, 235, 237, 0.12);
  --accent: #c9ff4a;
  --accent-ink: #152000;
  --orange: #ff7849;
  --blue: #71d8ff;
  --danger: #ff6b6b;
  --warning: #ffcf4a;
  --success: #68e0a3;
  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 30px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% -10%, rgba(113, 216, 255, 0.12), transparent 34rem),
    radial-gradient(circle at -10% 25%, rgba(201, 255, 74, 0.06), transparent 28rem),
    var(--bg);
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: var(--accent); }

.app-frame {
  width: min(100%, 880px);
  min-height: 100vh;
  margin: 0 auto;
  border-inline: 1px solid rgba(255, 255, 255, 0.03);
  background: rgba(11, 20, 26, 0.74);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: calc(10px + env(safe-area-inset-top)) 20px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 20, 26, 0.84);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  font-weight: 800;
  letter-spacing: -0.02em;
  cursor: pointer;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(201, 255, 74, 0.08);
}

.local-badge, .eyebrow, .pill, .status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.local-badge { color: var(--success); }
.local-badge span { font-size: 0.55rem; }

#app {
  min-height: calc(100vh - 64px);
  padding: 22px 20px calc(104px + env(safe-area-inset-bottom));
  outline: none;
}

.bottom-nav {
  position: fixed;
  z-index: 25;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 880px);
  margin: auto;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(11, 20, 26, 0.9);
  backdrop-filter: blur(20px);
}

.bottom-nav[hidden] { display: none; }

.bottom-nav button {
  display: grid;
  gap: 3px;
  place-items: center;
  padding: 7px 4px;
  border: 0;
  border-radius: 14px;
  color: var(--subtle);
  background: transparent;
  font-size: 0.7rem;
  cursor: pointer;
}

.bottom-nav button.active {
  color: var(--accent);
  background: rgba(201, 255, 74, 0.07);
}

.nav-icon { font-size: 1.35rem; line-height: 1; }

.stack { display: grid; gap: 16px; }
.stack-lg { display: grid; gap: 24px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 14px; }

.hero {
  position: relative;
  overflow: hidden;
  padding: 28px;
  border: 1px solid rgba(201, 255, 74, 0.14);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgba(201, 255, 74, 0.12), transparent 48%),
    var(--surface);
  box-shadow: var(--shadow);
}

.hero::after {
  position: absolute;
  top: -70px;
  right: -70px;
  width: 210px;
  height: 210px;
  border: 38px solid rgba(113, 216, 255, 0.07);
  border-radius: 50%;
  content: "";
}

.hero > * { position: relative; z-index: 1; }
.hero-compact { padding-block: 22px; }
.hero h1, .hero h2, .page-title { max-width: 14ch; }

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -0.035em; }
h1 { margin-bottom: 14px; font-size: clamp(2.3rem, 9vw, 4.7rem); line-height: 0.95; }
h2 { margin-bottom: 10px; font-size: clamp(1.55rem, 5vw, 2.2rem); line-height: 1.03; }
h3 { margin-bottom: 8px; font-size: 1.05rem; }
p { color: var(--muted); line-height: 1.55; }
.lead { max-width: 44rem; font-size: 1.05rem; }
.eyebrow { margin-bottom: 12px; color: var(--accent); }
.page-title { margin-bottom: 6px; }
.section-title { margin: 8px 0 0; }
.fine-print { color: var(--subtle); font-size: 0.78rem; line-height: 1.5; }

.card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.card-raised {
  background: linear-gradient(155deg, rgba(255,255,255,0.035), transparent), var(--surface-2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14);
}

.card-accent { border-color: rgba(201, 255, 74, 0.25); }
.card-warning { border-color: rgba(255, 207, 74, 0.36); background: rgba(255, 207, 74, 0.07); }
.card-danger { border-color: rgba(255, 107, 107, 0.4); background: rgba(255, 107, 107, 0.08); }

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 15px;
  color: var(--accent-ink);
  background: var(--accent);
  font-weight: 850;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.button:hover { filter: brightness(1.04); }
.button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(113, 216, 255, 0.42); outline-offset: 2px; }
.button-secondary { color: var(--ink); border-color: var(--line); background: var(--surface-3); }
.button-ghost { color: var(--muted); border-color: var(--line); background: transparent; }
.button-danger { color: white; border-color: rgba(255, 107, 107, 0.35); background: rgba(255, 107, 107, 0.14); }
.button-wide { width: 100%; }
.button-small { min-height: 38px; padding: 8px 12px; border-radius: 12px; font-size: 0.86rem; }
.button[disabled] { opacity: 0.42; cursor: not-allowed; filter: none; }

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.metric { padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,0.025); }
.metric strong { display: block; margin-bottom: 4px; font-size: 1.45rem; letter-spacing: -0.04em; }
.metric span { color: var(--subtle); font-size: 0.75rem; }

.progress-track { overflow: hidden; height: 9px; border-radius: 99px; background: rgba(255,255,255,0.07); }
.progress-bar { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--blue)); transition: width 300ms ease; }

.session-list { display: grid; gap: 10px; }
.session-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: inherit;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.session-card:hover { border-color: rgba(201, 255, 74, 0.3); background: var(--surface-2); }
.session-number { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 14px; color: var(--accent); background: rgba(201, 255, 74, 0.08); font-weight: 900; }
.session-card h3 { margin: 0 0 3px; }
.session-card p { margin: 0; font-size: 0.83rem; }
.session-meta { color: var(--subtle); font-size: 0.74rem; }
.session-arrow { color: var(--accent); font-size: 1.3rem; }

.profile-layout { display: grid; grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr); gap: 22px; align-items: center; }
.radar { width: 100%; max-width: 320px; margin: auto; overflow: visible; }
.radar-grid { fill: none; stroke: rgba(255,255,255,0.12); stroke-width: 1; }
.radar-axis { stroke: rgba(255,255,255,0.09); stroke-width: 1; }
.radar-shape { fill: rgba(201,255,74,0.16); stroke: var(--accent); stroke-width: 2.5; }
.radar-dot { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.radar-label { fill: var(--muted); font-size: 9px; font-weight: 750; text-anchor: middle; }

.score-list { display: grid; gap: 11px; }
.score-row { display: grid; grid-template-columns: 100px 1fr 42px; align-items: center; gap: 10px; font-size: 0.82rem; }
.score-row strong { text-align: right; }
.score-track { height: 7px; border-radius: 99px; background: rgba(255,255,255,0.07); }
.score-fill { height: 100%; border-radius: inherit; background: var(--score-color, var(--accent)); }

.priority-list { display: grid; gap: 10px; }
.priority { display: grid; grid-template-columns: 10px 1fr; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,0.022); }
.priority-dot { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--blue); }
.priority[data-level="care"] .priority-dot { background: var(--danger); }
.priority[data-level="attention"] .priority-dot { background: var(--warning); }
.priority[data-level="focus"] .priority-dot { background: var(--accent); }
.priority h3 { margin-bottom: 4px; }
.priority p { margin: 0; font-size: 0.86rem; }

.pill { width: fit-content; padding: 6px 9px; border-radius: 99px; color: var(--blue); background: rgba(113, 216, 255, 0.08); }
.status-chip { padding: 5px 8px; border-radius: 99px; color: var(--subtle); background: rgba(255,255,255,0.055); }
.status-chip.complete { color: var(--success); background: rgba(104, 224, 163, 0.09); }

.test-form { display: grid; gap: 18px; }
.test-card { display: grid; gap: 16px; padding: 20px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
.test-head { display: grid; gap: 5px; }
.test-head p { margin: 0; font-size: 0.9rem; }
.instruction { padding: 12px 14px; border-left: 3px solid var(--blue); border-radius: 0 12px 12px 0; background: rgba(113, 216, 255, 0.055); color: var(--muted); font-size: 0.84rem; line-height: 1.5; }
.reference { color: var(--subtle); font-size: 0.76rem; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-grid .field:only-child, .field-grid .field-full { grid-column: 1 / -1; }
.field { display: grid; gap: 7px; }
.field label { color: var(--muted); font-size: 0.8rem; font-weight: 750; }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 54px; }
.unit { position: absolute; top: 50%; right: 14px; color: var(--subtle); font-size: 0.78rem; transform: translateY(-50%); pointer-events: none; }
input[type="number"], select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: var(--surface-3);
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 20px, calc(100% - 12px) 20px; background-size: 5px 5px; background-repeat: no-repeat; }
textarea { min-height: 84px; resize: vertical; }

.range-field { grid-column: 1 / -1; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.range-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.range-value { color: var(--accent); font-weight: 900; }
input[type="range"] { width: 100%; accent-color: var(--accent); }

.check-list { display: grid; gap: 10px; }
.check-item { display: grid; grid-template-columns: 24px 1fr; gap: 11px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,0.025); cursor: pointer; }
.check-item:has(input:checked) { border-color: rgba(255,107,107,0.5); background: rgba(255,107,107,0.08); }
.check-item input { width: 20px; height: 20px; margin: 0; accent-color: var(--danger); }
.check-item span { color: var(--muted); line-height: 1.42; }

.history { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.history th, .history td { padding: 11px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.history th { color: var(--subtle); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; }
.history td:last-child, .history th:last-child { text-align: right; }

.empty-state { padding: 34px 22px; border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; }
.empty-state strong { display: block; margin-bottom: 6px; }
.empty-state p { max-width: 34rem; margin-inline: auto; }

.toast {
  position: fixed;
  z-index: 50;
  right: 20px;
  bottom: calc(90px + env(safe-area-inset-bottom));
  left: 20px;
  width: fit-content;
  max-width: min(420px, calc(100% - 40px));
  margin: auto;
  padding: 12px 16px;
  border: 1px solid rgba(201,255,74,0.2);
  border-radius: 14px;
  color: var(--ink);
  background: var(--surface-3);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 180ms ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

.source-list { margin: 0; padding-left: 20px; color: var(--muted); }
.source-list li + li { margin-top: 8px; }

@media (min-width: 720px) {
  #app { padding-inline: 34px; }
  .hero { padding: 38px; }
  .session-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .profile-layout, .grid-2 { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:last-child { grid-column: 1 / -1; }
  .field-grid { grid-template-columns: 1fr 1fr; }
  .score-row { grid-template-columns: 82px 1fr 36px; }
  .local-badge { font-size: 0; }
  .local-badge::after { content: "Lokal"; font-size: 0.68rem; }
}

@media (max-width: 390px) {
  #app { padding-inline: 14px; }
  .topbar { padding-inline: 14px; }
  .hero { padding: 22px; }
  .field-grid { grid-template-columns: 1fr; }
  .range-field { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@media print {
  :root { color-scheme: light; --ink: #102028; --muted: #475b63; --subtle: #62747b; --bg: white; --surface: white; --surface-2: #f5f8f4; --surface-3: #edf2ef; --line: #d9e0dc; }
  body { background: white; }
  .no-print { display: none !important; }
  .app-frame { width: 100%; border: 0; background: white; }
  #app { padding: 0; }
  .card, .hero { break-inside: avoid; box-shadow: none; }
  .radar-shape { fill: rgba(95, 130, 0, 0.12); stroke: #587800; }
  .radar-dot { fill: #587800; stroke: white; }
}
