:root {
  --bg:          #cde8d4;
  --surface:     rgba(255, 255, 255, 0.55);
  --surface-card: rgba(255, 255, 255, 0.70);
  --text:        #182e20;
  --muted:       #3d6450;
  --brand:       #2a5439;
  --brand-hover: #1e3e2a;
  --brand-soft:  rgba(42, 84, 57, 0.12);
  --line:        rgba(42, 84, 57, 0.18);
  --radius:      16px;
  --radius-sm:   10px;

  --barn-bg:     rgba(37, 99, 235, 0.10);
  --barn-text:   #1d4ed8;
  --ungdom-bg:   rgba(217, 119, 6, 0.10);
  --ungdom-text: #92400e;
  --voksen-bg:   rgba(109, 40, 217, 0.10);
  --voksen-text: #5b21b6;
}

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", ui-rounded, -apple-system, "Segoe UI", system-ui, sans-serif;
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: min(1140px, 94%);
  margin: 0 auto;
}

/* ── Hero ─────────────────────────────────────────────────────── */
.hero {
  padding: 4rem 0 2rem;
}

.eyebrow {
  margin: 0;
  color: var(--brand);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  opacity: 0.7;
}

h1 {
  margin: 0.4rem 0 0.5rem;
  font-size: clamp(2.2rem, 4.5vw, 3.6rem);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--brand) !important;
}

.lead {
  max-width: 52ch;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 400;
  opacity: 0.85;
}

/* ── Search bar ───────────────────────────────────────────────── */
.search-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  backdrop-filter: blur(8px);
}

.age-group-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 2px;
}

.category-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

/* Age group buttons */
.age-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.2rem;
  border: 1.5px solid var(--line);
  border-radius: 99px;
  background: transparent;
  font: 500 0.92rem/1 "DM Sans", system-ui, sans-serif;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.age-btn .age-range {
  font-weight: 400;
  font-size: 0.80rem;
  opacity: 0.7;
}

.age-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}

.age-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.age-btn.active .age-range {
  opacity: 0.75;
}

/* Category pills */
.cat-btn {
  padding: 0.38rem 0.85rem;
  border: 1.5px solid var(--line);
  border-radius: 99px;
  background: transparent;
  font: 400 0.83rem/1 "DM Sans", system-ui, sans-serif;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.cat-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}

.cat-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

/* ── Layout ───────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 1rem;
  padding-bottom: 3rem;
}

/* ── Filters sidebar ──────────────────────────────────────────── */
.filters {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: sticky;
  top: 1rem;
  height: fit-content;
  backdrop-filter: blur(8px);
}

.filters h2 {
  margin: 0 0 1rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--muted);
  opacity: 0.7;
}

label {
  display: block;
  font-weight: 500;
  font-size: 0.85rem;
  margin-top: 1rem;
  color: var(--text);
  opacity: 0.75;
}

input[list],
input[type="range"] {
  width: 100%;
  margin-top: 0.35rem;
}

input[list] {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.52rem 0.7rem;
  font: 400 0.9rem "DM Sans", system-ui, sans-serif;
  background: rgba(255,255,255,0.6);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

input[list]:focus {
  border-color: var(--brand);
  background: rgba(255,255,255,0.85);
}

input[type="range"] {
  accent-color: var(--brand);
}

.hint {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  opacity: 0.7;
  line-height: 1.4;
}

.hint.error { color: #a01b1b; opacity: 1; }

button#resetBtn {
  margin-top: 1.25rem;
  width: 100%;
  padding: 0.6rem 1rem;
  border: 1.5px solid var(--brand);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--brand);
  font: 600 0.85rem "DM Sans", system-ui, sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.02em;
}

button#resetBtn:hover {
  background: var(--brand);
  color: #fff;
}

/* ── Results ──────────────────────────────────────────────────── */
.results {
  min-width: 0;
}

.results-top {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.85rem;
  padding-left: 0.15rem;
}

#count {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  opacity: 0.7;
  font-weight: 400;
}

/* ── Cards ────────────────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 0.8rem;
}

.card {
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  transition: box-shadow 0.18s, border-color 0.18s;
  backdrop-filter: blur(6px);
}

.card:hover {
  box-shadow: 0 6px 28px rgba(26, 46, 32, 0.1);
  border-color: rgba(42, 84, 57, 0.3);
}

.card-head {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.1rem;
}

.tag {
  border-radius: 99px;
  padding: 0.2rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.tag.type {
  background: var(--brand-soft);
  color: var(--brand);
}

.tag-barn    { background: var(--barn-bg);    color: var(--barn-text);   }
.tag-ungdom  { background: var(--ungdom-bg);  color: var(--ungdom-text); }
.tag-voksen  { background: var(--voksen-bg);  color: var(--voksen-text); }

.title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text);
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.80rem;
  font-weight: 400;
  opacity: 0.75;
}

.description {
  margin: 0.15rem 0 0;
  font-size: 0.875rem;
  color: var(--text);
  opacity: 0.82;
  flex: 1;
  line-height: 1.45;
}

.links {
  margin-top: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.links a {
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.links a:hover {
  opacity: 0.7;
}

/* ── Empty state ──────────────────────────────────────────────── */
.empty {
  padding: 3rem 1.5rem;
  color: var(--muted);
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  font-size: 0.9rem;
  grid-column: 1 / -1;
  text-align: center;
  background: var(--surface);
}

