:root {
  --bg: #fafafa;
  --fg: #1a1a1a;
  --muted: #666;
  --border: #e2e2e2;
  --accent: #2563eb;
  --card-bg: #fff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --fg: #f0f0f0;
    --muted: #999;
    --border: #2a2a2a;
    --accent: #5b8def;
    --card-bg: #1b1b1b;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.main-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.nav-group {
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
  overflow-x: auto;
  white-space: nowrap;
}

.nav-group-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  flex-shrink: 0;
}

.main-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.main-nav a:hover,
.main-nav a.active {
  color: var(--fg);
}

.brand {
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
  font-size: 1.1rem;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

h1 { margin-top: 0; }

p.muted, .muted { color: var(--muted); }

.list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
}

.list-row-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.list-row-title {
  font-weight: 600;
}

.list-row-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-shrink: 0;
}

.list-row-actions a,
.list-row-actions button {
  font-size: 0.85rem;
}

.list-row-actions button {
  width: auto;
  min-height: 0;
  padding: 0.4rem 0.9rem;
}

.list-row-actions form {
  margin: 0;
  display: inline-flex;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.badge-inaktiv {
  color: var(--muted);
  border-style: dashed;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

form.stacked {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

form.stacked label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
}

select {
  font-size: 1rem;
  padding: 0.75rem 1rem;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  width: 100%;
  background: var(--card-bg);
  color: var(--fg);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.form-actions button {
  width: auto;
}

.form-actions a {
  color: var(--muted);
  font-size: 0.9rem;
}

.error {
  color: #c0392b;
  font-size: 0.9rem;
}

input, button {
  font-size: 1rem;
  padding: 0.75rem 1rem;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  width: 100%;
  max-width: 100%;
}

button {
  background: var(--fg);
  color: var(--bg);
  border: 1px solid var(--fg);
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.05s ease;
}

button:hover { opacity: 0.82; }
button:active { transform: scale(0.98); }

input:focus, button:focus-visible {
  outline: none;
  border-color: var(--fg);
}

.auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.auth-mark {
  font-weight: 600;
  font-size: 2.4rem;
  letter-spacing: -0.03em;
  color: var(--fg);
}

.auth-card input {
  text-align: center;
  background: transparent;
  min-height: 42px;
}

.auth-card button {
  width: auto;
  min-height: 0;
  padding: 0.55rem 1.6rem;
  font-size: 0.85rem;
  border-radius: 999px;
}

.auth-message {
  text-align: center;
}

.auth-message p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.auth-message a {
  color: var(--fg);
  font-size: 0.85rem;
}

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.15s;
  }
}
