:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1a1f36;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --border: #e5e7eb;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.header {
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
  color: #fff;
  padding: 1.5rem 1rem;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.subtitle {
  margin: 0.25rem 0 0;
  opacity: 0.85;
  font-size: 0.95rem;
}

.tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  max-width: 1100px;
  margin: 0 auto;
  overflow-x: auto;
}

.tab {
  border: none;
  background: transparent;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
}

.tab:hover { background: var(--surface); color: var(--text); }
.tab.active { background: var(--surface); color: var(--primary); font-weight: 600; box-shadow: var(--shadow); }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

.panel { display: none; }
.panel.active { display: block; }

.panel h2 { margin-top: 0; font-size: 1.25rem; }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  background: var(--surface);
  padding: 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.form-grid input[type="number"],
.form-grid input[type="email"],
.form-grid input[type="text"],
.form-grid input[type="url"],
.form-grid input[type="date"] {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
}

.full-width { grid-column: 1 / -1; }

fieldset {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
}

legend { font-size: 0.875rem; font-weight: 600; padding: 0 0.25rem; }

.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 400;
  font-size: 0.875rem;
}

.btn {
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  cursor: pointer;
  font-weight: 500;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #d1d5db; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }

.card-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}

.card h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.card .meta { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.5rem; }
.card .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #e0e7ff;
  color: #3730a3;
}

.badge.godkendt { background: #d1fae5; color: #065f46; }
.badge.foreslaaet { background: #fef3c7; color: #92400e; }
.badge.afvist { background: #fee2e2; color: #991b1b; }
.badge.publiceret { background: #d1fae5; color: #065f46; }
.badge.planlagt { background: #dbeafe; color: #1e40af; }
.badge.klar_til_review { background: #fce7f3; color: #9d174d; }
.badge.fejlet { background: #fee2e2; color: #991b1b; }

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert.success { background: #d1fae5; color: #065f46; }
.alert.error { background: #fee2e2; color: #991b1b; }
.alert.hidden { display: none; }

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  background: var(--surface);
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.cal-header {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.25rem;
}

.cal-day {
  min-height: 80px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem;
  font-size: 0.75rem;
}

.cal-day.other-month { opacity: 0.4; }
.cal-day-num { font-weight: 600; margin-bottom: 0.25rem; }

.cal-event {
  background: #dbeafe;
  border-radius: 4px;
  padding: 0.15rem 0.3rem;
  margin-bottom: 2px;
  font-size: 0.65rem;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-list {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.log-row {
  display: grid;
  grid-template-columns: 140px 100px 1fr;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.log-row:last-child { border-bottom: none; }
.log-time { color: var(--muted); }

.modal {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: 560px;
  width: 92vw;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal::backdrop { background: rgba(0, 0, 0, 0.4); }

.modal-inner {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-inner label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.preview-box {
  background: var(--bg);
  border-radius: 6px;
  padding: 0.75rem;
  font-size: 0.85rem;
  max-height: 200px;
  overflow-y: auto;
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--muted);
  background: var(--surface);
  border-radius: var(--radius);
}

@media (max-width: 640px) {
  .log-row { grid-template-columns: 1fr; gap: 0.25rem; }
  .calendar-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .cal-day { min-height: 60px; }
}