.empty-icon {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 0.6rem;
  opacity: 0.5;
}

.empty p { margin: 0.2rem 0; opacity: 0.75; }
.empty-tip { font-size: 0.82rem; opacity: 0.55; }

/* ── Divider ──────────────────────────────────────────────────── */
.hero::after {
  content: "";
  display: block;
  height: 1px;
  background: var(--line);
  margin-top: 2rem;
}

/* ── Scrollbar hide on age-row ────────────────────────────────── */
.age-group-row::-webkit-scrollbar { display: none; }
.age-group-row { -ms-overflow-style: none; scrollbar-width: none; }

/* ── Add-activity button ──────────────────────────────────────── */
.add-btn {
  margin-left: auto;
  padding: 0.4rem 1rem;
  border: 1.5px solid var(--brand);
  border-radius: 99px;
  background: transparent;
  color: var(--brand);
  font: 600 0.82rem/1 "DM Sans", system-ui, sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.add-btn:hover {
  background: var(--brand);
  color: #fff;
}

/* ── Tag: Ny (locally submitted) ──────────────────────────────── */
.tag-ny {
  background: rgba(16, 185, 129, 0.12);
  color: #065f46;
}

/* ── Modal overlay ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 30, 15, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem 1.75rem 1.5rem;
  width: min(520px, 100%);
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(10, 30, 15, 0.18);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  opacity: 1;
  text-transform: none;
}

.modal-close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  border-radius: 6px;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.modal-close:hover { opacity: 1; }

.modal-desc {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
  opacity: 0.8;
  line-height: 1.45;
}

/* Modal form inputs */
.modal label {
  display: block;
  font-weight: 500;
  font-size: 0.83rem;
  margin-top: 0.9rem;
  color: var(--text);
  opacity: 0.75;
}

.modal label:first-of-type { margin-top: 0; }

.modal input[type="text"],
.modal input[type="url"],
.modal input[type="email"],
.modal input[type="number"],
.modal select,
.modal textarea {
  width: 100%;
  margin-top: 0.3rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.52rem 0.7rem;
  font: 400 0.9rem "DM Sans", system-ui, sans-serif;
  background: rgba(255,255,255,0.7);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.modal input:focus,
.modal select:focus,
.modal textarea:focus {
  border-color: var(--brand);
  background: rgba(255,255,255,0.9);
}

.modal textarea {
  resize: vertical;
  line-height: 1.5;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-row label { margin-top: 0.9rem; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.4rem;
}

.modal-cancel-btn {
  padding: 0.6rem 1.1rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font: 500 0.875rem "DM Sans", system-ui, sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}

.modal-cancel-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.modal-submit {
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #fff;
  font: 600 0.875rem "DM Sans", system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.15s;
}

.modal-submit:hover  { background: var(--brand-hover); }
.modal-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Admin PIN gate ───────────────────────────────────────────── */
.admin-pin-gate {
  position: fixed;
  inset: 0;
  background: rgba(10, 30, 15, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
}
.admin-pin-gate.hidden { display: none; }

.admin-pin-card {
  background: rgba(255,255,255,0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem;
  width: min(360px, 100%);
  box-shadow: 0 20px 60px rgba(10,30,15,0.2);
  text-align: center;
}

.admin-pin-icon { font-size: 2rem; margin-bottom: 0.5rem; }

.admin-pin-card h2 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  text-transform: none;
  opacity: 1;
}

.admin-pin-card > p {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0 0 1.2rem;
  opacity: 0.8;
}

.pin-input {
  width: 100%;
  text-align: center;
  letter-spacing: 0.3em;
  font-size: 1.4rem;
  padding: 0.6rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  margin-bottom: 0.75rem;
  transition: border-color 0.15s;
  box-sizing: border-box;
  font-family: monospace;
}
.pin-input:focus { border-color: var(--brand); }

.pin-submit {
  width: 100%;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #fff;
  font: 600 0.9rem "DM Sans", system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.15s;
}
.pin-submit:hover { background: var(--brand-hover); }

.pin-error {
  color: #a01b1b;
  font-size: 0.82rem;
  margin: 0.5rem 0 0;
  opacity: 1;
}
.pin-error.hidden { display: none; }

/* ── Admin panel ──────────────────────────────────────────────── */
.admin-panel {
  background: rgba(42, 84, 57, 0.05);
  border-bottom: 1.5px solid var(--line);
  padding: 1.1rem 0 1.25rem;
}
.admin-panel.hidden { display: none; }

.admin-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.admin-header h2 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 1;
}

.admin-badge {
  background: var(--brand);
  color: #fff;
  border-radius: 99px;
  padding: 0.15rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
}

.admin-logout {
  margin-left: auto;
  padding: 0.32rem 0.85rem;
  border: 1.5px solid var(--line);
  border-radius: 99px;
  background: transparent;
  color: var(--muted);
  font: 500 0.78rem "DM Sans", system-ui, sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  opacity: 0.75;
}
.admin-logout:hover { border-color: #a01b1b; color: #a01b1b; opacity: 1; }

/* ── Proposal (forslag) cards ─────────────────────────────────── */
.forslag-liste {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.forslag-tom {
  color: var(--muted);
  font-size: 0.875rem;
  opacity: 0.7;
  text-align: center;
  padding: 1.25rem;
  margin: 0;
}

.forslag-card {
  background: rgba(255,255,255,0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  backdrop-filter: blur(6px);
}

.forslag-info { flex: 1; min-width: 0; }

.forslag-info strong {
  display: block;
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.forslag-tags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.3rem;
}

.forslag-meta {
  font-size: 0.79rem;
  color: var(--muted);
  opacity: 0.8;
  margin: 0.15rem 0 0;
  line-height: 1.4;
}

.forslag-desc {
  font-size: 0.83rem;
  color: var(--text);
  opacity: 0.75;
  margin: 0.3rem 0 0;
  line-height: 1.4;
}

.forslag-link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 500;
}
.forslag-link:hover { opacity: 0.7; }

.forslag-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
}

.btn-godkjenn, .btn-rediger, .btn-avslaa {
  padding: 0.36rem 0.85rem;
  border-radius: var(--radius-sm);
  font: 600 0.77rem "DM Sans", system-ui, sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  border: 1.5px solid;
  white-space: nowrap;
}

.btn-godkjenn {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn-godkjenn:hover { background: var(--brand-hover); border-color: var(--brand-hover); }

.btn-rediger {
  background: transparent;
  border-color: var(--brand);
  color: var(--brand);
}
.btn-rediger:hover { background: var(--brand-soft); }

.btn-avslaa {
  background: transparent;
  border-color: rgba(160,27,27,0.3);
  color: #a01b1b;
}
.btn-avslaa:hover { background: rgba(160,27,27,0.07); border-color: rgba(160,27,27,0.5); }

/* ── Modal success state ──────────────────────────────────────── */
.modal-success {
  text-align: center;
  padding: 1.5rem 0 0.5rem;
}
.modal-success.hidden { display: none; }

.success-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.6rem;
}

.modal-success h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.modal-success > p {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0 0 1.25rem;
  opacity: 0.8;
  line-height: 1.5;
}

.mailto-btn {
  display: inline-block;
  padding: 0.6rem 1.3rem;
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font: 600 0.875rem "DM Sans", system-ui, sans-serif;
  transition: background 0.15s;
}
.mailto-btn:hover { background: var(--brand-hover); }

.modal-success-close {
  display: block;
  margin: 0.9rem auto 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font: 400 0.82rem "DM Sans", system-ui, sans-serif;
  cursor: pointer;
  opacity: 0.65;
  text-decoration: underline;
  padding: 0;
}
.modal-success-close:hover { opacity: 1; }

/* ── Decision (beslutning) modal ──────────────────────────────── */
.beslutning-modal { max-width: 480px; }

.beslutning-aktivitet {
  background: var(--brand-soft);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.45;
}

.beslutning-aktivitet strong {
  display: block;
  font-size: 0.93rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.beslutning-aktivitet .bsl-tags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.beslutning-aktivitet .bsl-desc {
  color: var(--muted);
  font-size: 0.8rem;
  opacity: 0.85;
  margin-top: 0.2rem;
}

/* avslå variant: red confirm button */
.modal-submit.avslaa-btn {
  background: #b91c1c;
}
.modal-submit.avslaa-btn:hover { background: #991b1b; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .filters { position: static; }
}

@media (max-width: 500px) {
  h1 { font-size: 1.9rem; }
  .age-btn { padding: 0.45rem 0.9rem; font-size: 0.85rem; }
  .cat-btn { font-size: 0.78rem; padding: 0.35rem 0.7rem; }
}
