* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Manrope', system-ui, sans-serif;
  color: #171B21;
  background: #F5F6F8;
}
a { color: #2954E5; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; margin-bottom: 6px; }
h3 { font-size: 14px; margin-bottom: 12px; }
.muted { color: #6B7280; }
.small { font-size: 13px; }

input, select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #E7E9EE;
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  background: #FAFBFC;
  margin-bottom: 16px;
}
input:focus, select:focus { outline: 2px solid #2954E5; outline-offset: 1px; }
label { display: block; font-size: 13px; font-weight: 700; color: #40454D; margin-bottom: 6px; }

.btn-primary, .btn-secondary, .btn-dark {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border: none; border-radius: 12px;
  font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.btn-primary { background: #2954E5; color: white; }
.btn-primary:hover { background: #1F42BD; text-decoration: none; }
.btn-secondary { background: white; border: 1px solid #E7E9EE; color: #171B21; }
.btn-dark { background: #171B21; color: white; }
.btn-block { width: 100%; justify-content: center; }
.link-danger { background: none; border: none; color: #E5484D; font-weight: 700; font-size: 13px; cursor: pointer; }

/* --- Auth --- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; background: white; border: 1px solid #E7E9EE; border-radius: 24px; padding: 40px; }
.switch-text { text-align: center; margin-top: 20px; font-size: 14px; color: #6B7280; }

/* --- App shell --- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: white; border-right: 1px solid #E7E9EE;
  display: flex; flex-direction: column; padding: 24px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; margin-bottom: 32px; }
.brand-icon { width: 32px; height: 32px; border-radius: 10px; background: #2954E5; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-name { font-weight: 800; font-size: 17px; }

.btn-new-area {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px; border-radius: 12px; background: #EAF0FF; color: #2954E5;
  font-size: 14px; font-weight: 700; margin-bottom: 20px;
}
.btn-new-area:hover { text-decoration: none; background: #DCE6FE; }

.nav-links { display: flex; flex-direction: column; gap: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  font-size: 14px; color: #5B6472; font-weight: 600;
}
.nav-link:hover { text-decoration: none; background: #F5F6F8; }
.nav-link.active { background: #EAF0FF; color: #2954E5; font-weight: 700; }

.sidebar-spacer { flex: 1; }
.user-footer { border-top: 1px solid #E7E9EE; padding-top: 16px; display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 32px; height: 32px; border-radius: 10px; background: #F0F1F4; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.user-info { flex: 1; min-width: 0; }
.user-email { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #171B21; display: block; }
.user-email:hover { text-decoration: underline; }
.user-info a { font-size: 12px; }

.content { flex: 1; overflow-y: auto; padding: 36px 44px; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; gap: 16px; }
.header-actions { display: flex; align-items: center; gap: 16px; }
.inline-toggle-label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: #40454D; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; font-weight: 600; }
.flash-error { background: #FDE8E9; color: #C22B30; }
.flash-success { background: #E7F8EF; color: #178A57; }

.back-link { display: inline-block; font-size: 13px; font-weight: 700; margin-bottom: 18px; }

/* --- Toggle switch --- */
.toggle { width: 40px; height: 22px; border-radius: 11px; border: none; position: relative; cursor: pointer; background: #D8DCE3; flex-shrink: 0; }
.toggle.on { background: #2954E5; }
.toggle-knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: white; transition: left 0.15s; }
.toggle.on .toggle-knob { left: 20px; }

/* --- Dashboard cards --- */
.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.area-card { background: white; border: 1px solid #E7E9EE; border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.area-card-top { display: flex; align-items: center; justify-content: space-between; }
.area-name { font-weight: 700; font-size: 16px; }
.area-map-preview {
  position: relative; height: 110px; border-radius: 14px; overflow: hidden;
  background: repeating-linear-gradient(100deg, #EAF0FF 0 40px, #F5F7FF 40px 80px);
}
.area-pin { position: absolute; top: 45%; left: 50%; width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 3px white; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-size: 12px; font-weight: 600; background: #F0F1F4; color: #40454D; padding: 4px 10px; border-radius: 999px; }
.area-card-bottom { display: flex; align-items: center; justify-content: space-between; }
.empty-state { text-align: center; padding: 60px 20px; background: white; border: 1px dashed #D8DCE3; border-radius: 20px; }
.empty-state p { margin-bottom: 16px; color: #6B7280; }

/* --- Forms / new area --- */
.form-card { max-width: 520px; background: white; border: 1px solid #E7E9EE; border-radius: 20px; padding: 32px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.source-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.source-btn { flex: 1; padding: 10px; border: 1px solid #E7E9EE; border-radius: 12px; background: white; font-family: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.source-btn.active { background: #EAF0FF; border-color: #2954E5; color: #2954E5; }
.dropzone { border: 2px dashed #D8DCE3; border-radius: 14px; padding: 28px; text-align: center; margin-bottom: 24px; background: #FAFBFC; position: relative; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone-text { font-size: 14px; font-weight: 600; }
.dropzone-hint { font-size: 12px; color: #9AA1AC; margin-top: 4px; }

/* --- Area detail --- */
.area-detail-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.col-main { display: flex; flex-direction: column; gap: 20px; }
.area-map-full { height: 400px; border-radius: 20px; overflow: hidden; border: 1px solid #E7E9EE; position: relative; z-index: 0; }
.panel { background: white; border: 1px solid #E7E9EE; border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 22px; }
.col-side.panel { padding: 22px; }

.notif-list { display: flex; flex-direction: column; gap: 12px; }
.notif-row { display: flex; align-items: flex-start; gap: 10px; }
.notif-dot { margin-top: 5px; width: 8px; height: 8px; border-radius: 50%; background: #2954E5; flex-shrink: 0; }
.notif-dot.status-ny-situation { background: #B25A0F; }
.notif-dot.status-opdateret { background: #2954E5; }
.notif-dot.status-lukket { background: #178A57; }
.notif-title { font-size: 13px; font-weight: 700; }
.notif-message { font-size: 13px; }

.checklist { display: flex; flex-direction: column; gap: 8px; }
.check-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  border: 1px solid #E7E9EE; background: white; cursor: pointer; text-align: left; font-family: inherit;
}
.check-row.checked { background: #F5F8FF; border-color: #2954E5; }
.checkbox { width: 16px; height: 16px; border-radius: 5px; border: 2px solid #D8DCE3; flex-shrink: 0; }
.check-row.checked .checkbox { border-color: #2954E5; background: #2954E5; }
.check-row span:last-child { font-size: 13px; font-weight: 600; }

.priority-row { display: flex; gap: 6px; }
.priority-btn { flex: 1; padding: 9px 4px; border-radius: 9px; border: 1px solid #E7E9EE; background: white; color: #40454D; font-size: 12px; font-weight: 700; cursor: pointer; font-family: inherit; }
.priority-btn.active { border-color: #2954E5; background: #2954E5; color: white; }

.select-input { margin-bottom: 0; }
.switch-row { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.switch-row span { font-size: 14px; font-weight: 600; color: #40454D; }

.verified-badge { display: flex; align-items: center; gap: 8px; background: #E7F8EF; color: #178A57; padding: 12px 14px; border-radius: 12px; font-size: 13px; font-weight: 700; margin-top: 4px; }

/* --- History --- */
.history-row { display: flex; align-items: flex-start; gap: 14px; padding: 18px 22px; border-bottom: 1px solid #EEF0F3; }
.history-body { flex: 1; }
.history-area { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.history-meta { text-align: right; flex-shrink: 0; }
.status-badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #F0F1F4; color: #6B7280; }
.status-badge.status-ny-situation { background: #FCEADA; color: #B25A0F; }
.status-badge.status-opdateret { background: #EAF0FF; color: #2954E5; }
.status-badge.status-lukket { background: #E7F8EF; color: #178A57; }

/* --- Admin --- */
.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card { background: white; border: 1px solid #E7E9EE; border-radius: 16px; padding: 20px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; }
.stat-value { font-size: 28px; font-weight: 800; }
.stat-label { font-size: 13px; color: #6B7280; font-weight: 600; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; font-size: 12px; color: #9AA1AC; font-weight: 700; padding: 12px 20px; border-bottom: 1px solid #EEF0F3; }
.admin-table td { font-size: 13px; padding: 12px 20px; border-bottom: 1px solid #EEF0F3; }
.admin-table tr:last-child td { border-bottom: none; }

/* --- Mobil-topbar (skjult på desktop) --- */
.mobile-topbar {
  display: none; align-items: center; gap: 14px; padding: 14px 18px;
  background: white; border-bottom: 1px solid #E7E9EE; position: sticky; top: 0; z-index: 30;
}
.hamburger-btn { background: none; border: none; padding: 4px; cursor: pointer; color: #171B21; }
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(23,27,33,0.4); z-index: 39;
}
.sidebar-overlay.open { display: block; }

/* ==================== RESPONSIVT LAYOUT (mobil/tablet) ==================== */
@media (max-width: 860px) {
  .mobile-topbar { display: flex; }
  .mobile-topbar .brand-icon { width: 26px; height: 26px; }
  .mobile-topbar .brand-name { font-size: 15px; }

  .app-shell { flex-direction: column; }

  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 260px; max-width: 80vw;
    transform: translateX(-100%); transition: transform 0.2s ease; z-index: 40;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar .brand { display: none; } /* brand vises i mobil-topbaren i stedet */

  .content { padding: 20px 16px 40px; }

  h1 { font-size: 21px; }
  .page-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-header .btn-primary, .page-header .header-actions { width: 100%; justify-content: center; }
  .header-actions { flex-wrap: wrap; }

  .area-grid { grid-template-columns: 1fr; }
  .area-detail-grid { grid-template-columns: 1fr; }
  .area-map-full { height: 260px; }

  .region-grid { grid-template-columns: 1fr; }

  .admin-stats { grid-template-columns: repeat(2, 1fr); }

  .panel { overflow-x: auto; }
  .admin-table { min-width: 480px; }

  .auth-card { max-width: 92vw; padding: 28px; }
  .auth-overlay { padding: 16px; justify-content: center; }

  /* Danmarkskort: gør sidepanel-listen fuld bredde, og reducér filter-panelet */
  .list-panel { width: 88vw; right: -92vw; }
  .filter-panel { width: 220px; max-height: 60vh; }
}

@media (max-width: 480px) {
  .badge-row { gap: 4px; }
  .priority-row { flex-wrap: wrap; }
  .source-toggle { flex-direction: column; }
}
